caelum0x 1bc04fa81b feat(insights): the Insights fork behind the add-on, site entries, tenant summaries, caps that say what happens (PY1.3)
Railyard side of PY1.3 (RYP-D2, RYP-E1, SC-E3). Acceptance:
1. apps/insights: umami-software/umami v3.4.0 (MIT, commit ec0ff503),
   vendored --depth 1, LICENSE kept, NOTICE added. Fork additions only:
   src/railyard/{ingest,summary,tenancy,api-only}.ts, /v1/ingest/batch (the
   edge collector contract v1, bearer INSIGHTS_INGEST_TOKEN, no IP ever,
   retried batches de-duplicated by migration 90_railyard_ingest_receipts),
   /api/v1/tenants/{org}/summary (bearer INSIGHTS_API_TOKEN), src/proxy.ts
   (INSIGHTS_API_ONLY=1 serves only the Railyard API and the heartbeat).
   Tenant isolation is tested at the API level (an app id owned by another org
   is refused) and at the SQL level (upstream migrations 01-26 plus 90 on a
   throwaway cluster: org B never reads org A's rows, even naming its app).
   Upstream vitest suite: not run on the Mac (pnpm 12.3.4 pinned upstream,
   disk floor); it runs in the image build on box 2 or CI.
2. No upstream product name in anything a customer loads: the page tag, the
   console pages and the fork's additions (tests); the upstream dashboard is
   never served in API-only mode.
3. The console writes the collector's site entry on "Add app", on
   auto-created apps from deploys, and rewrites every entry on add-on, plan or
   pause changes (lib/sites.ts, SITES KV binding). The bridge gains
   `sites` (the project's app, site key, page tag and collector URLs, entry
   written) and the analytics proof is the first event from Insights. The
   console's Insights page shows visitors, events, first event and the
   visit -> signup -> first action funnel.
5. insights-edge/src/caps.ts: at 100% of the cap events are still counted and
   not stored until the next UTC month; the console shows the same message
   from a byte-identical copy (lib/caps.ts, tested).
4 (384 MB at 50 events a second for 10 min) is measured on staging before deploy.

Env: INSIGHTS_API_URL, INSIGHTS_API_TOKEN, SITES KV binding (console);
INSIGHTS_INGEST_TOKEN, INSIGHTS_API_TOKEN, INSIGHTS_API_ONLY (Insights).

Tests: console 54/54 (tsc clean), insights fork 7/7 (incl. SQL isolation),
insights-edge caps + collector + sim 14/14, tests/contract 3/3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 21:23:38 +03:00

253 lines
6.2 KiB
JSON

{
"SA": "\u1ea2 R\u1eadp X\u00ea-\u00fat",
"AF": "Afghanistan",
"EG": "Ai C\u1eadp",
"AL": "Albania",
"DZ": "Algeria",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AG": "Antigua v\u00e0 Barbuda",
"AT": "\u00c1o",
"AR": "Argentina",
"AM": "Armenia",
"AW": "Aruba",
"AU": "Australia",
"AZ": "Azerbaijan",
"IN": "\u1ea4n \u0110\u1ed9",
"PL": "Ba Lan",
"BS": "Bahamas",
"BH": "Bahrain",
"BD": "Bangladesh",
"BB": "Barbados",
"MK": "B\u1eafc Macedonia",
"BY": "Belarus",
"BZ": "Belize",
"BJ": "Benin",
"BM": "Bermuda",
"BT": "Bhutan",
"BE": "B\u1ec9",
"BO": "Bolivia",
"BA": "Bosnia v\u00e0 Herzegovina",
"BW": "Botswana",
"PT": "B\u1ed3 \u0110\u00e0o Nha",
"BR": "Brazil",
"BN": "Brunei",
"BG": "Bulgaria",
"BF": "Burkina Faso",
"BI": "Burundi",
"BQ": "Ca-ri-b\u00ea H\u00e0 Lan",
"UM": "C\u00e1c ti\u1ec3u \u0111\u1ea3o xa c\u1ee7a Hoa K\u1ef3",
"AE": "C\u00e1c Ti\u1ec3u V\u01b0\u01a1ng qu\u1ed1c \u1ea2 R\u1eadp Th\u1ed1ng nh\u1ea5t",
"CM": "Cameroon",
"KH": "Campuchia",
"CA": "Canada",
"CV": "Cape Verde",
"TD": "Chad",
"CL": "Chile",
"CO": "Colombia",
"KM": "Comoros",
"CG": "Congo - Brazzaville",
"CD": "Congo - Kinshasa",
"CR": "Costa Rica",
"DO": "C\u1ed9ng h\u00f2a Dominica",
"CF": "C\u1ed9ng h\u00f2a Trung Phi",
"CI": "C\u00f4te d\u2019Ivoire",
"HR": "Croatia",
"CU": "Cuba",
"CW": "Cura\u00e7ao",
"DJ": "Djibouti",
"DM": "Dominica",
"TW": "\u0110\u00e0i Loan",
"DK": "\u0110an M\u1ea1ch",
"BV": "\u0110\u1ea3o Bouvet",
"CX": "\u0110\u1ea3o Gi\u00e1ng Sinh",
"IM": "\u0110\u1ea3o Man",
"NF": "\u0110\u1ea3o Norfolk",
"DE": "\u0110\u1ee9c",
"EC": "Ecuador",
"SV": "El Salvador",
"ER": "Eritrea",
"EE": "Estonia",
"ET": "Ethiopia",
"FJ": "Fiji",
"GA": "Gabon",
"GM": "Gambia",
"GE": "Georgia",
"GH": "Ghana",
"GI": "Gibraltar",
"GL": "Greenland",
"GD": "Grenada",
"GP": "Guadeloupe",
"GU": "Guam",
"GT": "Guatemala",
"GG": "Guernsey",
"GF": "Guiana thu\u1ed9c Ph\u00e1p",
"GN": "Guinea",
"GQ": "Guinea X\u00edch \u0110\u1ea1o",
"GW": "Guinea-Bissau",
"GY": "Guyana",
"NL": "H\u00e0 Lan",
"HT": "Haiti",
"KR": "H\u00e0n Qu\u1ed1c",
"US": "Hoa K\u1ef3",
"HN": "Honduras",
"HK": "H\u1ed3ng K\u00f4ng, Trung Qu\u1ed1c",
"HU": "Hungary",
"GR": "Hy L\u1ea1p",
"IS": "Iceland",
"ID": "Indonesia",
"IR": "Iran",
"IQ": "Iraq",
"IE": "Ireland",
"IL": "Israel",
"IT": "Italy",
"JM": "Jamaica",
"JE": "Jersey",
"JO": "Jordan",
"KZ": "Kazakhstan",
"KE": "Kenya",
"KI": "Kiribati",
"XK": "Kosovo",
"KW": "Kuwait",
"KG": "Kyrgyzstan",
"IO": "L\u00e3nh th\u1ed5 \u1ea4n \u0110\u1ed9 D\u01b0\u01a1ng thu\u1ed9c Anh",
"PS": "L\u00e3nh th\u1ed5 Palestine",
"TF": "L\u00e3nh th\u1ed5 ph\u00eda Nam Thu\u1ed9c Ph\u00e1p",
"LA": "L\u00e0o",
"LV": "Latvia",
"LS": "Lesotho",
"LB": "Li-b\u0103ng",
"LR": "Liberia",
"LY": "Libya",
"LI": "Liechtenstein",
"LT": "Litva",
"LU": "Luxembourg",
"MA": "Ma-r\u1ed1c",
"MO": "Macao, Trung Qu\u1ed1c",
"MG": "Madagascar",
"MW": "Malawi",
"MY": "Malaysia",
"MV": "Maldives",
"ML": "Mali",
"MT": "Malta",
"MQ": "Martinique",
"MR": "Mauritania",
"MU": "Mauritius",
"YT": "Mayotte",
"MX": "Mexico",
"FM": "Micronesia",
"MD": "Moldova",
"MC": "Monaco",
"ME": "Montenegro",
"MS": "Montserrat",
"MZ": "Mozambique",
"MN": "M\u00f4ng C\u1ed5",
"MM": "Myanmar (Mi\u1ebfn \u0110i\u1ec7n)",
"NO": "Na Uy",
"AQ": "Nam C\u1ef1c",
"GS": "Nam Georgia & Qu\u1ea7n \u0111\u1ea3o Nam Sandwich",
"ZA": "Nam Phi",
"SS": "Nam Sudan",
"NA": "Namibia",
"NR": "Nauru",
"NP": "Nepal",
"NC": "New Caledonia",
"NZ": "New Zealand",
"RU": "Nga",
"JP": "Nh\u1eadt B\u1ea3n",
"NI": "Nicaragua",
"NE": "Niger",
"NG": "Nigeria",
"NU": "Niue",
"OM": "Oman",
"PK": "Pakistan",
"PW": "Palau",
"PA": "Panama",
"PG": "Papua New Guinea",
"PY": "Paraguay",
"PE": "Peru",
"FR": "Ph\u00e1p",
"FI": "Ph\u1ea7n Lan",
"PH": "Philippines",
"PF": "Polynesia thu\u1ed9c Ph\u00e1p",
"PR": "Puerto Rico",
"QA": "Qatar",
"AX": "Qu\u1ea7n \u0111\u1ea3o \u00c5land",
"MP": "Qu\u1ea7n \u0111\u1ea3o B\u1eafc Mariana",
"KY": "Qu\u1ea7n \u0111\u1ea3o Cayman",
"CC": "Qu\u1ea7n \u0111\u1ea3o Cocos (Keeling)",
"CK": "Qu\u1ea7n \u0111\u1ea3o Cook",
"FK": "Qu\u1ea7n \u0111\u1ea3o Falkland",
"FO": "Qu\u1ea7n \u0111\u1ea3o Faroe",
"HM": "Qu\u1ea7n \u0111\u1ea3o Heard v\u00e0 McDonald",
"MH": "Qu\u1ea7n \u0111\u1ea3o Marshall",
"PN": "Qu\u1ea7n \u0111\u1ea3o Pitcairn",
"SB": "Qu\u1ea7n \u0111\u1ea3o Solomon",
"TC": "Qu\u1ea7n \u0111\u1ea3o Turks v\u00e0 Caicos",
"VG": "Qu\u1ea7n \u0111\u1ea3o Virgin thu\u1ed9c Anh",
"VI": "Qu\u1ea7n \u0111\u1ea3o Virgin thu\u1ed9c M\u1ef9",
"RE": "R\u00e9union",
"RO": "Romania",
"RW": "Rwanda",
"PM": "Saint Pierre v\u00e0 Miquelon",
"WS": "Samoa",
"AS": "Samoa thu\u1ed9c M\u1ef9",
"SM": "San Marino",
"ST": "S\u00e3o Tom\u00e9 v\u00e0 Pr\u00edncipe",
"CZ": "S\u00e9c",
"SN": "Senegal",
"RS": "Serbia",
"SC": "Seychelles",
"SL": "Sierra Leone",
"SG": "Singapore",
"SX": "Sint Maarten",
"CY": "S\u00edp",
"SK": "Slovakia",
"SI": "Slovenia",
"SO": "Somalia",
"LK": "Sri Lanka",
"BL": "St. Barth\u00e9lemy",
"SH": "St. Helena",
"KN": "St. Kitts v\u00e0 Nevis",
"LC": "St. Lucia",
"MF": "St. Martin",
"VC": "St. Vincent v\u00e0 Grenadines",
"SD": "Sudan",
"SR": "Suriname",
"SJ": "Svalbard v\u00e0 Jan Mayen",
"SZ": "Swaziland",
"SY": "Syria",
"TJ": "Tajikistan",
"TZ": "Tanzania",
"ES": "T\u00e2y Ban Nha",
"EH": "T\u00e2y Sahara",
"TH": "Th\u00e1i Lan",
"VA": "Th\u00e0nh Vatican",
"TR": "Th\u1ed5 Nh\u0129 K\u1ef3",
"SE": "Th\u1ee5y \u0110i\u1ec3n",
"CH": "Th\u1ee5y S\u0129",
"TL": "Timor-Leste",
"TG": "Togo",
"TK": "Tokelau",
"TO": "Tonga",
"KP": "Tri\u1ec1u Ti\u00ean",
"TT": "Trinidad v\u00e0 Tobago",
"CN": "Trung Qu\u1ed1c",
"TN": "Tunisia",
"TM": "Turkmenistan",
"TV": "Tuvalu",
"UG": "Uganda",
"UA": "Ukraina",
"UY": "Uruguay",
"UZ": "Uzbekistan",
"VU": "Vanuatu",
"VE": "Venezuela",
"VN": "Vi\u1ec7t Nam",
"GB": "V\u01b0\u01a1ng qu\u1ed1c Anh",
"WF": "Wallis v\u00e0 Futuna",
"YE": "Yemen",
"ZM": "Zambia",
"ZW": "Zimbabwe"
}