UNPKG

finerio-pfm-unnax

Version:

This SDK lets you connect to [Finerio PFM API Unnax](http://ec2-3-16-174-50.us-east-2.compute.amazonaws.com:8082/swagger-ui/index.html#/) in an easier way.

1,524 lines (1,491 loc) 113 kB
require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const models_1 = require("../models"); class Accounts { constructor(fcSdk) { this.fcSdk = fcSdk; this.path = "/accounts"; } processResponse(response) { return new models_1.Account(response); } processDeleteResponse(status) { return status === "" ? 204 : 500; } processListResponse(response) { if (!response.data) { return []; } return response.data.map((account) => new models_1.Account(account)); } get(id) { return this.fcSdk.doGet(`${this.path}/${id}`, this.processResponse); } update(id, updateObject) { return this.fcSdk.doPut(`${this.path}/${id}`, updateObject ? updateObject.plainObject : {}, this.processResponse); } create(accountToCreate) { return this.fcSdk.doPost(this.path, accountToCreate.plainObject, this.processResponse); } delete(id) { return this.fcSdk.doDelete(`${this.path}/${id}`, this.processDeleteResponse); } list(cursor) { const params = cursor ? `?cursor=${cursor}` : ""; const uri = `${this.path}${params}`; return this.fcSdk.doGet(uri, this.processListResponse); } } exports.default = Accounts; },{"../models":18}],2:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const models_1 = require("../models"); class Budgets { constructor(fcSdk) { this.fcSdk = fcSdk; this.path = "/budgets"; } get(id) { const uri = `${this.path}/${id}`; return this.fcSdk.doGet(uri, this.processResponse); } update(id, updateObject) { const uri = `${this.path}/${id}`; return this.fcSdk.doPut(uri, updateObject.plainObject, this.processResponse); } create(createBudget) { const uri = `${this.path}`; return this.fcSdk.doPost(uri, createBudget.plainObject, this.processResponse); } processResponse(response) { return new models_1.Budget(response); } delete(id) { const uri = `${this.path}/${id}`; return this.fcSdk.doDelete(uri, this.processDeleteResponse); } processDeleteResponse(status) { return status === "" ? 204 : 500; } list(cursor) { const params = cursor ? `?userId=${cursor}` : ""; const uri = `${this.path}${params}`; return this.fcSdk.doGet(uri, this.processlistResponse); } processlistResponse(response) { return response.data ? [...response.data].reverse().map((bud) => new models_1.Budget(bud)) : []; } } exports.default = Budgets; },{"../models":18}],3:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const models_1 = require("../models"); class Categories { constructor(fcSdk) { this.fcSdk = fcSdk; this.path = "/categories"; } get(id) { const uri = `${this.path}/${id}`; return this.fcSdk.doGet(uri, this.processResponse); } update(id, updateObject) { const uri = `${this.path}/${id}`; return this.fcSdk.doPut(uri, updateObject.plainObject, this.processResponse); } create(createCategory) { const uri = `${this.path}`; return this.fcSdk.doPost(uri, createCategory.plainObject, this.processResponse); } processResponse(response) { return new models_1.Category(response); } delete(id) { const uri = `${this.path}/${id}`; return this.fcSdk.doDelete(uri, this.processDeleteResponse); } processDeleteResponse(status) { return status === "" ? 204 : 500; } list() { const uri = `${this.path}`; return this.fcSdk.doGet(uri, this.processlistResponse); } processlistResponse(response) { return response.data ? [...response.data].reverse().map((cat) => new models_1.Category(cat)) : []; } listWithSubcategories() { const uri = `${this.path}`; return this.fcSdk.doGet(uri, this.processListWithSubcategoriesResponse); } processListWithSubcategoriesResponse(response) { let categories = []; if (response.data) { const catsOrd = [...response.data].reverse(); categories = catsOrd .filter((cat) => !cat.parentCategoryId) .map((cat) => new models_1.ParentCategory(cat)); categories.forEach((parcat) => { parcat.subcategories = catsOrd .filter((rescat) => rescat.parentCategoryId === parcat.id) .map((cat) => new models_1.Category(cat)); }); } return categories; } } exports.default = Categories; },{"../models":18}],4:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SERVER_URL = exports.INSIGHTS_TYPE = exports.BUDGET_TYPE = exports.TRANSACTION_TYPE = exports.FINANCIAL_ENTITY_TYPE = exports.CATEGORY_TYPE = exports.ACCOUNT_TYPE = void 0; exports.ACCOUNT_TYPE = "PFM_SDK/ACCOUNT_TYPE"; exports.CATEGORY_TYPE = "PFM_SDK/CATEGORY_TYPE"; exports.FINANCIAL_ENTITY_TYPE = "PFM_SDK/FINANCIAL_ENTITY_TYPE"; exports.TRANSACTION_TYPE = "PFM_SDK/TRANSACTION_TYPE"; exports.BUDGET_TYPE = "PFM_SDK/BUDGET_TYPE"; exports.INSIGHTS_TYPE = "PFM_SDK/INSIGHTS_TYPE"; exports.SERVER_URL = "https://unnax-gateway-sandbox.finerioconnect.com"; },{}],5:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Error { constructor(code, title, detail) { this.code = code; this.title = title; this.detail = detail; } } exports.default = Error; },{}],6:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Error_1 = __importDefault(require("./Error")); exports.default = Error_1.default; },{"./Error":5}],7:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const models_1 = require("../models"); class FinancialEntitites { constructor(fcSdk) { this.fcSdk = fcSdk; this.path = "/financialEntities"; } processResponse(response) { return new models_1.FinancialEntity(response); } processListResponse(response) { if (!response.data) { return []; } return response.data.map((financialEntity) => new models_1.FinancialEntity(financialEntity)); } get(id) { return this.fcSdk.doGet(`${this.path}/${id}`, this.processResponse); } list(cursor) { const uri = `${this.path}${cursor ? "?cursor=" + cursor : ""}`; return this.fcSdk.doGet(uri, this.processListResponse); } } exports.default = FinancialEntitites; },{"../models":18}],8:[function(require,module,exports){ "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const axios_1 = __importDefault(require("axios")); const accounts_1 = __importDefault(require("../accounts")); const Budgets_1 = __importDefault(require("../budgets/Budgets")); const Categories_1 = __importDefault(require("../categories/Categories")); const constants_1 = require("../constants"); const error_1 = __importDefault(require("../error")); const index_1 = __importDefault(require("../financialEntities/index")); const Insights_1 = __importDefault(require("../insights/Insights")); const Login_1 = __importDefault(require("../models/Login")); const Transactions_1 = __importDefault(require("../transactions/Transactions")); class FinerioConnectSDK { constructor(arg) { this._authToken = ""; this._baseURL = ""; this._refreshToken = ""; this._tokenExpiresDate = null; this.getIncludedClasses = (arg) => { if (arg) { if (Array.isArray(arg)) { return arg; } if (typeof arg === "string") { return [arg]; } } return []; }; this._includedClasses = []; this._baseURL = constants_1.SERVER_URL; if (arg) { if (Array.isArray(arg) || typeof arg === "string") { this._includedClasses = this.getIncludedClasses(arg); } else if (typeof arg === "object") { if (arg.includes) { this._includedClasses = this.getIncludedClasses(arg.includes); } if (arg.serverUrl) { this._baseURL = arg.serverUrl; } } } this._axiosApiInstance = axios_1.default.create({ baseURL: this._baseURL, }); } login(username, password, clientId, headers) { return new Promise((resolve, reject) => { const uri = `/login`; this.doPost(uri, { username, password, clientId }, this.processLogin, headers) .then((response) => { this.setNewAccessData(response); resolve(this.connect()); }) .catch((error) => { reject(error); }); }); } connect(authToken) { if (authToken) { this._authToken = authToken; } this.setRequestInterceptors(); this.setResponseInterceptors(); if (this._includedClasses.length) { return this._includedClasses.reduce((acc, current) => { switch (current) { case constants_1.ACCOUNT_TYPE: return Object.assign(Object.assign({}, acc), { Accounts: new accounts_1.default(this) }); case constants_1.CATEGORY_TYPE: return Object.assign(Object.assign({}, acc), { Categories: new Categories_1.default(this) }); case constants_1.BUDGET_TYPE: return Object.assign(Object.assign({}, acc), { Budgets: new Budgets_1.default(this) }); case constants_1.TRANSACTION_TYPE: return Object.assign(Object.assign({}, acc), { Transactions: new Transactions_1.default(this) }); case constants_1.INSIGHTS_TYPE: return Object.assign(Object.assign({}, acc), { Insights: new Insights_1.default(this) }); case constants_1.FINANCIAL_ENTITY_TYPE: return Object.assign(Object.assign({}, acc), { FinancialEntities: new index_1.default(this) }); default: return acc; } }, {}); } return { Accounts: new accounts_1.default(this), Categories: new Categories_1.default(this), Transactions: new Transactions_1.default(this), Budgets: new Budgets_1.default(this), Insights: new Insights_1.default(this), FinancialEntities: new index_1.default(this), }; } refreshApiToken() { return new Promise((resolve, reject) => { const uri = `${this._baseURL}/oauth/access_token?refresh_token=${this._refreshToken}`; axios_1.default .post(uri, "", { headers: { Accept: "application/json", Authorization: `Bearer ${this._authToken}`, }, }) .then(({ data }) => { this.setNewAccessData(data); resolve(true); }) .catch((error) => { reject(new error_1.default(`${error.response.status}`, error.response.data.path, error.response.data.error)); }); }); } get authToken() { return this._authToken; } get refreshToken() { return this._refreshToken; } doGet(uri, success) { return new Promise((resolve, reject) => { this._axiosApiInstance .get(uri) .then((response) => resolve(success(response))) .catch((error) => this.processErrors(error, reject)); }); } doPost(uri, body, success, headers) { return new Promise((resolve, reject) => { this._axiosApiInstance .post(uri, body, headers && { headers }) .then((response) => { resolve(success(response)); }) .catch((error) => this.processErrors(error, reject)); }); } doPut(uri, body, success) { return new Promise((resolve, reject) => { this._axiosApiInstance .put(uri, body) .then((response) => resolve(success(response))) .catch((error) => this.processErrors(error, reject)); }); } doDelete(uri, success) { return new Promise((resolve, reject) => { this._axiosApiInstance .delete(uri) .then((response) => resolve(success(response))) .catch((error) => this.processErrors(error, reject)); }); } setNewAccessData(data) { const { access_token, refresh_token, expires_in } = data; const currentTimeAsMs = Date.now(); this._authToken = access_token; this._refreshToken = refresh_token; this._tokenExpiresDate = new Date(currentTimeAsMs + expires_in); } processLogin(response) { return new Login_1.default(response.data); } setRequestInterceptors() { this._axiosApiInstance.interceptors.request.use((config) => __awaiter(this, void 0, void 0, function* () { if (this._authToken) { if (this._tokenExpiresDate && Date.now() >= this._tokenExpiresDate.getTime()) { yield this.refreshApiToken(); } config.headers = Object.assign(Object.assign({}, config.headers), { Authorization: `Bearer ${this._authToken}` }); } return config; }), (error) => { Promise.reject(error); }); } setRequestHeaders(headers) { this._axiosApiInstance.interceptors.request.use((config) => __awaiter(this, void 0, void 0, function* () { config.headers = Object.assign(Object.assign({}, config.headers), headers); }), (error) => { Promise.reject(error); }); } setResponseInterceptors() { this._axiosApiInstance.interceptors.response.use((response) => { return response.data; }, (error) => __awaiter(this, void 0, void 0, function* () { const originalRequest = error.config; if (this.refreshToken && error.response.status === 401 && this._refreshToken && !originalRequest._retry) { originalRequest._retry = true; yield this.refreshApiToken(); return this._axiosApiInstance(originalRequest); } return Promise.reject(error); })); } processErrors(error, reject) { var _a; if (error.response && error.response.data && error.response.status !== 500) { reject(this.createErrorBadRequest((_a = error.response) === null || _a === void 0 ? void 0 : _a.data)); } else if (error.response && error.response.status) { reject(this.createErrorResObject(error)); } else { reject(this.createErrorObject(error)); } } createErrorBadRequest(errors) { const errorsList = []; if (errors.errors) errors.errors.forEach((error) => { errorsList.push(new error_1.default(error.code, error.title, error.detail)); }); else if (errors.error) errorsList.push(new error_1.default(`${errors.status}`, errors.error, `${errors.path}`)); return errorsList; } createErrorResObject(axiosError) { const { response: error } = axiosError; return new error_1.default(`${error.status}`, error.statusText, error.status === 404 ? "The item you requested was not found" : ""); } createErrorObject(error) { return new error_1.default(`${error.code}`, "", ""); } getUriParams(objectReq) { let params = ""; let index = 0; for (let [key, value] of Object.entries(objectReq)) { params += index === 0 ? "?" : "&"; if (Array.isArray(value)) params += `${key}=${value.join("&" + key + "=")}`; else params += `${key}=${value}`; index++; } return params; } } exports.default = FinerioConnectSDK; },{"../accounts":1,"../budgets/Budgets":2,"../categories/Categories":3,"../constants":4,"../error":6,"../financialEntities/index":7,"../insights/Insights":9,"../models/Login":13,"../transactions/Transactions":35,"axios":36}],9:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const models_1 = require("../models"); class Insights { constructor(fcSdk) { this.fcSdk = fcSdk; this.resumePath = "/resume"; this.analysisPath = "/analysis"; } resume(resumeParams) { const params = resumeParams ? this.fcSdk.getUriParams(resumeParams) : ""; const uri = `${this.resumePath}${params}`; return this.fcSdk.doGet(uri, this.processResumeResponse); } processResumeResponse(response) { return new models_1.Resume(response); } analysis(analysisParams) { const params = analysisParams ? this.fcSdk.getUriParams(analysisParams) : ""; const uri = `${this.analysisPath}${params}`; return this.fcSdk.doGet(uri, this.processAnalysisResponse); } processAnalysisResponse(response) { return response.data.map((res) => new models_1.Analysis(res)); } } exports.default = Insights; },{"../models":18}],10:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Account { constructor({ userId, id, financialEntityId, name, nature, number, balance, chargeable, dateCreated, lastUpdated, providerId, extra_data, }) { this._userId = userId; this._id = id; this._financialEntityId = financialEntityId; this._name = name; this._nature = nature; this._number = number; this._balance = balance; this._chargeable = chargeable; this._dateCreated = dateCreated || null; this._lastUpdated = lastUpdated || null; this._providerId = providerId || null; this._extra_data = extra_data || null; } get id() { return this._id; } get nature() { return this._nature; } set nature(value) { this._nature = value; } get name() { return this._name; } set name(value) { this._name = value; } get number() { return this._number; } set number(value) { this._number = value; } get balance() { return this._balance; } set balance(value) { this._balance = value; } get chargeable() { return this._chargeable; } set chargeable(value) { this._chargeable = value; } get dateCreated() { return this._dateCreated; } get lastUpdated() { return this._lastUpdated; } get userId() { return this._userId; } get financialEntityId() { return this._financialEntityId; } get providerId() { return this._providerId; } get extra_data() { return this._extra_data; } get plainObject() { return { id: this._id, userId: this._userId, financialEntityId: this._financialEntityId, name: this._name, nature: this._nature, number: this._number, balance: this._balance, chargeable: this._chargeable, providerId: this._providerId, dateCreated: this._dateCreated && this._dateCreated, lastUpdated: this._lastUpdated && this._lastUpdated, extraData: this._extra_data, }; } } exports.default = Account; },{}],11:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Budget { constructor({ id, categoryId, name, amount, warningPercentage, spent, leftToSpend, status, dateCreated, lastUpdated, dateDeleted = null, }) { this._id = id; this._categoryId = categoryId; this._name = name; this._amount = amount; this._warningPercentage = warningPercentage; this._spent = spent; this._leftToSpend = leftToSpend; this._status = status; this._dateCreated = dateCreated; this._lastUpdated = lastUpdated; this._dateDeleted = dateDeleted; } get id() { return this._id; } get categoryId() { return this._categoryId; } get name() { return this._name; } get amount() { return this._amount; } get warningPercentage() { return this._warningPercentage; } get spent() { return this._spent; } get leftToSpend() { return this._leftToSpend; } get status() { return this._status; } get dateCreated() { return this._dateCreated; } get lastUpdated() { return this._lastUpdated; } get dateDeleted() { return this._dateDeleted; } get plainObject() { return { id: this._id, categoryId: this._categoryId, name: this._name, amount: this._amount, warningPercentage: this._warningPercentage, spent: this._spent, leftToSpend: this._leftToSpend, status: this._status, dateCreated: this._dateCreated, lastUpdated: this._lastUpdated, dateDeleted: this._dateDeleted, }; } } exports.default = Budget; },{}],12:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class FinancialEntity { constructor({ id, name, code, imagePath, dateCreated, lastUpdated, }) { this._id = id; this._name = name; this._code = code; this._imagePath = imagePath || ""; this._dateCreated = dateCreated ? dateCreated : null; this._lastUpdated = lastUpdated ? lastUpdated : null; } get id() { return this._id; } get name() { return this._name; } set name(value) { this._name = value; } get imagePath() { return this._imagePath; } set imagePath(value) { this._imagePath = value; } get code() { return this._code; } set code(value) { this._code = value; } get dateCreated() { return this._dateCreated; } get lastUpdated() { return this._lastUpdated; } get plainObject() { return { id: this._id, name: this._name, code: this._code, imagePath: this._imagePath, dateCreated: this._dateCreated && this._dateCreated, lastUpdated: this._lastUpdated && this._lastUpdated, }; } } exports.default = FinancialEntity; },{}],13:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Login { constructor({ access_token, refresh_token, token_type, expires_in, id, username, roles, api_key, }) { this._access_token = access_token; this._refresh_token = refresh_token; this._token_type = token_type; this._expires_in = expires_in; this._id = id; this._username = username; this._roles = roles; this._api_key = api_key; } get access_token() { return this._access_token; } get refresh_token() { return this._refresh_token; } get token_type() { return this._token_type; } get expires_in() { return this._expires_in; } get id() { return this._id; } get username() { return this._username; } get roles() { return this._roles; } get api_key() { return this._api_key; } } exports.default = Login; },{}],14:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Transaction { constructor({ id, amount, categoryId, charge, date, dateCreated, description, lastUpdated, accountId, accountProviderId, calculable, }) { this._id = id; this._amount = amount; this._charge = charge; this._date = date; this._description = description; this._categoryId = categoryId; this._dateCreated = dateCreated; this._lastUpdated = lastUpdated; this._accountId = accountId; this._accountProviderId = accountProviderId; this._calculable = calculable; } get id() { return this._id; } get charge() { return this._charge; } set charge(value) { this._charge = value; } get date() { return this._date; } set date(value) { this._date = value; } get dateCreated() { return this._dateCreated; } get description() { return this._description; } get amount() { return this._amount; } get categoryId() { return this._categoryId; } get lastUpdated() { return this._lastUpdated; } get accountId() { return this._accountId; } get accountProviderId() { return this._accountProviderId; } get calculable() { return this._calculable; } set calculable(value) { this._calculable = value; } get plainObject() { return { id: this._id, charge: this._charge, description: this._description, amount: this._amount, date: this._date, dateCreated: this._dateCreated, lastUpdated: this.lastUpdated, categoryId: this._categoryId, accountId: this._accountId, accountProviderId: this._accountProviderId, calculable: this._calculable, }; } } exports.default = Transaction; },{}],15:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class TransactionList { constructor({ transactions, currentPage, totalPages, totalItems, }) { this._transactions = transactions; this._currentPage = currentPage; this._totalPages = totalPages; this._totalItems = totalItems; } get transactions() { return this._transactions; } get currentPage() { return this._currentPage; } get totalPages() { return this._totalPages; } get totalItems() { return this._totalItems; } get plainObject() { return { transactions: this._transactions.map((item) => item.plainObject), currentPage: this._currentPage, totalPages: this._totalPages, totalItems: this._totalItems, }; } } exports.default = TransactionList; },{}],16:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Category { constructor({ id, name, color, parentCategoryId, userId, imagePath, dateCreated = null, lastUpdated = null, }) { this._id = id; this._name = name; this._color = color; this._parentCategoryId = parentCategoryId; this._userId = userId; this._imagePath = imagePath; this._dateCreated = dateCreated; this._lastUpdated = lastUpdated; } get id() { return this._id; } get name() { return this._name; } get color() { return this._color; } get parentCategoryId() { return this._parentCategoryId; } get userId() { return this._userId; } get imagePath() { return this._imagePath; } get dateCreated() { return this._dateCreated; } get lastUpdated() { return this._lastUpdated; } get plainObject() { return { id: this._id, name: this._name, color: this._color, parentCategoryId: this._parentCategoryId, userId: this._userId, imagePath: this._imagePath, dateCreated: this._dateCreated, lastUpdated: this._lastUpdated, }; } } exports.default = Category; },{}],17:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Category_1 = __importDefault(require("./Category")); class ParentCategory extends Category_1.default { constructor({ id, name, color, parentCategoryId, userId, imagePath, dateCreated, lastUpdated, }, subcategories = []) { super({ id, name, color, parentCategoryId, userId, imagePath, dateCreated, lastUpdated, }); this._subcategories = subcategories; } get subcategories() { return this._subcategories; } set subcategories(subcategories) { this._subcategories = subcategories; } } exports.default = ParentCategory; },{"./Category":16}],18:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Analysis = exports.Resume = exports.Budget = exports.TransactionList = exports.Transaction = exports.ParentCategory = exports.FinancialEntity = exports.Category = exports.Account = void 0; var Account_1 = require("./Account"); Object.defineProperty(exports, "Account", { enumerable: true, get: function () { return __importDefault(Account_1).default; } }); var Category_1 = require("./category/Category"); Object.defineProperty(exports, "Category", { enumerable: true, get: function () { return __importDefault(Category_1).default; } }); var FinancialEntity_1 = require("./FinancialEntity"); Object.defineProperty(exports, "FinancialEntity", { enumerable: true, get: function () { return __importDefault(FinancialEntity_1).default; } }); var ParentCategory_1 = require("./category/ParentCategory"); Object.defineProperty(exports, "ParentCategory", { enumerable: true, get: function () { return __importDefault(ParentCategory_1).default; } }); var Transaction_1 = require("./Transaction"); Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return __importDefault(Transaction_1).default; } }); var TransactionList_1 = require("./TransactionList"); Object.defineProperty(exports, "TransactionList", { enumerable: true, get: function () { return __importDefault(TransactionList_1).default; } }); var Budget_1 = require("./Budget"); Object.defineProperty(exports, "Budget", { enumerable: true, get: function () { return __importDefault(Budget_1).default; } }); var Resume_1 = require("./insights/resume/Resume"); Object.defineProperty(exports, "Resume", { enumerable: true, get: function () { return __importDefault(Resume_1).default; } }); var Analysis_1 = require("./insights/analysis/Analysis"); Object.defineProperty(exports, "Analysis", { enumerable: true, get: function () { return __importDefault(Analysis_1).default; } }); },{"./Account":10,"./Budget":11,"./FinancialEntity":12,"./Transaction":14,"./TransactionList":15,"./category/Category":16,"./category/ParentCategory":17,"./insights/analysis/Analysis":19,"./insights/resume/Resume":26}],19:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const CategoryAnalysis_1 = __importDefault(require("./CategoryAnalysis")); class Analysis { constructor({ date, categories }) { this._date = date; this._categories = categories.map((cat) => new CategoryAnalysis_1.default(cat)); } get date() { return this._date; } get categories() { return this._categories; } } exports.default = Analysis; },{"./CategoryAnalysis":20}],20:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const SubcategoryAnalysis_1 = __importDefault(require("./SubcategoryAnalysis")); class CategoryAnalysis { constructor({ categoryId, amount, subcategories }) { this._categoryId = categoryId; this._amount = amount; this._subcategories = subcategories ? subcategories.map((subcat) => new SubcategoryAnalysis_1.default(subcat)) : []; } get categoryId() { return this._categoryId; } get amount() { return this._amount; } get subcategories() { return this._subcategories; } } exports.default = CategoryAnalysis; },{"./SubcategoryAnalysis":21}],21:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const TransactionAnalysis_1 = __importDefault(require("./TransactionAnalysis")); class SubcategoryAnalysis { constructor({ categoryId, amount, average, quantity, transactions, }) { this._categoryId = categoryId; this._amount = amount; this._average = average; this._quantity = quantity; this._transactions = transactions ? transactions.map((transaction) => new TransactionAnalysis_1.default(transaction)) : []; } get categoryId() { return this._categoryId; } get amount() { return this._amount; } get average() { return this._average; } get quantity() { return this._quantity; } get transactions() { return this._transactions; } } exports.default = SubcategoryAnalysis; },{"./TransactionAnalysis":22}],22:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class TransactionAnalysis { constructor({ accounts, description, average, quantity, amount, }) { this._accounts = accounts; this._description = description; this._average = average; this._quantity = quantity; this._amount = amount; } get average() { return this._average; } get description() { return this._description; } get amount() { return this._amount; } get quantity() { return this._quantity; } get accounts() { return this._accounts; } get plainObject() { return { accounts: this._accounts.toString(), description: this._description, average: this._average, quantity: this._quantity, amount: this._amount, }; } } exports.default = TransactionAnalysis; },{}],23:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Balance { constructor({ date, incomes, expenses }) { this._incomes = incomes; this._expenses = expenses; this._date = date; } get date() { return this._date; } set date(date) { this._date = date; } get incomes() { return this._incomes; } set incomes(incomes) { this._incomes = incomes; } get expenses() { return this._expenses; } set expenses(expenses) { this._expenses = expenses; } } exports.default = Balance; },{}],24:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const SubcategoryResume_1 = __importDefault(require("./SubcategoryResume")); class CategoryResume { constructor({ categoryId, amount, subcategories }) { this._categoryId = categoryId; this._amount = amount; this._subcategories = subcategories ? subcategories.map((subcat) => new SubcategoryResume_1.default(subcat)) : []; } get categoryId() { return this._categoryId; } get amount() { return this._amount; } get subcategories() { return this._subcategories; } } exports.default = CategoryResume; },{"./SubcategoryResume":28}],25:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const CategoryResume_1 = __importDefault(require("./CategoryResume")); class IncomeExpense { constructor({ date, categories, amount }) { this._date = date; this._categories = categories.map((cat) => new CategoryResume_1.default(cat)); this._amount = amount; } get date() { return this._date; } get categories() { return this._categories; } get amount() { return this._amount; } } exports.default = IncomeExpense; },{"./CategoryResume":24}],26:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Balance_1 = __importDefault(require("./Balance")); const IncomeExpense_1 = __importDefault(require("./IncomeExpense")); class Resume { constructor({ incomes, expenses, balances }) { this._incomes = incomes.map((income) => new IncomeExpense_1.default(income)); this._expenses = expenses.map((expense) => new IncomeExpense_1.default(expense)); this._balances = balances.map((balance) => new Balance_1.default(balance)); } get incomes() { return this._incomes; } get expenses() { return this._expenses; } get balances() { return this._balances; } } exports.default = Resume; },{"./Balance":23,"./IncomeExpense":25}],27:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class ResumeTransaction { constructor({ id, accountId, amount, categoryId, charge, date, dateCreated, description, lastUpdated, }) { this._id = id; this._accountId = accountId; this._amount = amount; this._charge = charge; this._date = date; this._description = description; this._categoryId = categoryId; this._dateCreated = dateCreated; this._lastUpdated = lastUpdated; } get id() { return this._id; } get accountId() { return this._accountId; } get charge() { return this._charge; } set charge(value) { this._charge = value; } get date() { return this._date; } set date(value) { this._date = value; } get dateCreated() { return this._dateCreated; } get description() { return this._description; } get amount() { return this._amount; } get categoryId() { return this._categoryId; } get lastUpdated() { return this._lastUpdated; } get plainObject() { return { id: this._id, accountId: this._accountId, charge: this._charge, description: this._description, amount: this._amount, date: this._date, dateCreated: this._dateCreated, lastUpdated: this.lastUpdated, categoryId: this._categoryId, }; } } exports.default = ResumeTransaction; },{}],28:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const TransactionsByDate_1 = __importDefault(require("./TransactionsByDate")); class SubcategoryResume { constructor({ categoryId, amount, transactionsByDate }) { this._categoryId = categoryId; this._amount = amount; this._transactionsByDate = transactionsByDate ? transactionsByDate.map((transaction) => new TransactionsByDate_1.default(transaction)) : []; } get categoryId() { return this._categoryId; } get amount() { return this._amount; } get transactionsByDate() { return this._transactionsByDate; } } exports.default = SubcategoryResume; },{"./TransactionsByDate":29}],29:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const ResumeTransaction_1 = __importDefault(require("./ResumeTransaction")); class TransactionsByDate { constructor({ date, transactions }) { this._date = date; this._transactions = transactions.map((transaction) => new ResumeTransaction_1.default(transaction)); } get date() { return this._date; } get transactions() { return this._transactions; } } exports.default = TransactionsByDate; },{"./ResumeTransaction":27}],30:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class AccountPayload { constructor(_financialEntityId, _nature, _name, _number, _balance, _chargeable) { this._financialEntityId = _financialEntityId; this._nature = _nature; this._name = _name; this._number = _number; this._balance = _balance; this._chargeable = _chargeable; } get financialEntityId() { return this._financialEntityId; } set financialEntityId(value) { this._financialEntityId = value; } get nature() { return this._nature; } set nature(value) { this._nature = value; } get name() { return this._name; } set name(value) { this._name = value; } get number() { return this._number; } set number(value) { this._number = value; } get balance() { return this._balance; } set balance(value) { this._balance = value; } get chargeable() { return this._chargeable; } set chargeable(value) { this._chargeable = value; } get plainObject() { return { financialEntityId: this._financialEntityId, nature: this._nature, name: this._name, number: this._number, balance: this._balance, chargeable: this._chargeable, }; } } exports.default = AccountPayload; },{}],31:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class BudgetPayload { constructor(_name, _amount, _warningPercentage, _categoryId) { this._name = _name; this._amount = _amount; this._warningPercentage = _warningPercentage; this._categoryId = _categoryId; } get categoryId() { return this._categoryId; } set categoryId(categoryId) { this._categoryId = categoryId; } get name() { return this._name; } set name(name) { this._name = name; } get amount() { return this._amount; } set amount(amount) { this._amount = amount; } get warningPercentage() { return this._warningPercentage; } set warningPercentage(warningPercentage) { this._warningPercentage = warningPercentage; } get plainObject() { return { categoryId: this._categoryId, name: this._name, amount: this._amount, warningPercentage: this.warningPercentage, }; } } exports.default = BudgetPayload; },{}],32:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class CategoryPayload { constructor(_name, _color, _parentCategoryId) { this._name = _name; this._color = _color; this._parentCategoryId = _parentCategoryId; } get name() { return this._name; } set name(name) { this._name = name; } get color() { return this._color; } set color(color) { this._color = color; } get parentCategoryId() { return this._parentCategoryId; } set parentCategoryId(parentCategoryId) { this._parentCategoryId = parentCategoryId; } get plainObject() { return { name: this._name, color: this._color, parentCategoryId: this._parentCategoryId, }; } } exports.default = CategoryPayload; },{}],33:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class TransactionPayload { constructor(_accountId, _date, _charge, _description, _amount, _categoryId, _calculable) { this._accountId = _accountId; this._date = _date; this._charge = _charge; this._description = _description; this._amount = _amount; this._categoryId = _categoryId; this._calculable = _calculable; } get charge() { return this._charge; } set charge(value) { this._charge = value; } get date() { return this._date; } set date(value) { this._date = value; } get description() { return this._description; } get amount() { return this._amount; } get categoryId() { return this._categoryId; } get accountId() { return this._accountId; } set accountId(value) { this._accountId = value; } get calculable() { return this._calculable; } set calculable(value) { this._calculable = value; } get plainObject() { return { accountId: this._accountId, amount: this._amount, categoryId: this._categoryId, charge: this._charge, date: this._date, description: this._description, calculable: this._calculable, }; } } exports.default = TransactionPayload; },{}],34:[function(require,module,exports){ "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TransactionPayload = exports.BudgetPayload = exports.CategoryPayload = exports.AccountPayload = void 0; var AccountPayload_1 = require("./AccountPayload"); Object.defineProperty(exports, "AccountPayload", { enumerable: true, get: function () { return __importDefault(AccountPayload_1).default; } }); var CategoryPayload_1 = require("./CategoryPayload"); Object.def