@gruncellka/porto-data 0.3.1 → 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 +85 -1
  2. package/LICENSE +199 -5
  3. package/README.md +52 -39
  4. package/index.d.ts +35 -18
  5. package/index.js +2 -1
  6. package/package.json +23 -9
  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
@@ -0,0 +1,120 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://raw.githubusercontent.com/gruncellka/porto-data/refs/heads/main/porto_data/schemas/envelopes.schema.json",
4
+ "title": "Envelopes (international physical sizes)",
5
+ "description": "Canonical envelope id and face dimensions (mm). standard ISO269 is the catalog token for the ISO 269 physical envelope-size family. Print/window geometry is jurisdiction-specific: formats/layouts.json.",
6
+ "type": "object",
7
+ "required": [
8
+ "file_type",
9
+ "unit",
10
+ "envelopes"
11
+ ],
12
+ "definitions": {
13
+ "envelope_sheet": {
14
+ "type": "object",
15
+ "required": [
16
+ "sheet",
17
+ "fold"
18
+ ],
19
+ "properties": {
20
+ "sheet": {
21
+ "type": "string",
22
+ "pattern": "^[AB][0-9]+$",
23
+ "description": "ISO 216 paper size (e.g. A4, A5, A6, B4)"
24
+ },
25
+ "fold": {
26
+ "type": "string",
27
+ "enum": [
28
+ "flat",
29
+ "half",
30
+ "quarter",
31
+ "trifold"
32
+ ],
33
+ "description": "Fold style for this sheets[] entry (outcome-oriented). flat=no crease; half=one crease (~½ area); quarter=two creases to ~¼ sheet area (e.g. A4→C6); trifold=two parallel creases, three panels (DL / business letter). quarter and trifold both use two creases; geometry differs."
34
+ },
35
+ "description": {
36
+ "type": "string",
37
+ "description": "Human-readable fold / use hint for SDKs and docs"
38
+ }
39
+ },
40
+ "additionalProperties": false
41
+ },
42
+ "envelope": {
43
+ "type": "object",
44
+ "required": [
45
+ "id",
46
+ "label",
47
+ "width",
48
+ "height",
49
+ "standard",
50
+ "sheets"
51
+ ],
52
+ "properties": {
53
+ "id": {
54
+ "type": "string",
55
+ "pattern": "^[A-Z0-9]+$",
56
+ "description": "Referenced from products.envelope_ids"
57
+ },
58
+ "label": {
59
+ "type": "string",
60
+ "minLength": 1
61
+ },
62
+ "width": {
63
+ "type": "integer",
64
+ "minimum": 1
65
+ },
66
+ "height": {
67
+ "type": "integer",
68
+ "minimum": 1
69
+ },
70
+ "standard": {
71
+ "type": "string",
72
+ "const": "ISO269",
73
+ "description": "Physical envelope size taxonomy for this row (ISO 269 C/B/DL family)"
74
+ },
75
+ "sheets": {
76
+ "type": "array",
77
+ "minItems": 1,
78
+ "items": {
79
+ "$ref": "#/definitions/envelope_sheet"
80
+ },
81
+ "description": "Document preparation options for this envelope: ISO 216 sheet size + fold that typically fits the face dimensions (carrier thickness and operator rules still apply)"
82
+ },
83
+ "notes": {
84
+ "type": "string"
85
+ }
86
+ },
87
+ "additionalProperties": false
88
+ }
89
+ },
90
+ "properties": {
91
+ "$schema": {
92
+ "type": "string",
93
+ "format": "uri"
94
+ },
95
+ "file_type": {
96
+ "type": "string",
97
+ "const": "envelopes"
98
+ },
99
+ "unit": {
100
+ "type": "object",
101
+ "required": [
102
+ "dimension"
103
+ ],
104
+ "properties": {
105
+ "dimension": {
106
+ "type": "string",
107
+ "const": "mm"
108
+ }
109
+ },
110
+ "additionalProperties": false
111
+ },
112
+ "envelopes": {
113
+ "type": "array",
114
+ "items": {
115
+ "$ref": "#/definitions/envelope"
116
+ }
117
+ }
118
+ },
119
+ "additionalProperties": false
120
+ }
@@ -1,60 +1,71 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://raw.githubusercontent.com/gruncellka/porto-data/refs/heads/main/porto_data/schemas/features.schema.json",
4
- "title": "Features Schema",
5
- "description": "Schema for service features definitions",
6
- "type": "object",
7
- "required": [
8
- "file_type",
9
- "features"
10
- ],
11
- "properties": {
12
- "$schema": {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://raw.githubusercontent.com/gruncellka/porto-data/refs/heads/main/porto_data/schemas/features.schema.json",
4
+ "title": "Features Schema",
5
+ "description": "Provider-scoped service feature catalog. Each row has a unified Porto `porto_id` (cross-provider vocabulary) and a provider `id` (this bundle’s primary key; `services[].features` references `id`, and may match `porto_id` when vocabulary aligns). Native-market `name` and English `label`.",
6
+ "type": "object",
7
+ "required": [
8
+ "file_type",
9
+ "provider",
10
+ "features"
11
+ ],
12
+ "properties": {
13
+ "$schema": {
14
+ "type": "string",
15
+ "format": "uri",
16
+ "description": "JSON Schema URI reference"
17
+ },
18
+ "file_type": {
19
+ "type": "string",
20
+ "const": "features",
21
+ "description": "File type identifier"
22
+ },
23
+ "provider": {
24
+ "type": "string",
25
+ "pattern": "^[a-z_]+$",
26
+ "description": "Provider id (must match providers.json and this file path)"
27
+ },
28
+ "features": {
29
+ "type": "array",
30
+ "minItems": 1,
31
+ "items": {
32
+ "type": "object",
33
+ "required": [
34
+ "id",
35
+ "porto_id",
36
+ "name",
37
+ "label",
38
+ "description"
39
+ ],
40
+ "properties": {
41
+ "id": {
13
42
  "type": "string",
14
- "format": "uri",
15
- "description": "JSON Schema URI reference"
16
- },
17
- "file_type": {
43
+ "pattern": "^[a-z_]+$",
44
+ "description": "Provider-scoped feature id in this catalog; referenced from services.json feature lists within the same provider"
45
+ },
46
+ "porto_id": {
47
+ "$ref": "porto_ids.schema.json#/definitions/feature_porto_id",
48
+ "description": "Unified Porto feature id for cross-provider resolution and SDK semantics"
49
+ },
50
+ "name": {
18
51
  "type": "string",
19
- "const": "features",
20
- "description": "File type identifier"
52
+ "minLength": 1,
53
+ "description": "Native-market display name (operator primary language, e.g. DE/FR)"
54
+ },
55
+ "label": {
56
+ "type": "string",
57
+ "minLength": 1,
58
+ "description": "English human-readable label for unified tooling and docs"
59
+ },
60
+ "description": {
61
+ "type": "string",
62
+ "minLength": 1,
63
+ "description": "Feature description"
64
+ }
21
65
  },
22
- "features": {
23
- "type": "array",
24
- "minItems": 1,
25
- "items": {
26
- "type": "object",
27
- "required": [
28
- "id",
29
- "name",
30
- "label",
31
- "description"
32
- ],
33
- "properties": {
34
- "id": {
35
- "type": "string",
36
- "pattern": "^[a-z_]+$",
37
- "description": "Feature ID"
38
- },
39
- "name": {
40
- "type": "string",
41
- "minLength": 1,
42
- "description": "German feature name"
43
- },
44
- "label": {
45
- "type": "string",
46
- "minLength": 1,
47
- "description": "English feature label"
48
- },
49
- "description": {
50
- "type": "string",
51
- "minLength": 1,
52
- "description": "Feature description"
53
- }
54
- },
55
- "additionalProperties": false
56
- }
57
- }
58
- },
59
- "additionalProperties": false
66
+ "additionalProperties": false
67
+ }
68
+ }
69
+ },
70
+ "additionalProperties": false
60
71
  }
@@ -0,0 +1,189 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://raw.githubusercontent.com/gruncellka/porto-data/refs/heads/main/porto_data/schemas/graph.schema.json",
4
+ "title": "Graph schema",
5
+ "description": "Provider graph: data file dependencies, resolution edges (products × zone × weight; marks × zone × service), and service list",
6
+ "type": "object",
7
+ "required": [
8
+ "file_type",
9
+ "provider",
10
+ "unit",
11
+ "dependencies",
12
+ "edges",
13
+ "services"
14
+ ],
15
+ "properties": {
16
+ "$schema": {
17
+ "type": "string",
18
+ "format": "uri",
19
+ "description": "JSON Schema URI reference"
20
+ },
21
+ "file_type": {
22
+ "type": "string",
23
+ "const": "graph",
24
+ "description": "File type identifier"
25
+ },
26
+ "provider": {
27
+ "type": "string",
28
+ "pattern": "^[a-z_]+$",
29
+ "description": "Provider identifier (e.g. deutschepost, ukrposhta, laposte, swisspost)"
30
+ },
31
+ "unit": {
32
+ "type": "object",
33
+ "required": [
34
+ "weight",
35
+ "dimension",
36
+ "price",
37
+ "currency"
38
+ ],
39
+ "properties": {
40
+ "weight": {
41
+ "type": "string",
42
+ "const": "g"
43
+ },
44
+ "dimension": {
45
+ "type": "string",
46
+ "const": "mm"
47
+ },
48
+ "price": {
49
+ "type": "string",
50
+ "const": "cents"
51
+ },
52
+ "currency": {
53
+ "type": "string",
54
+ "enum": [
55
+ "EUR",
56
+ "CHF",
57
+ "UAH",
58
+ "USD"
59
+ ],
60
+ "description": "ISO 4217 currency code; must match policy/markets.json markets[providers.json country].currency"
61
+ }
62
+ },
63
+ "additionalProperties": false
64
+ },
65
+ "dependencies": {
66
+ "type": "object",
67
+ "patternProperties": {
68
+ "^[a-z_]+$": {
69
+ "type": "object",
70
+ "required": [
71
+ "file",
72
+ "depends_on",
73
+ "description"
74
+ ],
75
+ "properties": {
76
+ "file": {
77
+ "type": "string",
78
+ "pattern": "^(policy/[a-z0-9_./-]+\\.json|formats/[a-z0-9_./-]+\\.json|[a-z0-9_./-]+\\.json)$",
79
+ "description": "Data path: provider-relative (e.g. prices/products.json) or bundle-shared under policy/ or formats/"
80
+ },
81
+ "depends_on": {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "string",
85
+ "pattern": "^(policy/[a-z0-9_./-]+\\.json|formats/[a-z0-9_./-]+\\.json|[a-z0-9_./-]+\\.json)$"
86
+ },
87
+ "description": "List of dependent files (same path convention as file)"
88
+ },
89
+ "description": {
90
+ "type": "string",
91
+ "minLength": 1,
92
+ "description": "Dependency description"
93
+ }
94
+ },
95
+ "additionalProperties": false
96
+ }
97
+ },
98
+ "additionalProperties": false
99
+ },
100
+ "edges": {
101
+ "type": "object",
102
+ "required": [
103
+ "products",
104
+ "marks"
105
+ ],
106
+ "properties": {
107
+ "products": {
108
+ "type": "object",
109
+ "description": "Per-product edges: each key is a **product `id`** from products.json. Maps product → allowed zones and weight tiers.",
110
+ "patternProperties": {
111
+ "^[a-z_]+$": {
112
+ "type": "object",
113
+ "required": [
114
+ "zones",
115
+ "weight_tiers"
116
+ ],
117
+ "properties": {
118
+ "zones": {
119
+ "type": "array",
120
+ "minItems": 1,
121
+ "items": {
122
+ "type": "string",
123
+ "pattern": "^[a-z0-9_]+$"
124
+ },
125
+ "description": "Available zones for this product"
126
+ },
127
+ "weight_tiers": {
128
+ "type": "array",
129
+ "minItems": 1,
130
+ "items": {
131
+ "type": "string",
132
+ "pattern": "^W[0-9]+$"
133
+ },
134
+ "description": "Available weight tiers for this product"
135
+ }
136
+ },
137
+ "additionalProperties": false
138
+ }
139
+ },
140
+ "additionalProperties": false
141
+ },
142
+ "marks": {
143
+ "type": "object",
144
+ "description": "Mark profile resolution per zone. Keys are zone ids from zones.json.",
145
+ "patternProperties": {
146
+ "^[a-z0-9_]+$": {
147
+ "type": "object",
148
+ "required": [
149
+ "profile"
150
+ ],
151
+ "properties": {
152
+ "profile": {
153
+ "type": "string",
154
+ "pattern": "^[a-z0-9_]+$",
155
+ "description": "Default marks.profiles[].id for this zone"
156
+ },
157
+ "services": {
158
+ "type": "object",
159
+ "minProperties": 1,
160
+ "patternProperties": {
161
+ "^[a-z_]+$": {
162
+ "type": "string",
163
+ "pattern": "^[a-z0-9_]+$"
164
+ }
165
+ },
166
+ "additionalProperties": false,
167
+ "description": "Native service id → marks.profiles[].id when that service is selected"
168
+ }
169
+ },
170
+ "additionalProperties": false
171
+ }
172
+ },
173
+ "additionalProperties": false
174
+ }
175
+ },
176
+ "additionalProperties": false
177
+ },
178
+ "services": {
179
+ "type": "array",
180
+ "minItems": 1,
181
+ "items": {
182
+ "type": "string",
183
+ "pattern": "^[a-z_]+$"
184
+ },
185
+ "description": "Attachable services for this provider. Each entry must match **services.json `id`** (provider-native key)."
186
+ }
187
+ },
188
+ "additionalProperties": false
189
+ }
@@ -0,0 +1,116 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://raw.githubusercontent.com/gruncellka/porto-data/refs/heads/main/porto_data/schemas/jurisdictions.schema.json",
4
+ "title": "Jurisdictions (membership reference)",
5
+ "description": "Symbolic blocs eu and un (members + timezone) plus per-country IANA zones (uppercase ISO alpha-2 key, timezone only). Switzerland is keyed CH only (no lowercase ch bloc). providers.json resolves operational timezone via jurisdictions[COUNTRY].timezone.",
6
+ "type": "object",
7
+ "required": [
8
+ "file_type",
9
+ "unit",
10
+ "jurisdictions"
11
+ ],
12
+ "properties": {
13
+ "$schema": {
14
+ "type": "string",
15
+ "format": "uri"
16
+ },
17
+ "file_type": {
18
+ "type": "string",
19
+ "const": "jurisdictions"
20
+ },
21
+ "description": {
22
+ "type": "string"
23
+ },
24
+ "unit": {
25
+ "type": "object",
26
+ "description": "Human-readable encoding hints for this file and related porto-data fields. Required: country_code (alpha-2 in jurisdictions.*.members and uppercase country keys). Other keys are optional documentation (e.g. region_code, date); values are short standard names.",
27
+ "required": [
28
+ "country_code"
29
+ ],
30
+ "properties": {
31
+ "country_code": {
32
+ "type": "string",
33
+ "const": "ISO 3166-1 alpha-2"
34
+ },
35
+ "region_code": {
36
+ "type": "string",
37
+ "const": "ISO 3166-2"
38
+ },
39
+ "date": {
40
+ "type": "string",
41
+ "const": "ISO 8601"
42
+ }
43
+ },
44
+ "additionalProperties": {
45
+ "type": "string",
46
+ "minLength": 1
47
+ }
48
+ },
49
+ "jurisdictions": {
50
+ "type": "object",
51
+ "description": "Keys: lowercase eu, un (blocs with members + timezone). Uppercase ISO alpha-2: timezone only. Framework tag CH resolves via country entry CH, not a ch bloc.",
52
+ "required": [
53
+ "eu",
54
+ "un"
55
+ ],
56
+ "properties": {
57
+ "eu": {
58
+ "$ref": "#/definitions/jurisdiction_bloc"
59
+ },
60
+ "un": {
61
+ "$ref": "#/definitions/jurisdiction_bloc"
62
+ }
63
+ },
64
+ "patternProperties": {
65
+ "^[A-Z]{2}$": {
66
+ "$ref": "#/definitions/jurisdiction_country"
67
+ }
68
+ },
69
+ "additionalProperties": false
70
+ }
71
+ },
72
+ "definitions": {
73
+ "jurisdiction_bloc": {
74
+ "type": "object",
75
+ "description": "Member list and default IANA zone for symbolic framework tags EU or UN.",
76
+ "required": [
77
+ "members",
78
+ "timezone"
79
+ ],
80
+ "properties": {
81
+ "members": {
82
+ "type": "array",
83
+ "description": "ISO 3166-1 alpha-2 codes in this bloc",
84
+ "minItems": 1,
85
+ "uniqueItems": true,
86
+ "items": {
87
+ "type": "string",
88
+ "pattern": "^[A-Z]{2}$"
89
+ }
90
+ },
91
+ "timezone": {
92
+ "type": "string",
93
+ "minLength": 3,
94
+ "pattern": "^[A-Za-z0-9_+-]+(/[A-Za-z0-9_+-]+)+$"
95
+ }
96
+ },
97
+ "additionalProperties": false
98
+ },
99
+ "jurisdiction_country": {
100
+ "type": "object",
101
+ "description": "Primary legal/operational IANA zone for this country code (same key as ISO alpha-2).",
102
+ "required": [
103
+ "timezone"
104
+ ],
105
+ "properties": {
106
+ "timezone": {
107
+ "type": "string",
108
+ "minLength": 3,
109
+ "pattern": "^[A-Za-z0-9_+-]+(/[A-Za-z0-9_+-]+)+$"
110
+ }
111
+ },
112
+ "additionalProperties": false
113
+ }
114
+ },
115
+ "additionalProperties": false
116
+ }