apple-maps-server-sdk 1.1.5 → 1.1.6
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/lib/globals.js +1 -2
- package/lib/index.js +4 -29
- package/package.json +4 -3
- package/tsconfig.json +3 -3
package/lib/globals.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/index.js
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -31,8 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
8
|
});
|
|
33
9
|
};
|
|
34
|
-
|
|
35
|
-
const axios_1 = __importStar(require("axios"));
|
|
10
|
+
import axios, { AxiosError } from "axios";
|
|
36
11
|
class AppleMaps {
|
|
37
12
|
constructor({ authorizationToken }) {
|
|
38
13
|
this.accessToken = "";
|
|
@@ -41,7 +16,7 @@ class AppleMaps {
|
|
|
41
16
|
if (!authorizationToken) {
|
|
42
17
|
throw new Error("'authorizationToken' param is required");
|
|
43
18
|
}
|
|
44
|
-
this.apiClient =
|
|
19
|
+
this.apiClient = axios.create({
|
|
45
20
|
baseURL: "https://maps-api.apple.com/v1",
|
|
46
21
|
});
|
|
47
22
|
this.getAccessToken();
|
|
@@ -68,7 +43,7 @@ class AppleMaps {
|
|
|
68
43
|
handleError(err, callback) {
|
|
69
44
|
var _a;
|
|
70
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
if (err instanceof
|
|
46
|
+
if (err instanceof AxiosError) {
|
|
72
47
|
if (((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
|
|
73
48
|
if (this.accessTokenRetries > 3) {
|
|
74
49
|
this.accessTokenRetries = 0;
|
|
@@ -160,4 +135,4 @@ class AppleMaps {
|
|
|
160
135
|
});
|
|
161
136
|
}
|
|
162
137
|
}
|
|
163
|
-
|
|
138
|
+
export default AppleMaps;
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apple-maps-server-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "An SDK for the Apple Maps Server API",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"types": "lib/index.d.ts",
|
|
6
|
+
"main": "lib/src/index.js",
|
|
7
|
+
"types": "lib/src/index.d.ts",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
10
|
"build": "tsc",
|
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ES6",
|
|
4
|
-
"module": "
|
|
4
|
+
"module": "esnext",
|
|
5
5
|
"declaration": true,
|
|
6
6
|
"outDir": "./lib",
|
|
7
7
|
"strict": true,
|
|
8
8
|
"esModuleInterop": true,
|
|
9
|
-
|
|
9
|
+
"moduleResolution": "node"
|
|
10
10
|
},
|
|
11
11
|
"include": ["src"],
|
|
12
12
|
"exclude": ["node_modules", "**/__tests__/*"]
|
|
13
|
-
}
|
|
13
|
+
}
|