@memori.ai/memori-api-client 1.0.0 → 1.2.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.
- package/CHANGELOG.md +30 -0
- package/dist/backend/memori.d.ts +21 -1
- package/dist/backend/user.d.ts +2 -2
- package/dist/engine/importExport.d.ts +21 -4
- package/dist/memori-api-client.cjs.development.js +136 -15
- package/dist/memori-api-client.cjs.development.js.map +1 -1
- package/dist/memori-api-client.cjs.production.min.js +1 -1
- package/dist/memori-api-client.cjs.production.min.js.map +1 -1
- package/dist/memori-api-client.esm.js +136 -15
- package/dist/memori-api-client.esm.js.map +1 -1
- package/dist/types.d.ts +80 -23
- package/package.json +1 -1
- package/src/backend/memori.ts +51 -1
- package/src/backend/user.ts +2 -2
- package/src/engine/importExport.ts +44 -8
- package/src/helpers/getApiUrl.ts +2 -3
- package/src/types.ts +84 -25
|
@@ -399,7 +399,7 @@ function _extends() {
|
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
var getApiUrl = function getApiUrl(hostname) {
|
|
402
|
-
return hostname ? new URL(hostname.startsWith('http') ? hostname : "https://" + hostname).origin
|
|
402
|
+
return hostname ? new URL(hostname.startsWith('http') ? hostname : "https://" + hostname).origin : 'https://backend.memori.ai';
|
|
403
403
|
};
|
|
404
404
|
|
|
405
405
|
var apiFetcher = function apiFetcher(path, opts) {
|
|
@@ -462,12 +462,38 @@ var memori = (function (apiUrl) {
|
|
|
462
462
|
});
|
|
463
463
|
},
|
|
464
464
|
|
|
465
|
+
/**
|
|
466
|
+
* Gets a list of Memori objects owned by the specified user.
|
|
467
|
+
* @param {string} tenantName - The name of the tenant
|
|
468
|
+
* @param {string} userID - The user name
|
|
469
|
+
* @param {string=} authToken - The login token
|
|
470
|
+
* @returns A list of Memori objects
|
|
471
|
+
*/
|
|
472
|
+
getUserByIDMemoriList: function getUserByIDMemoriList(tenantName, userID, authToken) {
|
|
473
|
+
return apiFetcher("/UserMemoriByID/" + tenantName + "/" + userID + (authToken ? "/" + authToken : ''), {
|
|
474
|
+
apiUrl: apiUrl
|
|
475
|
+
});
|
|
476
|
+
},
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Gets a list of Memori objects owned by the specified user.
|
|
480
|
+
* @param {string} tenantName - The name of the tenant
|
|
481
|
+
* @param {string} userName - The user name
|
|
482
|
+
* @param {string=} authToken - The login token
|
|
483
|
+
* @returns A list of Memori objects
|
|
484
|
+
*/
|
|
485
|
+
getUserMemoriList: function getUserMemoriList(tenantName, userName, authToken) {
|
|
486
|
+
return apiFetcher("/UserMemori/" + tenantName + "/" + userName + (authToken ? "/" + authToken : ''), {
|
|
487
|
+
apiUrl: apiUrl
|
|
488
|
+
});
|
|
489
|
+
},
|
|
490
|
+
|
|
465
491
|
/**
|
|
466
492
|
* Gets a list of Memori objects for the currently logged in User.
|
|
467
493
|
* @param authToken - The login token
|
|
468
494
|
* @returns A list of Memori objects
|
|
469
495
|
*/
|
|
470
|
-
|
|
496
|
+
getMemoriList: function getMemoriList(authToken) {
|
|
471
497
|
return apiFetcher("/Memori/" + authToken, {
|
|
472
498
|
apiUrl: apiUrl
|
|
473
499
|
});
|
|
@@ -636,7 +662,7 @@ var user = (function (apiUrl) {
|
|
|
636
662
|
* @param user - The user object
|
|
637
663
|
* @returns The created user object
|
|
638
664
|
*/
|
|
639
|
-
|
|
665
|
+
userSignUp: function userSignUp(user) {
|
|
640
666
|
return apiFetcher('/User', {
|
|
641
667
|
apiUrl: apiUrl,
|
|
642
668
|
body: user,
|
|
@@ -649,7 +675,7 @@ var user = (function (apiUrl) {
|
|
|
649
675
|
* @param user - The user object
|
|
650
676
|
* @returns The created user object
|
|
651
677
|
*/
|
|
652
|
-
|
|
678
|
+
userConfirmSignUp: function userConfirmSignUp(user) {
|
|
653
679
|
return apiFetcher('/UserConfirm', {
|
|
654
680
|
apiUrl: apiUrl,
|
|
655
681
|
body: user,
|
|
@@ -1633,11 +1659,11 @@ var importExport = (function (apiUrl) {
|
|
|
1633
1659
|
/**
|
|
1634
1660
|
* Imports memories from a CSV file.
|
|
1635
1661
|
* @param {string} sessionId The session ID
|
|
1636
|
-
* @param {string[]}
|
|
1637
|
-
* @param {
|
|
1662
|
+
* @param {string[]} rows Rows of the CSV file.
|
|
1663
|
+
* @param {ImportParams} params The specifications and content of the CSV file
|
|
1638
1664
|
*/
|
|
1639
1665
|
importCSV: function () {
|
|
1640
|
-
var _importCSV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId,
|
|
1666
|
+
var _importCSV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId, rows, params) {
|
|
1641
1667
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1642
1668
|
while (1) {
|
|
1643
1669
|
switch (_context.prev = _context.next) {
|
|
@@ -1646,7 +1672,7 @@ var importExport = (function (apiUrl) {
|
|
|
1646
1672
|
method: 'POST',
|
|
1647
1673
|
apiUrl: apiUrl,
|
|
1648
1674
|
body: _extends({
|
|
1649
|
-
|
|
1675
|
+
rows: rows
|
|
1650
1676
|
}, params)
|
|
1651
1677
|
}));
|
|
1652
1678
|
|
|
@@ -1665,6 +1691,101 @@ var importExport = (function (apiUrl) {
|
|
|
1665
1691
|
return importCSV;
|
|
1666
1692
|
}(),
|
|
1667
1693
|
|
|
1694
|
+
/**
|
|
1695
|
+
* Gets the status of an ongoing Import process.
|
|
1696
|
+
* @param {string} importID The import process ID
|
|
1697
|
+
*/
|
|
1698
|
+
importStatus: function () {
|
|
1699
|
+
var _importStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(importID) {
|
|
1700
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1701
|
+
while (1) {
|
|
1702
|
+
switch (_context2.prev = _context2.next) {
|
|
1703
|
+
case 0:
|
|
1704
|
+
return _context2.abrupt("return", apiFetcher("/ImportExport/ImportStatus/" + importID, {
|
|
1705
|
+
method: 'GET',
|
|
1706
|
+
apiUrl: apiUrl
|
|
1707
|
+
}));
|
|
1708
|
+
|
|
1709
|
+
case 1:
|
|
1710
|
+
case "end":
|
|
1711
|
+
return _context2.stop();
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
}, _callee2);
|
|
1715
|
+
}));
|
|
1716
|
+
|
|
1717
|
+
function importStatus(_x4) {
|
|
1718
|
+
return _importStatus.apply(this, arguments);
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
return importStatus;
|
|
1722
|
+
}(),
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* Interrupts an ongoing Import process.
|
|
1726
|
+
* @param {string} importID The import process ID
|
|
1727
|
+
*/
|
|
1728
|
+
stopImport: function () {
|
|
1729
|
+
var _stopImport = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(importID) {
|
|
1730
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1731
|
+
while (1) {
|
|
1732
|
+
switch (_context3.prev = _context3.next) {
|
|
1733
|
+
case 0:
|
|
1734
|
+
return _context3.abrupt("return", apiFetcher("/ImportExport/StopImport/" + importID, {
|
|
1735
|
+
method: 'POST',
|
|
1736
|
+
apiUrl: apiUrl
|
|
1737
|
+
}));
|
|
1738
|
+
|
|
1739
|
+
case 1:
|
|
1740
|
+
case "end":
|
|
1741
|
+
return _context3.stop();
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
}, _callee3);
|
|
1745
|
+
}));
|
|
1746
|
+
|
|
1747
|
+
function stopImport(_x5) {
|
|
1748
|
+
return _stopImport.apply(this, arguments);
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
return stopImport;
|
|
1752
|
+
}(),
|
|
1753
|
+
|
|
1754
|
+
/**
|
|
1755
|
+
* Imports memories from a TXT file.
|
|
1756
|
+
* @param {string} sessionId The session ID
|
|
1757
|
+
* @param {string[]} rows Rows of the TXT file.
|
|
1758
|
+
* @param {ImportCSVParams} params The specifications and content of the TXT file
|
|
1759
|
+
*/
|
|
1760
|
+
importTXT: function () {
|
|
1761
|
+
var _importTXT = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sessionId, rows, params) {
|
|
1762
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1763
|
+
while (1) {
|
|
1764
|
+
switch (_context4.prev = _context4.next) {
|
|
1765
|
+
case 0:
|
|
1766
|
+
return _context4.abrupt("return", apiFetcher("/ImportExport/ImportTXT/" + sessionId, {
|
|
1767
|
+
method: 'POST',
|
|
1768
|
+
apiUrl: apiUrl,
|
|
1769
|
+
body: _extends({
|
|
1770
|
+
rows: rows
|
|
1771
|
+
}, params)
|
|
1772
|
+
}));
|
|
1773
|
+
|
|
1774
|
+
case 1:
|
|
1775
|
+
case "end":
|
|
1776
|
+
return _context4.stop();
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
}, _callee4);
|
|
1780
|
+
}));
|
|
1781
|
+
|
|
1782
|
+
function importTXT(_x6, _x7, _x8) {
|
|
1783
|
+
return _importTXT.apply(this, arguments);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
return importTXT;
|
|
1787
|
+
}(),
|
|
1788
|
+
|
|
1668
1789
|
/**
|
|
1669
1790
|
* Exports memories to a CSV file.
|
|
1670
1791
|
* @param {string} sessionID The session ID
|
|
@@ -1672,12 +1793,12 @@ var importExport = (function (apiUrl) {
|
|
|
1672
1793
|
* @returns The CSV file content
|
|
1673
1794
|
*/
|
|
1674
1795
|
exportCSV: function () {
|
|
1675
|
-
var _exportCSV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1676
|
-
return _regeneratorRuntime().wrap(function
|
|
1796
|
+
var _exportCSV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sessionID, params) {
|
|
1797
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1677
1798
|
while (1) {
|
|
1678
|
-
switch (
|
|
1799
|
+
switch (_context5.prev = _context5.next) {
|
|
1679
1800
|
case 0:
|
|
1680
|
-
return
|
|
1801
|
+
return _context5.abrupt("return", apiFetcher("/ImportExport/ExportCSV/" + sessionID, {
|
|
1681
1802
|
method: 'POST',
|
|
1682
1803
|
apiUrl: apiUrl,
|
|
1683
1804
|
body: params,
|
|
@@ -1686,13 +1807,13 @@ var importExport = (function (apiUrl) {
|
|
|
1686
1807
|
|
|
1687
1808
|
case 1:
|
|
1688
1809
|
case "end":
|
|
1689
|
-
return
|
|
1810
|
+
return _context5.stop();
|
|
1690
1811
|
}
|
|
1691
1812
|
}
|
|
1692
|
-
},
|
|
1813
|
+
}, _callee5);
|
|
1693
1814
|
}));
|
|
1694
1815
|
|
|
1695
|
-
function exportCSV(
|
|
1816
|
+
function exportCSV(_x9, _x10) {
|
|
1696
1817
|
return _exportCSV.apply(this, arguments);
|
|
1697
1818
|
}
|
|
1698
1819
|
|