@mailwoman/kind-classifier 10.0.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -12
- package/lib/classify.ts +33 -34
- package/lib/index.ts +1 -8
- package/lib/intent/markers.ts +28 -25
- package/lib/intent/rules.ts +82 -83
- package/lib/poi.ts +96 -84
- package/lib/rules.ts +141 -79
- package/out/classify.d.ts +18 -20
- package/out/classify.d.ts.map +1 -1
- package/out/classify.js +28 -31
- package/out/classify.js.map +1 -1
- package/out/index.d.ts +1 -8
- package/out/index.d.ts.map +1 -1
- package/out/index.js +1 -8
- package/out/index.js.map +1 -1
- package/out/intent/markers.d.ts +17 -18
- package/out/intent/markers.d.ts.map +1 -1
- package/out/intent/markers.js +24 -23
- package/out/intent/markers.js.map +1 -1
- package/out/intent/rules.d.ts +31 -35
- package/out/intent/rules.d.ts.map +1 -1
- package/out/intent/rules.js +82 -83
- package/out/intent/rules.js.map +1 -1
- package/out/poi.d.ts +64 -56
- package/out/poi.d.ts.map +1 -1
- package/out/poi.js +60 -50
- package/out/poi.js.map +1 -1
- package/out/rules.d.ts +23 -40
- package/out/rules.d.ts.map +1 -1
- package/out/rules.js +117 -80
- package/out/rules.js.map +1 -1
- package/package.json +15 -50
package/out/rules.js
CHANGED
|
@@ -3,56 +3,47 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Rule-based
|
|
7
|
-
* and returns a confidence
|
|
8
|
-
*
|
|
9
|
-
* Bitter-lesson-safe: only universal structural patterns — no place-name dictionaries. ~1 small
|
|
10
|
-
* regex set per new locale, not 50K dictionary entries.
|
|
6
|
+
* Rule-based `QueryKind` scorers. Each scorer reads structural patterns in the normalized input and
|
|
7
|
+
* its QueryShape and returns a confidence from 0 to 1.
|
|
11
8
|
*/
|
|
12
|
-
import { NAME_PRONE_US_SUFFIXES, US_STREET_SUFFIX_LOOKUP } from "@mailwoman/codex/us/street
|
|
9
|
+
import { NAME_PRONE_US_SUFFIXES, US_STREET_SUFFIX_LOOKUP } from "@mailwoman/codex/us/street/suffix";
|
|
10
|
+
import { classifyTokens, foldInputClass } from "@mailwoman/query-shape/character-class";
|
|
13
11
|
import { isPostcodeFormat } from "@mailwoman/query-shape/known-formats";
|
|
14
12
|
/**
|
|
15
|
-
*
|
|
16
|
-
* and belongs to the structured-address scorer.
|
|
13
|
+
* Maximum length for a bare venue or landmark query.
|
|
17
14
|
*/
|
|
18
15
|
const MAX_LANDMARK_LENGTH = 50;
|
|
19
16
|
/**
|
|
20
|
-
*
|
|
17
|
+
* Maximum length for a bare postcode, including an optional country prefix and separators.
|
|
21
18
|
*/
|
|
22
19
|
const MAX_POSTCODE_ONLY_LENGTH = 16;
|
|
23
20
|
/**
|
|
24
|
-
*
|
|
25
|
-
* else too — a locality, a street — and another kind should win.
|
|
21
|
+
* Minimum fraction of the input that a postcode must cover for `postcode_only`.
|
|
26
22
|
*/
|
|
27
23
|
const MIN_POSTCODE_COVERAGE = 0.7;
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* Exported so `intent-rules.ts`'s `bare_toponym` can share the exact same ceiling. Sharing it is what makes
|
|
32
|
-
* "bare_toponym is a strict refinement of locality_only" a structural property rather than two numbers that happen to
|
|
33
|
-
* agree today.
|
|
25
|
+
* Maximum length for a bare locality.
|
|
26
|
+
* The `bare_toponym` intent rule uses the same limit.
|
|
34
27
|
*/
|
|
35
28
|
export const MAX_LOCALITY_ONLY_LENGTH = 30;
|
|
36
29
|
/**
|
|
37
|
-
*
|
|
38
|
-
* and the phrase is more likely a full address line.
|
|
30
|
+
* Minimum word count for a short venue phrase.
|
|
39
31
|
*/
|
|
40
32
|
const VENUE_PHRASE_MIN_WORDS = 2;
|
|
41
33
|
/**
|
|
42
|
-
*
|
|
34
|
+
* Maximum word count for a short venue phrase.
|
|
43
35
|
*/
|
|
44
36
|
const VENUE_PHRASE_MAX_WORDS = 4;
|
|
45
37
|
/**
|
|
46
|
-
*
|
|
38
|
+
* Maximum word count for a longer single-segment venue phrase.
|
|
47
39
|
*/
|
|
48
40
|
const LONG_VENUE_PHRASE_MAX_WORDS = 6;
|
|
49
41
|
/**
|
|
50
|
-
* Length at which
|
|
51
|
-
* alphanumeric inputs score lower because they are as likely to be a unit number.
|
|
42
|
+
* Length at which single-segment alphanumeric input scores as a likely structured address.
|
|
52
43
|
*/
|
|
53
44
|
const ALPHANUMERIC_POSTCODE_MIN_LENGTH = 15;
|
|
54
45
|
/**
|
|
55
|
-
*
|
|
46
|
+
* Phrases that signal a relative landmark description.
|
|
56
47
|
*/
|
|
57
48
|
const LANDMARK_LEADERS = [
|
|
58
49
|
"behind",
|
|
@@ -66,29 +57,27 @@ const LANDMARK_LEADERS = [
|
|
|
66
57
|
"beside",
|
|
67
58
|
];
|
|
68
59
|
/**
|
|
69
|
-
*
|
|
60
|
+
* Patterns that signal a street intersection.
|
|
70
61
|
*/
|
|
71
62
|
const INTERSECTION_PATTERNS = [
|
|
72
63
|
/\bcorner of\b/i,
|
|
73
64
|
/\bintersection of\b/i,
|
|
74
65
|
/\bat the corner of\b/i,
|
|
75
|
-
// "5th and Main", "Broadway & 42nd"
|
|
66
|
+
// Examples: "5th and Main", "Broadway & 42nd".
|
|
76
67
|
/\b\w+(?:st|nd|rd|th|street|ave|avenue|blvd|boulevard|road|rd|lane|ln)?\s+(?:and|&|@)\s+\w+/i,
|
|
77
68
|
];
|
|
78
69
|
/**
|
|
79
|
-
*
|
|
80
|
-
* covers all locale variants (US "PO Box 123", FR "BP 42", etc.).
|
|
70
|
+
* Scores input in which QueryShape detected a PO Box format.
|
|
81
71
|
*/
|
|
82
72
|
export function scorePoBox(_input, shape) {
|
|
83
73
|
const hit = shape.knownFormats.find((f) => f.format === "po_box");
|
|
84
74
|
if (!hit)
|
|
85
75
|
return 0;
|
|
86
|
-
//
|
|
87
|
-
// both rules fire on the same input.
|
|
76
|
+
// The bonus makes a PO Box win a tie with a structured address.
|
|
88
77
|
return Math.min(1, hit.confidence + 0.1);
|
|
89
78
|
}
|
|
90
79
|
/**
|
|
91
|
-
*
|
|
80
|
+
* Scores street-intersection phrasing.
|
|
92
81
|
*/
|
|
93
82
|
export function scoreIntersection(input, _shape) {
|
|
94
83
|
const text = input.normalized;
|
|
@@ -99,8 +88,7 @@ export function scoreIntersection(input, _shape) {
|
|
|
99
88
|
return 0;
|
|
100
89
|
}
|
|
101
90
|
/**
|
|
102
|
-
*
|
|
103
|
-
* location relative to another place.
|
|
91
|
+
* Scores input that begins with a relative-landmark phrase.
|
|
104
92
|
*/
|
|
105
93
|
export function scoreLandmark(input, _shape) {
|
|
106
94
|
const lc = input.normalized.toLowerCase().trim();
|
|
@@ -111,59 +99,101 @@ export function scoreLandmark(input, _shape) {
|
|
|
111
99
|
return 0;
|
|
112
100
|
}
|
|
113
101
|
/**
|
|
114
|
-
*
|
|
115
|
-
* matters: a trailing comma or doubled separator otherwise yields an empty string that inflates the word count and
|
|
116
|
-
* falsifies every-word predicates like the proper-case check below.
|
|
102
|
+
* Splits text on whitespace and commas and drops empty tokens.
|
|
117
103
|
*/
|
|
118
104
|
export function wordsOf(text) {
|
|
119
|
-
return text.split(/[\s,]+/).filter((word) => word.length
|
|
105
|
+
return text.split(/[\s,]+/).filter((word) => word.length);
|
|
120
106
|
}
|
|
121
107
|
/**
|
|
122
|
-
*
|
|
123
|
-
* `@mailwoman/codex`, minus its curated name-prone canonicals (PARK, FIELD, HILL, LAKE, …). Those double as ordinary
|
|
124
|
-
* proper-name heads ("Wrigley Field", "Menlo Park"), and disqualifying on them would reject the very venue and place
|
|
125
|
-
* names the rules below exist to capture. Shared with `intent-rules.ts` so both rule sets read one definition.
|
|
108
|
+
* Reports whether a word is a USPS street suffix that rarely appears in place names.
|
|
126
109
|
*/
|
|
127
110
|
export function isDisqualifyingStreetSuffix(word) {
|
|
128
111
|
const canonical = US_STREET_SUFFIX_LOOKUP.get(word.trim().toLowerCase());
|
|
129
112
|
return canonical !== undefined && !NAME_PRONE_US_SUFFIXES.has(canonical);
|
|
130
113
|
}
|
|
131
114
|
/**
|
|
132
|
-
*
|
|
133
|
-
|
|
115
|
+
* Removes postcode spans in the final segment and collapses the remaining separators.
|
|
116
|
+
*/
|
|
117
|
+
export function withoutPostcodeSpans(text, shape) {
|
|
118
|
+
const merged = mergedPostcodeSpans(shape);
|
|
119
|
+
if (!merged.length)
|
|
120
|
+
return text;
|
|
121
|
+
let remainder = text;
|
|
122
|
+
// The loop removes spans from last to first.
|
|
123
|
+
// This order keeps the remaining offsets valid.
|
|
124
|
+
for (let index = merged.length - 1; index >= 0; index--) {
|
|
125
|
+
const span = merged[index];
|
|
126
|
+
remainder = remainder.slice(0, span.start) + remainder.slice(span.end);
|
|
127
|
+
}
|
|
128
|
+
return remainder
|
|
129
|
+
.replaceAll(/[\s,]+/gu, " ")
|
|
130
|
+
.replace(/[\s,]+$/u, "")
|
|
131
|
+
.trim();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Reports whether text contains a Unicode letter.
|
|
134
135
|
*
|
|
135
|
-
*
|
|
136
|
-
|
|
136
|
+
* By itself, the `alpha` character class can match punctuation-only input.
|
|
137
|
+
*/
|
|
138
|
+
export function carriesLetter(text) {
|
|
139
|
+
return /\p{L}/u.test(text);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Merges overlapping postcode hits in the final segment into sorted, disjoint spans.
|
|
143
|
+
*/
|
|
144
|
+
function mergedPostcodeSpans(shape) {
|
|
145
|
+
// Postcode hits in earlier segments are often house numbers.
|
|
146
|
+
const tail = shape.segments?.at(-1)?.span;
|
|
147
|
+
if (!tail)
|
|
148
|
+
return [];
|
|
149
|
+
const merged = [];
|
|
150
|
+
for (const hit of shape.knownFormats) {
|
|
151
|
+
if (!isPostcodeFormat(hit.format))
|
|
152
|
+
continue;
|
|
153
|
+
if (hit.span.start < tail.start || hit.span.end > tail.end)
|
|
154
|
+
continue;
|
|
155
|
+
merged.push({ start: hit.span.start, end: hit.span.end });
|
|
156
|
+
}
|
|
157
|
+
if (merged.length < 2)
|
|
158
|
+
return merged;
|
|
159
|
+
merged.sort((left, right) => left.start - right.start);
|
|
160
|
+
const disjoint = [merged[0]];
|
|
161
|
+
for (const span of merged.slice(1)) {
|
|
162
|
+
const last = disjoint.at(-1);
|
|
163
|
+
if (span.start <= last.end) {
|
|
164
|
+
last.end = Math.max(last.end, span.end);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
disjoint.push(span);
|
|
168
|
+
}
|
|
169
|
+
return disjoint;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Scores short capitalized venue names that have no street suffix or recognized format.
|
|
137
173
|
*/
|
|
138
174
|
export function scoreVenueLandmark(input, shape) {
|
|
139
175
|
const text = input.normalized.trim();
|
|
140
176
|
const len = text.length;
|
|
141
177
|
if (len === 0 || len > MAX_LANDMARK_LENGTH)
|
|
142
178
|
return 0;
|
|
143
|
-
// Must have at least one capitalized word.
|
|
144
179
|
if (!/[A-Z]/.test(text))
|
|
145
180
|
return 0;
|
|
146
|
-
// Reject if any known postcode format hit exists.
|
|
147
181
|
if (shape.knownFormats.length)
|
|
148
182
|
return 0;
|
|
149
|
-
// Reject if it looks like a multi-segment structured address (City, ST ZIP).
|
|
150
183
|
const segCount = shape.segments?.length ?? 1;
|
|
151
184
|
if (segCount > 2)
|
|
152
185
|
return 0;
|
|
153
|
-
// Reject if any word is an unambiguous street suffix.
|
|
154
186
|
const words = wordsOf(text);
|
|
155
187
|
for (const w of words) {
|
|
156
188
|
if (isDisqualifyingStreetSuffix(w))
|
|
157
189
|
return 0;
|
|
158
190
|
}
|
|
159
|
-
//
|
|
191
|
+
// A leading number usually is a house number.
|
|
160
192
|
if (/^\d+\s/.test(text))
|
|
161
193
|
return 0;
|
|
162
|
-
//
|
|
194
|
+
// Venue names often contain a number after the first word.
|
|
163
195
|
const hasInternalNumber = /\s\d+/.test(text) && !/^\d/.test(text);
|
|
164
|
-
// Check if every word starts with uppercase (proper-noun pattern).
|
|
165
196
|
const allProperCase = words.length > 1 && words.every((w) => /^[A-Z]/.test(w));
|
|
166
|
-
// Boost for short single-segment capitalized phrases (2-4 words).
|
|
167
197
|
const wordCount = words.length;
|
|
168
198
|
if (wordCount >= VENUE_PHRASE_MIN_WORDS && wordCount <= VENUE_PHRASE_MAX_WORDS && segCount === 1) {
|
|
169
199
|
if (hasInternalNumber)
|
|
@@ -172,17 +202,13 @@ export function scoreVenueLandmark(input, shape) {
|
|
|
172
202
|
return 0.88;
|
|
173
203
|
return 0.65;
|
|
174
204
|
}
|
|
175
|
-
// Longer single-segment capitalized phrases get moderate confidence.
|
|
176
205
|
if (wordCount <= LONG_VENUE_PHRASE_MAX_WORDS && segCount === 1 && allProperCase) {
|
|
177
206
|
return 0.75;
|
|
178
207
|
}
|
|
179
208
|
return 0;
|
|
180
209
|
}
|
|
181
210
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* The "covering most of it" check is what distinguishes `"10118"` (postcode-only) from `"350 5th Ave 10118"`
|
|
185
|
-
* (structured-address with a postcode in it).
|
|
211
|
+
* Scores short input in which a postcode covers most of the text.
|
|
186
212
|
*/
|
|
187
213
|
export function scorePostcodeOnly(input, shape) {
|
|
188
214
|
const len = input.normalized.length;
|
|
@@ -192,61 +218,72 @@ export function scorePostcodeOnly(input, shape) {
|
|
|
192
218
|
if (!postcodeHit)
|
|
193
219
|
return 0;
|
|
194
220
|
const hitLen = postcodeHit.span.end - postcodeHit.span.start;
|
|
195
|
-
// At least 70% of the input must be the postcode for the rule to fire confidently.
|
|
196
221
|
if (hitLen / len < MIN_POSTCODE_COVERAGE)
|
|
197
222
|
return 0;
|
|
198
|
-
// Confidence scales with how much of the input is the postcode and how confident the format hit was.
|
|
199
223
|
return Math.min(1, postcodeHit.confidence * (hitLen / len) + 0.1);
|
|
200
224
|
}
|
|
201
225
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* Examples: `"Paris"`, `"NYC NY"`, `"Tokyo"`. Distinguishes from `structured_address` (multiple segments) and `vague`
|
|
205
|
-
* (long or mixed-class).
|
|
226
|
+
* Scores a place name with at most an administrative tail and an optional postcode.
|
|
206
227
|
*/
|
|
207
228
|
export function scoreLocalityOnly(input, shape) {
|
|
208
|
-
|
|
209
|
-
|
|
229
|
+
// Any recognized format other than a postcode rules out a bare locality.
|
|
230
|
+
let carriesPostcode = false;
|
|
231
|
+
for (const hit of shape.knownFormats) {
|
|
232
|
+
if (isPostcodeFormat(hit.format)) {
|
|
233
|
+
carriesPostcode = true;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
210
236
|
return 0;
|
|
211
|
-
|
|
237
|
+
}
|
|
238
|
+
// Only postcode hits in the final segment can be removed.
|
|
239
|
+
const removable = carriesPostcode ? mergedPostcodeSpans(shape) : [];
|
|
240
|
+
if (carriesPostcode && !removable.length)
|
|
212
241
|
return 0;
|
|
213
|
-
|
|
242
|
+
const withoutPostcode = carriesPostcode ? withoutPostcodeSpans(input.normalized, shape) : input.normalized;
|
|
243
|
+
const len = withoutPostcode.length;
|
|
244
|
+
if (len === 0 || len > MAX_LOCALITY_ONLY_LENGTH)
|
|
214
245
|
return 0;
|
|
215
|
-
|
|
216
|
-
|
|
246
|
+
if (!carriesLetter(withoutPostcode))
|
|
247
|
+
return 0;
|
|
248
|
+
// The remaining text must be alphabetic.
|
|
249
|
+
// Its class is recomputed only after a postcode was removed.
|
|
250
|
+
if (shape.characterClass !== "alpha") {
|
|
251
|
+
if (!carriesPostcode)
|
|
252
|
+
return 0;
|
|
253
|
+
if (foldInputClass(classifyTokens(withoutPostcode)) !== "alpha")
|
|
254
|
+
return 0;
|
|
255
|
+
}
|
|
256
|
+
// A locality and an administrative tail use at most two segments.
|
|
217
257
|
const segCount = shape.segments?.length ?? 1;
|
|
218
258
|
if (segCount > 2)
|
|
219
259
|
return 0;
|
|
220
260
|
return 0.85;
|
|
221
261
|
}
|
|
222
262
|
/**
|
|
223
|
-
*
|
|
224
|
-
* mixed-class.
|
|
263
|
+
* Scores multi-component address shapes.
|
|
225
264
|
*/
|
|
226
265
|
export function scoreStructuredAddress(input, shape) {
|
|
227
266
|
const len = input.normalized.length;
|
|
228
267
|
if (len === 0)
|
|
229
268
|
return 0;
|
|
230
269
|
const segCount = shape.segments?.length ?? 1;
|
|
231
|
-
//
|
|
232
|
-
if (segCount >= 2 &&
|
|
270
|
+
// Digits outside the postcode are required, so a locality with a postcode does not score here.
|
|
271
|
+
if (segCount >= 2 &&
|
|
272
|
+
shape.characterClass === "alphanumeric" &&
|
|
273
|
+
/\d/u.test(withoutPostcodeSpans(input.normalized, shape))) {
|
|
233
274
|
return 0.9;
|
|
234
|
-
|
|
275
|
+
}
|
|
235
276
|
if (len >= ALPHANUMERIC_POSTCODE_MIN_LENGTH && shape.characterClass === "alphanumeric")
|
|
236
277
|
return 0.75;
|
|
237
|
-
// Multi-segment
|
|
278
|
+
// Multi-segment input without digits may still be a multi-word locality, so it scores lower.
|
|
238
279
|
if (segCount >= 2)
|
|
239
280
|
return 0.6;
|
|
240
|
-
// Single-segment, short, alphanumeric (e.g. "10118-1234" with no other content) — weak.
|
|
241
281
|
if (len < ALPHANUMERIC_POSTCODE_MIN_LENGTH && shape.characterClass === "alphanumeric")
|
|
242
282
|
return 0.4;
|
|
243
283
|
return 0;
|
|
244
284
|
}
|
|
245
285
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* Returns a moderate baseline so `vague` always shows up as an alternative, even when other rules dominate. The
|
|
249
|
-
* coordinator decides whether to trust vague as the primary kind.
|
|
286
|
+
* Returns a low constant fallback score for ambiguous input.
|
|
250
287
|
*/
|
|
251
288
|
export function scoreVague(_input, _shape) {
|
|
252
289
|
return 0.3;
|
package/out/rules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","s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AA;IACX,CAAC;IAED,IAAI,GAAG,IAAI,gCAAgC,IAAI,KAAK,CAAC,cAAc,KAAK,cAAc;QAAE,OAAO,IAAI,CAAA;IAEnG,6FAA6F;IAC7F,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,GAAG,CAAA;IAE7B,IAAI,GAAG,GAAG,gCAAgC,IAAI,KAAK,CAAC,cAAc,KAAK,cAAc;QAAE,OAAO,GAAG,CAAA;IAEjG,OAAO,CAAC,CAAA;AACT,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAA2B,EAAE,MAAsB;IAC7E,OAAO,GAAG,CAAA;AACX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/kind-classifier",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Stage 2.5 of the runtime pipeline — categorize inputs by query shape (postcode_only / locality_only / structured_address / intersection / po_box / landmark / vague). Rule-based for v1.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
@@ -13,15 +13,10 @@
|
|
|
13
13
|
"out/**/*.js.map",
|
|
14
14
|
"out/**/*.d.ts",
|
|
15
15
|
"out/**/*.d.ts.map",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"**/*.ts",
|
|
19
|
-
"**/*.tsx",
|
|
20
|
-
"!*.test.ts",
|
|
21
|
-
"!*.test.tsx",
|
|
16
|
+
"lib/**/*.ts",
|
|
17
|
+
"lib/**/*.tsx",
|
|
22
18
|
"!**/*.test.ts",
|
|
23
|
-
"!**/*.test.tsx"
|
|
24
|
-
"!test/**"
|
|
19
|
+
"!**/*.test.tsx"
|
|
25
20
|
],
|
|
26
21
|
"type": "module",
|
|
27
22
|
"sideEffects": false,
|
|
@@ -39,25 +34,10 @@
|
|
|
39
34
|
"node": "./out/index.js",
|
|
40
35
|
"default": "./out/index.js"
|
|
41
36
|
},
|
|
42
|
-
"
|
|
43
|
-
"types": "./out
|
|
44
|
-
"node": "./out
|
|
45
|
-
"default": "./out
|
|
46
|
-
},
|
|
47
|
-
"./intent-rules": {
|
|
48
|
-
"types": "./out/intent/rules.d.ts",
|
|
49
|
-
"node": "./out/intent/rules.js",
|
|
50
|
-
"default": "./out/intent/rules.js"
|
|
51
|
-
},
|
|
52
|
-
"./rules": {
|
|
53
|
-
"types": "./out/rules.d.ts",
|
|
54
|
-
"node": "./out/rules.js",
|
|
55
|
-
"default": "./out/rules.js"
|
|
56
|
-
},
|
|
57
|
-
"./poi": {
|
|
58
|
-
"types": "./out/poi.d.ts",
|
|
59
|
-
"node": "./out/poi.js",
|
|
60
|
-
"default": "./out/poi.js"
|
|
37
|
+
"./*": {
|
|
38
|
+
"types": "./out/*.d.ts",
|
|
39
|
+
"node": "./out/*.js",
|
|
40
|
+
"default": "./out/*.js"
|
|
61
41
|
}
|
|
62
42
|
},
|
|
63
43
|
"publishConfig": {
|
|
@@ -69,25 +49,10 @@
|
|
|
69
49
|
"node": "./out/index.js",
|
|
70
50
|
"default": "./out/index.js"
|
|
71
51
|
},
|
|
72
|
-
"
|
|
73
|
-
"types": "./out
|
|
74
|
-
"node": "./out
|
|
75
|
-
"default": "./out
|
|
76
|
-
},
|
|
77
|
-
"./intent-rules": {
|
|
78
|
-
"types": "./out/intent/rules.d.ts",
|
|
79
|
-
"node": "./out/intent/rules.js",
|
|
80
|
-
"default": "./out/intent/rules.js"
|
|
81
|
-
},
|
|
82
|
-
"./rules": {
|
|
83
|
-
"types": "./out/rules.d.ts",
|
|
84
|
-
"node": "./out/rules.js",
|
|
85
|
-
"default": "./out/rules.js"
|
|
86
|
-
},
|
|
87
|
-
"./poi": {
|
|
88
|
-
"types": "./out/poi.d.ts",
|
|
89
|
-
"node": "./out/poi.js",
|
|
90
|
-
"default": "./out/poi.js"
|
|
52
|
+
"./*": {
|
|
53
|
+
"types": "./out/*.d.ts",
|
|
54
|
+
"node": "./out/*.js",
|
|
55
|
+
"default": "./out/*.js"
|
|
91
56
|
}
|
|
92
57
|
},
|
|
93
58
|
"imports": {
|
|
@@ -99,8 +64,8 @@
|
|
|
99
64
|
}
|
|
100
65
|
},
|
|
101
66
|
"dependencies": {
|
|
102
|
-
"@mailwoman/codex": "10.
|
|
103
|
-
"@mailwoman/core": "10.
|
|
104
|
-
"@mailwoman/query-shape": "10.
|
|
67
|
+
"@mailwoman/codex": "10.1.0",
|
|
68
|
+
"@mailwoman/core": "10.1.0",
|
|
69
|
+
"@mailwoman/query-shape": "10.1.0"
|
|
105
70
|
}
|
|
106
71
|
}
|