@bizon/amazon-ids 2.8.0 → 2.9.0

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.
package/package.json CHANGED
@@ -1,29 +1,42 @@
1
1
  {
2
2
  "name": "@bizon/amazon-ids",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Collection of Amazon identifiers",
5
- "main": "index.js",
6
5
  "repository": "https://github.com/bizon/amazon-ids",
7
6
  "author": "Bertrand Marron <bertrand.marron@gmail.com>",
8
7
  "license": "MIT",
9
- "scripts": {
10
- "test": "jest"
11
- },
12
8
  "files": [
13
- "index.js",
14
- "index.d.ts",
15
- "marketplaces.json"
9
+ "dist"
16
10
  ],
17
- "types": "index.d.ts",
11
+ "source": "./src/index.ts",
12
+ "exports": {
13
+ "require": "./dist/amazon-ids.js",
14
+ "default": "./dist/amazon-ids.modern.js"
15
+ },
16
+ "main": "./dist/amazon-ids.js",
17
+ "module": "./dist/amazon-ids.esm.js",
18
+ "types": "./dist/index.d.ts",
19
+ "unpkg": "./dist/amazon-ids.umd.js",
20
+ "scripts": {
21
+ "test": "jest",
22
+ "check:ts": "tsc --noEmit",
23
+ "build": "microbundle",
24
+ "dev": "microbundle watch"
25
+ },
18
26
  "dependencies": {
19
27
  "mem": "^8.1.1"
20
28
  },
21
29
  "devDependencies": {
22
30
  "@bizon/semantic-release-config": "^1.1.0",
23
- "jest": "^27.3.1",
31
+ "@tsconfig/node14": "^1.0.1",
32
+ "@types/jest": "^27.0.3",
33
+ "jest": "^27.4.5",
24
34
  "jest-junit": "^13.0.0",
25
- "semantic-release": "^18.0.0",
26
- "xo": "^0.46.4"
35
+ "microbundle": "^0.14.2",
36
+ "semantic-release": "^18.0.1",
37
+ "ts-jest": "^27.1.2",
38
+ "typescript": "^4.5.4",
39
+ "xo": "^0.47.0"
27
40
  },
28
41
  "keywords": [
29
42
  "amazon",
@@ -32,13 +45,11 @@
32
45
  "marketplaces"
33
46
  ],
34
47
  "jest": {
48
+ "preset": "ts-jest",
35
49
  "testEnvironment": "node",
36
- "testMatch": [
37
- "<rootDir>/__tests__/**/*.js"
38
- ],
39
50
  "collectCoverage": true,
40
51
  "collectCoverageFrom": [
41
- "index.js"
52
+ "src/**/*.ts"
42
53
  ],
43
54
  "coverageReporters": [
44
55
  "lcov",
@@ -49,16 +60,13 @@
49
60
  "semicolon": false,
50
61
  "space": 2,
51
62
  "rules": {
63
+ "import/extensions": "off",
52
64
  "unicorn/prefer-module": "off"
53
65
  },
54
- "overrides": [
55
- {
56
- "files": "__tests__/**/*.js",
57
- "envs": [
58
- "jest"
59
- ]
60
- }
61
- ]
66
+ "prettier": true
67
+ },
68
+ "prettier": {
69
+ "printWidth": 100
62
70
  },
63
71
  "release": {
64
72
  "extends": "@bizon/semantic-release-config"
package/index.d.ts DELETED
@@ -1,53 +0,0 @@
1
- export declare interface Marketplace {
2
- code: string;
3
- id: string;
4
- name: string;
5
- region: string;
6
- domain?: string;
7
- mwsDomain?: string;
8
- advertisingApiDomain?: string;
9
- imagesDomain?: string;
10
- vendorId?: string;
11
- sellerCentralDomain: string;
12
- vendorCentralDomain: string;
13
- }
14
-
15
- /**
16
- * All the available marketplaces
17
- */
18
- export declare const marketplaces: Marketplace[]
19
-
20
- /**
21
- * Get a marketplace by its id
22
- * @param id The marketplace's id
23
- * @returns The marketplace
24
- */
25
- export declare function getMarketplaceById(id: string): Marketplace | undefined
26
-
27
- /**
28
- * Get a marketplace by its code
29
- * @param code The marketplace's code
30
- * @returns The markerplace
31
- */
32
- export declare function getMarketplaceByCode(code: string): Marketplace | undefined
33
-
34
- /**
35
- * Get a marketplace by its domain
36
- * @param domain The marketplace's domain
37
- * @returns The marketplace
38
- */
39
- export declare function getMarketplaceByDomain(domain: string): Marketplace | undefined
40
-
41
- /**
42
- * Get several marketplaces by a MWS domain
43
- * @param domain The MWS domain
44
- * @returns The marketplaces
45
- */
46
- export declare function getMarketplacesByMwsDomain(domain: string): Marketplace[]
47
-
48
- /**
49
- * Get several marketplaces by a MWS region
50
- * @param mwsRegion The MWS region
51
- * @returns The marketplaces
52
- */
53
- export declare function getMarketplacesByMwsRegion(mwsRegion: string): Marketplace[]
package/index.js DELETED
@@ -1,50 +0,0 @@
1
- const mem = require('mem')
2
-
3
- const marketplaces = require('./marketplaces.json')
4
-
5
- const mwsRegionDomains = {
6
- // Generic MWS regions:
7
- na: 'mws.amazonservices.com',
8
- eu: 'mws-eu.amazonservices.com',
9
- fe: 'mws-fe.amazonservices.com',
10
-
11
- // Country specific MWS regions:
12
- ca: 'mws.amazonservices.ca',
13
- mx: 'mws.amazonservices.com.mx',
14
- ae: 'mws.amazonservices.ae',
15
- in: 'mws.amazonservices.in',
16
- jp: 'mws.amazonservices.jp',
17
- au: 'mws.amazonservices.com.au',
18
- }
19
-
20
- exports.marketplaces = marketplaces
21
-
22
- exports.getMarketplaceById = mem(id => marketplaces.find(marketplace => marketplace.id === id))
23
-
24
- exports.getMarketplaceByCode = mem(code => {
25
- code = code.toLowerCase()
26
-
27
- return marketplaces.find(marketplace => marketplace.code === code)
28
- })
29
-
30
- exports.getMarketplaceByDomain = mem(domain => {
31
- domain = domain.toLowerCase()
32
-
33
- if (domain.startsWith('www.')) {
34
- domain = domain.slice(4)
35
- }
36
-
37
- return marketplaces.find(marketplace => marketplace.domain === domain)
38
- })
39
-
40
- exports.getMarketplacesByMwsDomain = mem(domain => marketplaces.filter(marketplace => marketplace.mwsDomain === domain))
41
-
42
- exports.getMarketplacesByMwsRegion = mem(mwsRegion => {
43
- const mwsDomain = mwsRegionDomains[String(mwsRegion).toLowerCase()]
44
-
45
- if (!mwsDomain) {
46
- return []
47
- }
48
-
49
- return this.getMarketplacesByMwsDomain(mwsDomain)
50
- })
package/marketplaces.json DELETED
@@ -1,296 +0,0 @@
1
- [
2
- {
3
- "code": "de",
4
- "id": "A1PA6795UKMFR9",
5
- "name": "Germany",
6
- "region": "eu",
7
- "domain": "amazon.de",
8
- "mwsDomain": "mws-eu.amazonservices.com",
9
- "advertisingApiDomain": "advertising-api-eu.amazon.com",
10
- "imagesDomain": "images-eu.ssl-images-amazon.com",
11
- "vendorId": "A3JWKAKR8XB7XF",
12
- "sellerCentralDomain": "sellercentral-europe.amazon.com",
13
- "vendorCentralDomain": "vendorcentral.amazon.de"
14
- },
15
- {
16
- "code": "de-non-amazon",
17
- "id": "A38D8NSA03LJTC",
18
- "name": "Germany - Non-Amazon",
19
- "region": "eu"
20
- },
21
- {
22
- "code": "es",
23
- "id": "A1RKKUPIHCS9HS",
24
- "name": "Spain",
25
- "region": "eu",
26
- "domain": "amazon.es",
27
- "mwsDomain": "mws-eu.amazonservices.com",
28
- "advertisingApiDomain": "advertising-api-eu.amazon.com",
29
- "imagesDomain": "images-eu.ssl-images-amazon.com",
30
- "vendorId": "A1AT7YVPFBWXBL",
31
- "sellerCentralDomain": "sellercentral-europe.amazon.com",
32
- "vendorCentralDomain": "vendorcentral.amazon.es"
33
- },
34
- {
35
- "code": "es-non-amazon",
36
- "id": "AFQLKURYRPEL8",
37
- "name": "Spain - Non-Amazon",
38
- "region": "eu"
39
- },
40
- {
41
- "code": "fr",
42
- "id": "A13V1IB3VIYZZH",
43
- "name": "France",
44
- "region": "eu",
45
- "domain": "amazon.fr",
46
- "mwsDomain": "mws-eu.amazonservices.com",
47
- "advertisingApiDomain": "advertising-api-eu.amazon.com",
48
- "imagesDomain": "images-eu.ssl-images-amazon.com",
49
- "vendorId": "A1X6FK5RDHNB96",
50
- "sellerCentralDomain": "sellercentral-europe.amazon.com",
51
- "vendorCentralDomain": "vendorcentral.amazon.fr"
52
- },
53
- {
54
- "code": "fr-non-amazon",
55
- "id": "A1ZFFQZ3HTUKT9",
56
- "name": "France - Non-Amazon",
57
- "region": "eu"
58
- },
59
- {
60
- "code": "it",
61
- "id": "APJ6JRA9NG5V4",
62
- "name": "Italy",
63
- "region": "eu",
64
- "domain": "amazon.it",
65
- "mwsDomain": "mws-eu.amazonservices.com",
66
- "advertisingApiDomain": "advertising-api-eu.amazon.com",
67
- "imagesDomain": "images-eu.ssl-images-amazon.com",
68
- "vendorId": "A11IL2PNWYJU7H",
69
- "sellerCentralDomain": "sellercentral-europe.amazon.com",
70
- "vendorCentralDomain": "vendorcentral.amazon.it"
71
- },
72
- {
73
- "code": "it-non-amazon",
74
- "id": "A62U237T8HV6N",
75
- "name": "Italy - Non-Amazon",
76
- "region": "eu"
77
- },
78
- {
79
- "code": "uk",
80
- "id": "A1F83G8C2ARO7P",
81
- "name": "United Kingdom",
82
- "region": "eu",
83
- "domain": "amazon.co.uk",
84
- "mwsDomain": "mws-eu.amazonservices.com",
85
- "advertisingApiDomain": "advertising-api-eu.amazon.com",
86
- "imagesDomain": "images-eu.ssl-images-amazon.com",
87
- "vendorId": "A3P5ROKL5A1OLE",
88
- "sellerCentralDomain": "sellercentral-europe.amazon.com",
89
- "vendorCentralDomain": "vendorcentral.amazon.co.uk"
90
- },
91
- {
92
- "code": "uk-non-amazon",
93
- "id": "AZMDEXL2RVFNN",
94
- "name": "United Kingdom - Non-Amazon",
95
- "region": "eu"
96
- },
97
- {
98
- "code": "tr",
99
- "id": "A33AVAJ2PDY3EV",
100
- "name": "Turkey",
101
- "region": "eu",
102
- "domain": "amazon.com.tr",
103
- "mwsDomain": "mws-eu.amazonservices.com",
104
- "imagesDomain": "images-eu.ssl-images-amazon.com",
105
- "vendorId": "A1UNQM1SR2CHM",
106
- "sellerCentralDomain": "sellercentral.amazon.com.tr",
107
- "vendorCentralDomain": "vendorcentral.amazon.com.tr"
108
- },
109
- {
110
- "code": "eg",
111
- "id": "ARBP9OOSHTCHU",
112
- "name": "Egypt",
113
- "region": "eu",
114
- "domain": "amazon.eg",
115
- "mwsDomain": "mws-eu.amazonservices.com",
116
- "imagesDomain": "images-eu.ssl-images-amazon.com",
117
- "vendorId": "A1ZVRGNO5AYLOV",
118
- "sellerCentralDomain": "sellercentral.amazon.eg",
119
- "vendorCentralDomain": "vendorcentral.amazon.me"
120
- },
121
- {
122
- "code": "sa",
123
- "id": "A17E79C6D8DWNP",
124
- "name": "Saudi Arabia",
125
- "region": "eu",
126
- "domain": "amazon.sa",
127
- "mwsDomain": "mws-eu.amazonservices.com",
128
- "imagesDomain": "images-eu.ssl-images-amazon.com",
129
- "vendorId": "A2XPWB6MYN7ZDK"
130
- },
131
- {
132
- "code": "nl",
133
- "id": "A1805IZSGTT6HS",
134
- "name": "Netherlands",
135
- "region": "eu",
136
- "domain": "amazon.nl",
137
- "mwsDomain": "mws-eu.amazonservices.com",
138
- "imagesDomain": "images-eu.ssl-images-amazon.com",
139
- "vendorId": "A17D2BRD4YMT0X",
140
- "sellerCentralDomain": "sellercentral.amazon.nl",
141
- "vendorCentralDomain": "vendorcentral.amazon.nl"
142
- },
143
- {
144
- "code": "se",
145
- "id": "A2NODRKZP88ZB9",
146
- "name": "Sweden",
147
- "region": "eu",
148
- "domain": "amazon.se",
149
- "mwsDomain": "mws-eu.amazonservices.com",
150
- "imagesDomain": "images-eu.ssl-images-amazon.com",
151
- "vendorId": "ANU9KP01APNAG",
152
- "sellerCentralDomain": "sellercentral.amazon.se",
153
- "vendorCentralDomain": "vendorcentral.amazon.se"
154
- },
155
- {
156
- "code": "pl",
157
- "id": "A1C3SOZRARQ6R3",
158
- "name": "Poland",
159
- "region": "eu",
160
- "domain": "amazon.pl",
161
- "mwsDomain": "mws-eu.amazonservices.com",
162
- "imagesDomain": "images-eu.ssl-images-amazon.com",
163
- "vendorId": "A2R2221NX79QZP",
164
- "sellerCentralDomain": "sellercentral.amazon.pl",
165
- "vendorCentralDomain": "vendorcentral.amazon.pl"
166
- },
167
- {
168
- "code": "ca",
169
- "id": "A2EUQ1WTGCTBG2",
170
- "name": "Canada",
171
- "region": "na",
172
- "domain": "amazon.ca",
173
- "mwsDomain": "mws.amazonservices.ca",
174
- "advertisingApiDomain": "advertising-api.amazon.com",
175
- "imagesDomain": "images-na.ssl-images-amazon.com",
176
- "vendorId": "A3DWYIK6Y9EEQB",
177
- "sellerCentralDomain": "sellercentral.amazon.ca",
178
- "vendorCentralDomain": "vendorcentral.amazon.ca"
179
- },
180
- {
181
- "code": "ca-non-amazon",
182
- "id": "A1MQXOICRS2Z7M",
183
- "name": "Canada - Non-Amazon",
184
- "region": "na"
185
- },
186
- {
187
- "code": "mx",
188
- "id": "A1AM78C64UM0Y8",
189
- "name": "Mexico",
190
- "region": "na",
191
- "domain": "amazon.com.mx",
192
- "mwsDomain": "mws.amazonservices.com.mx",
193
- "imagesDomain": "images-na.ssl-images-amazon.com",
194
- "vendorId": "AVDBXBAVVSXLQ",
195
- "sellerCentralDomain": "sellercentral.amazon.com.mx",
196
- "vendorCentralDomain": "vendorcentral.amazon.com.mx"
197
- },
198
- {
199
- "code": "mx-non-amazon",
200
- "id": "A3H6HPSLHAK3XG",
201
- "name": "Mexico - Non-Amazon",
202
- "region": "na"
203
- },
204
- {
205
- "code": "us",
206
- "id": "ATVPDKIKX0DER",
207
- "name": "United States",
208
- "region": "na",
209
- "domain": "amazon.com",
210
- "mwsDomain": "mws.amazonservices.com",
211
- "advertisingApiDomain": "advertising-api.amazon.com",
212
- "imagesDomain": "images-na.ssl-images-amazon.com",
213
- "vendorId": "ATVPDKIKX0DER",
214
- "sellerCentralDomain": "sellercentral.amazon.com",
215
- "vendorCentralDomain": "vendorcentral.amazon.com"
216
- },
217
- {
218
- "code": "us-non-amazon",
219
- "id": "A2ZV50J4W1RKNI",
220
- "name": "United States - Non-Amazon",
221
- "region": "na"
222
- },
223
- {
224
- "code": "br",
225
- "id": "A2Q3Y263D00KWC",
226
- "name": "Brazil",
227
- "region": "na",
228
- "domain": "amazon.com.br",
229
- "mwsDomain": "mws.amazonservices.com",
230
- "imagesDomain": "images-na.ssl-images-amazon.com",
231
- "vendorId": "A1ZZFT5FULY4LN",
232
- "sellerCentralDomain": "sellercentral.amazon.com.br",
233
- "vendorCentralDomain": "vendorcentral.amazon.com.br"
234
- },
235
- {
236
- "code": "ae",
237
- "id": "A2VIGQ35RCS4UG",
238
- "name": "United Arab Emirates",
239
- "region": "eu",
240
- "domain": "amazon.ae",
241
- "mwsDomain": "mws.amazonservices.ae",
242
- "advertisingApiDomain": "advertising-api-eu.amazon.com",
243
- "imagesDomain": "images-eu.ssl-images-amazon.com",
244
- "vendorId": "A2KKU8J8O8784X",
245
- "sellerCentralDomain": "sellercentral.amazon.ae",
246
- "vendorCentralDomain": "vendorcentral.amazon.me"
247
- },
248
- {
249
- "code": "in",
250
- "id": "A21TJRUUN4KGV",
251
- "name": "India",
252
- "region": "eu",
253
- "domain": "amazon.in",
254
- "mwsDomain": "mws.amazonservices.in",
255
- "imagesDomain": "images-eu.ssl-images-amazon.com",
256
- "sellerCentralDomain": "sellercentral.amazon.in",
257
- "vendorCentralDomain": "vendorcentral.amazon.in"
258
- },
259
- {
260
- "code": "au",
261
- "id": "A39IBJ37TRP1C6",
262
- "name": "Australia",
263
- "region": "fe",
264
- "domain": "amazon.com.au",
265
- "mwsDomain": "mws.amazonservices.com.au",
266
- "advertisingApiDomain": "advertising-api-fe.amazon.com",
267
- "imagesDomain": "images-fe.ssl-images-amazon.com",
268
- "vendorId": "ANEGB3WVEVKZB",
269
- "sellerCentralDomain": "sellercentral.amazon.com.au",
270
- "vendorCentralDomain": "vendorcentral.amazon.com.au"
271
- },
272
- {
273
- "code": "jp",
274
- "id": "A1VC38T7YXB528",
275
- "name": "Japan",
276
- "region": "fe",
277
- "domain": "amazon.co.jp",
278
- "mwsDomain": "mws.amazonservices.jp",
279
- "advertisingApiDomain": "advertising-api-fe.amazon.com",
280
- "imagesDomain": "images-fe.ssl-images-amazon.com",
281
- "vendorId": "AN1VRQENFRJN5",
282
- "sellerCentralDomain": "sellercentral.amazon.co.jp",
283
- "vendorCentralDomain": "vendorcentral.amazon.co.jp"
284
- },
285
- {
286
- "code": "sg",
287
- "id": "A19VAU5U5O7RUS",
288
- "name": "Singapore",
289
- "region": "fe",
290
- "domain": "amazon.sg",
291
- "mwsDomain": "mws-fe.amazonservices.com",
292
- "imagesDomain": "images-fe.ssl-images-amazon.com",
293
- "sellerCentralDomain": "sellercentral.amazon.sg",
294
- "vendorCentralDomain": "vendorcentral.amazon.com.sg"
295
- }
296
- ]