@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
@@ -1,369 +1,189 @@
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/restrictions.schema.json",
4
- "title": "Restrictions Schema",
5
- "description": "Schema for postal restrictions and compliance information",
6
- "type": "object",
7
- "required": [
8
- "file_type",
9
- "unit",
10
- "sanctions_information",
11
- "denied_party_screening",
12
- "sources",
13
- "disclaimer",
14
- "restrictions",
15
- "compliance_frameworks"
16
- ],
17
- "properties": {
18
- "$schema": {
19
- "type": "string",
20
- "format": "uri",
21
- "description": "JSON Schema URI reference"
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://raw.githubusercontent.com/gruncellka/porto-data/refs/heads/main/porto_data/schemas/restrictions.schema.json",
4
+ "title": "Restrictions Schema",
5
+ "description": "Global destination restrictions (file: policy/restrictions.json). Grouped by ISO 3166-1 alpha-2 under destinations[].country_code. Per destination, restrictions holds only non-empty EU, UN, and/or CH arrays (sender legal lens); omit empty buckets. Each item: id, reason, notes, entity_type, optional region_code (ISO 3166-2) and optional description, status, reference (URL or null), effective_from / effective_to. Sender blocs: policy/jurisdictions.json. Operator overlays: providers/<id>/limits.json.",
6
+ "type": "object",
7
+ "required": [
8
+ "file_type",
9
+ "unit",
10
+ "sources",
11
+ "disclaimer",
12
+ "destinations"
13
+ ],
14
+ "properties": {
15
+ "$schema": {
16
+ "type": "string",
17
+ "format": "uri",
18
+ "description": "JSON Schema URI reference"
19
+ },
20
+ "file_type": {
21
+ "type": "string",
22
+ "const": "restrictions",
23
+ "description": "File type identifier"
24
+ },
25
+ "unit": {
26
+ "type": "object",
27
+ "required": [
28
+ "country_code",
29
+ "date"
30
+ ],
31
+ "properties": {
32
+ "country_code": {
33
+ "type": "string",
34
+ "const": "ISO 3166-1 alpha-2"
22
35
  },
23
- "file_type": {
36
+ "date": {
37
+ "type": "string",
38
+ "const": "ISO 8601"
39
+ }
40
+ },
41
+ "additionalProperties": false
42
+ },
43
+ "sources": {
44
+ "type": "array",
45
+ "items": {
46
+ "type": "string"
47
+ },
48
+ "description": "List of information sources"
49
+ },
50
+ "disclaimer": {
51
+ "type": "string",
52
+ "description": "Legal disclaimer text"
53
+ },
54
+ "destinations": {
55
+ "type": "array",
56
+ "minItems": 1,
57
+ "description": "Countries with restriction rows split by jurisdiction bucket (EU, UN, CH).",
58
+ "items": {
59
+ "type": "object",
60
+ "required": [
61
+ "country_code",
62
+ "restrictions"
63
+ ],
64
+ "additionalProperties": false,
65
+ "properties": {
66
+ "country_code": {
24
67
  "type": "string",
25
- "const": "restrictions",
26
- "description": "File type identifier"
27
- },
28
- "unit": {
68
+ "pattern": "^[A-Z]{2}$",
69
+ "description": "ISO 3166-1 alpha-2; rows below apply to this state/territory code."
70
+ },
71
+ "restrictions": {
29
72
  "type": "object",
30
- "required": [
31
- "country_code",
32
- "date"
33
- ],
73
+ "minProperties": 1,
74
+ "additionalProperties": false,
75
+ "description": "Non-empty arrays only: include EU, UN, and/or CH keys when that jurisdiction has rows; omit empty buckets entirely.",
34
76
  "properties": {
35
- "country_code": {
36
- "type": "string",
37
- "const": "ISO 3166-1 alpha-2"
38
- },
39
- "date": {
40
- "type": "string",
41
- "const": "ISO 8601"
77
+ "EU": {
78
+ "type": "array",
79
+ "minItems": 1,
80
+ "items": {
81
+ "$ref": "#/definitions/jurisdiction_restriction_item"
42
82
  }
43
- },
44
- "additionalProperties": false
45
- },
46
- "sanctions_information": {
47
- "type": "object",
48
- "required": [
49
- "eu_sanctions",
50
- "un_sanctions",
51
- "german_national"
52
- ],
53
- "properties": {
54
- "eu_sanctions": {
55
- "type": "object",
56
- "required": [
57
- "description",
58
- "primary_targets",
59
- "source",
60
- "url"
61
- ],
62
- "properties": {
63
- "description": {
64
- "type": "string"
65
- },
66
- "primary_targets": {
67
- "type": "array",
68
- "items": {
69
- "type": "string"
70
- }
71
- },
72
- "source": {
73
- "type": "string"
74
- },
75
- "url": {
76
- "type": "string",
77
- "format": "uri"
78
- }
79
- },
80
- "additionalProperties": false
81
- },
82
- "un_sanctions": {
83
- "type": "object",
84
- "required": [
85
- "description",
86
- "targets"
87
- ],
88
- "properties": {
89
- "description": {
90
- "type": "string"
91
- },
92
- "targets": {
93
- "type": "array",
94
- "items": {
95
- "type": "string"
96
- }
97
- }
98
- },
99
- "additionalProperties": false
100
- },
101
- "german_national": {
102
- "type": "object",
103
- "required": [
104
- "description",
105
- "notes"
106
- ],
107
- "properties": {
108
- "description": {
109
- "type": "string"
110
- },
111
- "notes": {
112
- "type": "string"
113
- }
114
- },
115
- "additionalProperties": false
83
+ },
84
+ "UN": {
85
+ "type": "array",
86
+ "minItems": 1,
87
+ "items": {
88
+ "$ref": "#/definitions/jurisdiction_restriction_item"
116
89
  }
117
- },
118
- "additionalProperties": false
119
- },
120
- "denied_party_screening": {
121
- "type": "object",
122
- "required": [
123
- "description",
124
- "details",
125
- "compliance"
126
- ],
127
- "properties": {
128
- "description": {
129
- "type": "string"
130
- },
131
- "details": {
132
- "type": "string"
133
- },
134
- "compliance": {
135
- "type": "array",
136
- "items": {
137
- "type": "string"
138
- }
90
+ },
91
+ "CH": {
92
+ "type": "array",
93
+ "minItems": 1,
94
+ "items": {
95
+ "$ref": "#/definitions/jurisdiction_restriction_item"
139
96
  }
140
- },
141
- "additionalProperties": false
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
103
+ },
104
+ "definitions": {
105
+ "jurisdiction_restriction_item": {
106
+ "type": "object",
107
+ "required": [
108
+ "id",
109
+ "reason",
110
+ "notes",
111
+ "entity_type",
112
+ "status",
113
+ "reference",
114
+ "effective_from",
115
+ "effective_to"
116
+ ],
117
+ "additionalProperties": false,
118
+ "properties": {
119
+ "id": {
120
+ "type": "string",
121
+ "minLength": 1,
122
+ "description": "Stable id for this row; unique per destinations[].country_code + jurisdiction bucket (EU|UN|CH). Same id may repeat in another bucket (e.g. EU vs CH)."
142
123
  },
143
- "sources": {
144
- "type": "array",
145
- "items": {
146
- "type": "string"
147
- },
148
- "description": "List of information sources"
124
+ "region_code": {
125
+ "type": "string",
126
+ "description": "ISO 3166-2 when restriction is sub-national; omit for country-wide row."
149
127
  },
150
- "disclaimer": {
151
- "type": "string",
152
- "description": "Legal disclaimer text"
128
+ "reason": {
129
+ "type": "string"
153
130
  },
154
- "restrictions": {
155
- "type": "array",
156
- "items": {
157
- "type": "object",
158
- "required": [
159
- "id",
160
- "country_code",
161
- "status",
162
- "reason",
163
- "notes",
164
- "effective_from"
165
- ],
166
- "properties": {
167
- "id": {
168
- "type": "string"
169
- },
170
- "country_code": {
171
- "type": "string",
172
- "pattern": "^[A-Z]{2}$"
173
- },
174
- "region_code": {
175
- "type": "string"
176
- },
177
- "claimed_by": {
178
- "type": "string",
179
- "pattern": "^[A-Z]{2}$"
180
- },
181
- "occupied_by": {
182
- "type": "string",
183
- "pattern": "^[A-Z]{2}$"
184
- },
185
- "disputed_by": {
186
- "type": "string",
187
- "pattern": "^[A-Za-z_]+$"
188
- },
189
- "status": {
190
- "type": "string",
191
- "enum": [
192
- "restricted",
193
- "limited",
194
- "suspended",
195
- "prohibited",
196
- "severely_restricted",
197
- "operational"
198
- ]
199
- },
200
- "reason": {
201
- "type": "string"
202
- },
203
- "restrictions": {
204
- "type": "string"
205
- },
206
- "notes": {
207
- "type": "string"
208
- },
209
- "areas": {
210
- "type": "object",
211
- "additionalProperties": {
212
- "type": "string"
213
- }
214
- },
215
- "zone_reference": {
216
- "type": [
217
- "string",
218
- "null"
219
- ]
220
- },
221
- "entity_type": {
222
- "type": "string",
223
- "enum": [
224
- "country",
225
- "territory",
226
- "occupied_territory",
227
- "disputed_territory"
228
- ]
229
- },
230
- "framework_id": {
231
- "type": "string"
232
- },
233
- "effective_from": {
234
- "type": [
235
- "string",
236
- "null"
237
- ],
238
- "format": "date"
239
- },
240
- "effective_to": {
241
- "type": [
242
- "string",
243
- "null"
244
- ],
245
- "format": "date"
246
- },
247
- "effective_partial": {
248
- "type": "boolean"
249
- },
250
- "legal_reference": {
251
- "type": [
252
- "string",
253
- "null"
254
- ],
255
- "format": "uri"
256
- }
257
- },
258
- "additionalProperties": false
259
- }
131
+ "description": {
132
+ "type": "string"
260
133
  },
261
- "compliance_frameworks": {
262
- "type": "object",
263
- "patternProperties": {
264
- "^[A-Z0-9_]+$": {
265
- "type": "object",
266
- "required": [
267
- "id",
268
- "label",
269
- "description",
270
- "type",
271
- "jurisdiction",
272
- "applies_to",
273
- "effective_from",
274
- "effective_to"
275
- ],
276
- "properties": {
277
- "id": {
278
- "type": "string"
279
- },
280
- "label": {
281
- "type": "string"
282
- },
283
- "description": {
284
- "type": "string"
285
- },
286
- "type": {
287
- "type": "string",
288
- "enum": [
289
- "eu_sanctions",
290
- "un_sanctions",
291
- "operational_political",
292
- "operational_infrastructure",
293
- "operational_conflict",
294
- "mixed_sanctions",
295
- "german_law"
296
- ]
297
- },
298
- "jurisdiction": {
299
- "type": "array",
300
- "items": {
301
- "type": "string",
302
- "enum": [
303
- "EU",
304
- "UN",
305
- "DP",
306
- "DE",
307
- "US"
308
- ]
309
- }
310
- },
311
- "applies_to": {
312
- "type": "array",
313
- "items": {
314
- "type": "string",
315
- "pattern": "^[A-Z]{2}$|^ALL$"
316
- }
317
- },
318
- "regions": {
319
- "type": "array",
320
- "items": {
321
- "type": "object",
322
- "required": [
323
- "code",
324
- "name"
325
- ],
326
- "properties": {
327
- "code": {
328
- "type": "string"
329
- },
330
- "name": {
331
- "type": "string"
332
- }
333
- },
334
- "additionalProperties": false
335
- }
336
- },
337
- "operational_note": {
338
- "type": "string"
339
- },
340
- "legal_reference": {
341
- "type": [
342
- "string",
343
- "null"
344
- ],
345
- "format": "uri"
346
- },
347
- "effective_from": {
348
- "type": [
349
- "string",
350
- "null"
351
- ],
352
- "format": "date"
353
- },
354
- "effective_to": {
355
- "type": [
356
- "string",
357
- "null"
358
- ],
359
- "format": "date"
360
- }
361
- },
362
- "additionalProperties": false
363
- }
364
- },
365
- "additionalProperties": false
134
+ "notes": {
135
+ "type": "string"
136
+ },
137
+ "areas": {
138
+ "type": "object",
139
+ "additionalProperties": {
140
+ "type": "string"
141
+ }
142
+ },
143
+ "entity_type": {
144
+ "type": "string",
145
+ "enum": [
146
+ "country",
147
+ "territory",
148
+ "disputed"
149
+ ]
150
+ },
151
+ "partial": {
152
+ "type": "boolean"
153
+ },
154
+ "status": {
155
+ "type": "string",
156
+ "enum": [
157
+ "restricted",
158
+ "limited",
159
+ "prohibited",
160
+ "severe",
161
+ "operational"
162
+ ]
163
+ },
164
+ "reference": {
165
+ "type": [
166
+ "string",
167
+ "null"
168
+ ],
169
+ "description": "Primary official URL for this row; null if policy-only."
170
+ },
171
+ "effective_from": {
172
+ "type": [
173
+ "string",
174
+ "null"
175
+ ],
176
+ "format": "date"
177
+ },
178
+ "effective_to": {
179
+ "type": [
180
+ "string",
181
+ "null"
182
+ ],
183
+ "format": "date"
366
184
  }
367
- },
368
- "additionalProperties": false
185
+ }
186
+ }
187
+ },
188
+ "additionalProperties": false
369
189
  }
@@ -0,0 +1,104 @@
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/rules.schema.json",
4
+ "title": "Provider rules",
5
+ "description": "Conditional letter policies evaluated after base product/price resolution. Zone scope follows the resolved product + graph.edges (no duplicate zones array on rules). Amounts for surcharges come from prices/services.json via service_id.",
6
+ "type": "object",
7
+ "required": [
8
+ "file_type",
9
+ "provider",
10
+ "rules"
11
+ ],
12
+ "additionalProperties": false,
13
+ "properties": {
14
+ "$schema": {
15
+ "type": "string",
16
+ "format": "uri"
17
+ },
18
+ "file_type": {
19
+ "type": "string",
20
+ "const": "provider_rules"
21
+ },
22
+ "provider": {
23
+ "type": "string",
24
+ "pattern": "^[a-z_]+$"
25
+ },
26
+ "unit": {
27
+ "type": "object",
28
+ "description": "Measurement units for metrics referenced in rules (same idea as products.unit). Keys align with rule.metric names.",
29
+ "additionalProperties": false,
30
+ "properties": {
31
+ "thickness": {
32
+ "type": "string",
33
+ "const": "mm",
34
+ "description": "Unit for metric `thickness`; min_exclusive/max_inclusive are in millimetres."
35
+ }
36
+ }
37
+ },
38
+ "rules": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "object",
42
+ "required": [
43
+ "id",
44
+ "kind",
45
+ "metric",
46
+ "product_ids",
47
+ "min_exclusive",
48
+ "max_inclusive",
49
+ "service_id"
50
+ ],
51
+ "additionalProperties": false,
52
+ "properties": {
53
+ "id": {
54
+ "type": "string",
55
+ "minLength": 1,
56
+ "description": "Stable rule id for logs and SDK line items"
57
+ },
58
+ "kind": {
59
+ "type": "string",
60
+ "enum": [
61
+ "band_attach"
62
+ ],
63
+ "description": "When the resolved metric value lies in (min_exclusive, max_inclusive], attach service_id surcharge"
64
+ },
65
+ "metric": {
66
+ "type": "string",
67
+ "enum": [
68
+ "thickness"
69
+ ],
70
+ "description": "Logical metric name; physical unit comes from document `unit` (e.g. unit.thickness mm). Add enum values only with SDK support."
71
+ },
72
+ "description": {
73
+ "type": "string",
74
+ "description": "Human note; verify against operator tariff"
75
+ },
76
+ "product_ids": {
77
+ "type": "array",
78
+ "minItems": 1,
79
+ "items": {
80
+ "type": "string",
81
+ "pattern": "^[a-z_]+$"
82
+ },
83
+ "description": "Native product ids this rule applies to"
84
+ },
85
+ "min_exclusive": {
86
+ "type": "number",
87
+ "minimum": 0,
88
+ "description": "Apply when metric value > this bound (e.g. 20 mm for metric thickness meaning >2 cm)"
89
+ },
90
+ "max_inclusive": {
91
+ "type": "number",
92
+ "minimum": 0,
93
+ "description": "Apply when metric value <= this bound (e.g. 50 mm for metric thickness meaning <=5 cm)"
94
+ },
95
+ "service_id": {
96
+ "type": "string",
97
+ "pattern": "^[a-z_]+$",
98
+ "description": "Native services.json id; must have a row in prices/services.json"
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }