wealthica-sdk-js 0.0.9 → 0.0.11

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/README.md CHANGED
@@ -342,13 +342,13 @@ Returns data within the last 1 year by default.
342
342
 
343
343
  ```javascript
344
344
  const transactions = await user.transactions.getList({
345
- institutionId: '603522490d2b02001233a5d6',
346
- ticker: 'BTC', // optional
345
+ institutions: ['603522490d2b02001233a5d6'],
347
346
  from: '2020-08-31', // optional
348
347
  to: '2021-08-31', // optional
349
- investment: 'bitcoin:cash:usd', // optional
348
+ investment: 'wise:cash:usd', // optional
350
349
  last: '603522490d2b02001233a5d6', // optional, blank string is allowed
351
350
  limit: 10, // optional
351
+ institutionId: '603522490d2b02001233a5d6', // Deprecated, use institutions prop
352
352
  });
353
353
  ```
354
354
 
@@ -357,13 +357,12 @@ todo: add response example
357
357
 
358
358
  ```
359
359
 
360
- #### user.transactions.getOne({ institutionId, txId })
360
+ #### user.transactions.getOne({ txId })
361
361
 
362
362
  This method retrieves a single transaction.
363
363
 
364
364
  ```javascript
365
365
  const transaction = await user.transactions.getOne({
366
- institutionId: '603522490d2b02001233a5d6',
367
366
  txId: '603522490d2b02001233a5d6'
368
367
  });
369
368
  ```
@@ -373,6 +372,21 @@ todo: add response example
373
372
 
374
373
  ```
375
374
 
375
+ #### user.positions.getList({ institutions })
376
+
377
+ This method retrieves user positions.
378
+
379
+ ```javascript
380
+ const positions = await user.positions.getList({
381
+ institutions: ['603522490d2b02001233a5d6']
382
+ });
383
+ ```
384
+
385
+ todo: add response example
386
+ ```json
387
+
388
+ ```
389
+
376
390
  ### Data APIs
377
391
 
378
392
  These methods provide general Wealthica information and do not require logging in a user.
@@ -41,6 +41,7 @@ interface APIUserInterface extends APIInterface {
41
41
  institutions: InstitutionsInterface
42
42
  history: HistoryInterface
43
43
  transactions: TransactionsInterface
44
+ positions: PositionsInterface
44
45
  }
45
46
 
46
47
  interface InstitutionsInterface {
@@ -62,6 +63,11 @@ interface TransactionsInterface {
62
63
  getOne(options: TransactionOptions): Promise<Transactions> | Promise<never>
63
64
  }
64
65
 
66
+ interface PositionsInterface {
67
+ constructor(api: APIUserInterface)
68
+ getList(options: PositionsOptions): Promise<Position[]> | Promise<never>
69
+ }
70
+
65
71
  type APIConfig = {
66
72
  clientId: string;
67
73
  secret?: string;
@@ -98,19 +104,41 @@ type ConnectData = {
98
104
  }
99
105
 
100
106
  type TransactionsOptions = {
101
- institutionId: string;
107
+ institutions?: Array<string>;
108
+ investments?: Array<string>;
109
+ groups?: Array<string>;
102
110
  from?: string;
103
111
  to?: string;
104
- investments?: string;
112
+ assets?: boolean;
113
+ liabilities?: boolean;
114
+ banking?: boolean;
115
+ types?: Array<string>;
116
+ deleted?: Boolean;
117
+ invalid?: Boolean;
118
+ new?: Boolean;
119
+ peek?: Boolean;
120
+ missing?: Boolean;
105
121
  last?: string;
106
122
  limit?: number;
123
+ sort?: string;
124
+ security?: Boolean;
125
+ skip_date_filter?: Boolean;
126
+ institutionId?: string;
107
127
  }
108
128
 
109
129
  type TransactionOptions = {
110
- institutionId: string;
111
130
  txId: string;
112
131
  }
113
132
 
133
+ type PositionsOptions = {
134
+ groups?: Array<string>;
135
+ institutions?: Array<string>;
136
+ investments?: Array<string>;
137
+ assets?: Boolean;
138
+ liabilities?: Boolean;
139
+ banking?: Boolean;
140
+ }
141
+
114
142
  type Part = {
115
143
  direction: string;
116
144
  ticker: string;
@@ -204,3 +232,49 @@ type Institution = {
204
232
  updated_at: number;
205
233
  resource_type: string;
206
234
  }
235
+
236
+ type Position = {
237
+ _id: string;
238
+ class: string;
239
+ classes: {
240
+ class: string;
241
+ weight: number;
242
+ };
243
+ category: string;
244
+ categories: Array<string>;
245
+ security: Security;
246
+ investments: Array<PositionInvestment>
247
+ quantity: number;
248
+ book_value: number;
249
+ market_value: number;
250
+ gain_amount: number;
251
+ gain_percent: number;
252
+ }
253
+
254
+ type Security = {
255
+ _id: string;
256
+ currency: string;
257
+ symbol: string;
258
+ type: string;
259
+ name: string;
260
+ aliases: Array<string>;
261
+ last_price: number;
262
+ last_date: string;
263
+ high_price: number;
264
+ high_date: string;
265
+ low_price: number;
266
+ low_date: string;
267
+ cusip: string;
268
+ }
269
+
270
+ type PositionInvestment = {
271
+ institution: string;
272
+ investment: string;
273
+ currency: string;
274
+ quantity: number;
275
+ book_value: number;
276
+ market_value: number;
277
+ value: number;
278
+ gain_amount: number;
279
+ gain_percent: number;
280
+ }
@@ -41,6 +41,7 @@ interface APIUserInterface extends APIInterface {
41
41
  institutions: InstitutionsInterface
42
42
  history: HistoryInterface
43
43
  transactions: TransactionsInterface
44
+ positions: PositionsInterface
44
45
  }
45
46
 
46
47
  interface InstitutionsInterface {
@@ -62,6 +63,11 @@ interface TransactionsInterface {
62
63
  getOne(options: TransactionOptions): Promise<Transactions> | Promise<never>
63
64
  }
64
65
 
66
+ interface PositionsInterface {
67
+ constructor(api: APIUserInterface)
68
+ getList(options: PositionsOptions): Promise<Position[]> | Promise<never>
69
+ }
70
+
65
71
  type APIConfig = {
66
72
  clientId: string;
67
73
  secret?: string;
@@ -98,19 +104,41 @@ type ConnectData = {
98
104
  }
99
105
 
100
106
  type TransactionsOptions = {
101
- institutionId: string;
107
+ institutions?: Array<string>;
108
+ investments?: Array<string>;
109
+ groups?: Array<string>;
102
110
  from?: string;
103
111
  to?: string;
104
- investments?: string;
112
+ assets?: boolean;
113
+ liabilities?: boolean;
114
+ banking?: boolean;
115
+ types?: Array<string>;
116
+ deleted?: Boolean;
117
+ invalid?: Boolean;
118
+ new?: Boolean;
119
+ peek?: Boolean;
120
+ missing?: Boolean;
105
121
  last?: string;
106
122
  limit?: number;
123
+ sort?: string;
124
+ security?: Boolean;
125
+ skip_date_filter?: Boolean;
126
+ institutionId?: string;
107
127
  }
108
128
 
109
129
  type TransactionOptions = {
110
- institutionId: string;
111
130
  txId: string;
112
131
  }
113
132
 
133
+ type PositionsOptions = {
134
+ groups?: Array<string>;
135
+ institutions?: Array<string>;
136
+ investments?: Array<string>;
137
+ assets?: Boolean;
138
+ liabilities?: Boolean;
139
+ banking?: Boolean;
140
+ }
141
+
114
142
  type Part = {
115
143
  direction: string;
116
144
  ticker: string;
@@ -204,3 +232,49 @@ type Institution = {
204
232
  updated_at: number;
205
233
  resource_type: string;
206
234
  }
235
+
236
+ type Position = {
237
+ _id: string;
238
+ class: string;
239
+ classes: {
240
+ class: string;
241
+ weight: number;
242
+ };
243
+ category: string;
244
+ categories: Array<string>;
245
+ security: Security;
246
+ investments: Array<PositionInvestment>
247
+ quantity: number;
248
+ book_value: number;
249
+ market_value: number;
250
+ gain_amount: number;
251
+ gain_percent: number;
252
+ }
253
+
254
+ type Security = {
255
+ _id: string;
256
+ currency: string;
257
+ symbol: string;
258
+ type: string;
259
+ name: string;
260
+ aliases: Array<string>;
261
+ last_price: number;
262
+ last_date: string;
263
+ high_price: number;
264
+ high_date: string;
265
+ low_price: number;
266
+ low_date: string;
267
+ cusip: string;
268
+ }
269
+
270
+ type PositionInvestment = {
271
+ institution: string;
272
+ investment: string;
273
+ currency: string;
274
+ quantity: number;
275
+ book_value: number;
276
+ market_value: number;
277
+ value: number;
278
+ gain_amount: number;
279
+ gain_percent: number;
280
+ }
@@ -6059,7 +6059,7 @@ var API = /*#__PURE__*/function () {
6059
6059
  return _ref.apply(this, arguments);
6060
6060
  };
6061
6061
  }());
6062
- var userResources = createResources(user, ['institutions', 'history', 'transactions']);
6062
+ var userResources = createResources(user, ['institutions', 'history', 'transactions', 'positions']);
6063
6063
  Object.assign(user, userResources);
6064
6064
  user.config.loginName = loginName;
6065
6065
  return user;
@@ -6632,7 +6632,8 @@ var RESOURCES = {
6632
6632
  history: __webpack_require__(55987),
6633
6633
  providers: __webpack_require__(95269),
6634
6634
  teams: __webpack_require__(67523),
6635
- transactions: __webpack_require__(46123)
6635
+ transactions: __webpack_require__(46123),
6636
+ positions: __webpack_require__(87334)
6636
6637
  };
6637
6638
  module.exports = function createResources(api, resources) {
6638
6639
  return resources.reduce(function (res, resource) {
@@ -6828,6 +6829,71 @@ module.exports = Institutions;
6828
6829
 
6829
6830
  /***/ }),
6830
6831
 
6832
+ /***/ 87334:
6833
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6834
+
6835
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
6836
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6837
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6838
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6839
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6840
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6841
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6842
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6843
+ var _require = __webpack_require__(9853),
6844
+ getQueryString = _require.getQueryString;
6845
+ var Positions = /*#__PURE__*/function () {
6846
+ function Positions(api) {
6847
+ _classCallCheck(this, Positions);
6848
+ this.api = api.userApi;
6849
+ }
6850
+ _createClass(Positions, [{
6851
+ key: "getList",
6852
+ value: function () {
6853
+ var _getList = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
6854
+ var options,
6855
+ url,
6856
+ query,
6857
+ response,
6858
+ _args = arguments;
6859
+ return regeneratorRuntime.wrap(function _callee$(_context) {
6860
+ while (1) {
6861
+ switch (_context.prev = _context.next) {
6862
+ case 0:
6863
+ options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
6864
+ url = '/positions';
6865
+ query = getQueryString(options);
6866
+ if (query) url = "".concat(url, "?").concat(query);
6867
+ _context.next = 6;
6868
+ return this.api.get(url);
6869
+ case 6:
6870
+ response = _context.sent;
6871
+ if (response.ok) {
6872
+ _context.next = 9;
6873
+ break;
6874
+ }
6875
+ throw response.originalError;
6876
+ case 9:
6877
+ return _context.abrupt("return", response.data);
6878
+ case 10:
6879
+ case "end":
6880
+ return _context.stop();
6881
+ }
6882
+ }
6883
+ }, _callee, this);
6884
+ }));
6885
+ function getList() {
6886
+ return _getList.apply(this, arguments);
6887
+ }
6888
+ return getList;
6889
+ }()
6890
+ }]);
6891
+ return Positions;
6892
+ }();
6893
+ module.exports = Positions;
6894
+
6895
+ /***/ }),
6896
+
6831
6897
  /***/ 95269:
6832
6898
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6833
6899
 
@@ -6996,10 +7062,12 @@ module.exports = Teams;
6996
7062
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6997
7063
 
6998
7064
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
6999
- var _excluded = ["institutionId"],
7000
- _excluded2 = ["institutionId", "txId"];
7065
+ var _excluded = ["txId"];
7001
7066
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7002
7067
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7068
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7069
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7070
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7003
7071
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
7004
7072
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
7005
7073
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -7019,9 +7087,8 @@ var Transactions = /*#__PURE__*/function () {
7019
7087
  value: function () {
7020
7088
  var _getList = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
7021
7089
  var options,
7022
- institutionId,
7023
- params,
7024
7090
  url,
7091
+ institutions,
7025
7092
  query,
7026
7093
  response,
7027
7094
  _args = arguments;
@@ -7030,15 +7097,17 @@ var Transactions = /*#__PURE__*/function () {
7030
7097
  switch (_context.prev = _context.next) {
7031
7098
  case 0:
7032
7099
  options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
7033
- institutionId = options.institutionId, params = _objectWithoutProperties(options, _excluded);
7034
- if (!(!institutionId || typeof institutionId !== 'string')) {
7035
- _context.next = 4;
7036
- break;
7100
+ url = '/transactions';
7101
+ institutions = options.institutions || []; // Add institutionId for backward compatibility
7102
+ if (options.institutionId && !institutions.includes(options.institutionId)) {
7103
+ institutions.push(options.institutionId);
7037
7104
  }
7038
- throw new Error('Please provide a valid Wealthica institution id.');
7039
- case 4:
7040
- url = "/transactions?institutions=".concat(institutionId);
7041
- query = getQueryString(params);
7105
+
7106
+ // eslint-disable-next-line no-param-reassign
7107
+ delete options.institutionId;
7108
+ query = getQueryString(_objectSpread(_objectSpread({}, options), {}, {
7109
+ institutions: institutions
7110
+ }));
7042
7111
  if (query) url = "".concat(url, "?").concat(query);
7043
7112
  _context.next = 9;
7044
7113
  return this.api.get(url);
@@ -7068,7 +7137,6 @@ var Transactions = /*#__PURE__*/function () {
7068
7137
  value: function () {
7069
7138
  var _getOne = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
7070
7139
  var options,
7071
- institutionId,
7072
7140
  txId,
7073
7141
  params,
7074
7142
  url,
@@ -7080,34 +7148,28 @@ var Transactions = /*#__PURE__*/function () {
7080
7148
  switch (_context2.prev = _context2.next) {
7081
7149
  case 0:
7082
7150
  options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
7083
- institutionId = options.institutionId, txId = options.txId, params = _objectWithoutProperties(options, _excluded2);
7084
- if (!(!institutionId || typeof institutionId !== 'string')) {
7085
- _context2.next = 4;
7086
- break;
7087
- }
7088
- throw new Error('Please provide a valid Wealthica institution id.');
7089
- case 4:
7151
+ txId = options.txId, params = _objectWithoutProperties(options, _excluded);
7090
7152
  if (!(!txId || typeof txId !== 'string')) {
7091
- _context2.next = 6;
7153
+ _context2.next = 4;
7092
7154
  break;
7093
7155
  }
7094
7156
  throw new Error('Please provide a valid Wealthica transaction id.');
7095
- case 6:
7157
+ case 4:
7096
7158
  url = "/transactions/".concat(txId);
7097
7159
  query = getQueryString(params);
7098
7160
  if (query) url = "".concat(url, "?").concat(query);
7099
- _context2.next = 11;
7161
+ _context2.next = 9;
7100
7162
  return this.api.get(url);
7101
- case 11:
7163
+ case 9:
7102
7164
  response = _context2.sent;
7103
7165
  if (response.ok) {
7104
- _context2.next = 14;
7166
+ _context2.next = 12;
7105
7167
  break;
7106
7168
  }
7107
7169
  throw response.originalError;
7108
- case 14:
7170
+ case 12:
7109
7171
  return _context2.abrupt("return", response.data);
7110
- case 15:
7172
+ case 13:
7111
7173
  case "end":
7112
7174
  return _context2.stop();
7113
7175
  }
package/dist/wealthica.js CHANGED
@@ -6049,7 +6049,7 @@ var API = /*#__PURE__*/function () {
6049
6049
  return _ref.apply(this, arguments);
6050
6050
  };
6051
6051
  }());
6052
- var userResources = createResources(user, ['institutions', 'history', 'transactions']);
6052
+ var userResources = createResources(user, ['institutions', 'history', 'transactions', 'positions']);
6053
6053
  Object.assign(user, userResources);
6054
6054
  user.config.loginName = loginName;
6055
6055
  return user;
@@ -6622,7 +6622,8 @@ var RESOURCES = {
6622
6622
  history: __webpack_require__(55987),
6623
6623
  providers: __webpack_require__(95269),
6624
6624
  teams: __webpack_require__(67523),
6625
- transactions: __webpack_require__(46123)
6625
+ transactions: __webpack_require__(46123),
6626
+ positions: __webpack_require__(87334)
6626
6627
  };
6627
6628
  module.exports = function createResources(api, resources) {
6628
6629
  return resources.reduce(function (res, resource) {
@@ -6818,6 +6819,71 @@ module.exports = Institutions;
6818
6819
 
6819
6820
  /***/ }),
6820
6821
 
6822
+ /***/ 87334:
6823
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6824
+
6825
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
6826
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6827
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6828
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6829
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6830
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6831
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6832
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6833
+ var _require = __webpack_require__(9853),
6834
+ getQueryString = _require.getQueryString;
6835
+ var Positions = /*#__PURE__*/function () {
6836
+ function Positions(api) {
6837
+ _classCallCheck(this, Positions);
6838
+ this.api = api.userApi;
6839
+ }
6840
+ _createClass(Positions, [{
6841
+ key: "getList",
6842
+ value: function () {
6843
+ var _getList = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
6844
+ var options,
6845
+ url,
6846
+ query,
6847
+ response,
6848
+ _args = arguments;
6849
+ return regeneratorRuntime.wrap(function _callee$(_context) {
6850
+ while (1) {
6851
+ switch (_context.prev = _context.next) {
6852
+ case 0:
6853
+ options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
6854
+ url = '/positions';
6855
+ query = getQueryString(options);
6856
+ if (query) url = "".concat(url, "?").concat(query);
6857
+ _context.next = 6;
6858
+ return this.api.get(url);
6859
+ case 6:
6860
+ response = _context.sent;
6861
+ if (response.ok) {
6862
+ _context.next = 9;
6863
+ break;
6864
+ }
6865
+ throw response.originalError;
6866
+ case 9:
6867
+ return _context.abrupt("return", response.data);
6868
+ case 10:
6869
+ case "end":
6870
+ return _context.stop();
6871
+ }
6872
+ }
6873
+ }, _callee, this);
6874
+ }));
6875
+ function getList() {
6876
+ return _getList.apply(this, arguments);
6877
+ }
6878
+ return getList;
6879
+ }()
6880
+ }]);
6881
+ return Positions;
6882
+ }();
6883
+ module.exports = Positions;
6884
+
6885
+ /***/ }),
6886
+
6821
6887
  /***/ 95269:
6822
6888
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6823
6889
 
@@ -6986,10 +7052,12 @@ module.exports = Teams;
6986
7052
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6987
7053
 
6988
7054
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
6989
- var _excluded = ["institutionId"],
6990
- _excluded2 = ["institutionId", "txId"];
7055
+ var _excluded = ["txId"];
6991
7056
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6992
7057
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7058
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7059
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7060
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6993
7061
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6994
7062
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6995
7063
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -7009,9 +7077,8 @@ var Transactions = /*#__PURE__*/function () {
7009
7077
  value: function () {
7010
7078
  var _getList = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
7011
7079
  var options,
7012
- institutionId,
7013
- params,
7014
7080
  url,
7081
+ institutions,
7015
7082
  query,
7016
7083
  response,
7017
7084
  _args = arguments;
@@ -7020,15 +7087,17 @@ var Transactions = /*#__PURE__*/function () {
7020
7087
  switch (_context.prev = _context.next) {
7021
7088
  case 0:
7022
7089
  options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
7023
- institutionId = options.institutionId, params = _objectWithoutProperties(options, _excluded);
7024
- if (!(!institutionId || typeof institutionId !== 'string')) {
7025
- _context.next = 4;
7026
- break;
7090
+ url = '/transactions';
7091
+ institutions = options.institutions || []; // Add institutionId for backward compatibility
7092
+ if (options.institutionId && !institutions.includes(options.institutionId)) {
7093
+ institutions.push(options.institutionId);
7027
7094
  }
7028
- throw new Error('Please provide a valid Wealthica institution id.');
7029
- case 4:
7030
- url = "/transactions?institutions=".concat(institutionId);
7031
- query = getQueryString(params);
7095
+
7096
+ // eslint-disable-next-line no-param-reassign
7097
+ delete options.institutionId;
7098
+ query = getQueryString(_objectSpread(_objectSpread({}, options), {}, {
7099
+ institutions: institutions
7100
+ }));
7032
7101
  if (query) url = "".concat(url, "?").concat(query);
7033
7102
  _context.next = 9;
7034
7103
  return this.api.get(url);
@@ -7058,7 +7127,6 @@ var Transactions = /*#__PURE__*/function () {
7058
7127
  value: function () {
7059
7128
  var _getOne = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
7060
7129
  var options,
7061
- institutionId,
7062
7130
  txId,
7063
7131
  params,
7064
7132
  url,
@@ -7070,34 +7138,28 @@ var Transactions = /*#__PURE__*/function () {
7070
7138
  switch (_context2.prev = _context2.next) {
7071
7139
  case 0:
7072
7140
  options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
7073
- institutionId = options.institutionId, txId = options.txId, params = _objectWithoutProperties(options, _excluded2);
7074
- if (!(!institutionId || typeof institutionId !== 'string')) {
7075
- _context2.next = 4;
7076
- break;
7077
- }
7078
- throw new Error('Please provide a valid Wealthica institution id.');
7079
- case 4:
7141
+ txId = options.txId, params = _objectWithoutProperties(options, _excluded);
7080
7142
  if (!(!txId || typeof txId !== 'string')) {
7081
- _context2.next = 6;
7143
+ _context2.next = 4;
7082
7144
  break;
7083
7145
  }
7084
7146
  throw new Error('Please provide a valid Wealthica transaction id.');
7085
- case 6:
7147
+ case 4:
7086
7148
  url = "/transactions/".concat(txId);
7087
7149
  query = getQueryString(params);
7088
7150
  if (query) url = "".concat(url, "?").concat(query);
7089
- _context2.next = 11;
7151
+ _context2.next = 9;
7090
7152
  return this.api.get(url);
7091
- case 11:
7153
+ case 9:
7092
7154
  response = _context2.sent;
7093
7155
  if (response.ok) {
7094
- _context2.next = 14;
7156
+ _context2.next = 12;
7095
7157
  break;
7096
7158
  }
7097
7159
  throw response.originalError;
7098
- case 14:
7160
+ case 12:
7099
7161
  return _context2.abrupt("return", response.data);
7100
- case 15:
7162
+ case 13:
7101
7163
  case "end":
7102
7164
  return _context2.stop();
7103
7165
  }