@mailwoman/registry 11.3.0 → 11.5.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 (50) hide show
  1. package/data/manifests/artifacts.json +5 -0
  2. package/data/manifests/coverage.json +571 -0
  3. package/data/manifests/sources.lock.json +48 -0
  4. package/data/normalized/groupings.json +10902 -0
  5. package/definitions/groupings.json +222 -0
  6. package/docs/data-policy.md +10 -0
  7. package/lib/artifacts/groupings/groupings.fixture.json +1222 -0
  8. package/lib/artifacts/groupings/groupings.ts +77 -0
  9. package/lib/groupings.ts +127 -0
  10. package/lib/index.ts +19 -2
  11. package/lib/types.ts +90 -0
  12. package/out/artifacts/groupings/groupings.d.ts +28 -0
  13. package/out/artifacts/groupings/groupings.d.ts.map +1 -0
  14. package/out/artifacts/groupings/groupings.fixture.json +1222 -0
  15. package/out/artifacts/groupings/groupings.js +59 -0
  16. package/out/artifacts/groupings/groupings.js.map +1 -0
  17. package/out/groupings.d.ts +59 -0
  18. package/out/groupings.d.ts.map +1 -0
  19. package/out/groupings.js +92 -0
  20. package/out/groupings.js.map +1 -0
  21. package/out/index.d.ts +6 -2
  22. package/out/index.d.ts.map +1 -1
  23. package/out/index.js +3 -1
  24. package/out/index.js.map +1 -1
  25. package/out/sdk/sources.d.ts +55 -1
  26. package/out/sdk/sources.d.ts.map +1 -1
  27. package/out/sdk/sources.js +83 -0
  28. package/out/sdk/sources.js.map +1 -1
  29. package/out/tools/generate.run.js +58 -0
  30. package/out/tools/generate.run.js.map +1 -1
  31. package/out/tools/groupings.d.ts +101 -0
  32. package/out/tools/groupings.d.ts.map +1 -0
  33. package/out/tools/groupings.js +295 -0
  34. package/out/tools/groupings.js.map +1 -0
  35. package/out/tools/normalize.d.ts +17 -3
  36. package/out/tools/normalize.d.ts.map +1 -1
  37. package/out/tools/normalize.js +6 -1
  38. package/out/tools/normalize.js.map +1 -1
  39. package/out/tools/normalize.run.js +50 -3
  40. package/out/tools/normalize.run.js.map +1 -1
  41. package/out/types.d.ts +81 -0
  42. package/out/types.d.ts.map +1 -1
  43. package/out/types.js +29 -0
  44. package/out/types.js.map +1 -1
  45. package/package.json +4 -2
  46. package/sdk/sources.ts +119 -0
  47. package/tools/generate.run.ts +65 -0
  48. package/tools/groupings.ts +428 -0
  49. package/tools/normalize.run.ts +64 -4
  50. package/tools/normalize.ts +16 -2
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.run.js","sourceRoot":"","sources":["../../tools/normalize.run.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AAElE;;;;;;;GAOG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEtE,MAAM,IAAI,GAAG,MAAM,cAAc,EAAE,CAAA;AAEnC,IAAI,CAAC,IAAI;IAAE,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAA;AAExG,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAA;AACvE,MAAM,IAAI,GAAG,oBAAoB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;AACrD,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAA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CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACxE,CAAA;AACF,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,iBAAiB,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAE,CAAC,KAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA"}
package/out/types.d.ts CHANGED
@@ -174,4 +174,85 @@ export interface AirportRecord {
174
174
  municipality: string | null;
175
175
  isoRegion: string | null;
176
176
  }
177
+ /**
178
+ * Whether a grouping admits members or a publisher assigns countries to it.
179
+ */
180
+ export declare const GroupingKind: {
181
+ readonly Organization: "organization";
182
+ readonly Classification: "classification";
183
+ };
184
+ export type GroupingKind = (typeof GroupingKind)[keyof typeof GroupingKind];
185
+ /**
186
+ * The role a membership statement gives its country.
187
+ * Only `member` counts as membership.
188
+ */
189
+ export declare const MembershipRole: {
190
+ readonly Member: "member";
191
+ readonly Associate: "associate";
192
+ readonly Observer: "observer";
193
+ readonly Suspended: "suspended";
194
+ readonly Other: "other";
195
+ };
196
+ export type MembershipRole = (typeof MembershipRole)[keyof typeof MembershipRole];
197
+ /**
198
+ * How a member's code relates to ISO 3166-1.
199
+ *
200
+ * `source-extension` is a code the publisher assigns outside ISO 3166-1, kept as the publisher
201
+ * spells it, such as the World Bank's `XK` for Kosovo and `JG` for the Channel Islands.
202
+ */
203
+ export declare const MemberCodeStatus: {
204
+ readonly OfficiallyAssigned: "officially-assigned";
205
+ readonly FormerlyUsed: "formerly-used";
206
+ readonly SourceExtension: "source-extension";
207
+ };
208
+ export type MemberCodeStatus = (typeof MemberCodeStatus)[keyof typeof MemberCodeStatus];
209
+ /**
210
+ * A date a source states, with the precision it states it at.
211
+ *
212
+ * `date` is `YYYY-MM-DD`, with the month and day set to `01` when the precision leaves them unstated.
213
+ */
214
+ export interface StatedDate {
215
+ date: string;
216
+ precision: "year" | "month" | "day";
217
+ }
218
+ /**
219
+ * One grouping as the groupings table holds it.
220
+ */
221
+ export interface GroupingRecord {
222
+ id: string;
223
+ name: string;
224
+ kind: GroupingKind;
225
+ /**
226
+ * The source and the selector the members were read through, such as `wikidata:Q458 P463`.
227
+ */
228
+ source: string;
229
+ /**
230
+ * The publication date of a classification's source, or null for an organization.
231
+ */
232
+ asOf: string | null;
233
+ /**
234
+ * The reasons the normalizer couldn't classify the grouping's statements.
235
+ * A blocked grouping answers no membership question.
236
+ */
237
+ blockedBy: string[];
238
+ }
239
+ /**
240
+ * One membership interval: a country's place in a grouping between two stated dates.
241
+ */
242
+ export interface MembershipRow {
243
+ grouping: string;
244
+ code: string;
245
+ codeStatus: MemberCodeStatus;
246
+ role: MembershipRole;
247
+ /**
248
+ * The start, or null when the source states none.
249
+ * A null start is unknown rather than the epoch.
250
+ */
251
+ start: StatedDate | null;
252
+ end: StatedDate | null;
253
+ /**
254
+ * The statement or source row the interval was read from, such as `wikidata:Q145-…`.
255
+ */
256
+ evidence: string;
257
+ }
177
258
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH;;;;GAIG;AACH,MAAM,CAAC,OAAO,WAAW,GAAG,CAAC;IAC5B,MAAM,0BAA0B,EAAE,OAAO,MAAM,CAAA;IAC/C,MAAM,0BAA0B,EAAE,OAAO,MAAM,CAAA;IAC/C,MAAM,2BAA2B,EAAE,OAAO,MAAM,CAAA;IAEhD;;OAEG;IACH,KAAK,yBAAyB,GAAG,MAAM,GAAG;QAAE,QAAQ,CAAC,CAAC,0BAA0B,CAAC,EAAE,IAAI,CAAA;KAAE,CAAA;IAEzF;;OAEG;IACH,KAAK,yBAAyB,GAAG,MAAM,GAAG;QAAE,QAAQ,CAAC,CAAC,0BAA0B,CAAC,EAAE,IAAI,CAAA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,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAA;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,YAAY,CAAA;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB;;;OAGG;IACH,SAAS,EAAE,MAAM,EAAE,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,cAAc,CAAA;IACpB;;;OAGG;IACH,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;IACxB,GAAG,EAAE,UAAU,GAAG,IAAI,CAAA;IACtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CAChB"}
package/out/types.js CHANGED
@@ -27,4 +27,33 @@ export const AirportCountryStatus = {
27
27
  SourceExtension: "source-extension",
28
28
  Unstated: "unstated",
29
29
  };
30
+ /**
31
+ * Whether a grouping admits members or a publisher assigns countries to it.
32
+ */
33
+ export const GroupingKind = {
34
+ Organization: "organization",
35
+ Classification: "classification",
36
+ };
37
+ /**
38
+ * The role a membership statement gives its country.
39
+ * Only `member` counts as membership.
40
+ */
41
+ export const MembershipRole = {
42
+ Member: "member",
43
+ Associate: "associate",
44
+ Observer: "observer",
45
+ Suspended: "suspended",
46
+ Other: "other",
47
+ };
48
+ /**
49
+ * How a member's code relates to ISO 3166-1.
50
+ *
51
+ * `source-extension` is a code the publisher assigns outside ISO 3166-1, kept as the publisher
52
+ * spells it, such as the World Bank's `XK` for Kosovo and `JG` for the Channel Islands.
53
+ */
54
+ export const MemberCodeStatus = {
55
+ OfficiallyAssigned: "officially-assigned",
56
+ FormerlyUsed: "formerly-used",
57
+ SourceExtension: "source-extension",
58
+ };
30
59
  //# sourceMappingURL=types.js.map
package/out/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AA+FlE;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;IAC9B,SAAS,EAAE,WAAW;CACb,CAAA;AAuBV;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,kBAAkB,EAAE,qBAAqB;IACzC,YAAY,EAAE,eAAe;CACpB,CAAA;AAIV;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC,SAAS,EAAE,WAAW;IACtB,eAAe,EAAE,kBAAkB;IACnC,QAAQ,EAAE,UAAU;CACX,CAAA"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE;AA+FlE;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;IAC9B,SAAS,EAAE,WAAW;CACb,CAAA;AAuBV;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,kBAAkB,EAAE,qBAAqB;IACzC,YAAY,EAAE,eAAe;CACpB,CAAA;AAIV;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IACnC,SAAS,EAAE,WAAW;IACtB,eAAe,EAAE,kBAAkB;IACnC,QAAQ,EAAE,UAAU;CACX,CAAA;AAqCV;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,YAAY,EAAE,cAAc;IAC5B,cAAc,EAAE,gBAAgB;CACvB,CAAA;AAIV;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;CACL,CAAA;AAIV;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,kBAAkB,EAAE,qBAAqB;IACzC,YAAY,EAAE,eAAe;IAC7B,eAAe,EAAE,kBAAkB;CAC1B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailwoman/registry",
3
- "version": "11.3.0",
3
+ "version": "11.5.0",
4
4
  "description": "A generated, typed registry of standardized identifiers and their relationships: ISO 3166-1 country codes, IATA airport codes, ISO 639 language subtags, ISO 15924 scripts and BCP 47 tags in this release, compiled from pinned open sources into RGY1 lookup artifacts with branded types, a synchronous TypeScript reader, a Rust lookup core and a WebAssembly batch adapter.",
5
5
  "keywords": [
6
6
  "airport-codes",
@@ -43,6 +43,8 @@
43
43
  "type": "module",
44
44
  "sideEffects": [
45
45
  "./sdk/**/*.run.ts",
46
+ "./sdk/sources.ts",
47
+ "./out/sdk/sources.js",
46
48
  "./tools/**/*.run.ts",
47
49
  "./out/sdk/**/*.run.js",
48
50
  "./out/tools/**/*.run.js"
@@ -135,7 +137,7 @@
135
137
  }
136
138
  },
137
139
  "dependencies": {
138
- "@mailwoman/core": "11.3.0",
140
+ "@mailwoman/core": "11.5.0",
139
141
  "path-ts": "^2.5.0"
140
142
  },
141
143
  "devDependencies": {
package/sdk/sources.ts CHANGED
@@ -13,6 +13,8 @@
13
13
  */
14
14
 
15
15
  import { currentSourcePath } from "@mailwoman/core/data-root"
16
+ import { readLocalJSONFile } from "@mailwoman/core/fs/readers"
17
+ import { workspacePath } from "@mailwoman/core/paths"
16
18
  import type { PathBuilder } from "path-ts"
17
19
 
18
20
  /**
@@ -59,6 +61,10 @@ export const SOURCE_IDS = [
59
61
  "ourairports-airports",
60
62
  "ourairports-countries",
61
63
  "wikidata-iso3166-1",
64
+ "wikidata-memberships-p463",
65
+ "wikidata-memberships-p527",
66
+ "worldbank-countries",
67
+ "wikipedia-developed-country",
62
68
  ] as const
63
69
 
64
70
  export type SourceID = (typeof SOURCE_IDS)[number]
@@ -86,6 +92,81 @@ ORDER BY ?alpha2 ?item`
86
92
  */
87
93
  export const WIKIDATA_SPARQL_ENDPOINT = "https://query.wikidata.org/sparql"
88
94
 
95
+ /**
96
+ * The grouping declarations, read for the organization items the membership query asks about.
97
+ */
98
+ export interface GroupingDefinitions {
99
+ schemaVersion: number
100
+ groupings: Array<{
101
+ id: string
102
+ name: string
103
+ kind: "organization" | "classification"
104
+ source:
105
+ | { type: "wikidata"; item: string; property: "P463" | "P527" | "both" }
106
+ | { type: "worldbank-income"; level: string }
107
+ | { type: "wikipedia-imf-advanced"; aliases: Record<string, string> }
108
+ }>
109
+ /**
110
+ * Wikidata items that hold a membership for an ISO entry whose code sits on
111
+ * another item, mapped to that code.
112
+ */
113
+ entities: Record<string, string>
114
+ /**
115
+ * Wikidata role items mapped to the role they give a membership statement.
116
+ */
117
+ roles: Record<string, "member" | "associate" | "observer" | "suspended" | "other">
118
+ }
119
+
120
+ // The definitions decide the query text, and the query text is part of the locked URL,
121
+ // so a changed definition list is a changed source that a fetch refuses until `--repin`.
122
+ const GROUPING_DEFINITIONS = await readLocalJSONFile<GroupingDefinitions>(
123
+ workspacePath("registry", "definitions", "groupings.json")
124
+ )
125
+
126
+ const ORGANIZATION_VALUES = GROUPING_DEFINITIONS.groupings
127
+ .flatMap((grouping) => (grouping.source.type === "wikidata" ? [`wd:${grouping.source.item}`] : []))
128
+ .join(" ")
129
+
130
+ /**
131
+ * A SPARQL query that reads every membership statement of the declared organizations through one property.
132
+ *
133
+ * P463 ("member of") sits on the member and P527 ("has part(s)") sits on the organization.
134
+ * Both are read so the normalizer can take membership from the property a definition names
135
+ * and report where the other disagrees.
136
+ *
137
+ * Each row is one statement and one of its role values, with its rank and its start
138
+ * and end times at their stated precision.
139
+ * A statement with no role yields one row with `?role` unbound.
140
+ *
141
+ * Each property is its own query: on 2026-11-24 the query service answered each
142
+ * in under 4 s and timed out at 65 s on their UNION.
143
+ */
144
+ export function membershipsQuery(property: "P463" | "P527"): string {
145
+ const pattern =
146
+ property === "P463"
147
+ ? "?member p:P463 ?statement . ?statement ps:P463 ?org ."
148
+ : "?org p:P527 ?statement . ?statement ps:P527 ?member ."
149
+
150
+ return `SELECT ?org ?member ?statement ?rank ?role ?start ?startPrecision ?end ?endPrecision WHERE {
151
+ VALUES ?org { ${ORGANIZATION_VALUES} }
152
+ ${pattern}
153
+ ?statement wikibase:rank ?rank .
154
+ OPTIONAL { ?statement pq:P2868 ?role . }
155
+ OPTIONAL { ?statement pqv:P580 ?startNode . ?startNode wikibase:timeValue ?start ; wikibase:timePrecision ?startPrecision . }
156
+ OPTIONAL { ?statement pqv:P582 ?endNode . ?endNode wikibase:timeValue ?end ; wikibase:timePrecision ?endPrecision . }
157
+ }
158
+ ORDER BY ?org ?member ?statement ?role`
159
+ }
160
+
161
+ /**
162
+ * The revision of the English Wikipedia article "Developed country" whose "IMF
163
+ * advanced economies" section the IMF classification is read from.
164
+ *
165
+ * The section lists the economies of the IMF World Economic Outlook statistical appendix it cites.
166
+ * A revision is immutable, so the pinned bytes change only when this number does.
167
+ */
168
+ export const DEVELOPED_COUNTRY_REVISION = 1_387_385_587
169
+
89
170
  /**
90
171
  * The open profile's sources.
91
172
  *
@@ -147,6 +228,44 @@ export const SOURCES: readonly SourceDefinition[] = [
147
228
  },
148
229
  feeds: ["iso3166-1-alpha2", "iso3166-1-alpha3", "iso3166-1-numeric"],
149
230
  },
231
+ ...(["P463", "P527"] as const).map((property): SourceDefinition => ({
232
+ id: `wikidata-memberships-${property.toLowerCase() as "p463" | "p527"}`,
233
+ url: `${WIKIDATA_SPARQL_ENDPOINT}?format=json&query=${encodeURIComponent(membershipsQuery(property))}`,
234
+ file: `wikidata-memberships-${property.toLowerCase()}.json`,
235
+ terms: {
236
+ statement:
237
+ "Wikidata publishes its structured data under the Creative Commons CC0 1.0 Universal public domain dedication.",
238
+ readAt: "https://www.wikidata.org/wiki/Wikidata:Licensing",
239
+ elected: true,
240
+ },
241
+ feeds: ["country-grouping"],
242
+ })),
243
+ {
244
+ id: "worldbank-countries",
245
+ url: "https://api.worldbank.org/v2/country?format=json&per_page=400",
246
+ file: "worldbank-countries.json",
247
+ terms: {
248
+ statement:
249
+ "Unless otherwise noted, these Datasets are provided to you under a Creative Commons Attribution 4.0 " +
250
+ "International License (CC BY 4.0). Attribution: The World Bank: Dataset name: Data source (if known).",
251
+ readAt: "https://www.worldbank.org/ext/en/legal/terms-conditions/datasets",
252
+ elected: true,
253
+ },
254
+ feeds: ["country-grouping"],
255
+ },
256
+ {
257
+ id: "wikipedia-developed-country",
258
+ url: `https://en.wikipedia.org/w/index.php?title=Developed_country&oldid=${DEVELOPED_COUNTRY_REVISION}&action=raw`,
259
+ file: "wikipedia-developed-country.wikitext",
260
+ terms: {
261
+ statement:
262
+ "The source is read for the list of economies the IMF classifies as advanced, which is a list of facts. " +
263
+ "The article's prose is CC BY-SA 4.0 and isn't redistributed.",
264
+ readAt: "https://en.wikipedia.org/wiki/Wikipedia:Copyrights",
265
+ elected: true,
266
+ },
267
+ feeds: ["country-grouping"],
268
+ },
150
269
  ]
151
270
 
152
271
  /**
@@ -27,6 +27,7 @@ import { runFile } from "@mailwoman/core/scripting/process"
27
27
  import { prettyJSON, stringifyJSON } from "@mailwoman/core/values/json"
28
28
 
29
29
  import { artifactModulePath } from "#tools/artifact-path"
30
+ import { formatGroupings, type NormalizedGroupings } from "#tools/groupings"
30
31
  import { type NormalizedSubtags, SUBTAG_TABLES, type SubtagTable, subtagTableRows } from "#tools/language-subtags"
31
32
 
32
33
  const { values } = parseArguments({ options: { check: { type: "boolean", default: false } } })
@@ -164,6 +165,70 @@ export const ${table.toUpperCase()}_SUBTAGS_FILE_DATE = ${stringifyJSON(subtags.
164
165
  await emit(registry("lib", "artifacts", "bcp47", `${table}.ts`), module)
165
166
  }
166
167
 
168
+ // The groupings are a JSON fixture too, for the subtag tables' reason: about 1,600 rows,
169
+ // read by a filter over one grouping or one country.
170
+ const groupings = await readLocalJSONFile<NormalizedGroupings>(registry("data", "normalized", "groupings.json"))
171
+
172
+ {
173
+ const fixture = formatGroupings(groupings)
174
+ const sha256 = sha256Hex(fixture)
175
+ const name = "country-groupings"
176
+
177
+ manifest[name] = { sha256, bytes: Buffer.byteLength(fixture), profile: profile.profile }
178
+
179
+ await emit(registry("lib", "artifacts", "groupings", "groupings.fixture.json"), fixture)
180
+
181
+ const ids = groupings.groupings.map((grouping) => grouping.id)
182
+
183
+ // The header is written in the shape the comment-reflow rule leaves it, one sentence per line.
184
+ const module = `${spdxHeaderText(SourceHeaderSyntax.Slash)}/**
185
+ * The \`${name}\` table of the \`${profile.profile}\` profile: ${groupings.groupings.length} groupings and ${groupings.records.length} membership rows.
186
+ *
187
+ * The rows live in \`./groupings.fixture.json\`,
188
+ * SHA-256 ${sha256}.
189
+ * Generated by tools/generate.run.ts from data/normalized.
190
+ *
191
+ * Edit the definitions, the data or the generator rather than this file.
192
+ */
193
+
194
+ import type { GroupingRecord, MembershipRow } from "#types"
195
+
196
+ import fixture from "./groupings.fixture.json" with { type: "json" }
197
+
198
+ /**
199
+ * Every grouping ID the table declares.
200
+ */
201
+ export const GROUPING_IDS = [
202
+ ${ids.map((id) => `\t${stringifyJSON(id)},`).join("\n")}
203
+ ] as const
204
+
205
+ export type GroupingID = (typeof GROUPING_IDS)[number]
206
+
207
+ const groupings = Object.freeze(fixture.groupings as GroupingRecord[])
208
+ const records = Object.freeze(fixture.records as MembershipRow[])
209
+
210
+ /**
211
+ * Returns the groupings table.
212
+ *
213
+ * Callers read the rows and never write them.
214
+ */
215
+ export function groupingRows(): readonly GroupingRecord[] {
216
+ return groupings
217
+ }
218
+
219
+ /**
220
+ * Returns the membership rows.
221
+ *
222
+ * Callers read the rows and never write them.
223
+ */
224
+ export function membershipRows(): readonly MembershipRow[] {
225
+ return records
226
+ }
227
+ `
228
+
229
+ await emit(registry("lib", "artifacts", "groupings", "groupings.ts"), module)
230
+ }
231
+
167
232
  await emit(registry("data", "manifests", "artifacts.json"), prettyJSON(manifest))
168
233
 
169
234
  // The fixture profile, committed as bytes so the layout test and the Rust tests read the same artifacts.