@doist/todoist-api-typescript 3.0.1 → 3.0.3
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/dist/consts/endpoints.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASKS = exports.getAuthBaseUri = exports.getSyncBaseUri = exports.getRestBaseUri = void 0;
|
|
3
|
+
exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASKS = exports.getAuthBaseUri = exports.getSyncBaseUri = exports.getRestBaseUri = exports.API_SYNC_BASE_URI = void 0;
|
|
4
4
|
var BASE_URI = 'https://api.todoist.com';
|
|
5
5
|
var API_REST_BASE_URI = '/rest/v2/';
|
|
6
|
-
|
|
6
|
+
exports.API_SYNC_BASE_URI = '/sync/v9/';
|
|
7
7
|
var TODOIST_URI = 'https://todoist.com';
|
|
8
8
|
var API_AUTHORIZATION_BASE_URI = '/oauth/';
|
|
9
9
|
function getRestBaseUri(domainBase) {
|
|
@@ -13,7 +13,7 @@ function getRestBaseUri(domainBase) {
|
|
|
13
13
|
exports.getRestBaseUri = getRestBaseUri;
|
|
14
14
|
function getSyncBaseUri(domainBase) {
|
|
15
15
|
if (domainBase === void 0) { domainBase = BASE_URI; }
|
|
16
|
-
return new URL(API_SYNC_BASE_URI, domainBase).toString();
|
|
16
|
+
return new URL(exports.API_SYNC_BASE_URI, domainBase).toString();
|
|
17
17
|
}
|
|
18
18
|
exports.getSyncBaseUri = getSyncBaseUri;
|
|
19
19
|
function getAuthBaseUri(domainBase) {
|
package/dist/restClient.js
CHANGED
|
@@ -51,11 +51,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.request = exports.isSuccess = exports.paramsSerializer = void 0;
|
|
54
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
54
55
|
var axios_1 = __importDefault(require("axios"));
|
|
55
56
|
var axios_case_converter_1 = __importDefault(require("axios-case-converter"));
|
|
56
57
|
var errors_1 = require("./types/errors");
|
|
57
58
|
var uuid_1 = require("uuid");
|
|
58
59
|
var axios_retry_1 = __importDefault(require("axios-retry"));
|
|
60
|
+
var endpoints_1 = require("./consts/endpoints");
|
|
59
61
|
function paramsSerializer(params) {
|
|
60
62
|
var qs = new URLSearchParams();
|
|
61
63
|
Object.keys(params).forEach(function (key) {
|
|
@@ -124,7 +126,8 @@ function request(httpMethod, baseUri, relativePath, apiToken, payload, requestId
|
|
|
124
126
|
_b.label = 1;
|
|
125
127
|
case 1:
|
|
126
128
|
_b.trys.push([1, 9, , 10]);
|
|
127
|
-
|
|
129
|
+
// Sync api don't allow a request id in the CORS
|
|
130
|
+
if (httpMethod === 'POST' && !requestId && !baseUri.includes(endpoints_1.API_SYNC_BASE_URI)) {
|
|
128
131
|
requestId = (0, uuid_1.v4)();
|
|
129
132
|
}
|
|
130
133
|
axiosClient = getAxiosClient(baseUri, apiToken, requestId);
|
|
@@ -137,7 +140,9 @@ function request(httpMethod, baseUri, relativePath, apiToken, payload, requestId
|
|
|
137
140
|
return [3 /*break*/, 8];
|
|
138
141
|
case 2: return [4 /*yield*/, axiosClient.get(relativePath, {
|
|
139
142
|
params: payload,
|
|
140
|
-
paramsSerializer:
|
|
143
|
+
paramsSerializer: {
|
|
144
|
+
serialize: paramsSerializer,
|
|
145
|
+
},
|
|
141
146
|
})];
|
|
142
147
|
case 3: return [2 /*return*/, _b.sent()];
|
|
143
148
|
case 4: return [4 /*yield*/, axiosClient.post(relativePath, payload)];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doist/todoist-api-typescript",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "A typescript wrapper for the Todoist REST API.",
|
|
5
5
|
"author": "Doist developers",
|
|
6
6
|
"repository": "git@github.com:doist/todoist-api-typescript.git",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"prepare": "npm run build"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"axios": "^0.
|
|
28
|
-
"axios-case-converter": "^0.
|
|
27
|
+
"axios": "^1.0.0",
|
|
28
|
+
"axios-case-converter": "^1.0.0",
|
|
29
29
|
"axios-retry": "^3.1.9",
|
|
30
30
|
"runtypes": "^6.5.0",
|
|
31
31
|
"ts-custom-error": "^3.2.0",
|
|
@@ -34,9 +34,8 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@doist/eslint-config": "8.1.3",
|
|
36
36
|
"@doist/prettier-config": "3.0.5",
|
|
37
|
-
"@types/axios": "0.14.0",
|
|
38
37
|
"@types/jest": "29.4.0",
|
|
39
|
-
"@types/uuid": "
|
|
38
|
+
"@types/uuid": "9.0.7",
|
|
40
39
|
"@typescript-eslint/eslint-plugin": "5.54.1",
|
|
41
40
|
"@typescript-eslint/parser": "5.54.1",
|
|
42
41
|
"eslint": "8.35.0",
|
|
@@ -52,9 +51,12 @@
|
|
|
52
51
|
"rimraf": "3.0.2",
|
|
53
52
|
"ts-jest": "29.0.5",
|
|
54
53
|
"ts-node": "10.9.1",
|
|
55
|
-
"type-fest": "^4.
|
|
54
|
+
"type-fest": "^4.12.0",
|
|
56
55
|
"typescript": "4.9.5"
|
|
57
56
|
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"type-fest": "^4.12.0"
|
|
59
|
+
},
|
|
58
60
|
"prettier": "@doist/prettier-config",
|
|
59
61
|
"husky": {
|
|
60
62
|
"hooks": {
|