@rackbops/docket-types 0.15.0 → 0.17.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 +12 -7
- package/dist/extract.d.ts +33 -3
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +118 -9
- package/dist/extract.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/money.d.ts +12 -1
- package/dist/money.d.ts.map +1 -1
- package/dist/money.js +22 -2
- package/dist/money.js.map +1 -1
- package/dist/price.d.ts +9 -2
- package/dist/price.d.ts.map +1 -1
- package/dist/price.js +23 -5
- package/dist/price.js.map +1 -1
- package/dist/reminder.d.ts +4 -1
- package/dist/reminder.d.ts.map +1 -1
- package/dist/reminder.js +7 -3
- package/dist/reminder.js.map +1 -1
- package/dist/renewal.d.ts +2 -1
- package/dist/renewal.d.ts.map +1 -1
- package/dist/renewal.js.map +1 -1
- package/dist/research-answer.d.ts.map +1 -1
- package/dist/research-answer.js +12 -3
- package/dist/research-answer.js.map +1 -1
- package/dist/research-sources.d.ts.map +1 -1
- package/dist/research-sources.js +6 -3
- package/dist/research-sources.js.map +1 -1
- package/dist/research.d.ts +1 -4
- package/dist/research.d.ts.map +1 -1
- package/dist/research.js +5 -19
- package/dist/research.js.map +1 -1
- package/dist/retry.d.ts +26 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +30 -0
- package/dist/retry.js.map +1 -0
- package/dist/scout.d.ts +5 -1
- package/dist/scout.d.ts.map +1 -1
- package/dist/scout.js +13 -21
- package/dist/scout.js.map +1 -1
- package/dist/want-ebay.d.ts +3 -3
- package/dist/want-ebay.d.ts.map +1 -1
- package/dist/want-ebay.js +8 -17
- package/dist/want-ebay.js.map +1 -1
- package/dist/want-shopify.d.ts +5 -2
- package/dist/want-shopify.d.ts.map +1 -1
- package/dist/want-shopify.js +9 -21
- package/dist/want-shopify.js.map +1 -1
- package/dist/want-sources.d.ts +23 -4
- package/dist/want-sources.d.ts.map +1 -1
- package/dist/want-sources.js +38 -17
- package/dist/want-sources.js.map +1 -1
- package/dist/want-text.d.ts +19 -0
- package/dist/want-text.d.ts.map +1 -0
- package/dist/want-text.js +41 -0
- package/dist/want-text.js.map +1 -0
- package/dist/wantjudge.d.ts.map +1 -1
- package/dist/wantjudge.js +26 -34
- package/dist/wantjudge.js.map +1 -1
- package/dist/wantlist.d.ts +31 -1
- package/dist/wantlist.d.ts.map +1 -1
- package/dist/wantlist.js +93 -26
- package/dist/wantlist.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
The tracker's task types, built on `@rackbops/docket-core`'s contract. Shipped so far:
|
|
4
4
|
|
|
5
5
|
- `reminder` (Lepid-Labs/city-hall#7): notify lane, `once` or `calendar`, done and snooze replies.
|
|
6
|
-
- `renewal` (city-hall#11): a `period` schedule rolling from the renewal date, asking
|
|
7
|
-
cancel / renewed at lead time; the decision and the amount recorded per period (the current
|
|
6
|
+
- `renewal` (Lepid-Labs/city-hall#11): a `period` schedule rolling from the renewal date, asking
|
|
7
|
+
keep / cancel / renewed at lead time; the decision and the amount recorded per period (the current
|
|
8
8
|
row in the task's state, the history in the series); cancel ends the task.
|
|
9
|
-
- `price` (city-hall#11): a `poll` schedule; each run reads the page through the host's
|
|
10
|
-
port, extracts the price structurally (JSON-LD, product and Open Graph meta tags, a JSON
|
|
11
|
-
or the owner's pattern; `extractPrice`), appends it to the series and alerts once per
|
|
12
|
-
of the drop line, measured from the first, last (default) or peak price seen; done stops
|
|
9
|
+
- `price` (Lepid-Labs/city-hall#11): a `poll` schedule; each run reads the page through the host's
|
|
10
|
+
`Fetch` port, extracts the price structurally (JSON-LD, product and Open Graph meta tags, a JSON
|
|
11
|
+
body, or the owner's pattern; `extractPrice`), appends it to the series and alerts once per
|
|
12
|
+
crossing of the drop line, measured from the first, last (default) or peak price seen; done stops
|
|
13
|
+
it.
|
|
13
14
|
|
|
14
15
|
- `research` (category 5, E8): execute lane, `once`, an optional deadline. Two `claude -p` Jobs
|
|
15
16
|
go through the runner:
|
|
@@ -207,7 +208,11 @@ The tracker's task types, built on `@rackbops/docket-core`'s contract. Shipped s
|
|
|
207
208
|
Shopify's catalog search through Firecrawl's Alexandria, 5 credits a look; a product counts only
|
|
208
209
|
when every word of the search is in its title, and the judge opens no store for it) and
|
|
209
210
|
`ebaySource` (eBay listings from eBay's own Browse API, with the host's eBay app token; the
|
|
210
|
-
judge opens no eBay page for it).
|
|
211
|
+
judge opens no eBay page for it). A watch's optional `exclude` (words or phrases) drops any
|
|
212
|
+
listing whose title holds one of them, as whole words in order on the target's word split,
|
|
213
|
+
when the source is read, so it is never told, from every source; a judged watch checks its
|
|
214
|
+
waiting listings again when it settles them (docket#77); `parseExclude` reads the list from
|
|
215
|
+
one comma-separated field, and `isExcluded` is the test.
|
|
211
216
|
- `wantjudge` (category 2, plan 5.4, item 63): the same watch on the execute lane. New listings
|
|
212
217
|
are read in plain code (no charge), then one Job has the model judge each one and its seller
|
|
213
218
|
(WebFetch only on the watch's own host, never WebSearch or the runner's files; 12 turns,
|
package/dist/extract.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Price extraction from a fetched page, structured sources first (city-hall#11): JSON-LD
|
|
2
|
+
* Price extraction from a fetched page, structured sources first (Lepid-Labs/city-hall#11): JSON-LD
|
|
3
3
|
* `Product` / `Offer` blocks, then the product and Open Graph price meta tags, then any JSON
|
|
4
4
|
* body, then a pattern the owner supplied. Pure string work on plain text, no DOM, no model;
|
|
5
5
|
* the model fallback the plan budgets for (section 6) is a later type, not this one.
|
|
@@ -21,13 +21,43 @@ export interface ExtractedPrice {
|
|
|
21
21
|
* Null when there is no digit.
|
|
22
22
|
*/
|
|
23
23
|
export declare function parsePrice(text: string): number | null;
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* The first price found walking a JSON value. At each level: the record's own `price` or
|
|
26
|
+
* `lowPrice` (with its `priceCurrency` or `currency`), then its `priceSpecification`, then its
|
|
27
|
+
* `offers`, then every other child in order (docket#56 pinned this order and this comment).
|
|
28
|
+
*/
|
|
25
29
|
export declare function priceFromJson(value: unknown, depth?: number): ExtractedPrice | null;
|
|
26
30
|
/** JSON-LD blocks in a page, parsed; broken blocks are skipped. */
|
|
27
31
|
export declare function jsonLdBlocks(html: string): unknown[];
|
|
28
32
|
/** The price from the page's meta tags, when a product or Open Graph price is declared. */
|
|
29
33
|
export declare function priceFromMeta(html: string): ExtractedPrice | null;
|
|
30
|
-
/** The
|
|
34
|
+
/** The longest owner pattern taken. */
|
|
35
|
+
export declare const MAX_PATTERN_CHARS = 300;
|
|
36
|
+
/**
|
|
37
|
+
* How much of a body an owner's pattern runs over. The price type runs on the notify lane, which
|
|
38
|
+
* never waits (plan 5.3), and a pattern runs on the event loop. `patternProblem` refuses the
|
|
39
|
+
* exponential shapes; the cap only limits the rest. It does not bound a polynomial one: an
|
|
40
|
+
* unanchored `.*\$(\d+)` over a one-line body with no `$` grows with the square of the length
|
|
41
|
+
* (about 6 s at 80,000 characters in review). A host that needs a hard bound runs the pattern
|
|
42
|
+
* off the loop, with a timeout.
|
|
43
|
+
*/
|
|
44
|
+
export declare const MAX_PATTERN_BODY_CHARS = 500000;
|
|
45
|
+
/**
|
|
46
|
+
* Why the owner's pattern is refused, or null when it is taken: it must parse, stay under
|
|
47
|
+
* `MAX_PATTERN_CHARS`, and repeat no group that could match one stretch of text in many ways
|
|
48
|
+
* (docket#45) -- a group that itself repeats (`(a+)+`, `(x*)*`) or holds an alternation whose
|
|
49
|
+
* branches overlap (`(a|a)*`, `(\s| )*`, `(.|\s)*`), the shapes that backtrack catastrophically
|
|
50
|
+
* on about thirty characters. A heuristic, not a proof: it reads the pattern's text, skipping
|
|
51
|
+
* escapes and character classes, so it also refuses safe shapes whose parts cannot overlap
|
|
52
|
+
* (`(?:\d+,)*\d+`, `(?:\s| )*`); the first is better said as a character class
|
|
53
|
+
* (`[\d,]+`). A host checks it when a pattern is saved; `priceFromPattern` refuses such a
|
|
54
|
+
* pattern too, and the price type never fetches with one.
|
|
55
|
+
*/
|
|
56
|
+
export declare function patternProblem(pattern: string): string | null;
|
|
57
|
+
/**
|
|
58
|
+
* The first capture group of the owner's pattern, read as a price, over at most
|
|
59
|
+
* `MAX_PATTERN_BODY_CHARS` of the body. A pattern `patternProblem` refuses reads nothing.
|
|
60
|
+
*/
|
|
31
61
|
export declare function priceFromPattern(body: string, pattern: string): ExtractedPrice | null;
|
|
32
62
|
/**
|
|
33
63
|
* The price a fetched body carries: the owner's pattern when given, else JSON-LD, else meta
|
package/dist/extract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyBtD;AAgCD
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyBtD;AAgCD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,cAAc,GAAG,IAAI,CAgC9E;AAMD,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAUpD;AAgBD,2FAA2F;AAC3F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAYjE;AAED,uCAAuC;AACvC,eAAO,MAAM,iBAAiB,MAAM,CAAA;AACpC;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,SAAU,CAAA;AAE7C;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAa7D;AAiED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAQrF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAiBlF"}
|
package/dist/extract.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Price extraction from a fetched page, structured sources first (city-hall#11): JSON-LD
|
|
2
|
+
* Price extraction from a fetched page, structured sources first (Lepid-Labs/city-hall#11): JSON-LD
|
|
3
3
|
* `Product` / `Offer` blocks, then the product and Open Graph price meta tags, then any JSON
|
|
4
4
|
* body, then a pattern the owner supplied. Pure string work on plain text, no DOM, no model;
|
|
5
5
|
* the model fallback the plan budgets for (section 6) is a later type, not this one.
|
|
@@ -70,7 +70,11 @@ function asPrice(value) {
|
|
|
70
70
|
function isRecord(value) {
|
|
71
71
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
72
72
|
}
|
|
73
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* The first price found walking a JSON value. At each level: the record's own `price` or
|
|
75
|
+
* `lowPrice` (with its `priceCurrency` or `currency`), then its `priceSpecification`, then its
|
|
76
|
+
* `offers`, then every other child in order (docket#56 pinned this order and this comment).
|
|
77
|
+
*/
|
|
74
78
|
export function priceFromJson(value, depth = 0) {
|
|
75
79
|
if (depth > 12)
|
|
76
80
|
return null;
|
|
@@ -111,7 +115,8 @@ export function priceFromJson(value, depth = 0) {
|
|
|
111
115
|
}
|
|
112
116
|
return null;
|
|
113
117
|
}
|
|
114
|
-
|
|
118
|
+
// The type may be unquoted (`type=application/ld+json`), as minified pages write it (docket#56).
|
|
119
|
+
const JSON_LD = /<script[^>]*type\s*=\s*(?:["']application\/ld\+json["']|application\/ld\+json(?=[\s>]))[^>]*>([\s\S]*?)<\/script>/gi;
|
|
115
120
|
/** JSON-LD blocks in a page, parsed; broken blocks are skipped. */
|
|
116
121
|
export function jsonLdBlocks(html) {
|
|
117
122
|
const blocks = [];
|
|
@@ -151,16 +156,120 @@ export function priceFromMeta(html) {
|
|
|
151
156
|
}
|
|
152
157
|
return null;
|
|
153
158
|
}
|
|
154
|
-
/** The
|
|
155
|
-
export
|
|
156
|
-
|
|
159
|
+
/** The longest owner pattern taken. */
|
|
160
|
+
export const MAX_PATTERN_CHARS = 300;
|
|
161
|
+
/**
|
|
162
|
+
* How much of a body an owner's pattern runs over. The price type runs on the notify lane, which
|
|
163
|
+
* never waits (plan 5.3), and a pattern runs on the event loop. `patternProblem` refuses the
|
|
164
|
+
* exponential shapes; the cap only limits the rest. It does not bound a polynomial one: an
|
|
165
|
+
* unanchored `.*\$(\d+)` over a one-line body with no `$` grows with the square of the length
|
|
166
|
+
* (about 6 s at 80,000 characters in review). A host that needs a hard bound runs the pattern
|
|
167
|
+
* off the loop, with a timeout.
|
|
168
|
+
*/
|
|
169
|
+
export const MAX_PATTERN_BODY_CHARS = 500_000;
|
|
170
|
+
/**
|
|
171
|
+
* Why the owner's pattern is refused, or null when it is taken: it must parse, stay under
|
|
172
|
+
* `MAX_PATTERN_CHARS`, and repeat no group that could match one stretch of text in many ways
|
|
173
|
+
* (docket#45) -- a group that itself repeats (`(a+)+`, `(x*)*`) or holds an alternation whose
|
|
174
|
+
* branches overlap (`(a|a)*`, `(\s| )*`, `(.|\s)*`), the shapes that backtrack catastrophically
|
|
175
|
+
* on about thirty characters. A heuristic, not a proof: it reads the pattern's text, skipping
|
|
176
|
+
* escapes and character classes, so it also refuses safe shapes whose parts cannot overlap
|
|
177
|
+
* (`(?:\d+,)*\d+`, `(?:\s| )*`); the first is better said as a character class
|
|
178
|
+
* (`[\d,]+`). A host checks it when a pattern is saved; `priceFromPattern` refuses such a
|
|
179
|
+
* pattern too, and the price type never fetches with one.
|
|
180
|
+
*/
|
|
181
|
+
export function patternProblem(pattern) {
|
|
182
|
+
if (pattern.length > MAX_PATTERN_CHARS) {
|
|
183
|
+
return `the pattern is longer than ${MAX_PATTERN_CHARS} characters`;
|
|
184
|
+
}
|
|
157
185
|
try {
|
|
158
|
-
|
|
186
|
+
new RegExp(pattern, "i");
|
|
159
187
|
}
|
|
160
188
|
catch {
|
|
161
|
-
return
|
|
189
|
+
return "the pattern is not a valid regular expression";
|
|
190
|
+
}
|
|
191
|
+
return repeatsAnAmbiguousGroup(pattern)
|
|
192
|
+
? "the pattern repeats a group that itself repeats or has a |, like (a+)+ or (a|b)*, " +
|
|
193
|
+
"which can stall the tracker; use a character class, like [\\d,]+"
|
|
194
|
+
: null;
|
|
195
|
+
}
|
|
196
|
+
/** An unbounded quantifier at `i` in `p`: `*`, `+` or `{n,}`. */
|
|
197
|
+
function unboundedAt(p, i) {
|
|
198
|
+
const c = p[i];
|
|
199
|
+
return c === "*" || c === "+" || /^\{\d+,\}/.test(p.slice(i));
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A repeating quantifier at `i`: unbounded, or `{n}` / `{n,m}` above 1. (`{,3}` is no quantifier
|
|
203
|
+
* in a pattern without the `u` flag: it matches itself.)
|
|
204
|
+
*/
|
|
205
|
+
function repeatsAt(p, i) {
|
|
206
|
+
if (unboundedAt(p, i))
|
|
207
|
+
return true;
|
|
208
|
+
const m = /^\{(\d+)(?:,(\d+))?\}/.exec(p.slice(i));
|
|
209
|
+
return m !== null && Number(m[2] ?? m[1]) > 1;
|
|
210
|
+
}
|
|
211
|
+
function repeatsAnAmbiguousGroup(p) {
|
|
212
|
+
// One entry per open group: whether anything inside it repeats without bound, and whether it
|
|
213
|
+
// holds an alternation (its own `|`, or one in an unrepeated group inside it).
|
|
214
|
+
const open = [];
|
|
215
|
+
const top = () => open[open.length - 1];
|
|
216
|
+
let inside = false;
|
|
217
|
+
for (let i = 0; i < p.length; i++) {
|
|
218
|
+
const c = p[i];
|
|
219
|
+
if (c === "\\") {
|
|
220
|
+
i++;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
if (inside) {
|
|
224
|
+
if (c === "]")
|
|
225
|
+
inside = false;
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
if (c === "[") {
|
|
229
|
+
inside = true;
|
|
230
|
+
if (p[i + 1] === "]")
|
|
231
|
+
i++;
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
if (c === "(") {
|
|
235
|
+
open.push({ repeats: false, alt: false });
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
if (c === "|") {
|
|
239
|
+
const g = top();
|
|
240
|
+
if (g)
|
|
241
|
+
g.alt = true;
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if (c === ")") {
|
|
245
|
+
const g = open.pop() ?? { repeats: false, alt: false };
|
|
246
|
+
const repeated = repeatsAt(p, i + 1);
|
|
247
|
+
if (repeated && (g.repeats || g.alt))
|
|
248
|
+
return true;
|
|
249
|
+
const parent = top();
|
|
250
|
+
if (parent) {
|
|
251
|
+
if (g.repeats || unboundedAt(p, i + 1))
|
|
252
|
+
parent.repeats = true;
|
|
253
|
+
if (g.alt && !repeated)
|
|
254
|
+
parent.alt = true;
|
|
255
|
+
}
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
const g = top();
|
|
259
|
+
if (g && unboundedAt(p, i))
|
|
260
|
+
g.repeats = true;
|
|
162
261
|
}
|
|
163
|
-
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The first capture group of the owner's pattern, read as a price, over at most
|
|
266
|
+
* `MAX_PATTERN_BODY_CHARS` of the body. A pattern `patternProblem` refuses reads nothing.
|
|
267
|
+
*/
|
|
268
|
+
export function priceFromPattern(body, pattern) {
|
|
269
|
+
if (patternProblem(pattern) !== null)
|
|
270
|
+
return null;
|
|
271
|
+
const re = new RegExp(pattern, "i");
|
|
272
|
+
const m = re.exec(body.slice(0, MAX_PATTERN_BODY_CHARS));
|
|
164
273
|
const captured = m?.[1] ?? m?.[0];
|
|
165
274
|
if (captured === undefined)
|
|
166
275
|
return null;
|
package/dist/extract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,4FAA4F;IAC5F,kCAAkC;IAClC,MAAM,CAAC,GAAG,+CAA+C,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAA;IAC5F,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAA;IACnB,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;IAC3D,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACvC,IAAI,QAAQ;QAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACtC,IAAI,KAAK,GAAG,MAAM,CAAA;IAClB,IAAI,QAAQ,GAAG,EAAE,CAAA;IACjB,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACt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AAG,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACvD,IAAI,CAAC;YACH,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;QAC3C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The six categories of the plan (section 1.2) as type identifiers, and the types shipped so far:
|
|
5
5
|
* `reminder` with the reminder slice (Lepid-Labs/city-hall#7), `renewal` and `price` with the
|
|
6
|
-
* renewal and price-tracker slice (city-hall#11), and `research` (category 5, E8), the
|
|
7
|
-
* execute-lane type: a research run and a reviewer run through the runner. `scout` (category
|
|
8
|
-
* `wantlist` and the judged `wantjudge` (category 2) came from the tracker plugin in 0.6.0 (E9,
|
|
6
|
+
* renewal and price-tracker slice (Lepid-Labs/city-hall#11), and `research` (category 5, E8), the
|
|
7
|
+
* first execute-lane type: a research run and a reviewer run through the runner. `scout` (category
|
|
8
|
+
* 1), `wantlist` and the judged `wantjudge` (category 2) came from the tracker plugin in 0.6.0 (E9,
|
|
9
9
|
* plan item 104).
|
|
10
10
|
*/
|
|
11
11
|
import type { TaskType } from "@rackbops/docket-core";
|
|
12
12
|
export type { Lane } from "@rackbops/docket-core";
|
|
13
|
-
export { type ExtractedPrice, extractPrice, jsonLdBlocks, parsePrice, priceFromJson, priceFromMeta, priceFromPattern, } from "./extract.js";
|
|
13
|
+
export { type ExtractedPrice, extractPrice, jsonLdBlocks, MAX_PATTERN_BODY_CHARS, MAX_PATTERN_CHARS, parsePrice, patternProblem, priceFromJson, priceFromMeta, priceFromPattern, } from "./extract.js";
|
|
14
14
|
export { checkDraft, INTAKE_ALLOWED_TOOLS, INTAKE_MAX_BUDGET_USD, INTAKE_MAX_TURNS, INTAKE_SCHEMA, INTAKE_STATES, INTAKE_TIMEOUT_MS, type IntakeAnswer, type IntakeContext, type IntakeDraft, type IntakeField, type IntakeLine, type IntakeRead, type IntakeState, type IntakeTask, type IntakeType, type IntakeValue, intakeJob, MAX_LINE_CHARS, MAX_REPLY_CHARS, MAX_TRANSCRIPT_CHARS, readIntake, transcriptLines, } from "./intake.js";
|
|
15
|
-
export { money } from "./money.js";
|
|
15
|
+
export { currencyCode, money } from "./money.js";
|
|
16
16
|
export { BASELINE_RULES, type BaselineRule, DEFAULT_BASELINE, DEFAULT_DROP_PERCENT, MISSES_BEFORE_TELLING, type PriceConfig, type PriceState, price, reference, } from "./price.js";
|
|
17
17
|
export { DEFAULT_SNOOZE_MS, type ReminderConfig, reminder, snoozeUntil } from "./reminder.js";
|
|
18
18
|
export { decisionOf, isRenewalDecision, RENEWAL_DECISIONS, type RenewalConfig, type RenewalDecision, type RenewalState, renewal, } from "./renewal.js";
|
|
@@ -20,13 +20,15 @@ export { AUTH_RETRY_MS, deadlineOf, draftJson, MAX_CONTEXT_CHARS, MAX_QUESTION_C
|
|
|
20
20
|
export { ANSWER_SCHEMA, type BlockedPage, clean, fitMessage, MAX_BLOCKED, MAX_MESSAGE_CHARS, parseAnswer, parseBlocked, parseReview, REVIEW_SCHEMA, type ResearchAnswer, type ResearchFinding, type Review, renderAnswer, renderUpdate, safeUrl, VERDICTS, type Verdict, ZWSP, } from "./research-answer.js";
|
|
21
21
|
export { BARRED_SITES, blockedKey, GATHERED_ALLOWED_TOOLS, GATHERED_DENIED_TOOLS, type GatheredPage, gatheredPages, MAX_GATHERED_CHARS, MAX_GATHERED_PAGES, MAX_PAGE_CHARS, MAX_PAGE_TITLE_CHARS, MIN_PAGE_CHARS, NOT_OPENED_WHY, pagesBlock, pagesJson, type ReadSources, SENT_DISALLOWED_TOOLS, SOURCES_DEADLINE_MARGIN_MINUTES, SOURCES_DEADLINE_MARGIN_MS, SOURCES_WAIT_DAYS, SOURCES_WAIT_MS, sourcesExpiry, uniqueBlocked, WEB_DISALLOWED_TOOLS, withBarredSites, } from "./research-sources.js";
|
|
22
22
|
export { BGG_CATEGORIES, bggCategoryUrl, FIRECRAWL_TOOLS, WEB_ALLOWED_TOOLS, } from "./research-web.js";
|
|
23
|
+
export { RETRIED, type Retry, retryOutcome } from "./retry.js";
|
|
23
24
|
export { itemKey, LENS_TEXT, LENSES, type Lens, lensOf, MAX_FOR_CHARS, MAX_INTEREST_CHARS, MAX_INTERESTS, MAX_ITEMS, MAX_SCOUT_NOTES, MAX_SHOWN, MIN_ITEMS, PROMPT_SHOWN, parseScout, renderScout, SCOUT_MAX_BUDGET_USD, SCOUT_MAX_TURNS, SCOUT_SCHEMA, SCOUT_TIMEOUT_MS, type ScoutConfig, type ScoutItem, type ScoutState, type ShownItem, scout, scoutJob, scoutState, } from "./scout.js";
|
|
24
25
|
export { BGG_ATTRIBUTION, BGG_HOST, BGG_SPACING_MS, type BggOptions, bggSource, bggThingUrl, MAX_SCANNED, parseBggThingId, parseMarketplace, } from "./want-bgg.js";
|
|
25
26
|
export { EBAY_ATTRIBUTION, EBAY_CURRENCY, EBAY_LIMIT, EBAY_MARKETPLACE, EBAY_SEARCH_PATH, type EbayBrowse, type EbayRequest, type EbaySearch, ebayRequest, ebaySource, parseEbayAnswer, } from "./want-ebay.js";
|
|
26
27
|
export { matchesWords, minorUnits, parseShopifyAnswer, SHOPIFY_ATTRIBUTION, SHOPIFY_CAPABILITY, SHOPIFY_COUNTRY, SHOPIFY_CREDITS, SHOPIFY_CURRENCY, SHOPIFY_LIMIT, SHOPIFY_PROVIDER, type ShopifyRequest, type ShopifyScrape, type ShopifySearch, searchWords, shopifyQuery, shopifyRequest, shopifySource, } from "./want-shopify.js";
|
|
27
|
-
export { inboxSource, isEbayHost, type Listing, listingKey,
|
|
28
|
+
export { inboxSource, isEbayHost, type Listing, listingKey, MAX_LISTINGS, NEVER_EBAY, pageSource, type ReadInbox, readListings, type SearchLimits, SOURCE_IDS, type Source, type SourceId, SourceMiss, SourceUnavailableError, type Submitted, submittedListing, } from "./want-sources.js";
|
|
29
|
+
export { SOURCE_TEXT, type SourceText, sourceText } from "./want-text.js";
|
|
28
30
|
export { FITS, type Fit, JUDGE_MAX_BUDGET_USD, JUDGE_MAX_TURNS, JUDGE_SCHEMA, JUDGE_TIMEOUT_MS, type JudgeOptions, type JudgeState, type JudgeVerdict, judgeHosts, judgeJob, judgeState, parseVerdicts, RETRY_GRACE_MS, renderJudged, renderUnchecked, wantjudgeType, } from "./wantjudge.js";
|
|
29
|
-
export { clip, inert, keepsFindings, listingFinding, listingLine, MAX_DM_CHARS, MAX_NEW_PER_RUN, MAX_REPORTED, miss, moreLine, type Polled, pollWant, priceText, renderWant, SHOWN_IN_DM, type WantConfig, type WantState, wantlistType, wantState, withinLimits, } from "./wantlist.js";
|
|
31
|
+
export { clip, EXCLUDE_CHARS, inert, isExcluded, keepsFindings, listingFinding, listingLine, MAX_DM_CHARS, MAX_EXCLUDE, MAX_NEW_PER_RUN, MAX_REPORTED, miss, moreLine, type Polled, parseExclude, pollWant, priceText, renderWant, SHOWN_IN_DM, type WantConfig, type WantState, wanted, wantlistType, wantState, withinLimits, } from "./wantlist.js";
|
|
30
32
|
/**
|
|
31
33
|
* The six task categories the tracker starts with (plan section 1.2), as type identifiers, then
|
|
32
34
|
* `wantjudge`: category 2's watch with the model's look first (plan 5.4), a type of its own.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAUrD,YAAY,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EACL,KAAK,cAAc,EACnB,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,SAAS,EACT,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAUrD,YAAY,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EACL,KAAK,cAAc,EACnB,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,SAAS,EACT,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EACL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gB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,MAAM,CAEvD;AAED,2EAA2E;AAC3E,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CASjE,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The six categories of the plan (section 1.2) as type identifiers, and the types shipped so far:
|
|
5
5
|
* `reminder` with the reminder slice (Lepid-Labs/city-hall#7), `renewal` and `price` with the
|
|
6
|
-
* renewal and price-tracker slice (city-hall#11), and `research` (category 5, E8), the
|
|
7
|
-
* execute-lane type: a research run and a reviewer run through the runner. `scout` (category
|
|
8
|
-
* `wantlist` and the judged `wantjudge` (category 2) came from the tracker plugin in 0.6.0 (E9,
|
|
6
|
+
* renewal and price-tracker slice (Lepid-Labs/city-hall#11), and `research` (category 5, E8), the
|
|
7
|
+
* first execute-lane type: a research run and a reviewer run through the runner. `scout` (category
|
|
8
|
+
* 1), `wantlist` and the judged `wantjudge` (category 2) came from the tracker plugin in 0.6.0 (E9,
|
|
9
9
|
* plan item 104).
|
|
10
10
|
*/
|
|
11
11
|
import { price } from "./price.js";
|
|
@@ -16,9 +16,9 @@ import { scout } from "./scout.js";
|
|
|
16
16
|
import { pageSource } from "./want-sources.js";
|
|
17
17
|
import { wantjudgeType } from "./wantjudge.js";
|
|
18
18
|
import { wantlistType } from "./wantlist.js";
|
|
19
|
-
export { extractPrice, jsonLdBlocks, parsePrice, priceFromJson, priceFromMeta, priceFromPattern, } from "./extract.js";
|
|
19
|
+
export { extractPrice, jsonLdBlocks, MAX_PATTERN_BODY_CHARS, MAX_PATTERN_CHARS, parsePrice, patternProblem, priceFromJson, priceFromMeta, priceFromPattern, } from "./extract.js";
|
|
20
20
|
export { checkDraft, INTAKE_ALLOWED_TOOLS, INTAKE_MAX_BUDGET_USD, INTAKE_MAX_TURNS, INTAKE_SCHEMA, INTAKE_STATES, INTAKE_TIMEOUT_MS, intakeJob, MAX_LINE_CHARS, MAX_REPLY_CHARS, MAX_TRANSCRIPT_CHARS, readIntake, transcriptLines, } from "./intake.js";
|
|
21
|
-
export { money } from "./money.js";
|
|
21
|
+
export { currencyCode, money } from "./money.js";
|
|
22
22
|
export { BASELINE_RULES, DEFAULT_BASELINE, DEFAULT_DROP_PERCENT, MISSES_BEFORE_TELLING, price, reference, } from "./price.js";
|
|
23
23
|
export { DEFAULT_SNOOZE_MS, reminder, snoozeUntil } from "./reminder.js";
|
|
24
24
|
export { decisionOf, isRenewalDecision, RENEWAL_DECISIONS, renewal, } from "./renewal.js";
|
|
@@ -26,13 +26,15 @@ export { AUTH_RETRY_MS, deadlineOf, draftJson, MAX_CONTEXT_CHARS, MAX_QUESTION_C
|
|
|
26
26
|
export { ANSWER_SCHEMA, clean, fitMessage, MAX_BLOCKED, MAX_MESSAGE_CHARS, parseAnswer, parseBlocked, parseReview, REVIEW_SCHEMA, renderAnswer, renderUpdate, safeUrl, VERDICTS, ZWSP, } from "./research-answer.js";
|
|
27
27
|
export { BARRED_SITES, blockedKey, GATHERED_ALLOWED_TOOLS, GATHERED_DENIED_TOOLS, gatheredPages, MAX_GATHERED_CHARS, MAX_GATHERED_PAGES, MAX_PAGE_CHARS, MAX_PAGE_TITLE_CHARS, MIN_PAGE_CHARS, NOT_OPENED_WHY, pagesBlock, pagesJson, SENT_DISALLOWED_TOOLS, SOURCES_DEADLINE_MARGIN_MINUTES, SOURCES_DEADLINE_MARGIN_MS, SOURCES_WAIT_DAYS, SOURCES_WAIT_MS, sourcesExpiry, uniqueBlocked, WEB_DISALLOWED_TOOLS, withBarredSites, } from "./research-sources.js";
|
|
28
28
|
export { BGG_CATEGORIES, bggCategoryUrl, FIRECRAWL_TOOLS, WEB_ALLOWED_TOOLS, } from "./research-web.js";
|
|
29
|
+
export { RETRIED, retryOutcome } from "./retry.js";
|
|
29
30
|
export { itemKey, LENS_TEXT, LENSES, lensOf, MAX_FOR_CHARS, MAX_INTEREST_CHARS, MAX_INTERESTS, MAX_ITEMS, MAX_SCOUT_NOTES, MAX_SHOWN, MIN_ITEMS, PROMPT_SHOWN, parseScout, renderScout, SCOUT_MAX_BUDGET_USD, SCOUT_MAX_TURNS, SCOUT_SCHEMA, SCOUT_TIMEOUT_MS, scout, scoutJob, scoutState, } from "./scout.js";
|
|
30
31
|
export { BGG_ATTRIBUTION, BGG_HOST, BGG_SPACING_MS, bggSource, bggThingUrl, MAX_SCANNED, parseBggThingId, parseMarketplace, } from "./want-bgg.js";
|
|
31
32
|
export { EBAY_ATTRIBUTION, EBAY_CURRENCY, EBAY_LIMIT, EBAY_MARKETPLACE, EBAY_SEARCH_PATH, ebayRequest, ebaySource, parseEbayAnswer, } from "./want-ebay.js";
|
|
32
33
|
export { matchesWords, minorUnits, parseShopifyAnswer, SHOPIFY_ATTRIBUTION, SHOPIFY_CAPABILITY, SHOPIFY_COUNTRY, SHOPIFY_CREDITS, SHOPIFY_CURRENCY, SHOPIFY_LIMIT, SHOPIFY_PROVIDER, searchWords, shopifyQuery, shopifyRequest, shopifySource, } from "./want-shopify.js";
|
|
33
|
-
export { inboxSource, isEbayHost, listingKey,
|
|
34
|
+
export { inboxSource, isEbayHost, listingKey, MAX_LISTINGS, NEVER_EBAY, pageSource, readListings, SOURCE_IDS, SourceMiss, SourceUnavailableError, submittedListing, } from "./want-sources.js";
|
|
35
|
+
export { SOURCE_TEXT, sourceText } from "./want-text.js";
|
|
34
36
|
export { FITS, JUDGE_MAX_BUDGET_USD, JUDGE_MAX_TURNS, JUDGE_SCHEMA, JUDGE_TIMEOUT_MS, judgeHosts, judgeJob, judgeState, parseVerdicts, RETRY_GRACE_MS, renderJudged, renderUnchecked, wantjudgeType, } from "./wantjudge.js";
|
|
35
|
-
export { clip, inert, keepsFindings, listingFinding, listingLine, MAX_DM_CHARS, MAX_NEW_PER_RUN, MAX_REPORTED, miss, moreLine, pollWant, priceText, renderWant, SHOWN_IN_DM, wantlistType, wantState, withinLimits, } from "./wantlist.js";
|
|
37
|
+
export { clip, EXCLUDE_CHARS, inert, isExcluded, keepsFindings, listingFinding, listingLine, MAX_DM_CHARS, MAX_EXCLUDE, MAX_NEW_PER_RUN, MAX_REPORTED, miss, moreLine, parseExclude, pollWant, priceText, renderWant, SHOWN_IN_DM, wanted, wantlistType, wantState, withinLimits, } from "./wantlist.js";
|
|
36
38
|
/**
|
|
37
39
|
* The six task categories the tracker starts with (plan section 1.2), as type identifiers, then
|
|
38
40
|
* `wantjudge`: category 2's watch with the model's look first (plan 5.4), a type of its own.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAG5C,OAAO,EAEL,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,iBAAiB,EAWjB,SAAS,EACT,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,KAAK,E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U;IACV,OAAO;IACP,UAAU;IACV,WAAW;CACH,CAAA;AAIV,2FAA2F;AAC3F,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,OAAQ,QAA8B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AACxD,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,UAAU,GAAgD,MAAM,CAAC,MAAM,CAAC;IACnF,QAAQ,EAAE,QAA6B;IACvC,OAAO,EAAE,OAA4B;IACrC,KAAK,EAAE,KAA0B;IACjC,QAAQ,EAAE,QAA6B;IACvC,KAAK,EAAE,KAA0B;IACjC,0FAA0F;IAC1F,QAAQ,EAAE,YAAY,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAsB;IACjE,SAAS,EAAE,aAAa,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAsB;CACpE,CAAC,CAAA"}
|
package/dist/money.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* A currency as a code: the three letters trimmed and upper-cased, or undefined when the text is
|
|
3
|
+
* empty or not three letters ("dollars"). Every want source and the limits read a watch's
|
|
4
|
+
* currency through this, so an invalid one counts as none named, everywhere (docket#58).
|
|
5
|
+
*/
|
|
6
|
+
export declare function currencyCode(raw: string | undefined): string | undefined;
|
|
7
|
+
/** How many minor units make one of `currency` (100 for USD, 1 for JPY, 1000 for KWD). */
|
|
8
|
+
export declare function minorUnits(currency: string): number;
|
|
9
|
+
/**
|
|
10
|
+
* An amount with its unit, in the currency's own decimals: `15.99 USD`, `4000 JPY`, `1.234 KWD`;
|
|
11
|
+
* two decimals when the unit is empty or not a currency this knows (docket#61).
|
|
12
|
+
*/
|
|
2
13
|
export declare function money(amount: number, currency: string): string;
|
|
3
14
|
//# sourceMappingURL=money.d.ts.map
|
package/dist/money.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../src/money.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../src/money.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGxE;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG9D"}
|
package/dist/money.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
const ZERO_DECIMAL = new Set("BIF CLP DJF GNF ISK JPY KMF KRW PYG RWF UGX UYI VND VUV XAF XOF XPF".split(" "));
|
|
2
|
+
const THREE_DECIMAL = new Set("BHD IQD JOD KWD LYD OMR TND".split(" "));
|
|
3
|
+
/**
|
|
4
|
+
* A currency as a code: the three letters trimmed and upper-cased, or undefined when the text is
|
|
5
|
+
* empty or not three letters ("dollars"). Every want source and the limits read a watch's
|
|
6
|
+
* currency through this, so an invalid one counts as none named, everywhere (docket#58).
|
|
7
|
+
*/
|
|
8
|
+
export function currencyCode(raw) {
|
|
9
|
+
const c = (raw ?? "").trim().toUpperCase();
|
|
10
|
+
return /^[A-Z]{3}$/.test(c) ? c : undefined;
|
|
11
|
+
}
|
|
12
|
+
/** How many minor units make one of `currency` (100 for USD, 1 for JPY, 1000 for KWD). */
|
|
13
|
+
export function minorUnits(currency) {
|
|
14
|
+
const c = currency.trim().toUpperCase();
|
|
15
|
+
return ZERO_DECIMAL.has(c) ? 1 : THREE_DECIMAL.has(c) ? 1000 : 100;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* An amount with its unit, in the currency's own decimals: `15.99 USD`, `4000 JPY`, `1.234 KWD`;
|
|
19
|
+
* two decimals when the unit is empty or not a currency this knows (docket#61).
|
|
20
|
+
*/
|
|
2
21
|
export function money(amount, currency) {
|
|
3
|
-
|
|
22
|
+
const digits = Math.round(Math.log10(minorUnits(currency)));
|
|
23
|
+
return `${amount.toFixed(digits)} ${currency}`.trim();
|
|
4
24
|
}
|
|
5
25
|
//# sourceMappingURL=money.js.map
|
package/dist/money.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"money.js","sourceRoot":"","sources":["../src/money.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"money.js","sourceRoot":"","sources":["../src/money.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG,IAAI,GAAG,CAC1B,qEAAqE,CAAC,KAAK,CAAC,GAAG,CAAC,CACjF,CAAA;AACD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,6BAA6B,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;AAEvE;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,GAAuB;IAClD,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IAC1C,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC7C,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IACvC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAA;AACpE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,MAAc,EAAE,QAAgB;IACpD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC3D,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;AACvD,CAAC"}
|
package/dist/price.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Category 3 (plan section 1.2, city-hall#11): track an item's price, record it, alert
|
|
3
|
-
* drops by 10% or more. A `poll` schedule; each run reads the page through the Fetch port,
|
|
2
|
+
* Category 3 (plan section 1.2, Lepid-Labs/city-hall#11): track an item's price, record it, alert
|
|
3
|
+
* when it drops by 10% or more. A `poll` schedule; each run reads the page through the Fetch port,
|
|
4
4
|
* extracts the price (structured sources first, `extract.ts`), appends it to the task's series
|
|
5
5
|
* and compares it with the baseline the owner chose -- first seen, last seen or the peak --
|
|
6
6
|
* alerting once per crossing of the line. Notify lane, tier 0, no model.
|
|
@@ -32,6 +32,13 @@ export interface PriceState {
|
|
|
32
32
|
/** Consecutive polls that yielded no price. */
|
|
33
33
|
misses: number;
|
|
34
34
|
alerts: number;
|
|
35
|
+
/**
|
|
36
|
+
* The currency the prices above are in, upper-cased, when the page or the config named one. A
|
|
37
|
+
* read the page declares in another currency is a miss, never a drop (docket#59). Absent in a
|
|
38
|
+
* state from before docket#59: such a state is held to the config's currency, if any, and the
|
|
39
|
+
* next good read fills it in.
|
|
40
|
+
*/
|
|
41
|
+
currency?: string;
|
|
35
42
|
}
|
|
36
43
|
/** The price a drop is measured from under `rule`, or null before anything was seen. */
|
|
37
44
|
export declare function reference(state: PriceState, rule: BaselineRule): number | null;
|
package/dist/price.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../src/price.ts"],"names":[],"mappings":"AAUA;;;;;;GAMG;AAEH,eAAO,MAAM,cAA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GAAG,EAAE,MAAM,CAAA;IACX,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,gGAAgG;IAChG,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,4FAA4F;AAC5F,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,iFAAiF;IACjF,KAAK,EAAE,OAAO,CAAA;IACd,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAoCD,wFAAwF;AACxF,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAI9E;AAgBD,eAAO,MAAM,KAAK,uDAuHhB,CAAA"}
|
package/dist/price.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineTaskType, } from "@rackbops/docket-core";
|
|
2
|
-
import { extractPrice } from "./extract.js";
|
|
3
|
-
import { money } from "./money.js";
|
|
2
|
+
import { extractPrice, patternProblem } from "./extract.js";
|
|
3
|
+
import { currencyCode, money } from "./money.js";
|
|
4
4
|
/**
|
|
5
|
-
* Category 3 (plan section 1.2, city-hall#11): track an item's price, record it, alert
|
|
6
|
-
* drops by 10% or more. A `poll` schedule; each run reads the page through the Fetch port,
|
|
5
|
+
* Category 3 (plan section 1.2, Lepid-Labs/city-hall#11): track an item's price, record it, alert
|
|
6
|
+
* when it drops by 10% or more. A `poll` schedule; each run reads the page through the Fetch port,
|
|
7
7
|
* extracts the price (structured sources first, `extract.ts`), appends it to the task's series
|
|
8
8
|
* and compares it with the baseline the owner chose -- first seen, last seen or the peak --
|
|
9
9
|
* alerting once per crossing of the line. Notify lane, tier 0, no model.
|
|
@@ -32,6 +32,7 @@ function stateOf(value) {
|
|
|
32
32
|
below: s.below ?? false,
|
|
33
33
|
misses: s.misses,
|
|
34
34
|
alerts: s.alerts ?? 0,
|
|
35
|
+
...(typeof s.currency === "string" && s.currency !== "" ? { currency: s.currency } : {}),
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
function dropPercent(config) {
|
|
@@ -95,6 +96,10 @@ export const price = defineTaskType({
|
|
|
95
96
|
if (!fetch)
|
|
96
97
|
throw new Error("the price type needs the Fetch port; the host configured none");
|
|
97
98
|
const state = stateOf(ctx.state);
|
|
99
|
+
// A refused pattern never runs: it could stall the notify lane (docket#45).
|
|
100
|
+
const refused = ctx.config.pattern ? patternProblem(ctx.config.pattern) : null;
|
|
101
|
+
if (refused)
|
|
102
|
+
return miss(ctx, state, `pattern refused: ${refused}`);
|
|
98
103
|
let body;
|
|
99
104
|
try {
|
|
100
105
|
const response = await fetch.get(ctx.config.url);
|
|
@@ -118,12 +123,15 @@ export const price = defineTaskType({
|
|
|
118
123
|
const point = currency
|
|
119
124
|
? { value: seen, unit: currency, note: "observed" }
|
|
120
125
|
: { value: seen, note: "observed" };
|
|
126
|
+
// Only a valid code is kept as the watch's currency (docket#58).
|
|
127
|
+
const code = currencyCode(currency) ?? "";
|
|
128
|
+
const kept = code === "" ? {} : { currency: code };
|
|
121
129
|
const rule = baselineRule(ctx.config);
|
|
122
130
|
const drop = dropPercent(ctx.config);
|
|
123
131
|
const ref = reference(state, rule);
|
|
124
132
|
if (ref === null) {
|
|
125
133
|
return {
|
|
126
|
-
state: { first: seen, last: seen, peak: seen, below: false, misses: 0, alerts: 0 },
|
|
134
|
+
state: { first: seen, last: seen, peak: seen, below: false, misses: 0, alerts: 0, ...kept },
|
|
127
135
|
series: [point],
|
|
128
136
|
notify: {
|
|
129
137
|
text: `Now tracking ${ctx.task.title} at ${money(seen, currency)}. I will say when it ` +
|
|
@@ -133,6 +141,15 @@ export const price = defineTaskType({
|
|
|
133
141
|
summary: `baseline ${money(seen, currency)}`,
|
|
134
142
|
};
|
|
135
143
|
}
|
|
144
|
+
// A geo-switched page (EUR against a USD baseline) is no drop: a miss, so the owner hears
|
|
145
|
+
// after a few and the baseline stays as it was. Only a currency the page itself declares
|
|
146
|
+
// counts (the config's is a fallback for a page that names none), and a state from before
|
|
147
|
+
// docket#59 is held to the config's currency when it has one.
|
|
148
|
+
const declared = currencyCode(found.currency) ?? "";
|
|
149
|
+
const known = state.currency ?? currencyCode(ctx.config.currency) ?? "";
|
|
150
|
+
if (known !== "" && declared !== "" && declared !== known) {
|
|
151
|
+
return miss(ctx, state, `the page now prices in ${declared}, not ${known}`);
|
|
152
|
+
}
|
|
136
153
|
const line = ref * (1 - drop / 100);
|
|
137
154
|
const below = seen <= line + 1e-9;
|
|
138
155
|
const crossing = below && !state.below;
|
|
@@ -143,6 +160,7 @@ export const price = defineTaskType({
|
|
|
143
160
|
below,
|
|
144
161
|
misses: 0,
|
|
145
162
|
alerts: state.alerts + (crossing ? 1 : 0),
|
|
163
|
+
...(state.currency ? { currency: state.currency } : kept),
|
|
146
164
|
};
|
|
147
165
|
if (!crossing) {
|
|
148
166
|
return {
|