ynab 2.5.0 → 2.6.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.
@@ -42,8 +42,8 @@ export declare class BaseAPI {
42
42
  private middleware;
43
43
  constructor(configuration?: Configuration);
44
44
  withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
45
- withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
46
- withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
45
+ withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware["pre"]>): T;
46
+ withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware["post"]>): T;
47
47
  /**
48
48
  * Check if the given MIME is a JSON MIME.
49
49
  * JSON MIME examples:
@@ -85,9 +85,9 @@ export declare const COLLECTION_FORMATS: {
85
85
  tsv: string;
86
86
  pipes: string;
87
87
  };
88
- export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
88
+ export type FetchAPI = WindowOrWorkerGlobalScope["fetch"];
89
89
  export type Json = any;
90
- export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
90
+ export type HTTPMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
91
91
  export type HTTPHeaders = {
92
92
  [key: string]: string;
93
93
  };
@@ -101,7 +101,7 @@ export type HTTPRequestInit = {
101
101
  credentials?: RequestCredentials;
102
102
  body?: HTTPBody;
103
103
  };
104
- export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
104
+ export type ModelPropertyNaming = "camelCase" | "snake_case" | "PascalCase" | "original";
105
105
  export type InitOverrideFunction = (requestContext: {
106
106
  init: HTTPRequestInit;
107
107
  context: RequestOpts;
@@ -68,13 +68,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
68
68
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
69
69
  }
70
70
  };
71
+ import fetchPonyfill from "fetch-ponyfill";
71
72
  // Polyfill fetch globally - this makes it easier to override with modules like fetch-mock.
72
- var fetchPonyfill = require("fetch-ponyfill")();
73
+ var fetchPonyfillInstance = fetchPonyfill();
73
74
  if (!globalThis.fetch) {
74
- globalThis.fetch = fetchPonyfill.fetch;
75
- globalThis.Response = fetchPonyfill.Response;
76
- globalThis.Headers = fetchPonyfill.Headers;
77
- globalThis.Request = fetchPonyfill.Request;
75
+ globalThis.fetch = fetchPonyfillInstance.fetch;
76
+ globalThis.Response = fetchPonyfillInstance.Response;
77
+ globalThis.Headers = fetchPonyfillInstance.Headers;
78
+ globalThis.Request = fetchPonyfillInstance.Request;
78
79
  }
79
80
  export var BASE_PATH = "https://api.ynab.com/v1".replace(/\/+$/, "");
80
81
  var Configuration = /** @class */ (function () {
@@ -91,7 +92,9 @@ var Configuration = /** @class */ (function () {
91
92
  });
92
93
  Object.defineProperty(Configuration.prototype, "basePath", {
93
94
  get: function () {
94
- return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
95
+ return this.configuration.basePath != null
96
+ ? this.configuration.basePath
97
+ : BASE_PATH;
95
98
  },
96
99
  enumerable: false,
97
100
  configurable: true
@@ -135,7 +138,7 @@ var Configuration = /** @class */ (function () {
135
138
  get: function () {
136
139
  var apiKey = this.configuration.apiKey;
137
140
  if (apiKey) {
138
- return typeof apiKey === 'function' ? apiKey : function () { return apiKey; };
141
+ return typeof apiKey === "function" ? apiKey : function () { return apiKey; };
139
142
  }
140
143
  return undefined;
141
144
  },
@@ -147,9 +150,11 @@ var Configuration = /** @class */ (function () {
147
150
  var _this = this;
148
151
  var accessToken = this.configuration.accessToken;
149
152
  if (accessToken) {
150
- return typeof accessToken === 'function' ? accessToken : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
151
- return [2 /*return*/, accessToken];
152
- }); }); };
153
+ return typeof accessToken === "function"
154
+ ? accessToken
155
+ : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
156
+ return [2 /*return*/, accessToken];
157
+ }); }); };
153
158
  }
154
159
  return undefined;
155
160
  },
@@ -196,7 +201,8 @@ var BaseAPI = /** @class */ (function () {
196
201
  if (!middleware.pre) return [3 /*break*/, 3];
197
202
  return [4 /*yield*/, middleware.pre(__assign({ fetch: this.fetchApi }, fetchParams))];
198
203
  case 2:
199
- fetchParams = (_f.sent()) || fetchParams;
204
+ fetchParams =
205
+ (_f.sent()) || fetchParams;
200
206
  _f.label = 3;
201
207
  case 3:
202
208
  _i++;
@@ -226,7 +232,8 @@ var BaseAPI = /** @class */ (function () {
226
232
  response: response ? response.clone() : undefined,
227
233
  })];
228
234
  case 9:
229
- response = (_f.sent()) || response;
235
+ response =
236
+ (_f.sent()) || response;
230
237
  _f.label = 10;
231
238
  case 10:
232
239
  _b++;
@@ -234,7 +241,7 @@ var BaseAPI = /** @class */ (function () {
234
241
  case 11:
235
242
  if (response === undefined) {
236
243
  if (e_1 instanceof Error) {
237
- throw new FetchError(e_1, 'The request failed and the interceptors did not return an alternative response');
244
+ throw new FetchError(e_1, "The request failed and the interceptors did not return an alternative response");
238
245
  }
239
246
  else {
240
247
  throw e_1;
@@ -255,7 +262,8 @@ var BaseAPI = /** @class */ (function () {
255
262
  response: response.clone(),
256
263
  })];
257
264
  case 14:
258
- response = (_f.sent()) || response;
265
+ response =
266
+ (_f.sent()) || response;
259
267
  _f.label = 15;
260
268
  case 15:
261
269
  _d++;
@@ -319,7 +327,7 @@ var BaseAPI = /** @class */ (function () {
319
327
  return [4 /*yield*/, this.fetchApi(url, init)];
320
328
  case 2:
321
329
  response = _b.sent();
322
- if (!(response && (response.status >= 200 && response.status < 300))) return [3 /*break*/, 3];
330
+ if (!(response && response.status >= 200 && response.status < 300)) return [3 /*break*/, 3];
323
331
  return [2 /*return*/, response];
324
332
  case 3: return [4 /*yield*/, response.json()];
325
333
  case 4: throw _b.sent();
@@ -335,14 +343,17 @@ var BaseAPI = /** @class */ (function () {
335
343
  switch (_b.label) {
336
344
  case 0:
337
345
  url = this.configuration.basePath + context.path;
338
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
346
+ if (context.query !== undefined &&
347
+ Object.keys(context.query).length !== 0) {
339
348
  // only add the querystring to the URL if there are query parameters.
340
349
  // this is done to avoid urls ending with a "?" character which buggy webservers
341
350
  // do not handle correctly sometimes.
342
- url += '?' + this.configuration.queryParamsStringify(context.query);
351
+ url += "?" + this.configuration.queryParamsStringify(context.query);
343
352
  }
344
353
  headers = Object.assign({}, this.configuration.headers, context.headers);
345
- Object.keys(headers).forEach(function (key) { return headers[key] === undefined ? delete headers[key] : {}; });
354
+ Object.keys(headers).forEach(function (key) {
355
+ return headers[key] === undefined ? delete headers[key] : {};
356
+ });
346
357
  initOverrideFn = typeof initOverrides === "function"
347
358
  ? initOverrides
348
359
  : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
@@ -361,12 +372,12 @@ var BaseAPI = /** @class */ (function () {
361
372
  })];
362
373
  case 1:
363
374
  overriddenInit = __assign.apply(void 0, _a.concat([(_b.sent())]));
364
- if (isFormData(overriddenInit.body)
365
- || (overriddenInit.body instanceof URLSearchParams)
366
- || isBlob(overriddenInit.body)) {
375
+ if (isFormData(overriddenInit.body) ||
376
+ overriddenInit.body instanceof URLSearchParams ||
377
+ isBlob(overriddenInit.body)) {
367
378
  body = overriddenInit.body;
368
379
  }
369
- else if (this.isJsonMime(headers['Content-Type'])) {
380
+ else if (this.isJsonMime(headers["Content-Type"])) {
370
381
  body = JSON.stringify(overriddenInit.body);
371
382
  }
372
383
  else {
@@ -388,13 +399,12 @@ var BaseAPI = /** @class */ (function () {
388
399
  next.middleware = this.middleware.slice();
389
400
  return next;
390
401
  };
391
- BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
402
+ BaseAPI.jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
392
403
  return BaseAPI;
393
404
  }());
394
405
  export { BaseAPI };
395
- ;
396
406
  function isBlob(value) {
397
- return typeof Blob !== 'undefined' && value instanceof Blob;
407
+ return typeof Blob !== "undefined" && value instanceof Blob;
398
408
  }
399
409
  function isFormData(value) {
400
410
  return typeof FormData !== "undefined" && value instanceof FormData;
@@ -443,17 +453,18 @@ export function exists(json, key) {
443
453
  return value !== null && value !== undefined;
444
454
  }
445
455
  export function querystring(params, prefix) {
446
- if (prefix === void 0) { prefix = ''; }
456
+ if (prefix === void 0) { prefix = ""; }
447
457
  return Object.keys(params)
448
458
  .map(function (key) { return querystringSingleKey(key, params[key], prefix); })
449
459
  .filter(function (part) { return part.length > 0; })
450
- .join('&');
460
+ .join("&");
451
461
  }
452
462
  function querystringSingleKey(key, value, keyPrefix) {
453
- if (keyPrefix === void 0) { keyPrefix = ''; }
463
+ if (keyPrefix === void 0) { keyPrefix = ""; }
454
464
  var fullKey = keyPrefix + (keyPrefix.length ? "[".concat(key, "]") : key);
455
465
  if (value instanceof Array) {
456
- var multiValue = value.map(function (singleValue) { return encodeURIComponent(String(singleValue)); })
466
+ var multiValue = value
467
+ .map(function (singleValue) { return encodeURIComponent(String(singleValue)); })
457
468
  .join("&".concat(encodeURIComponent(fullKey), "="));
458
469
  return "".concat(encodeURIComponent(fullKey), "=").concat(multiValue);
459
470
  }
@@ -478,7 +489,7 @@ export function mapValues(data, fn) {
478
489
  export function canConsumeForm(consumes) {
479
490
  for (var _i = 0, consumes_1 = consumes; _i < consumes_1.length; _i++) {
480
491
  var consume = consumes_1[_i];
481
- if ('multipart/form-data' === consume.contentType) {
492
+ if ("multipart/form-data" === consume.contentType) {
482
493
  return true;
483
494
  }
484
495
  }
@@ -534,7 +545,6 @@ var BlobApiResponse = /** @class */ (function () {
534
545
  });
535
546
  });
536
547
  };
537
- ;
538
548
  return BlobApiResponse;
539
549
  }());
540
550
  export { BlobApiResponse };
@@ -552,7 +562,6 @@ var TextApiResponse = /** @class */ (function () {
552
562
  });
553
563
  });
554
564
  };
555
- ;
556
565
  return TextApiResponse;
557
566
  }());
558
567
  export { TextApiResponse };
package/dist/index.js CHANGED
@@ -11,14 +11,29 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
11
11
  if (k2 === undefined) k2 = k;
12
12
  o[k2] = m[k];
13
13
  }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
14
26
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
27
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
28
  };
29
+ var __importDefault = (this && this.__importDefault) || function (mod) {
30
+ return (mod && mod.__esModule) ? mod : { "default": mod };
31
+ };
17
32
  Object.defineProperty(exports, "__esModule", { value: true });
18
33
  exports.api = exports.utils = exports.API = void 0;
19
- const apis = require("./apis");
34
+ const apis = __importStar(require("./apis"));
20
35
  const CustomTransactionsApi_1 = require("./apis/CustomTransactionsApi");
21
- const utils_1 = require("./utils");
36
+ const utils_1 = __importDefault(require("./utils"));
22
37
  exports.utils = utils_1.default;
23
38
  const runtime_1 = require("./runtime");
24
39
  /* eslint-disable */
package/dist/runtime.d.ts CHANGED
@@ -42,8 +42,8 @@ export declare class BaseAPI {
42
42
  private middleware;
43
43
  constructor(configuration?: Configuration);
44
44
  withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
45
- withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
46
- withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
45
+ withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware["pre"]>): T;
46
+ withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware["post"]>): T;
47
47
  /**
48
48
  * Check if the given MIME is a JSON MIME.
49
49
  * JSON MIME examples:
@@ -85,9 +85,9 @@ export declare const COLLECTION_FORMATS: {
85
85
  tsv: string;
86
86
  pipes: string;
87
87
  };
88
- export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
88
+ export type FetchAPI = WindowOrWorkerGlobalScope["fetch"];
89
89
  export type Json = any;
90
- export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
90
+ export type HTTPMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
91
91
  export type HTTPHeaders = {
92
92
  [key: string]: string;
93
93
  };
@@ -101,7 +101,7 @@ export type HTTPRequestInit = {
101
101
  credentials?: RequestCredentials;
102
102
  body?: HTTPBody;
103
103
  };
104
- export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
104
+ export type ModelPropertyNaming = "camelCase" | "snake_case" | "PascalCase" | "original";
105
105
  export type InitOverrideFunction = (requestContext: {
106
106
  init: HTTPRequestInit;
107
107
  context: RequestOpts;
package/dist/runtime.js CHANGED
@@ -7,15 +7,19 @@
7
7
  *
8
8
  * Generated by: OpenAPI Generator (https://openapi-generator.tech)
9
9
  */
10
+ var __importDefault = (this && this.__importDefault) || function (mod) {
11
+ return (mod && mod.__esModule) ? mod : { "default": mod };
12
+ };
10
13
  Object.defineProperty(exports, "__esModule", { value: true });
11
14
  exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.canConsumeForm = exports.mapValues = exports.querystring = exports.exists = exports.COLLECTION_FORMATS = exports.RequiredError = exports.FetchError = exports.ResponseError = exports.BaseAPI = exports.DefaultConfig = exports.Configuration = exports.BASE_PATH = void 0;
15
+ const fetch_ponyfill_1 = __importDefault(require("fetch-ponyfill"));
12
16
  // Polyfill fetch globally - this makes it easier to override with modules like fetch-mock.
13
- const fetchPonyfill = require("fetch-ponyfill")();
17
+ const fetchPonyfillInstance = (0, fetch_ponyfill_1.default)();
14
18
  if (!globalThis.fetch) {
15
- globalThis.fetch = fetchPonyfill.fetch;
16
- globalThis.Response = fetchPonyfill.Response;
17
- globalThis.Headers = fetchPonyfill.Headers;
18
- globalThis.Request = fetchPonyfill.Request;
19
+ globalThis.fetch = fetchPonyfillInstance.fetch;
20
+ globalThis.Response = fetchPonyfillInstance.Response;
21
+ globalThis.Headers = fetchPonyfillInstance.Headers;
22
+ globalThis.Request = fetchPonyfillInstance.Request;
19
23
  }
20
24
  exports.BASE_PATH = "https://api.ynab.com/v1".replace(/\/+$/, "");
21
25
  class Configuration {
@@ -26,7 +30,9 @@ class Configuration {
26
30
  this.configuration = configuration;
27
31
  }
28
32
  get basePath() {
29
- return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH;
33
+ return this.configuration.basePath != null
34
+ ? this.configuration.basePath
35
+ : exports.BASE_PATH;
30
36
  }
31
37
  get fetchApi() {
32
38
  return this.configuration.fetchApi;
@@ -46,14 +52,16 @@ class Configuration {
46
52
  get apiKey() {
47
53
  const apiKey = this.configuration.apiKey;
48
54
  if (apiKey) {
49
- return typeof apiKey === 'function' ? apiKey : () => apiKey;
55
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
50
56
  }
51
57
  return undefined;
52
58
  }
53
59
  get accessToken() {
54
60
  const accessToken = this.configuration.accessToken;
55
61
  if (accessToken) {
56
- return typeof accessToken === 'function' ? accessToken : async () => accessToken;
62
+ return typeof accessToken === "function"
63
+ ? accessToken
64
+ : async () => accessToken;
57
65
  }
58
66
  return undefined;
59
67
  }
@@ -76,10 +84,11 @@ class BaseAPI {
76
84
  let fetchParams = { url, init };
77
85
  for (const middleware of this.middleware) {
78
86
  if (middleware.pre) {
79
- fetchParams = await middleware.pre({
80
- fetch: this.fetchApi,
81
- ...fetchParams,
82
- }) || fetchParams;
87
+ fetchParams =
88
+ (await middleware.pre({
89
+ fetch: this.fetchApi,
90
+ ...fetchParams,
91
+ })) || fetchParams;
83
92
  }
84
93
  }
85
94
  let response = undefined;
@@ -89,18 +98,19 @@ class BaseAPI {
89
98
  catch (e) {
90
99
  for (const middleware of this.middleware) {
91
100
  if (middleware.onError) {
92
- response = await middleware.onError({
93
- fetch: this.fetchApi,
94
- url: fetchParams.url,
95
- init: fetchParams.init,
96
- error: e,
97
- response: response ? response.clone() : undefined,
98
- }) || response;
101
+ response =
102
+ (await middleware.onError({
103
+ fetch: this.fetchApi,
104
+ url: fetchParams.url,
105
+ init: fetchParams.init,
106
+ error: e,
107
+ response: response ? response.clone() : undefined,
108
+ })) || response;
99
109
  }
100
110
  }
101
111
  if (response === undefined) {
102
112
  if (e instanceof Error) {
103
- throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
113
+ throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
104
114
  }
105
115
  else {
106
116
  throw e;
@@ -109,12 +119,13 @@ class BaseAPI {
109
119
  }
110
120
  for (const middleware of this.middleware) {
111
121
  if (middleware.post) {
112
- response = await middleware.post({
113
- fetch: this.fetchApi,
114
- url: fetchParams.url,
115
- init: fetchParams.init,
116
- response: response.clone(),
117
- }) || response;
122
+ response =
123
+ (await middleware.post({
124
+ fetch: this.fetchApi,
125
+ url: fetchParams.url,
126
+ init: fetchParams.init,
127
+ response: response.clone(),
128
+ })) || response;
118
129
  }
119
130
  }
120
131
  return response;
@@ -153,7 +164,7 @@ class BaseAPI {
153
164
  async request(context, initOverrides) {
154
165
  const { url, init } = await this.createFetchParams(context, initOverrides);
155
166
  const response = await this.fetchApi(url, init);
156
- if (response && (response.status >= 200 && response.status < 300)) {
167
+ if (response && response.status >= 200 && response.status < 300) {
157
168
  return response;
158
169
  }
159
170
  else {
@@ -162,14 +173,15 @@ class BaseAPI {
162
173
  }
163
174
  async createFetchParams(context, initOverrides) {
164
175
  let url = this.configuration.basePath + context.path;
165
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
176
+ if (context.query !== undefined &&
177
+ Object.keys(context.query).length !== 0) {
166
178
  // only add the querystring to the URL if there are query parameters.
167
179
  // this is done to avoid urls ending with a "?" character which buggy webservers
168
180
  // do not handle correctly sometimes.
169
- url += '?' + this.configuration.queryParamsStringify(context.query);
181
+ url += "?" + this.configuration.queryParamsStringify(context.query);
170
182
  }
171
183
  const headers = Object.assign({}, this.configuration.headers, context.headers);
172
- Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
184
+ Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
173
185
  const initOverrideFn = typeof initOverrides === "function"
174
186
  ? initOverrides
175
187
  : async () => initOverrides;
@@ -184,15 +196,15 @@ class BaseAPI {
184
196
  ...(await initOverrideFn({
185
197
  init: initParams,
186
198
  context,
187
- }))
199
+ })),
188
200
  };
189
201
  let body;
190
- if (isFormData(overriddenInit.body)
191
- || (overriddenInit.body instanceof URLSearchParams)
192
- || isBlob(overriddenInit.body)) {
202
+ if (isFormData(overriddenInit.body) ||
203
+ overriddenInit.body instanceof URLSearchParams ||
204
+ isBlob(overriddenInit.body)) {
193
205
  body = overriddenInit.body;
194
206
  }
195
- else if (this.isJsonMime(headers['Content-Type'])) {
207
+ else if (this.isJsonMime(headers["Content-Type"])) {
196
208
  body = JSON.stringify(overriddenInit.body);
197
209
  }
198
210
  else {
@@ -200,7 +212,7 @@ class BaseAPI {
200
212
  }
201
213
  const init = {
202
214
  ...overriddenInit,
203
- body
215
+ body,
204
216
  };
205
217
  return { url, init };
206
218
  }
@@ -216,10 +228,9 @@ class BaseAPI {
216
228
  }
217
229
  }
218
230
  exports.BaseAPI = BaseAPI;
219
- BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
220
- ;
231
+ BaseAPI.jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
221
232
  function isBlob(value) {
222
- return typeof Blob !== 'undefined' && value instanceof Blob;
233
+ return typeof Blob !== "undefined" && value instanceof Blob;
223
234
  }
224
235
  function isFormData(value) {
225
236
  return typeof FormData !== "undefined" && value instanceof FormData;
@@ -259,17 +270,18 @@ function exists(json, key) {
259
270
  return value !== null && value !== undefined;
260
271
  }
261
272
  exports.exists = exists;
262
- function querystring(params, prefix = '') {
273
+ function querystring(params, prefix = "") {
263
274
  return Object.keys(params)
264
- .map(key => querystringSingleKey(key, params[key], prefix))
265
- .filter(part => part.length > 0)
266
- .join('&');
275
+ .map((key) => querystringSingleKey(key, params[key], prefix))
276
+ .filter((part) => part.length > 0)
277
+ .join("&");
267
278
  }
268
279
  exports.querystring = querystring;
269
- function querystringSingleKey(key, value, keyPrefix = '') {
280
+ function querystringSingleKey(key, value, keyPrefix = "") {
270
281
  const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
271
282
  if (value instanceof Array) {
272
- const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
283
+ const multiValue = value
284
+ .map((singleValue) => encodeURIComponent(String(singleValue)))
273
285
  .join(`&${encodeURIComponent(fullKey)}=`);
274
286
  return `${encodeURIComponent(fullKey)}=${multiValue}`;
275
287
  }
@@ -291,7 +303,7 @@ function mapValues(data, fn) {
291
303
  exports.mapValues = mapValues;
292
304
  function canConsumeForm(consumes) {
293
305
  for (const consume of consumes) {
294
- if ('multipart/form-data' === consume.contentType) {
306
+ if ("multipart/form-data" === consume.contentType) {
295
307
  return true;
296
308
  }
297
309
  }
@@ -324,7 +336,6 @@ class BlobApiResponse {
324
336
  async value() {
325
337
  return await this.raw.blob();
326
338
  }
327
- ;
328
339
  }
329
340
  exports.BlobApiResponse = BlobApiResponse;
330
341
  class TextApiResponse {
@@ -334,6 +345,5 @@ class TextApiResponse {
334
345
  async value() {
335
346
  return await this.raw.text();
336
347
  }
337
- ;
338
348
  }
339
349
  exports.TextApiResponse = TextApiResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ynab",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "YNAB API Javascript (Node) Library",
5
5
  "author": "YNAB",
6
6
  "email": "api@ynab.com",