@doist/todoist-api-typescript 3.0.2 → 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.
@@ -1,3 +1,4 @@
1
+ export declare const API_SYNC_BASE_URI = "/sync/v9/";
1
2
  export declare function getRestBaseUri(domainBase?: string): string;
2
3
  export declare function getSyncBaseUri(domainBase?: string): string;
3
4
  export declare function getAuthBaseUri(domainBase?: string): string;
@@ -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
- var API_SYNC_BASE_URI = '/sync/v9/';
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) {
@@ -57,6 +57,7 @@ var axios_case_converter_1 = __importDefault(require("axios-case-converter"));
57
57
  var errors_1 = require("./types/errors");
58
58
  var uuid_1 = require("uuid");
59
59
  var axios_retry_1 = __importDefault(require("axios-retry"));
60
+ var endpoints_1 = require("./consts/endpoints");
60
61
  function paramsSerializer(params) {
61
62
  var qs = new URLSearchParams();
62
63
  Object.keys(params).forEach(function (key) {
@@ -125,7 +126,8 @@ function request(httpMethod, baseUri, relativePath, apiToken, payload, requestId
125
126
  _b.label = 1;
126
127
  case 1:
127
128
  _b.trys.push([1, 9, , 10]);
128
- if (httpMethod === 'POST' && !requestId) {
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)) {
129
131
  requestId = (0, uuid_1.v4)();
130
132
  }
131
133
  axiosClient = getAxiosClient(baseUri, apiToken, requestId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "3.0.2",
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",
@@ -51,9 +51,12 @@
51
51
  "rimraf": "3.0.2",
52
52
  "ts-jest": "29.0.5",
53
53
  "ts-node": "10.9.1",
54
- "type-fest": "^4.5.0",
54
+ "type-fest": "^4.12.0",
55
55
  "typescript": "4.9.5"
56
56
  },
57
+ "peerDependencies": {
58
+ "type-fest": "^4.12.0"
59
+ },
57
60
  "prettier": "@doist/prettier-config",
58
61
  "husky": {
59
62
  "hooks": {