@gruncellka/porto-data 0.3.0 → 0.4.1

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 (88) hide show
  1. package/CHANGELOG.md +215 -0
  2. package/LICENSE +199 -5
  3. package/README.md +53 -34
  4. package/index.d.ts +35 -18
  5. package/index.js +2 -1
  6. package/package.json +28 -8
  7. package/porto_data/formats/envelopes.json +120 -0
  8. package/porto_data/formats/layouts.json +288 -0
  9. package/porto_data/mappings.json +65 -10
  10. package/porto_data/metadata.json +662 -125
  11. package/porto_data/policy/jurisdictions.json +839 -0
  12. package/porto_data/policy/markets.json +75 -0
  13. package/porto_data/policy/restrictions.json +668 -0
  14. package/porto_data/providers/deutschepost/features.json +42 -0
  15. package/porto_data/providers/deutschepost/graph.json +203 -0
  16. package/porto_data/providers/deutschepost/limits.json +17 -0
  17. package/porto_data/providers/deutschepost/marks.json +71 -0
  18. package/porto_data/providers/deutschepost/prices/products.json +239 -0
  19. package/porto_data/providers/deutschepost/prices/services.json +51 -0
  20. package/porto_data/providers/deutschepost/products.json +197 -0
  21. package/porto_data/providers/deutschepost/services.json +88 -0
  22. package/porto_data/providers/deutschepost/weights.json +46 -0
  23. package/porto_data/providers/deutschepost/zones.json +231 -0
  24. package/porto_data/providers/laposte/features.json +42 -0
  25. package/porto_data/providers/laposte/graph.json +234 -0
  26. package/porto_data/providers/laposte/limits.json +17 -0
  27. package/porto_data/providers/laposte/marks.json +39 -0
  28. package/porto_data/providers/laposte/prices/products.json +947 -0
  29. package/porto_data/providers/laposte/prices/services.json +41 -0
  30. package/porto_data/providers/laposte/products.json +276 -0
  31. package/porto_data/providers/laposte/services.json +63 -0
  32. package/porto_data/providers/laposte/weights.json +38 -0
  33. package/porto_data/providers/laposte/zones.json +230 -0
  34. package/porto_data/providers/swisspost/features.json +21 -0
  35. package/porto_data/providers/swisspost/graph.json +212 -0
  36. package/porto_data/providers/swisspost/limits.json +17 -0
  37. package/porto_data/providers/swisspost/marks.json +41 -0
  38. package/porto_data/providers/swisspost/prices/products.json +347 -0
  39. package/porto_data/providers/swisspost/prices/services.json +31 -0
  40. package/porto_data/providers/swisspost/products.json +193 -0
  41. package/porto_data/providers/swisspost/rules.json +25 -0
  42. package/porto_data/providers/swisspost/services.json +40 -0
  43. package/porto_data/providers/swisspost/weights.json +38 -0
  44. package/porto_data/providers/swisspost/zones.json +223 -0
  45. package/porto_data/providers/ukrposhta/features.json +28 -0
  46. package/porto_data/providers/ukrposhta/graph.json +148 -0
  47. package/porto_data/providers/ukrposhta/limits.json +17 -0
  48. package/porto_data/providers/ukrposhta/marks.json +25 -0
  49. package/porto_data/providers/ukrposhta/prices/products.json +123 -0
  50. package/porto_data/providers/ukrposhta/prices/services.json +42 -0
  51. package/porto_data/providers/ukrposhta/products.json +74 -0
  52. package/porto_data/providers/ukrposhta/services.json +40 -0
  53. package/porto_data/providers/ukrposhta/weights.json +26 -0
  54. package/porto_data/providers/ukrposhta/zones.json +226 -0
  55. package/porto_data/providers.json +37 -0
  56. package/porto_data/schemas/envelopes.schema.json +120 -0
  57. package/porto_data/schemas/features.schema.json +66 -55
  58. package/porto_data/schemas/graph.schema.json +189 -0
  59. package/porto_data/schemas/jurisdictions.schema.json +116 -0
  60. package/porto_data/schemas/layouts.schema.json +156 -0
  61. package/porto_data/schemas/limits.schema.json +253 -0
  62. package/porto_data/schemas/mappings.schema.json +73 -0
  63. package/porto_data/schemas/markets.schema.json +186 -0
  64. package/porto_data/schemas/marks.schema.json +127 -0
  65. package/porto_data/schemas/metadata.schema.json +183 -0
  66. package/porto_data/schemas/porto_ids.schema.json +45 -0
  67. package/porto_data/schemas/product_prices.schema.json +126 -0
  68. package/porto_data/schemas/products.schema.json +338 -110
  69. package/porto_data/schemas/providers.schema.json +71 -0
  70. package/porto_data/schemas/restrictions.schema.json +175 -355
  71. package/porto_data/schemas/rules.schema.json +104 -0
  72. package/porto_data/schemas/service_prices.schema.json +116 -0
  73. package/porto_data/schemas/services.schema.json +113 -70
  74. package/porto_data/schemas/weights.schema.json +70 -0
  75. package/porto_data/schemas/zones.schema.json +78 -72
  76. package/porto_data/data/data_links.json +0 -148
  77. package/porto_data/data/dimensions.json +0 -158
  78. package/porto_data/data/features.json +0 -66
  79. package/porto_data/data/prices.json +0 -242
  80. package/porto_data/data/products.json +0 -84
  81. package/porto_data/data/restrictions.json +0 -795
  82. package/porto_data/data/services.json +0 -61
  83. package/porto_data/data/weight_tiers.json +0 -54
  84. package/porto_data/data/zones.json +0 -230
  85. package/porto_data/schemas/data_links.schema.json +0 -223
  86. package/porto_data/schemas/dimensions.schema.json +0 -215
  87. package/porto_data/schemas/prices.schema.json +0 -180
  88. package/porto_data/schemas/weight_tiers.schema.json +0 -70
package/CHANGELOG.md ADDED
@@ -0,0 +1,215 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.4.1] - 2026-07-05
8
+
9
+ Release since **v0.3.1**: multi-provider bundle layout, **`policy/markets.json`**, delivery/indemnity resolution contract, and npm publish tarball checks for the new paths.
10
+
11
+ ### Fixed
12
+
13
+ - **PyPI:** PEP 639 `license = "Apache-2.0"` + `license-files` (removed invalid `License ::` classifier).
14
+ - **npm:** Exclude `docs/` from published tarball.
15
+ - **JSON:** Store UTF-8 literals instead of `\u` escapes in catalog files.
16
+
17
+ ### Added
18
+
19
+ **Multi-provider catalog**
20
+
21
+ - **`graph.edges.marks`:** Zone → mark profile resolution under **`edges`** (`products` + `marks`). Catalog in `marks.json` → `profiles[]`.
22
+ - **Mark profiles:** Measured sizes in `marks.json`; resolution via `graph.edges.marks`. See [mark-profiles.md](docs/mark-profiles.md).
23
+ - **Operators:** Full letter catalogs for Deutsche Post, Ukrposhta, La Poste, and Swiss Post under **`providers/<id>/`**.
24
+ - **Policy:** **`policy/jurisdictions.json`**, **`policy/restrictions.json`**, **`policy/markets.json`** (DE, FR, CH, UA fiscal defaults).
25
+ - **Swiss Post:** Optional **`providers/swisspost/rules.json`** (e.g. thickness surcharge) where modeled.
26
+ - **Docs:** [docs/providers/](docs/providers/) tariff notes per operator; [resolution.md](docs/resolution.md), [provider-template.md](docs/provider-template.md), [porto_id.md](docs/porto_id.md), [tariff-verification.md](docs/tariff-verification.md); [id.md](docs/id.md), [policy.md](docs/policy.md), [formats.md](docs/formats.md).
27
+ - **Mappings:** Required provider template schemas enforced in mappings validation.
28
+
29
+ **Validation**
30
+
31
+ - **`porto validate --type porto_ids`** — enum checks, native-id cross-file refs, duplicate `porto_id` warnings.
32
+ - **`porto validate --type markets`** — registry ↔ markets coverage and fiscal shape checks.
33
+ - **`porto validate --type delivery`** — zone coverage, span/days shape, Swiss Post A/B weekday rules, feature refs, La Poste indemnity rules, twin resolution fingerprint guard.
34
+
35
+ **Delivery & resolution contract**
36
+
37
+ - **`markets.working_days`:** Per-country postal calendar (`weekdays`, `exclude_public_holidays`) on every market row.
38
+ - **`products.delivery[]`:** Zone-grouped operator delivery SLA (`span`, `days_min`/`days_max`, optional `weekdays` override). Union of entry zones must equal `product.zones`.
39
+ - **`products.included_features[]`:** Optional bundled capability ids (refs provider `features.json`; omit when not applicable).
40
+ - **`products.indemnity`:** Optional operator tier + loss/damage cap (`tier`, `max.amount` in market minor units; currency from `markets[country]`).
41
+
42
+ ### Changed
43
+
44
+ **Multi-provider & docs**
45
+
46
+ - **Ukrposhta docs:** Letters-only bundle scope; verification **verified** for in-scope letter products; `porto_id` **`large`** = domestic `dokument` documented in [id.md](docs/id.md), [resolution.md](docs/resolution.md), [providers/ukrposhta.md](docs/providers/ukrposhta.md).
47
+ - **Mark layout data model:** Removed `marks.zones` and top-level `mark_edges`. Resolution lives in **`graph.edges.marks`**; `marks.json` is catalog only.
48
+ - **Marks `scope_notes`:** DE sizes flagged as sample-based; CH/FR registered documented as same footprint as lane until measured.
49
+ - **Docs:** `mark-profiles.md`, `resolution.md`, `identity-map.md`, `provider-template.md` — data vs SDK split.
50
+ - **Validation order:** schema → mappings → **markets** → limits → **porto_ids** → **delivery** → graph.
51
+ - **`porto_ids.schema.json`:** Validator rejects **product** enum overlap with **service** or **feature** tokens; products are size buckets only.
52
+ - **`metadata.json`:** Generated with 2-space indent (matches data JSON).
53
+ - **2026 tariff snapshot:** Catalog baseline **`effective_from`: `2026-01-01`** on products and price rows where applicable (see per-provider docs under **`docs/providers/`**).
54
+
55
+ **Delivery contract**
56
+
57
+ - **La Poste:** Populated **`indemnity`** and **`included_features`** on recommandée and tracked letter products.
58
+ - **`products.indemnity.max`:** Amount only — currency resolved from **`markets[country].currency`** (not duplicated on product rows).
59
+
60
+ ### Breaking
61
+
62
+ **Multi-provider layout**
63
+
64
+ - **Layout geometry (`formats/layouts.json`):** Removed **`address_area`** and **`print_area`**. Layout rows expose factual **`window`** and **`post_mark`** only; sender/recipient placement and printable regions are compose-layer concerns, not catalog fields.
65
+ - **Multi-provider layout:** Shared data under **`porto_data/policy/`** (restrictions, jurisdictions, **markets**) and **`porto_data/formats/`** (envelopes, layouts). Per-operator catalogs under **`porto_data/providers/<id>/`**. Root **`providers.json`** is the domain registry. Legacy flat **`porto_data/data/`** and **`data_links.json`** are removed.
66
+ - **Prices:** **`providers/<id>/prices.json`** → **`prices/products.json`** (`product_prices`) and **`prices/services.json`** (`service_prices`).
67
+ - **Weights:** **`weight_tiers.json`** → **`weights.json`**.
68
+ - **Products:** **`supported_zones`** → **`zones`**; physical sizes via **`envelope_ids`** + **`formats/envelopes.json`**; product **`unit`** is **`weight`** (`g`) only.
69
+ - **Features:** Operator-scoped **`providers/<id>/features.json`** only (no global features file).
70
+ - **Registry:** Four operators — **`deutschepost`**, **`ukrposhta`**, **`laposte`**, **`swisspost`** — in **`providers.json`** and **`mappings.json`**; keys must match **`providers/<id>/`** folder names. Registry **`label`** = display name; **`name`** = legal entity (replaces former display **`name`** + **`legal_name`**).
71
+ - **`graph.json`:** Removed **`lookup_rules`**, **`global_settings`**, and **`price_lookup`**. **`services`** is top-level. Price paths from **`dependencies`**; join keys from price schemas (`product_id`, `zone`, `weight_tier` / `service_id`).
72
+ - **Mark profile ids:** Provider-specific stamp ids (`internetmarke_*`, `mtel_*`, `webstamp_*`, `label_default`) replaced by shared layout ids (`domestic`, `international`, `registered`, `registered_international`) — not the same namespace as `porto_id: registered`. See [mark-profiles.md](docs/mark-profiles.md).
73
+
74
+ **Identity & fiscal**
75
+
76
+ - **Product `porto_id`:** Size buckets only (`small` … `extra_large`, `postcard`). La Poste recommandée rows use **`small`** like other letter products; **`registered`** is service-only (removed from product enum).
77
+ - **`porto_id` contract:** Enum-locked in **`schemas/porto_ids.schema.json`**. **`products.porto_id`** required on every product row.
78
+ - **Ukrposhta native ids:** `letter_standard` → **`lyst_standartnyi`**, `ukrposhta_document` → **`dokument`**.
79
+ - **Service refs:** Graph and prices use native **`services[].id`** only (not `porto_id` in graph **`services`** or `service_id`).
80
+ - **`policy/markets.json`:** Country-level **currency**, **VAT**, and **`international_currency`**. **`providers.json`** no longer carries `vat`.
81
+ - **Currency resolution:** SDK default is **`markets[country].currency`** (`row.currency` → file `unit.currency` → market).
82
+ - **Field names (shorter keys):** `available_services` → **`services`** (graph); `compliance_frameworks` → **`frameworks`** (limits); `integration_supported` → **`integrations`** (services); `provider_context`/`national_policy` → **`context`**/**`national`**; `intl_currencies` → **`international_currency`**; `exempt_letters` → **`exempt`** (under `vat`); top-level `vat.inclusive` / `intl_excl` → **`vat.domestic.inclusive`** / **`vat.international.inclusive`**; Porto-assigned native ids: **`recommended_international`** (not `_intl`); `metric_band_attach_service` → **`band_attach`** (rules); `severely_restricted` → **`severe`**; `disputed_territory` → **`disputed`**; `legal_reference` → **`reference`** (limits); `effective_partial` → **`partial`**; framework types `operational_*` → **`infrastructure`**/**`political`**/**`conflict`**.
83
+
84
+ **Catalog & CLI**
85
+
86
+ - **La Poste catalog:** **`lettre_recommandee_inter_r_deux`** removed (international R2 retired **2026-04-01**).
87
+ - **CLI:** **`porto validate --type products_delivery`** removed; use **`--type delivery`**.
88
+
89
+ ## [0.3.1]
90
+
91
+ ### Changed
92
+
93
+ - Package metadata for PyPI/npm was expanded for better registry indexing and discoverability:
94
+ - PyPI: explicit `license` file mapping, MIT classifier, project URLs, and changelog URL in `pyproject.toml`.
95
+ - npm: added `author`, `homepage`, `bugs`, and included `CHANGELOG.md` in published `files`.
96
+ - `bump2version` auto-tagging is disabled (`tag = False`) to avoid creating tags from release branches; tags are now intended to be created manually on `main`.
97
+ - MIT `LICENSE` text was normalized to canonical ASCII quotes for tool/scanner compatibility.
98
+
99
+ ## [0.3.0] - 2026-03-06
100
+
101
+ ### Changed
102
+
103
+ - **BREAKING**: Python baseline is now **3.13+** (`requires-python >=3.13`).
104
+ - **Tooling**: Ruff/MyPy targets are aligned to Python **3.13**.
105
+ - **npm runtime**: minimum Node.js is now **>=20** via `engines.node`.
106
+ - **TypeScript**: development/build baseline is now pinned to **5.9.x** (`~5.9.3`).
107
+ - **Pre-commit**: Ruff hook updated to a modern version that supports `py313`.
108
+
109
+ ## [0.2.1] - 2026-03-01
110
+
111
+ ### Added
112
+
113
+ - **npm**: `index.js` (main entry) and `index.d.ts` (TypeScript types) so the package has a valid entry point and typed exports; fixes registry EntryPointError.
114
+ - **PyPI**: `porto_data` package now exposes `metadata`, `__version__`, and `get_package_root()`; added `py.typed` (PEP 561) for type checkers.
115
+ - **Pre-publish test**: `tests/test_publish.sh` packs the npm tarball and builds the PyPI wheel, installs both and verifies imports; run via `make test-publish` or in the publish workflow.
116
+
117
+ ### Changed
118
+
119
+ - **Publish workflow**: Validate job now sets up Node.js and runs `tests/test_publish.sh` before build; publish is rejected if the test fails.
120
+ - **npm**: `.npmignore` documents exclusions; package contents remain controlled by `package.json` `files` (no Python in the npm package).
121
+
122
+ ## [0.2.0] - 2026-02-28
123
+
124
+ ### Changed
125
+
126
+ - **What we publish**: Both npm and PyPI packages now ship only data (JSON + schemas). No CLI or tools in the published packages; use the repo for validation.
127
+ - **npm**: Publish uses Trusted Publishing (OIDC). No `NPM_TOKEN` secret; Node 22 and `--provenance` in CI.
128
+ - **Re-publish**: Manual workflow run lets you choose target `both`, `npm`, or `pypi` (e.g. re-publish only PyPI after a failure).
129
+ - **Versioning**: bump2version creates tag `v{new_version}` so the release workflow runs on tag push.
130
+
131
+ ## [0.1.0] - 2025-12-21
132
+
133
+ ### Added
134
+
135
+ - Unified `porto` CLI command (replaces standalone Python scripts)
136
+ - New CLI subcommands:
137
+ - `porto validate` - Validate JSON schemas and data links
138
+ - `porto validate --type schema` - Validate JSON against schemas
139
+ - `porto validate --type links` - Validate data_links.json consistency
140
+ - `porto validate --type links --analyze` - Detailed links analysis
141
+ - `porto metadata` - Generate metadata.json with checksums
142
+ - Comprehensive test suite (107 tests, 87% coverage)
143
+ - Codecov integration for coverage tracking
144
+ - Test coverage reporting in CI/CD pipeline
145
+ - `scripts/validators/` package with modular validation architecture
146
+ - `scripts/data_files.py` - Centralized data file management
147
+ - Type-safe validation results with `ValidationResults` TypedDict
148
+ - Shared validation helpers in `scripts/validators/helpers.py`
149
+
150
+ ### Changed
151
+
152
+ - **BREAKING**: All imports now use proper `scripts.*` package paths
153
+ - Old: `from validators.links import ...`
154
+ - New: `from scripts.validators.links import ...`
155
+ - Refactored validation logic into organized modules:
156
+ - `scripts/validators/schema.py` - JSON schema validation
157
+ - `scripts/validators/links.py` - Data links validation
158
+ - `scripts/validators/base.py` - Type definitions
159
+ - Removed `sys.path` hacks in favor of proper package imports (full IDE support)
160
+ - Pre-commit hooks now format test files (`tests/`) and `metadata.json`
161
+ - Improved error messages and validation output
162
+ - CLI version now reads from package metadata (single source of truth)
163
+
164
+ ### Technical
165
+
166
+ - Modular validation architecture with clear separation of concerns
167
+ - All imports resolvable by IDEs (syntax highlighting works)
168
+ - Removed E402 lint exceptions (no longer needed)
169
+ - Updated type checking to include both `scripts/` and `cli/` directories
170
+ - Centralized path constants in `scripts/data_files.py`
171
+ - Fail-fast validation of required entities at import time
172
+ - Improved test fixtures and utilities in `tests/conftest.py`
173
+
174
+ ### Fixed
175
+
176
+ - IDE syntax highlighting for all imports
177
+ - Type checking errors with proper package imports
178
+ - Pre-commit hooks now catch formatting issues in test files
179
+ - `metadata.json` now automatically formatted on commit
180
+
181
+ ## [0.0.1] - 2025-10-22
182
+
183
+ ### Added
184
+
185
+ - Initial release of Porto Data v0.0.1
186
+ - 9 JSON data files with comprehensive Deutsche Post shipping data
187
+ - Complete JSON schemas for all data files
188
+ - Automated validation and quality checks
189
+ - GitHub Actions CI/CD workflow
190
+ - Pre-commit hooks for code quality
191
+ - Documentation and examples
192
+
193
+ ### Data Files
194
+
195
+ - `products.json` - Shipping products (letters, merchandise)
196
+ - `services.json` - Additional services (registered mail, insurance)
197
+ - `prices.json` - Pricing tables by product, zone, and weight
198
+ - `zones.json` - Geographic zones and country mappings
199
+ - `weight_tiers.json` - Weight brackets for pricing
200
+ - `dimensions.json` - Size limits and specifications
201
+ - `restrictions.json` - Shipping restrictions and compliance frameworks
202
+ - `features.json` - Service features with German/English names
203
+ - `data_links.json` - Cross-references between data files
204
+
205
+ ### Technical
206
+
207
+ - Python 3.11+ support
208
+ - JSON schema validation
209
+ - Automated metadata generation with checksums
210
+ - Ruff
211
+ - MyPy
212
+
213
+ ### Fixed
214
+
215
+ - MyPy type checking issues
package/LICENSE CHANGED
@@ -1,9 +1,203 @@
1
- MIT License
1
+ Copyright 2025 Oleksandr Tsyba
2
2
 
3
- Copyright (c) 2025 gruncellka
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
4
6
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
8
 
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+ 1. Definitions.
8
10
 
9
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
package/README.md CHANGED
@@ -3,85 +3,104 @@
3
3
  [![validation](https://github.com/gruncellka/porto-data/actions/workflows/validation.yml/badge.svg)](https://github.com/gruncellka/porto-data/actions/workflows/validation.yml)
4
4
  [![codecov](https://codecov.io/gh/gruncellka/porto-data/branch/main/graph/badge.svg)](https://codecov.io/gh/gruncellka/porto-data)
5
5
 
6
- **Structured JSON data for Deutsche Post shipping services**
6
+ **Porto Data** is **JSON + schemas** for national postal operators under one shared layout and vocabulary. Published on **npm** and **PyPI** with the **same** `porto_data/` tree on every platform.
7
7
 
8
- A comprehensive, schema-validated dataset containing Deutsche Post pricing, restrictions, zones, features, services, and compliance frameworks for international postal services. All data is validated against JSON schemas and published as a self-contained package on **npm** and **PyPI**.
8
+ The bundle covers **Deutsche Post**, **Ukrposhta**, **La Poste**, and **Swiss Post** with shared policy/formats data at the bundle root and **per-operator** catalogs under **`providers/<id>/`** (products, services, prices, zones, weight tiers, features, limits, **`graph.json`**). Registry display names: **`providers.json`** **`label`**; legal entities: **`name`**.
9
9
 
10
10
  ---
11
11
 
12
12
  ## Install
13
13
 
14
- **npm** (scope: `@gruncellka`)
14
+ **TypeScript / JavaScript (npm)**
15
15
 
16
16
  ```bash
17
17
  npm install @gruncellka/porto-data
18
18
  ```
19
19
 
20
- **PyPI (Python)**
20
+ **Python (PyPI)**
21
21
 
22
22
  ```bash
23
23
  pip install gruncellka-porto-data
24
24
  ```
25
25
 
26
- The package includes `data/`, `schemas/`, `mappings.json`, and `metadata.json` so you can validate and use the data offline. Data files reference canonical schema URLs (GitHub); schemas are shipped in the package for local validation.
26
+ Shipped layout: **`porto_data/policy/`**, **`porto_data/formats/`**, **`porto_data/providers/<id>/`**, **`porto_data/schemas/`**, **`mappings.json`**, **`metadata.json`**. Resolve paths via **`mappings.json`** / **`metadata.json`** (no legacy flat `data/` tree).
27
27
 
28
- - **PyPI**: After `pip install`, use the `porto` CLI or import the `porto_data` package; paths are resolved automatically.
29
- - **npm**: Data lives under `porto_data/` (e.g. `porto_data/data/products.json`, `porto_data/schemas/`, `porto_data/mappings.json`, `porto_data/metadata.json`). Same layout in both ecosystems; the `porto_data` folder exists so the wheel includes the files correctly.
28
+ - **Python:** `import porto_data` and open files relative to the package root.
29
+ - **TypeScript / JavaScript:** same paths (e.g. `porto_data/providers.json`, `porto_data/policy/restrictions.json`, `porto_data/providers/deutschepost/products.json`).
30
+
31
+ ### Cross-platform (npm and PyPI)
32
+
33
+ Both packages ship **only UTF-8 JSON, schemas, `mappings.json`, and `metadata.json`**—**no native extensions**. The layout is identical on **Linux, macOS, and Windows**. PyPI includes a tiny Python helper (`import porto_data`); npm exposes `metadata.json` via `index.js`—the underlying files are normal JSON you can read from any language.
30
34
 
31
35
  ---
32
36
 
33
37
  ## Use cases
34
38
 
35
- E-commerce and logistics (shipping costs, restrictions), compliance (sanctions, frameworks), research and education.
39
+ E-commerce and logistics (multi-carrier quotes, letters), compliance (sanctions, frameworks), research and education.
36
40
 
37
41
  ---
38
42
 
39
- ## Data statistics
43
+ ## Logical files (per operator unless noted)
40
44
 
41
- 9 JSON files, 9 schemas; 190+ countries in zones; 5 product types; 5 service types (e.g. registered mail); 31 restrictions across 18 compliance frameworks.
45
+ | File | Description |
46
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
47
+ | `products.json` | Letter (and related) products; **`unit.weight`** only (`g`); physical sizes via **`envelope_ids`** + global **`envelopes.json`** (`envelopes[]`: **`id`**, **`width`/`height`** mm) |
48
+ | `services.json` | Add-on services: **`porto_id`** (unified), provider **`id`**, native **`name`**, English **`label`** |
49
+ | `prices/products.json` | Base letter postage grid (`file_type` **`product_prices`**): **`product_id`** × **`zone`** × **`weight_tier`** (effective-dated **`amount`** in cents) |
50
+ | `prices/services.json` | Add-on service amounts (`file_type` **`service_prices`**) keyed by **`service_id`** (matches catalog **`services.json`** **`id`**) |
51
+ | `zones.json` | Geographic zones and country mappings |
52
+ | `weights.json` | Weight brackets for pricing |
53
+ | `features.json` | Operator-scoped **`id`**, unified **`porto_id`**, native **`name`**, English **`label`** |
54
+ | `limits.json` | Provider operational overlay on global policy (**`limits[]` often empty**; see [docs/policy.md](docs/policy.md)) |
55
+ | `graph.json` | **`dependencies`**, **`edges.products`**, **`edges.marks`**, **`services`**, **`unit`** |
56
+ | `marks.json` | Franking footprint **catalog**: **`profiles[]`** only; resolution in **`graph.edges.marks`** |
57
+ | `formats/layouts.json` | Jurisdiction-keyed print/window geometry (**DE / CH / FR**) per envelope **`id`** (`file_type` **`layouts`**); optional **`standard`** (norm token, e.g. **DIN678**, **SN010130**, **NFEN13850**); physical sizes remain in **`formats/envelopes.json`** |
58
+ | `formats/envelopes.json` | Physical envelope catalog: **`envelopes[]`** with **`id`**, **`width`/`height`**, **`standard`** `ISO269`, **`sheets[]`** (ISO 216 **`sheet`** + **`fold`**) |
59
+ | `policy/restrictions.json` | Sanctions-style restrictions and compliance frameworks |
60
+ | `policy/jurisdictions.json` | `jurisdictions.eu` / `jurisdictions.un` (ISO alpha-2; align with symbolic `EU` / `UN`) |
61
+ | `policy/markets.json` | Per-country **`currency`**, **`vat`**, **`international_currency`**, optional **`settlement`** — via `providers.json` `country` → [docs/policy.md](docs/policy.md) · [docs/resolution.md](docs/resolution.md) |
42
62
 
43
- ---
63
+ All JSON validates against **`schemas/`**; **`mappings.json`** maps entities to paths; **`metadata.json`** has checksums and schema URLs.
44
64
 
45
- ## Data overview and structure
65
+ **Cross-file rules:** native **`id`** in graph/prices; **`porto_id`** for cross-operator input — see [docs/resolution.md](docs/resolution.md).
46
66
 
47
- | File | Description |
48
- | ------------------- | ------------------------------------------------------- |
49
- | `products.json` | Shipping products (letters, parcels, packages) |
50
- | `services.json` | Additional services (registered mail, etc.) |
51
- | `prices.json` | Pricing by product, zone, and weight (effective dates) |
52
- | `zones.json` | Geographic zones and country mappings |
53
- | `weight_tiers.json` | Weight brackets for pricing |
54
- | `dimensions.json` | Size limits and specifications |
55
- | `features.json` | Service features and capabilities |
56
- | `restrictions.json` | Shipping restrictions, sanctions, compliance frameworks |
57
- | `data_links.json` | Cross-references between data files |
67
+ **Tariff verification:** CI validates structure only — not that amounts match live carrier tables. See [docs/tariff-verification.md](docs/tariff-verification.md) and per-provider notes under [docs/providers/](docs/providers/).
58
68
 
59
- All data is validated against JSON schemas in `schemas/`; `mappings.json` maps schemas to files; `metadata.json` has checksums and canonical URLs. **Structure:** Products Prices Zones (dimensions, weight tiers, effective dates); Services Features; Restrictions Frameworks (e.g. EU sanctions, UN resolutions). One-directional; no circular dependencies. `data_links.json` describes dependencies and lookup rules.
69
+ **Provider tariff dating (catalog baseline):** In **`providers/<id>/products.json`**, **`prices/products.json`**, and **`prices/services.json`**, **`effective_from`** is the **bundle baseline** (**`2026-01-01`**) for the modeled **2026** tariff snapshot. Use **`effective_to`**: **`null`** until a row is superseded by a newer **`price[]`** entry. (Other files, e.g. **`policy/restrictions.json`** or **`limits.json`**, keep their own effective-dating semantics.)
60
70
 
61
71
  ---
62
72
 
63
73
  ## Standards
64
74
 
65
- - **Country codes**: ISO 3166-1 alpha-2 (`DE`, `US`, `FR`, `YE`)
66
- - **Region codes**: ISO 3166-2 (`DE-BY`, `US-CA`, `FR-75`)
67
- - **Dates**: ISO 8601 (`2024-01-15`, `2023-06-01`)
68
- - **Jurisdiction**: `EU` (European Union), `UN` (United Nations), `DE` (Germany), `DP` (Deutsche Post operational)
69
-
70
- **Restrictions:** Tracks occupied/disputed territories, links to legal frameworks (EU sanctions, UN resolutions), supports partial territory restrictions (`effective_partial`) and historical dates (`effective_from`, `effective_to`).
75
+ - **Country / region / dates:** ISO 3166-1 alpha-2, ISO 3166-2, ISO 8601.
76
+ - **Policy vs operator overlays:** [docs/policy.md](docs/policy.md) (`restrictions`, `markets`, `jurisdictions` vs `limits.json`).
77
+ - **Currency / VAT resolution:** [docs/resolution.md](docs/resolution.md) § Currency and VAT.
71
78
 
72
79
  ---
73
80
 
74
81
  ## Disclaimer
75
82
 
76
- This is **reference data** for Deutsche Post services. Always verify current restrictions, pricing, and service availability with Deutsche Post before shipping. Data accuracy is best-effort. Official information: [Deutsche Post](https://www.deutschepost.de).
83
+ **Reference data only.** Confirm pricing, restrictions, and availability with the **carrier** you use before shipping. Not a substitute for official systems or legal advice.
77
84
 
78
85
  ---
79
86
 
80
87
  ## Related resources
81
88
 
82
- - [Deutsche Post](https://www.deutschepost.de)
83
- - [EU Sanctions Map](https://www.sanctionsmap.eu/)
84
- - [ISO 3166 Country Codes](https://www.iso.org/iso-3166-country-codes.html)
89
+ - **Mark profiles:** [docs/mark-profiles.md](docs/mark-profiles.md) — sizes and `zones`.
90
+ - **Policy & fiscal defaults:** [docs/policy.md](docs/policy.md)
91
+ - **Unified `porto_id`:** [docs/id.md](docs/id.md) · [docs/porto_id.md](docs/porto_id.md) · [docs/resolution.md](docs/resolution.md) · [docs/provider-template.md](docs/provider-template.md)
92
+ - **Tariff reconciliation:** [docs/tariff-verification.md](docs/tariff-verification.md)
93
+
94
+ **Carriers in this bundle** — tariff / modeling notes, shipped JSON folder, and official site:
95
+
96
+ | Provider (`providers.json` id) | Label | Legal name (`name`) | Reconciliation doc | Bundle data folder | Website |
97
+ | ------------------------------ | ----- | ------------------- | ---------------------------------------------------------------- | ------------------------------------ | ---------------------------------------------- |
98
+ | `deutschepost` | Deutsche Post | Deutsche Post AG | [docs/providers/deutschepost.md](docs/providers/deutschepost.md) | `porto_data/providers/deutschepost/` | [deutschepost.de](https://www.deutschepost.de) |
99
+ | `ukrposhta` | Ukrposhta | Ukrposhta JSC | [docs/providers/ukrposhta.md](docs/providers/ukrposhta.md) | `porto_data/providers/ukrposhta/` | [ukrposhta.ua](https://ukrposhta.ua/) |
100
+ | `laposte` | La Poste | La Poste S.A. | [docs/providers/laposte.md](docs/providers/laposte.md) | `porto_data/providers/laposte/` | [laposte.fr](https://www.laposte.fr) |
101
+ | `swisspost` | Swiss Post | Die Schweizerische Post AG | [docs/providers/swisspost.md](docs/providers/swisspost.md) | `porto_data/providers/swisspost/` | [post.ch](https://www.post.ch) |
102
+
103
+ **Other references:** [EU Sanctions Map](https://www.sanctionsmap.eu/), [ISO 3166 country codes](https://www.iso.org/iso-3166-country-codes.html)
85
104
 
86
105
  ---
87
106
 
package/index.d.ts CHANGED
@@ -1,33 +1,50 @@
1
1
  /**
2
2
  * Type declarations for @gruncellka/porto-data (npm).
3
- * Default export is metadata; data files live under porto_data/.
3
+ * Default export matches porto_data/metadata.json (generated).
4
4
  */
5
5
 
6
6
  export interface FileRef {
7
- path: string;
8
- checksum: string;
9
- size: number;
10
- url?: string;
7
+ path: string
8
+ checksum: string
9
+ size: number
11
10
  }
12
11
 
12
+ export interface SchemaRef extends FileRef {
13
+ url: string
14
+ }
15
+
16
+ /** One logical entity: paired data file + schema file. */
13
17
  export interface EntityMeta {
14
- data: FileRef;
15
- schema: FileRef;
18
+ data: FileRef
19
+ schema: SchemaRef
16
20
  }
17
21
 
18
22
  export interface PortoDataMetadata {
23
+ $schema: string
19
24
  project: {
20
- name: string;
21
- version: string;
22
- description: string;
23
- };
24
- generated_at: string;
25
- entities: Record<string, EntityMeta>;
25
+ name: string
26
+ version: string
27
+ description: string
28
+ }
29
+ generated_at: string
30
+ /** Shared policy files (e.g. jurisdictions, restrictions). */
31
+ policy: Record<string, EntityMeta>
32
+ /** Shared format files (e.g. envelopes, layouts). */
33
+ formats: Record<string, EntityMeta>
34
+ /** Bundle registry entries (e.g. providers.json). */
35
+ registry: Record<string, EntityMeta>
36
+ /** Per postal provider: entity name → data + schema refs. */
37
+ providers: Record<string, Record<string, EntityMeta>>
38
+ /** Root manifest files: mappings.json and providers.json. */
39
+ bundle?: {
40
+ mappings: EntityMeta
41
+ providers_registry: EntityMeta
42
+ }
26
43
  checksums: {
27
- algorithm: string;
28
- note: string;
29
- };
44
+ algorithm: 'SHA-256'
45
+ note: string
46
+ }
30
47
  }
31
48
 
32
- declare const metadata: PortoDataMetadata;
33
- export default metadata;
49
+ declare const metadata: PortoDataMetadata
50
+ export default metadata