@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,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/service_prices.schema.json",
4
+ "title": "Service surcharge prices",
5
+ "description": "Add-on service amounts keyed by service_id (native id from services.json). Convention: price[].effective_from uses the catalog baseline date (currently 2026-01-01) as bundle snapshot start, not carrier historical introduction dates.",
6
+ "type": "object",
7
+ "required": [
8
+ "file_type",
9
+ "provider",
10
+ "unit",
11
+ "service_prices"
12
+ ],
13
+ "properties": {
14
+ "$schema": {
15
+ "type": "string",
16
+ "format": "uri"
17
+ },
18
+ "file_type": {
19
+ "type": "string",
20
+ "const": "service_prices"
21
+ },
22
+ "provider": {
23
+ "type": "string",
24
+ "pattern": "^[a-z_]+$",
25
+ "description": "Provider identifier"
26
+ },
27
+ "unit": {
28
+ "type": "object",
29
+ "required": [
30
+ "price",
31
+ "currency"
32
+ ],
33
+ "properties": {
34
+ "price": {
35
+ "type": "string",
36
+ "const": "cents"
37
+ },
38
+ "currency": {
39
+ "type": "string",
40
+ "enum": [
41
+ "EUR",
42
+ "CHF",
43
+ "UAH",
44
+ "USD"
45
+ ],
46
+ "description": "Default currency for rows in this file. Set row.currency only when a row is quoted in another currency (must differ from this default)."
47
+ }
48
+ },
49
+ "additionalProperties": false
50
+ },
51
+ "service_prices": {
52
+ "type": "array",
53
+ "minItems": 1,
54
+ "items": {
55
+ "type": "object",
56
+ "required": [
57
+ "service_id",
58
+ "price"
59
+ ],
60
+ "properties": {
61
+ "service_id": {
62
+ "type": "string",
63
+ "pattern": "^[a-z0-9_]+$",
64
+ "description": "Must match services.json id"
65
+ },
66
+ "currency": {
67
+ "type": "string",
68
+ "enum": [
69
+ "EUR",
70
+ "CHF",
71
+ "UAH",
72
+ "USD"
73
+ ],
74
+ "description": "Row override when this amount is not in unit.currency. Omit when same as file default. SDK priority: row → file unit → markets[country].currency."
75
+ },
76
+ "price": {
77
+ "type": "array",
78
+ "minItems": 1,
79
+ "items": {
80
+ "type": "object",
81
+ "required": [
82
+ "amount",
83
+ "effective_from"
84
+ ],
85
+ "properties": {
86
+ "amount": {
87
+ "type": "integer",
88
+ "minimum": 0
89
+ },
90
+ "effective_from": {
91
+ "type": [
92
+ "string",
93
+ "null"
94
+ ],
95
+ "format": "date",
96
+ "description": "Row valid from this date. Provider bundles use the catalog baseline (e.g. 2026-01-01) unless superseding rows exist."
97
+ },
98
+ "effective_to": {
99
+ "type": [
100
+ "string",
101
+ "null"
102
+ ],
103
+ "format": "date",
104
+ "description": "Null while current; set when a newer price row replaces this amount."
105
+ }
106
+ },
107
+ "additionalProperties": false
108
+ }
109
+ }
110
+ },
111
+ "additionalProperties": false
112
+ }
113
+ }
114
+ },
115
+ "additionalProperties": false
116
+ }
@@ -1,77 +1,120 @@
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/services.schema.json",
4
- "title": "Services Schema",
5
- "description": "Schema for Deutsche Post services definitions",
6
- "type": "object",
7
- "required": [
8
- "file_type",
9
- "services"
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/services.schema.json",
4
+ "title": "Services Schema",
5
+ "description": "Provider-scoped postal add-on services. Each row has unified Porto `porto_id` (SDK input), provider `id` (native catalog key for graph/prices/rules), native `name`, and English `label`.",
6
+ "type": "object",
7
+ "required": [
8
+ "file_type",
9
+ "provider",
10
+ "services"
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": "services",
21
+ "description": "File type identifier"
22
+ },
23
+ "provider": {
24
+ "type": "string",
25
+ "pattern": "^[a-z_]+$",
26
+ "description": "Provider identifier (e.g. deutschepost, ukrposhta, laposte, swisspost)"
27
+ },
28
+ "services": {
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
+ "features"
40
+ ],
41
+ "properties": {
42
+ "id": {
13
43
  "type": "string",
14
- "format": "uri",
15
- "description": "JSON Schema URI reference"
16
- },
17
- "file_type": {
44
+ "pattern": "^[a-z_]+$",
45
+ "description": "Provider-scoped service id in this catalog (may match operator naming; referenced from provider-specific tooling)"
46
+ },
47
+ "porto_id": {
48
+ "$ref": "porto_ids.schema.json#/definitions/service_porto_id",
49
+ "description": "Unified Porto service id for SDK input and cross-operator resolution. graph.json and prices.service_id use native `id`, not `porto_id`."
50
+ },
51
+ "name": {
18
52
  "type": "string",
19
- "const": "services",
20
- "description": "File type identifier"
21
- },
22
- "services": {
53
+ "minLength": 1,
54
+ "description": "Native-market service name (operator primary language)"
55
+ },
56
+ "label": {
57
+ "type": "string",
58
+ "minLength": 1,
59
+ "description": "English human-readable label for unified tooling and docs"
60
+ },
61
+ "description": {
62
+ "type": "string",
63
+ "minLength": 1,
64
+ "description": "Service description"
65
+ },
66
+ "features": {
23
67
  "type": "array",
24
68
  "minItems": 1,
25
69
  "items": {
26
- "type": "object",
27
- "required": [
28
- "id",
29
- "name",
30
- "description",
31
- "features"
32
- ],
33
- "properties": {
34
- "id": {
35
- "type": "string",
36
- "pattern": "^[a-z_]+$",
37
- "description": "Service ID"
38
- },
39
- "name": {
40
- "type": "string",
41
- "minLength": 1,
42
- "description": "German service name"
43
- },
44
- "name_en": {
45
- "type": "string",
46
- "minLength": 1,
47
- "description": "English service name (optional)"
48
- },
49
- "description": {
50
- "type": "string",
51
- "minLength": 1,
52
- "description": "Service description"
53
- },
54
- "features": {
55
- "type": "array",
56
- "minItems": 1,
57
- "items": {
58
- "type": "string",
59
- "pattern": "^[a-z_]+$",
60
- "description": "Feature ID reference"
61
- },
62
- "description": "List of feature IDs this service provides"
63
- },
64
- "source_id": {
65
- "type": [
66
- "string",
67
- "null"
68
- ],
69
- "description": "Deutsche Post PPL service identifier (note: services in PPL are typically composite products, not standalone IDs)"
70
- }
71
- },
72
- "additionalProperties": false
73
- }
74
- }
75
- },
76
- "additionalProperties": false
70
+ "type": "string",
71
+ "pattern": "^[a-z_]+$",
72
+ "description": "Feature ID reference"
73
+ },
74
+ "description": "Feature references: each entry may be provider feature `id` or unified `porto_id` (see features.json)"
75
+ },
76
+ "source_id": {
77
+ "type": [
78
+ "string",
79
+ "null"
80
+ ],
81
+ "description": "Deutsche Post PPL service identifier (note: services in PPL are typically composite products, not standalone IDs)"
82
+ },
83
+ "online_supported": {
84
+ "type": "boolean",
85
+ "description": "Whether this service can be ordered via online provider flows (e.g. Internetmarke, WebStamp). Default: true if omitted. Set false for discontinued or offline-only services."
86
+ },
87
+ "integrations": {
88
+ "type": "object",
89
+ "additionalProperties": {
90
+ "type": "boolean"
91
+ },
92
+ "description": "Per-integration support: { \"internetmarke\": true, \"webstamp\": false }. Only list integrations with explicit evidence of support."
93
+ },
94
+ "supported_zones": {
95
+ "type": "array",
96
+ "items": {
97
+ "type": "string",
98
+ "pattern": "^[a-z0-9_]+$"
99
+ },
100
+ "description": "Zone IDs where this service is orderable via API. When omitted, service is available for all zones the product supports. Used for API restrictions (e.g. Einschreiben Einwurf/Rückschein only domestic via Internetmarke)."
101
+ },
102
+ "combinable_with": {
103
+ "type": "array",
104
+ "items": {
105
+ "type": "string",
106
+ "pattern": "^[a-z_]+$"
107
+ },
108
+ "description": "Service IDs this service can be combined with in a single order."
109
+ },
110
+ "enables_tracking": {
111
+ "type": "boolean",
112
+ "description": "When true, ordering this service activates tracking on the execution result (product tracking_mode must be optional or included)."
113
+ }
114
+ },
115
+ "additionalProperties": false
116
+ }
117
+ }
118
+ },
119
+ "additionalProperties": false
77
120
  }
@@ -0,0 +1,70 @@
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/weights.schema.json",
4
+ "title": "Weights schema",
5
+ "description": "Provider weight brackets (tier ids W* → min/max g) for pricing and resolution",
6
+ "type": "object",
7
+ "required": [
8
+ "file_type",
9
+ "provider",
10
+ "unit",
11
+ "weights"
12
+ ],
13
+ "properties": {
14
+ "$schema": {
15
+ "type": "string",
16
+ "format": "uri",
17
+ "description": "JSON Schema URI reference"
18
+ },
19
+ "file_type": {
20
+ "type": "string",
21
+ "const": "weights",
22
+ "description": "File type identifier"
23
+ },
24
+ "provider": {
25
+ "type": "string",
26
+ "pattern": "^[a-z_]+$",
27
+ "description": "Provider identifier (e.g. deutschepost, ukrposhta, laposte, swisspost)"
28
+ },
29
+ "unit": {
30
+ "type": "object",
31
+ "required": [
32
+ "weight"
33
+ ],
34
+ "properties": {
35
+ "weight": {
36
+ "type": "string",
37
+ "const": "g"
38
+ }
39
+ },
40
+ "additionalProperties": false
41
+ },
42
+ "weights": {
43
+ "type": "object",
44
+ "patternProperties": {
45
+ "^W[0-9]+$": {
46
+ "type": "object",
47
+ "required": [
48
+ "min",
49
+ "max"
50
+ ],
51
+ "properties": {
52
+ "min": {
53
+ "type": "integer",
54
+ "minimum": 0,
55
+ "description": "Minimum weight in grams"
56
+ },
57
+ "max": {
58
+ "type": "integer",
59
+ "minimum": 1,
60
+ "description": "Maximum weight in grams"
61
+ }
62
+ },
63
+ "additionalProperties": false
64
+ }
65
+ },
66
+ "additionalProperties": false
67
+ }
68
+ },
69
+ "additionalProperties": false
70
+ }
@@ -1,79 +1,85 @@
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/zones.schema.json",
4
- "title": "Zones Schema",
5
- "description": "Schema for shipping zones definitions",
6
- "type": "object",
7
- "required": [
8
- "file_type",
9
- "unit",
10
- "zones"
11
- ],
12
- "properties": {
13
- "$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/zones.schema.json",
4
+ "title": "Zones Schema",
5
+ "description": "Schema for shipping zones definitions",
6
+ "type": "object",
7
+ "required": [
8
+ "file_type",
9
+ "provider",
10
+ "unit",
11
+ "zones"
12
+ ],
13
+ "properties": {
14
+ "$schema": {
15
+ "type": "string",
16
+ "format": "uri",
17
+ "description": "JSON Schema URI reference"
18
+ },
19
+ "file_type": {
20
+ "type": "string",
21
+ "const": "zones",
22
+ "description": "File type identifier"
23
+ },
24
+ "provider": {
25
+ "type": "string",
26
+ "pattern": "^[a-z_]+$",
27
+ "description": "Provider identifier (e.g. deutschepost, ukrposhta, laposte, swisspost)"
28
+ },
29
+ "unit": {
30
+ "type": "object",
31
+ "required": [
32
+ "country_code"
33
+ ],
34
+ "properties": {
35
+ "country_code": {
36
+ "type": "string",
37
+ "const": "ISO 3166-1 alpha-2"
38
+ }
39
+ },
40
+ "additionalProperties": false
41
+ },
42
+ "zones": {
43
+ "type": "array",
44
+ "minItems": 1,
45
+ "items": {
46
+ "type": "object",
47
+ "required": [
48
+ "id",
49
+ "name",
50
+ "description",
51
+ "country_codes"
52
+ ],
53
+ "properties": {
54
+ "id": {
14
55
  "type": "string",
15
- "format": "uri",
16
- "description": "JSON Schema URI reference"
17
- },
18
- "file_type": {
56
+ "pattern": "^[a-z0-9_]+$",
57
+ "description": "Zone ID"
58
+ },
59
+ "name": {
19
60
  "type": "string",
20
- "const": "zones",
21
- "description": "File type identifier"
22
- },
23
- "unit": {
24
- "type": "object",
25
- "required": [
26
- "country_code"
27
- ],
28
- "properties": {
29
- "country_code": {
30
- "type": "string",
31
- "const": "ISO 3166-1 alpha-2"
32
- }
33
- },
34
- "additionalProperties": false
35
- },
36
- "zones": {
61
+ "minLength": 1,
62
+ "description": "Zone name"
63
+ },
64
+ "description": {
65
+ "type": "string",
66
+ "minLength": 1,
67
+ "description": "Zone description"
68
+ },
69
+ "country_codes": {
37
70
  "type": "array",
38
71
  "minItems": 1,
39
72
  "items": {
40
- "type": "object",
41
- "required": [
42
- "id",
43
- "name",
44
- "description",
45
- "country_codes"
46
- ],
47
- "properties": {
48
- "id": {
49
- "type": "string",
50
- "pattern": "^[a-z0-9_]+$",
51
- "description": "Zone ID"
52
- },
53
- "name": {
54
- "type": "string",
55
- "minLength": 1,
56
- "description": "Zone name"
57
- },
58
- "description": {
59
- "type": "string",
60
- "minLength": 1,
61
- "description": "Zone description"
62
- },
63
- "country_codes": {
64
- "type": "array",
65
- "minItems": 1,
66
- "items": {
67
- "type": "string",
68
- "pattern": "^[A-Z]{2}$",
69
- "description": "ISO 3166-1 alpha-2 country code"
70
- },
71
- "description": "List of country codes in this zone"
72
- }
73
- },
74
- "additionalProperties": false
75
- }
76
- }
77
- },
78
- "additionalProperties": false
73
+ "type": "string",
74
+ "pattern": "^[A-Z]{2}$",
75
+ "description": "ISO 3166-1 alpha-2 country code"
76
+ },
77
+ "description": "List of country codes in this zone"
78
+ }
79
+ },
80
+ "additionalProperties": false
81
+ }
82
+ }
83
+ },
84
+ "additionalProperties": false
79
85
  }