@toolpath/tool-scraper 2.1.0 → 2.3.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.
Files changed (43) hide show
  1. package/dist/conventions.d.ts +48 -2
  2. package/dist/conventions.js +41 -0
  3. package/dist/family.d.ts +16 -2
  4. package/dist/holding.d.ts +396 -0
  5. package/dist/holding.js +360 -0
  6. package/dist/index.d.ts +23 -13
  7. package/dist/index.js +23 -13
  8. package/dist/measure.d.ts +14 -10
  9. package/dist/measure.js +14 -13
  10. package/dist/node/cad-mirror.d.ts +58 -1
  11. package/dist/node/cad-mirror.js +56 -8
  12. package/dist/node/cli.d.ts +4 -1
  13. package/dist/node/cli.js +192 -18
  14. package/dist/node/holder-import.d.ts +223 -0
  15. package/dist/node/holder-import.js +379 -0
  16. package/dist/node/index.d.ts +1 -0
  17. package/dist/node/index.js +1 -0
  18. package/dist/node/paths.d.ts +16 -0
  19. package/dist/node/paths.js +20 -0
  20. package/dist/profiles.d.ts +275 -0
  21. package/dist/profiles.js +295 -0
  22. package/dist/provenance.d.ts +9 -1
  23. package/dist/provenance.js +9 -1
  24. package/dist/records.d.ts +60 -20
  25. package/dist/records.js +31 -19
  26. package/dist/registry.d.ts +61 -5
  27. package/dist/registry.js +109 -6
  28. package/dist/vendors/kennametal/holding.d.ts +35 -0
  29. package/dist/vendors/kennametal/holding.js +112 -0
  30. package/dist/vendors/kennametal/index.d.ts +1 -0
  31. package/dist/vendors/kennametal/index.js +1 -0
  32. package/dist/vendors/maritool/holding.d.ts +79 -0
  33. package/dist/vendors/maritool/holding.js +164 -0
  34. package/dist/vendors/maritool/index.d.ts +1 -0
  35. package/dist/vendors/maritool/index.js +1 -0
  36. package/dist/vendors/maritool/scrape.d.ts +37 -13
  37. package/dist/vendors/maritool/scrape.js +53 -14
  38. package/dist/vendors/regofix/holding.d.ts +35 -0
  39. package/dist/vendors/regofix/holding.js +108 -0
  40. package/dist/vendors/regofix/index.d.ts +1 -0
  41. package/dist/vendors/regofix/index.js +1 -0
  42. package/dist/vendors/regofix/scrape.js +2 -2
  43. package/package.json +3 -2
@@ -0,0 +1,79 @@
1
+ /**
2
+ * MariTool's toolholding column vocabulary, and nothing else.
3
+ *
4
+ * The vendor at the far end of the range this package covers: where Kennametal
5
+ * states a holder's taper, contact, clamping mode, style and unit as five
6
+ * per-family constants, MariTool states every one of them per part.
7
+ * `families/maritool.ts` declares **no facts at all** for exactly that reason —
8
+ * each CSV is one spindle taper holding three clamping styles, the HSK file
9
+ * holds nine sizes, and `Gage Length` is metric on some parts and imperial on
10
+ * others inside one category page. So this mapper reads columns where the
11
+ * Kennametal one reads facts, and the record shape is the same either way.
12
+ *
13
+ * ## The record's unit comes from the gage length
14
+ *
15
+ * `scrape.holderRow` promotes `Gage Length` into the `conventions.GAGE_COLUMNS`
16
+ * pair with **exactly one cell filled**, and which one is filled is the only
17
+ * statement about unit system this vendor makes per part. That is what
18
+ * {@link HOLDING_MAPPERS} reads, and a row with both cells filled is refused
19
+ * rather than resolved: it would mean the scraper had changed shape, and
20
+ * picking one would hide that.
21
+ *
22
+ * ## `Shank Size` is the bore, and a bare cell is inches
23
+ *
24
+ * MariTool publishes no `D1`. Its shrink-fit and hydraulic holders state the
25
+ * shank they take under the vendor's own `Shank Size` label, which
26
+ * `scrape.holderRow` carries verbatim and unsuffixed — the adapter deliberately
27
+ * does not promote it, because a promoted column carries a unit suffix and
28
+ * these families declare no unit for one to be taken from.
29
+ *
30
+ * The cell takes three shapes across the 293 non-collet holders in the catalog,
31
+ * and {@link parseShankSize} reads all three: `.500`, `10mm`, and
32
+ * `.1181 (3mm)` — a decimal inch with the vendor's own metric annotation beside
33
+ * it. **A cell that names no unit is inches**, which is a claim about this
34
+ * vendor and worth the evidence: every bare value published is a fractional
35
+ * inch size (`.125`, `.1875`, `.250`, `.3125`, `.375`, `.4375`, `.500`, `.625`,
36
+ * `.750`, `1.0`, `1.25`, `1.5`), and the annotated form proves the reading —
37
+ * `.1181` is 3 mm in inches, to four places. One part in the catalog states a
38
+ * bare inch shank on a holder gaged in millimetres (`HSK40E-SF.125-45`), which
39
+ * is converted rather than warned about: the record's unit is itself promoted
40
+ * off another cell here, so the two disagreeing is this vendor's shape rather
41
+ * than a fault.
42
+ *
43
+ * ## Two published columns this does not carry
44
+ *
45
+ * - **`Nose Diameter`**, on 200-odd parts. It measures the holder's nose and
46
+ * `bodyDiameter` is `D2`, the body — promoting one into a field named for the
47
+ * other is precisely the collision `conventions` warns about at length. It
48
+ * also mixes `.870` with `.870 inches` in one column, which is a second
49
+ * reason to leave it as the receipt of what the vendor said.
50
+ * - **`Collet Grip Range`.** `scrape.holderRow` says why: it is the ER series'
51
+ * range restated on the holder's page, a pure function of `Collet Size`, and
52
+ * a real capacity comes from a collet family joined on `CST`.
53
+ */
54
+ import { type UnitSystem } from '../../conventions.js';
55
+ import { type HoldingMappers } from '../../holding.js';
56
+ /** MariTool's own label for the cell {@link parseShankSize} reads a bore from. */
57
+ export declare const SHANK_SIZE_LABEL = "Shank Size";
58
+ /**
59
+ * MariTool's own label for the lock-nut diameter — `D11`, on five parts.
60
+ *
61
+ * Carried where `Nose Diameter` is not, because this one names exactly what the
62
+ * record's field names: the outside diameter of the collet nut, which is what
63
+ * decides whether a holder clears a fixture.
64
+ */
65
+ export declare const COLLET_NUT_DIAMETER_LABEL = "Collet Nut Outside Diameter";
66
+ /** One cell as a diameter and the system it is stated in. Null where unreadable. */
67
+ export declare function parseShankSize(cell: string): {
68
+ value: number;
69
+ stated: UnitSystem;
70
+ } | null;
71
+ /**
72
+ * The toolholding half of the adapter contract `registry` looks up by brand.
73
+ *
74
+ * Holders only: MariTool sells collets and this package does not scrape them,
75
+ * so there is no `collet` mapper and `registry.toHolding` refuses a request for
76
+ * one naming what this brand does map. A partial table is the honest state for
77
+ * a kind nobody has read the columns of.
78
+ */
79
+ export declare const HOLDING_MAPPERS: HoldingMappers;
@@ -0,0 +1,164 @@
1
+ /**
2
+ * MariTool's toolholding column vocabulary, and nothing else.
3
+ *
4
+ * The vendor at the far end of the range this package covers: where Kennametal
5
+ * states a holder's taper, contact, clamping mode, style and unit as five
6
+ * per-family constants, MariTool states every one of them per part.
7
+ * `families/maritool.ts` declares **no facts at all** for exactly that reason —
8
+ * each CSV is one spindle taper holding three clamping styles, the HSK file
9
+ * holds nine sizes, and `Gage Length` is metric on some parts and imperial on
10
+ * others inside one category page. So this mapper reads columns where the
11
+ * Kennametal one reads facts, and the record shape is the same either way.
12
+ *
13
+ * ## The record's unit comes from the gage length
14
+ *
15
+ * `scrape.holderRow` promotes `Gage Length` into the `conventions.GAGE_COLUMNS`
16
+ * pair with **exactly one cell filled**, and which one is filled is the only
17
+ * statement about unit system this vendor makes per part. That is what
18
+ * {@link HOLDING_MAPPERS} reads, and a row with both cells filled is refused
19
+ * rather than resolved: it would mean the scraper had changed shape, and
20
+ * picking one would hide that.
21
+ *
22
+ * ## `Shank Size` is the bore, and a bare cell is inches
23
+ *
24
+ * MariTool publishes no `D1`. Its shrink-fit and hydraulic holders state the
25
+ * shank they take under the vendor's own `Shank Size` label, which
26
+ * `scrape.holderRow` carries verbatim and unsuffixed — the adapter deliberately
27
+ * does not promote it, because a promoted column carries a unit suffix and
28
+ * these families declare no unit for one to be taken from.
29
+ *
30
+ * The cell takes three shapes across the 293 non-collet holders in the catalog,
31
+ * and {@link parseShankSize} reads all three: `.500`, `10mm`, and
32
+ * `.1181 (3mm)` — a decimal inch with the vendor's own metric annotation beside
33
+ * it. **A cell that names no unit is inches**, which is a claim about this
34
+ * vendor and worth the evidence: every bare value published is a fractional
35
+ * inch size (`.125`, `.1875`, `.250`, `.3125`, `.375`, `.4375`, `.500`, `.625`,
36
+ * `.750`, `1.0`, `1.25`, `1.5`), and the annotated form proves the reading —
37
+ * `.1181` is 3 mm in inches, to four places. One part in the catalog states a
38
+ * bare inch shank on a holder gaged in millimetres (`HSK40E-SF.125-45`), which
39
+ * is converted rather than warned about: the record's unit is itself promoted
40
+ * off another cell here, so the two disagreeing is this vendor's shape rather
41
+ * than a fault.
42
+ *
43
+ * ## Two published columns this does not carry
44
+ *
45
+ * - **`Nose Diameter`**, on 200-odd parts. It measures the holder's nose and
46
+ * `bodyDiameter` is `D2`, the body — promoting one into a field named for the
47
+ * other is precisely the collision `conventions` warns about at length. It
48
+ * also mixes `.870` with `.870 inches` in one column, which is a second
49
+ * reason to leave it as the receipt of what the vendor said.
50
+ * - **`Collet Grip Range`.** `scrape.holderRow` says why: it is the ER series'
51
+ * range restated on the holder's page, a pure function of `Collet Size`, and
52
+ * a real capacity comes from a collet family joined on `CST`.
53
+ */
54
+ import { CAD_COLUMN, CAD_DXF_COLUMN, COLLET_SERIES_COLUMN, CONTACT_COLUMN, DESCRIPTION_COLUMN, GAGE_COLUMNS, } from '../../conventions.js';
55
+ import { IncompletePartError, VendorResponseError } from '../../errors.js';
56
+ import { familyBrand } from '../../family.js';
57
+ import { asUnit, clampingMode, contactMode, holderRecord, published, } from '../../holding.js';
58
+ import { fractionValue } from '../../measure.js';
59
+ import { CLAMPING_COLUMN, MATERIAL_COLUMN, STYLE_COLUMN, TAPER_COLUMN } from './scrape.js';
60
+ /** MariTool's own label for the cell {@link parseShankSize} reads a bore from. */
61
+ export const SHANK_SIZE_LABEL = 'Shank Size';
62
+ /**
63
+ * MariTool's own label for the lock-nut diameter — `D11`, on five parts.
64
+ *
65
+ * Carried where `Nose Diameter` is not, because this one names exactly what the
66
+ * record's field names: the outside diameter of the collet nut, which is what
67
+ * decides whether a holder clears a fixture.
68
+ */
69
+ export const COLLET_NUT_DIAMETER_LABEL = 'Collet Nut Outside Diameter';
70
+ /**
71
+ * A `Shank Size` cell: a decimal, an optional unit, an optional annotation.
72
+ *
73
+ * The annotation is captured only so it can be dropped — it is the vendor's own
74
+ * conversion of the same dimension (`.1181 (3mm)`), not a second measurement,
75
+ * and reading it would put two sizes on one holder.
76
+ *
77
+ * `inches` leads the unit alternation because a regex alternation is ordered and
78
+ * `in` would otherwise match the first two letters of `inches` and leave `ches`
79
+ * unmatched — the same trap `parseGageLength` documents.
80
+ */
81
+ const SHANK_SIZE = /^(?<value>\d*\.?\d+)\s*(?<unit>mm|inches|inch|in)?\s*(?:\([^)]*\))?$/i;
82
+ /** One cell as a diameter and the system it is stated in. Null where unreadable. */
83
+ export function parseShankSize(cell) {
84
+ const parsed = SHANK_SIZE.exec(cell.trim())?.groups;
85
+ if (parsed === undefined)
86
+ return null;
87
+ const value = fractionValue(parsed['value'] ?? '');
88
+ if (value === null || value <= 0)
89
+ return null;
90
+ const unit = (parsed['unit'] ?? '').toLowerCase();
91
+ return { value, stated: unit === 'mm' ? 'millimeters' : 'inches' };
92
+ }
93
+ /** How a part names itself in a warning or a refusal. */
94
+ function subject(row) {
95
+ return `${row[MATERIAL_COLUMN] ?? ''} (${row[DESCRIPTION_COLUMN] ?? ''})`;
96
+ }
97
+ /** The gage length and, with it, the unit system this record is in. */
98
+ function gage(row, what) {
99
+ const inches = fractionValue(row[GAGE_COLUMNS.inches] ?? '');
100
+ const millimeters = fractionValue(row[GAGE_COLUMNS.millimeters] ?? '');
101
+ if (inches !== null && millimeters !== null) {
102
+ throw new VendorResponseError(what, `publishes a gage length in both unit columns (${inches} in and ` +
103
+ `${millimeters} mm) — the scrape fills exactly one, and which one is ` +
104
+ `filled is the only unit system this vendor states per part`);
105
+ }
106
+ if (inches !== null)
107
+ return { unit: 'inches', gaugeLength: inches };
108
+ if (millimeters !== null)
109
+ return { unit: 'millimeters', gaugeLength: millimeters };
110
+ throw new IncompletePartError(what, 'publishes no gage length in either unit column');
111
+ }
112
+ /** One of MariTool's own unsuffixed diameter cells, in `unit`. */
113
+ function diameter(row, label, unit, what) {
114
+ const cell = (row[label] ?? '').trim();
115
+ if (cell === '')
116
+ return null;
117
+ const measured = parseShankSize(cell);
118
+ if (measured === null) {
119
+ throw new VendorResponseError(what, `${label} is ${JSON.stringify(cell)}, which is not a diameter this ` +
120
+ `package can read — add its shape to SHANK_SIZE once it is clear what ` +
121
+ `the vendor means by it`);
122
+ }
123
+ return asUnit(measured.value, measured.stated, unit);
124
+ }
125
+ /** One MariTool holder row -> one {@link HolderRecord}. */
126
+ function holder(row, family) {
127
+ const what = subject(row);
128
+ const { unit, gaugeLength } = gage(row, what);
129
+ const material = published(row[MATERIAL_COLUMN], what, 'part number');
130
+ return holderRecord({
131
+ brand: familyBrand(family),
132
+ materialNumber: material,
133
+ // MariTool publishes one number per part and no second catalog designation
134
+ // — `conventions.IDENTITY_DEVIATIONS` records why, and inventing one here
135
+ // would put a column in the record the vendor does not publish. The part
136
+ // number is what a human orders by, so it is both.
137
+ catalogNumber: material,
138
+ description: row[DESCRIPTION_COLUMN] ?? '',
139
+ unit,
140
+ // One part in the catalog, `BT40-ER32-60`, publishes no `Taper` cell at all,
141
+ // and `scrape.holderRow` leaves both columns empty rather than inferring one
142
+ // from the part number. It becomes no record and a warning, which is the
143
+ // same call a cutting tool with no overall length gets.
144
+ taper: published(row[TAPER_COLUMN], what, 'taper'),
145
+ contact: contactMode(published(row[CONTACT_COLUMN], what, 'contact mode'), what),
146
+ clamping: clampingMode(published(row[CLAMPING_COLUMN], what, 'clamping mode'), what),
147
+ style: published(row[STYLE_COLUMN], what, 'style'),
148
+ colletSeries: row[COLLET_SERIES_COLUMN] || null,
149
+ bore: diameter(row, SHANK_SIZE_LABEL, unit, what),
150
+ gaugeLength,
151
+ lockNutDiameter: diameter(row, COLLET_NUT_DIAMETER_LABEL, unit, what),
152
+ cadModelUrl: row[CAD_COLUMN] || null,
153
+ cadDxfUrl: row[CAD_DXF_COLUMN] || null,
154
+ });
155
+ }
156
+ /**
157
+ * The toolholding half of the adapter contract `registry` looks up by brand.
158
+ *
159
+ * Holders only: MariTool sells collets and this package does not scrape them,
160
+ * so there is no `collet` mapper and `registry.toHolding` refuses a request for
161
+ * one naming what this brand does map. A partial table is the honest state for
162
+ * a kind nobody has read the columns of.
163
+ */
164
+ export const HOLDING_MAPPERS = { holder };
@@ -7,4 +7,5 @@
7
7
  * `docs/MARITOOL_CATALOG.md`.
8
8
  */
9
9
  export * from './catalog.js';
10
+ export * from './holding.js';
10
11
  export * from './scrape.js';
@@ -7,4 +7,5 @@
7
7
  * `docs/MARITOOL_CATALOG.md`.
8
8
  */
9
9
  export * from './catalog.js';
10
+ export * from './holding.js';
10
11
  export * from './scrape.js';
@@ -26,11 +26,16 @@
26
26
  *
27
27
  * ## What the vendor gets wrong
28
28
  *
29
- * Four faults found on 2026-08-29, all reported as warnings rather than
29
+ * Four faults found on 2026-08-29. Three are reported as warnings rather than
30
30
  * fixed — two disagreeing vendor cells cannot say which one is wrong, and a
31
31
  * scraper that corrects one becomes a place tool data is authored by hand.
32
32
  * This is the same call `vendors/regofix/scrape.ts` made on its three.
33
33
  *
34
+ * The fourth is resolved rather than reported, and the difference is where the
35
+ * answer came from: `docs/ADDING-A-VENDOR.md` says that when a vendor label is
36
+ * unclear you **ask**, and record the answer and its date. That is what
37
+ * happened — see fault 2.
38
+ *
34
39
  * 1. **`BT40-ER32-60` publishes no `Taper` row at all**, alone among the 529
35
40
  * parts in scope. Its row is kept with `taper` and `contact` empty rather
36
41
  * than dropped or filled in from its part number: the CSV is a receipt, and
@@ -38,10 +43,21 @@
38
43
  * 2. **`Collet Size` carries a collet *nut* designation on two parts.**
39
44
  * `CAT40-ER25-3.0MD` and `BT30-ER25-60M` both state `ER25M`, and `ER25M` is
40
45
  * not a collet series — `HSK40E-ER16-3.0M` puts exactly that shape of value
41
- * in its own `Collet Nut` cell, which is the column it belongs in. The
42
- * string is written into `CST` as designated, so it joins to no collet
43
- * family, and it is warned about. Widening it to `ER25` would offer a
44
- * machinist a collet that may not seat.
46
+ * in its own `Collet Nut` cell, which is the column it belongs in.
47
+ *
48
+ * **`ER25M` is the mini collet nut series, and the collet it closes is a
49
+ * plain ER25** (JG 2026-09-02). So {@link colletSeries} resolves the cell to
50
+ * the collet the holder actually takes, and the two parts join to the ER25
51
+ * collets they fit. Until that answer existed the string was written through
52
+ * as designated and warned about, because widening a series on a guess is
53
+ * how a machinist is offered a collet that does not seat — and the cost of
54
+ * being wrong the other way was one option, not a purchase.
55
+ *
56
+ * **Nothing is lost by resolving it.** `Collet Size` is one of the vendor's
57
+ * own labels and is carried into the CSV verbatim, so the receipt still says
58
+ * `ER25M` and still says which of the two parts has a mini nut. What changes
59
+ * is only `CST`, which is a derived join key rather than a record of what the
60
+ * vendor published — the same thing the spacing rule below does to it.
45
61
  * 3. **`Collet Size` is spaced inconsistently within one style** — `ER 11`
46
62
  * and `ER11` are both published. {@link colletSeries} closes the space,
47
63
  * because `CST` is a join key and two spellings of one series join to
@@ -254,15 +270,23 @@ export declare function parseGageLength(cell: string): GageLength;
254
270
  /**
255
271
  * A `Collet Size` cell as the series `CST` joins a collet family on.
256
272
  *
257
- * Only the spacing is closed. MariTool publishes `ER 11` and `ER11` within one
258
- * style, and two spellings of one series join to nothing `CST` is the key
259
- * `families/kennametal.ts` states the holder-to-collet join against, and the
260
- * collet side of it spells the series without a space.
273
+ * **Derived, not a receipt.** `CST` is the key `families/kennametal.ts` states
274
+ * the holder-to-collet join against, so what belongs in it is the series of the
275
+ * collet the holder takes. The vendor's own cell is carried into the CSV under
276
+ * its own label and untouched, which is where the two normalisations below are
277
+ * still visible.
278
+ *
279
+ * Two things are closed, and both exist because two spellings of one series
280
+ * join to nothing:
281
+ *
282
+ * - **Spacing.** MariTool publishes `ER 11` and `ER11` within one style, and
283
+ * the collet side of the join spells the series without a space.
284
+ * - **A nut designation.** `ER25M` names a mini nut, not a collet series — see
285
+ * {@link NUT_DESIGNATION} and this module's docstring.
261
286
  *
262
- * Nothing else is normalised. `ER25M` is written through as designated even
263
- * though no such collet series exists, because the alternative is to decide on
264
- * the vendor's behalf that its `M` is the mini nut its `Collet Nut` column
265
- * carries elsewhere — see this module's docstring. {@link holderRow} warns.
287
+ * Nothing else is. A cell this leaves as neither `ER<n>` nor a nut designation
288
+ * is written through as the vendor designated it, and {@link holderRow} warns
289
+ * that it joins to no collet.
266
290
  */
267
291
  export declare function colletSeries(cell: string): string;
268
292
  /**
@@ -26,11 +26,16 @@
26
26
  *
27
27
  * ## What the vendor gets wrong
28
28
  *
29
- * Four faults found on 2026-08-29, all reported as warnings rather than
29
+ * Four faults found on 2026-08-29. Three are reported as warnings rather than
30
30
  * fixed — two disagreeing vendor cells cannot say which one is wrong, and a
31
31
  * scraper that corrects one becomes a place tool data is authored by hand.
32
32
  * This is the same call `vendors/regofix/scrape.ts` made on its three.
33
33
  *
34
+ * The fourth is resolved rather than reported, and the difference is where the
35
+ * answer came from: `docs/ADDING-A-VENDOR.md` says that when a vendor label is
36
+ * unclear you **ask**, and record the answer and its date. That is what
37
+ * happened — see fault 2.
38
+ *
34
39
  * 1. **`BT40-ER32-60` publishes no `Taper` row at all**, alone among the 529
35
40
  * parts in scope. Its row is kept with `taper` and `contact` empty rather
36
41
  * than dropped or filled in from its part number: the CSV is a receipt, and
@@ -38,10 +43,21 @@
38
43
  * 2. **`Collet Size` carries a collet *nut* designation on two parts.**
39
44
  * `CAT40-ER25-3.0MD` and `BT30-ER25-60M` both state `ER25M`, and `ER25M` is
40
45
  * not a collet series — `HSK40E-ER16-3.0M` puts exactly that shape of value
41
- * in its own `Collet Nut` cell, which is the column it belongs in. The
42
- * string is written into `CST` as designated, so it joins to no collet
43
- * family, and it is warned about. Widening it to `ER25` would offer a
44
- * machinist a collet that may not seat.
46
+ * in its own `Collet Nut` cell, which is the column it belongs in.
47
+ *
48
+ * **`ER25M` is the mini collet nut series, and the collet it closes is a
49
+ * plain ER25** (JG 2026-09-02). So {@link colletSeries} resolves the cell to
50
+ * the collet the holder actually takes, and the two parts join to the ER25
51
+ * collets they fit. Until that answer existed the string was written through
52
+ * as designated and warned about, because widening a series on a guess is
53
+ * how a machinist is offered a collet that does not seat — and the cost of
54
+ * being wrong the other way was one option, not a purchase.
55
+ *
56
+ * **Nothing is lost by resolving it.** `Collet Size` is one of the vendor's
57
+ * own labels and is carried into the CSV verbatim, so the receipt still says
58
+ * `ER25M` and still says which of the two parts has a mini nut. What changes
59
+ * is only `CST`, which is a derived join key rather than a record of what the
60
+ * vendor published — the same thing the spacing rule below does to it.
45
61
  * 3. **`Collet Size` is spaced inconsistently within one style** — `ER 11`
46
62
  * and `ER11` are both published. {@link colletSeries} closes the space,
47
63
  * because `CST` is a join key and two spellings of one series join to
@@ -444,21 +460,44 @@ export function parseGageLength(cell) {
444
460
  const unit = (parsed?.[2] ?? '').toLowerCase() === 'mm' ? 'millimeters' : 'inches';
445
461
  return { value, unit };
446
462
  }
463
+ /**
464
+ * A `Collet Size` cell that names the **nut** rather than the collet.
465
+ *
466
+ * `M` is MariTool's mini collet nut, and the collet a mini nut closes is the
467
+ * plain one of that series (JG 2026-09-02). The vendor's own `Collet Nut`
468
+ * column carries `ER11M`, `ER16M`, `ER20M` and `ER25M` beside a `Collet Size`
469
+ * of plain `ER 11`, `ER 16`, `ER 20` and `ER 25` on 57 parts, which is the
470
+ * column those values belong in.
471
+ *
472
+ * Anchored on `ER\d+` rather than stripping a trailing letter, so a suffix that
473
+ * turns out to designate something else still reaches {@link holderRow}'s
474
+ * warning instead of being quietly shortened into a series that fits nothing.
475
+ */
476
+ const NUT_DESIGNATION = /^(ER\d+)M$/;
447
477
  /**
448
478
  * A `Collet Size` cell as the series `CST` joins a collet family on.
449
479
  *
450
- * Only the spacing is closed. MariTool publishes `ER 11` and `ER11` within one
451
- * style, and two spellings of one series join to nothing `CST` is the key
452
- * `families/kennametal.ts` states the holder-to-collet join against, and the
453
- * collet side of it spells the series without a space.
480
+ * **Derived, not a receipt.** `CST` is the key `families/kennametal.ts` states
481
+ * the holder-to-collet join against, so what belongs in it is the series of the
482
+ * collet the holder takes. The vendor's own cell is carried into the CSV under
483
+ * its own label and untouched, which is where the two normalisations below are
484
+ * still visible.
485
+ *
486
+ * Two things are closed, and both exist because two spellings of one series
487
+ * join to nothing:
488
+ *
489
+ * - **Spacing.** MariTool publishes `ER 11` and `ER11` within one style, and
490
+ * the collet side of the join spells the series without a space.
491
+ * - **A nut designation.** `ER25M` names a mini nut, not a collet series — see
492
+ * {@link NUT_DESIGNATION} and this module's docstring.
454
493
  *
455
- * Nothing else is normalised. `ER25M` is written through as designated even
456
- * though no such collet series exists, because the alternative is to decide on
457
- * the vendor's behalf that its `M` is the mini nut its `Collet Nut` column
458
- * carries elsewhere — see this module's docstring. {@link holderRow} warns.
494
+ * Nothing else is. A cell this leaves as neither `ER<n>` nor a nut designation
495
+ * is written through as the vendor designated it, and {@link holderRow} warns
496
+ * that it joins to no collet.
459
497
  */
460
498
  export function colletSeries(cell) {
461
- return cell.replace(/\s+/g, '');
499
+ const closed = cell.replace(/\s+/g, '');
500
+ return NUT_DESIGNATION.exec(closed)?.[1] ?? closed;
462
501
  }
463
502
  /**
464
503
  * One listing row plus its spec table -> one CSV row.
@@ -0,0 +1,35 @@
1
+ /**
2
+ * REGO-FIX's toolholding column vocabulary, and nothing else.
3
+ *
4
+ * Two things about this vendor decide the shape of what is below, and both are
5
+ * the reverse of Kennametal's:
6
+ *
7
+ * - **`contact` is a column, not a family fact.** REGO-FIX publishes plain and
8
+ * dual-contact powRgrip in one product group — `BT 30 / PG 25 x 080 H` and
9
+ * `BT+ 30 / PG 25 x 080 H` are two rows of one table — so `scrape.holderRow`
10
+ * resolves it from the vendor's own `form_name` and writes
11
+ * `conventions.CONTACT_COLUMN`. `families/regofix.ts` deliberately declares no
12
+ * `contact` fact, and reading one here would silently mask a scrape that lost
13
+ * the column.
14
+ * - **`unit` is a column on a collet.** Every one of the twelve PG groups holds
15
+ * metric and fractional-inch collets side by side, so there is no
16
+ * family-level answer to declare, and none of the collet families declares
17
+ * one.
18
+ *
19
+ * ## What a powRgrip holder does not publish
20
+ *
21
+ * No `D1`. A powRgrip holder clamps through a PG collet, and a collet-clamping
22
+ * holder that also carried a bore would be claiming two ways of gripping one
23
+ * tool — `scrape.holderRow` says so, and `holding.checkHolder` refuses it.
24
+ *
25
+ * No `L2`, `L9`, `V` or `D11` either: the DIN 4000 documents publish `A2`, `B1`
26
+ * and `B2`, whose meaning is not stated anywhere this package has been able to
27
+ * check, and they stay behind `conventions.DIN_PREFIX` rather than being guessed
28
+ * at. `B3`, the projection length, *is* pinned and understood — it is the
29
+ * `x 050` of the designation — and it is still not on the record, under
30
+ * `records.ToolRecord`'s standing rule that a field arrives when something
31
+ * displays it.
32
+ */
33
+ import { type HoldingMappers } from '../../holding.js';
34
+ /** The toolholding half of the adapter contract `registry` looks up by brand. */
35
+ export declare const HOLDING_MAPPERS: HoldingMappers;
@@ -0,0 +1,108 @@
1
+ /**
2
+ * REGO-FIX's toolholding column vocabulary, and nothing else.
3
+ *
4
+ * Two things about this vendor decide the shape of what is below, and both are
5
+ * the reverse of Kennametal's:
6
+ *
7
+ * - **`contact` is a column, not a family fact.** REGO-FIX publishes plain and
8
+ * dual-contact powRgrip in one product group — `BT 30 / PG 25 x 080 H` and
9
+ * `BT+ 30 / PG 25 x 080 H` are two rows of one table — so `scrape.holderRow`
10
+ * resolves it from the vendor's own `form_name` and writes
11
+ * `conventions.CONTACT_COLUMN`. `families/regofix.ts` deliberately declares no
12
+ * `contact` fact, and reading one here would silently mask a scrape that lost
13
+ * the column.
14
+ * - **`unit` is a column on a collet.** Every one of the twelve PG groups holds
15
+ * metric and fractional-inch collets side by side, so there is no
16
+ * family-level answer to declare, and none of the collet families declares
17
+ * one.
18
+ *
19
+ * ## What a powRgrip holder does not publish
20
+ *
21
+ * No `D1`. A powRgrip holder clamps through a PG collet, and a collet-clamping
22
+ * holder that also carried a bore would be claiming two ways of gripping one
23
+ * tool — `scrape.holderRow` says so, and `holding.checkHolder` refuses it.
24
+ *
25
+ * No `L2`, `L9`, `V` or `D11` either: the DIN 4000 documents publish `A2`, `B1`
26
+ * and `B2`, whose meaning is not stated anywhere this package has been able to
27
+ * check, and they stay behind `conventions.DIN_PREFIX` rather than being guessed
28
+ * at. `B3`, the projection length, *is* pinned and understood — it is the
29
+ * `x 050` of the designation — and it is still not on the record, under
30
+ * `records.ToolRecord`'s standing rule that a field arrives when something
31
+ * displays it.
32
+ */
33
+ import { CAD_COLUMN, COLLET_DESIGNATION_COLUMN, COLLET_SERIES_COLUMN, CONTACT_COLUMN, } from '../../conventions.js';
34
+ import { familyBrand } from '../../family.js';
35
+ import { checkUnitAgreement, clampingMode, colletRecord, contactMode, dim, holderRecord, holdingFact, published, unitSystem, } from '../../holding.js';
36
+ import { consoleWarn } from '../../scrape.js';
37
+ /** The identity columns this vendor adopted from Kennametal, being second. */
38
+ const MATERIAL_NUMBER = 'Material Number';
39
+ const CATALOG_NUMBER = 'ISO Catalog Number';
40
+ /**
41
+ * The column `scrape.colletRow` writes the system it read off a designation to.
42
+ *
43
+ * REGO-FIX's own, and not a convention: it is the only vendor here that states
44
+ * a unit per row, so there is no second writer for the name to be shared with.
45
+ */
46
+ const UNIT_COLUMN = 'unit';
47
+ /** How a part names itself in a warning or a refusal. */
48
+ function subject(row) {
49
+ return `${row[CATALOG_NUMBER] ?? ''} (${row[MATERIAL_NUMBER] ?? ''})`;
50
+ }
51
+ /** One powRgrip holder row -> one {@link HolderRecord}. */
52
+ function holder(row, family) {
53
+ const what = subject(row);
54
+ const unit = holdingFact(family, 'unit', family.unit);
55
+ return holderRecord({
56
+ brand: familyBrand(family),
57
+ materialNumber: published(row[MATERIAL_NUMBER], what, 'material number'),
58
+ // The designation REGO-FIX titles the part with — `BT 30 / PG 25 x 080 H`.
59
+ // It is the catalog number and not a description: the vendor publishes no
60
+ // prose about a holder anywhere, so `description` is `''`.
61
+ catalogNumber: published(row[CATALOG_NUMBER], what, 'catalog number'),
62
+ description: '',
63
+ unit,
64
+ taper: holdingFact(family, 'taper', family.taper),
65
+ contact: contactMode(published(row[CONTACT_COLUMN], what, 'contact mode'), what),
66
+ clamping: clampingMode(holdingFact(family, 'clamping', family.clamping), what),
67
+ style: holdingFact(family, 'style', family.style),
68
+ colletSeries: row[COLLET_SERIES_COLUMN] || null,
69
+ gaugeLength: published(dim(row, 'L1', unit), what, 'L1 gage length'),
70
+ bodyDiameter: dim(row, 'D2', unit),
71
+ cadModelUrl: row[CAD_COLUMN] || null,
72
+ cadDxfUrl: null,
73
+ });
74
+ }
75
+ /** One PG or PGST collet row -> one {@link ColletRecord}. */
76
+ function collet(row, family, options = {}) {
77
+ const warn = options.warn ?? consoleWarn;
78
+ const what = subject(row);
79
+ const unit = unitSystem(published(row[UNIT_COLUMN], what, 'unit system'), what);
80
+ // An inch collet carries both columns, because `scrape.colletRow` projects the
81
+ // exact fraction from the designation into millimetres. Cross-checking them is
82
+ // therefore checking this package's own arithmetic as much as the vendor's,
83
+ // which is worth doing once per row and costs nothing when they agree.
84
+ for (const label of ['D1', 'CCCN', 'CCCX'])
85
+ checkUnitAgreement(row, label, what, warn);
86
+ return colletRecord({
87
+ brand: familyBrand(family),
88
+ materialNumber: published(row[MATERIAL_NUMBER], what, 'material number'),
89
+ catalogNumber: published(row[CATALOG_NUMBER], what, 'catalog number'),
90
+ description: '',
91
+ unit,
92
+ // Written exactly as the vendor designates it, so a `PGST15` collet matches
93
+ // no `PG25` holder. `families/regofix.ts` records why that is the
94
+ // conservative direction and how to resolve it — by asking REGO-FIX, not by
95
+ // widening the string.
96
+ series: published(row[COLLET_DESIGNATION_COLUMN], what, 'collet series'),
97
+ style: holdingFact(family, 'style', family.style),
98
+ nominal: dim(row, 'D1', unit),
99
+ // A powRgrip collet clamps one size to h6 rather than closing over a range,
100
+ // so its capacity is its nominal diameter at both ends — the vendor's own
101
+ // `Clamping range or tolerance` row. A zero-width range is still a range,
102
+ // and `holding.checkCollet` refuses only an inverted one.
103
+ clampMin: published(dim(row, 'CCCN', unit), what, 'CCCN clamping minimum'),
104
+ clampMax: published(dim(row, 'CCCX', unit), what, 'CCCX clamping maximum'),
105
+ });
106
+ }
107
+ /** The toolholding half of the adapter contract `registry` looks up by brand. */
108
+ export const HOLDING_MAPPERS = { holder, collet };
@@ -5,4 +5,5 @@
5
5
  * roster and the geometry are two different fetches. See
6
6
  * `docs/REGOFIX_PRODUCTFINDER_API.md`.
7
7
  */
8
+ export * from './holding.js';
8
9
  export * from './scrape.js';
@@ -5,4 +5,5 @@
5
5
  * roster and the geometry are two different fetches. See
6
6
  * `docs/REGOFIX_PRODUCTFINDER_API.md`.
7
7
  */
8
+ export * from './holding.js';
8
9
  export * from './scrape.js';
@@ -53,7 +53,7 @@
53
53
  * (`1715.08215` and `1725.08215`). This is why the nominal size is parsed
54
54
  * from the vendor's own designation and `o_mm` is only ever a cross-check.
55
55
  */
56
- import { CAD_COLUMN, COLLET_SERIES_COLUMN, CONTACT_COLUMN, DIN_PREFIX, GAGE_COLUMNS, } from '../../conventions.js';
56
+ import { CAD_COLUMN, COLLET_DESIGNATION_COLUMN, COLLET_SERIES_COLUMN, CONTACT_COLUMN, DIN_PREFIX, GAGE_COLUMNS, } from '../../conventions.js';
57
57
  import { VendorResponseError } from '../../errors.js';
58
58
  import { statusOf } from '../../fetch.js';
59
59
  import { convertLength, fractionValue } from '../../measure.js';
@@ -417,7 +417,7 @@ export function colletRow(source, warn = consoleWarn) {
417
417
  const row = {
418
418
  'Material Number': sku,
419
419
  'ISO Catalog Number': title,
420
- 'Collet Series': (parsed['series'] ?? '').replaceAll(' ', ''),
420
+ [COLLET_DESIGNATION_COLUMN]: (parsed['series'] ?? '').replaceAll(' ', ''),
421
421
  unit,
422
422
  o_mm: plain(one(source, 'o_mm')),
423
423
  Square_mm: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolpath/tool-scraper",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "Scrape cutting-tool geometry from vendor catalogs into records and CSVs",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -82,7 +82,8 @@
82
82
  "README.md"
83
83
  ],
84
84
  "dependencies": {
85
- "htmlparser2": "12.0.0"
85
+ "htmlparser2": "12.0.0",
86
+ "@toolpath/tool-support": "^0.1.0"
86
87
  },
87
88
  "devDependencies": {
88
89
  "@types/node": "24.10.1",