node-appwrite 16.0.0 → 17.0.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.
Files changed (92) hide show
  1. package/README.md +2 -2
  2. package/dist/client.js +3 -3
  3. package/dist/client.js.map +1 -1
  4. package/dist/client.mjs +3 -3
  5. package/dist/client.mjs.map +1 -1
  6. package/dist/enums/adapter.d.mts +6 -0
  7. package/dist/enums/adapter.d.ts +6 -0
  8. package/dist/enums/adapter.js +11 -0
  9. package/dist/enums/adapter.js.map +1 -0
  10. package/dist/enums/adapter.mjs +10 -0
  11. package/dist/enums/adapter.mjs.map +1 -0
  12. package/dist/enums/build-runtime.d.mts +67 -0
  13. package/dist/enums/build-runtime.d.ts +67 -0
  14. package/dist/enums/build-runtime.js +72 -0
  15. package/dist/enums/build-runtime.js.map +1 -0
  16. package/dist/enums/build-runtime.mjs +71 -0
  17. package/dist/enums/build-runtime.mjs.map +1 -0
  18. package/dist/enums/deployment-download-type.d.mts +6 -0
  19. package/dist/enums/deployment-download-type.d.ts +6 -0
  20. package/dist/enums/deployment-download-type.js +11 -0
  21. package/dist/enums/deployment-download-type.js.map +1 -0
  22. package/dist/enums/deployment-download-type.mjs +10 -0
  23. package/dist/enums/deployment-download-type.mjs.map +1 -0
  24. package/dist/enums/framework.d.mts +18 -0
  25. package/dist/enums/framework.d.ts +18 -0
  26. package/dist/enums/framework.js +23 -0
  27. package/dist/enums/framework.js.map +1 -0
  28. package/dist/enums/framework.mjs +22 -0
  29. package/dist/enums/framework.mjs.map +1 -0
  30. package/dist/enums/image-format.d.mts +0 -1
  31. package/dist/enums/image-format.d.ts +0 -1
  32. package/dist/enums/image-format.js +0 -1
  33. package/dist/enums/image-format.js.map +1 -1
  34. package/dist/enums/image-format.mjs +0 -1
  35. package/dist/enums/image-format.mjs.map +1 -1
  36. package/dist/enums/runtime.d.mts +5 -1
  37. package/dist/enums/runtime.d.ts +5 -1
  38. package/dist/enums/runtime.js +4 -0
  39. package/dist/enums/runtime.js.map +1 -1
  40. package/dist/enums/runtime.mjs +4 -0
  41. package/dist/enums/runtime.mjs.map +1 -1
  42. package/dist/enums/v-c-s-deployment-type.d.mts +7 -0
  43. package/dist/enums/v-c-s-deployment-type.d.ts +7 -0
  44. package/dist/enums/v-c-s-deployment-type.js +12 -0
  45. package/dist/enums/v-c-s-deployment-type.js.map +1 -0
  46. package/dist/enums/v-c-s-deployment-type.mjs +11 -0
  47. package/dist/enums/v-c-s-deployment-type.mjs.map +1 -0
  48. package/dist/index.d.mts +7 -0
  49. package/dist/index.d.ts +7 -0
  50. package/dist/index.js +35 -0
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.mjs +7 -0
  53. package/dist/index.mjs.map +1 -1
  54. package/dist/models.d.mts +286 -48
  55. package/dist/models.d.ts +286 -48
  56. package/dist/services/databases.d.mts +44 -2
  57. package/dist/services/databases.d.ts +44 -2
  58. package/dist/services/databases.js +151 -12
  59. package/dist/services/databases.js.map +1 -1
  60. package/dist/services/databases.mjs +151 -12
  61. package/dist/services/databases.mjs.map +1 -1
  62. package/dist/services/functions.d.mts +56 -30
  63. package/dist/services/functions.d.ts +56 -30
  64. package/dist/services/functions.js +185 -87
  65. package/dist/services/functions.js.map +1 -1
  66. package/dist/services/functions.mjs +185 -87
  67. package/dist/services/functions.mjs.map +1 -1
  68. package/dist/services/sites.d.mts +286 -0
  69. package/dist/services/sites.d.ts +286 -0
  70. package/dist/services/sites.js +923 -0
  71. package/dist/services/sites.js.map +1 -0
  72. package/dist/services/sites.mjs +922 -0
  73. package/dist/services/sites.mjs.map +1 -0
  74. package/dist/services/storage.d.mts +6 -3
  75. package/dist/services/storage.d.ts +6 -3
  76. package/dist/services/storage.js +15 -3
  77. package/dist/services/storage.js.map +1 -1
  78. package/dist/services/storage.mjs +15 -3
  79. package/dist/services/storage.mjs.map +1 -1
  80. package/dist/services/tokens.d.mts +55 -0
  81. package/dist/services/tokens.d.ts +55 -0
  82. package/dist/services/tokens.js +149 -0
  83. package/dist/services/tokens.js.map +1 -0
  84. package/dist/services/tokens.mjs +148 -0
  85. package/dist/services/tokens.mjs.map +1 -0
  86. package/dist/services/users.d.mts +3 -1
  87. package/dist/services/users.d.ts +3 -1
  88. package/dist/services/users.js +9 -1
  89. package/dist/services/users.js.map +1 -1
  90. package/dist/services/users.mjs +9 -1
  91. package/dist/services/users.mjs.map +1 -1
  92. package/package.json +1 -1
@@ -1532,17 +1532,16 @@ class Databases {
1532
1532
  );
1533
1533
  }
1534
1534
  /**
1535
- * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
1536
-
1537
- *
1538
- * @param {string} databaseId
1539
- * @param {string} collectionId
1540
- * @param {string} documentId
1541
- * @param {Omit<Document, keyof Models.Document>} data
1542
- * @param {string[]} permissions
1543
- * @throws {AppwriteException}
1544
- * @returns {Promise<Document>}
1545
- */
1535
+ * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
1536
+ *
1537
+ * @param {string} databaseId
1538
+ * @param {string} collectionId
1539
+ * @param {string} documentId
1540
+ * @param {Omit<Document, keyof Models.Document>} data
1541
+ * @param {string[]} permissions
1542
+ * @throws {AppwriteException}
1543
+ * @returns {Promise<Document>}
1544
+ */
1546
1545
  createDocument(databaseId, collectionId, documentId, data, permissions) {
1547
1546
  if (typeof databaseId === "undefined") {
1548
1547
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
@@ -1578,6 +1577,142 @@ class Databases {
1578
1577
  payload
1579
1578
  );
1580
1579
  }
1580
+ /**
1581
+ * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
1582
+ *
1583
+ * @param {string} databaseId
1584
+ * @param {string} collectionId
1585
+ * @param {object[]} documents
1586
+ * @throws {AppwriteException}
1587
+ * @returns {Promise<Models.DocumentList<Document>>}
1588
+ */
1589
+ createDocuments(databaseId, collectionId, documents) {
1590
+ if (typeof databaseId === "undefined") {
1591
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
1592
+ }
1593
+ if (typeof collectionId === "undefined") {
1594
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
1595
+ }
1596
+ if (typeof documents === "undefined") {
1597
+ throw new client.AppwriteException('Missing required parameter: "documents"');
1598
+ }
1599
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1600
+ const payload = {};
1601
+ if (typeof documents !== "undefined") {
1602
+ payload["documents"] = documents;
1603
+ }
1604
+ const uri = new URL(this.client.config.endpoint + apiPath);
1605
+ const apiHeaders = {
1606
+ "content-type": "application/json"
1607
+ };
1608
+ return this.client.call(
1609
+ "post",
1610
+ uri,
1611
+ apiHeaders,
1612
+ payload
1613
+ );
1614
+ }
1615
+ /**
1616
+ * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
1617
+
1618
+ *
1619
+ * @param {string} databaseId
1620
+ * @param {string} collectionId
1621
+ * @param {object[]} documents
1622
+ * @throws {AppwriteException}
1623
+ * @returns {Promise<Models.DocumentList<Document>>}
1624
+ */
1625
+ upsertDocuments(databaseId, collectionId, documents) {
1626
+ if (typeof databaseId === "undefined") {
1627
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
1628
+ }
1629
+ if (typeof collectionId === "undefined") {
1630
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
1631
+ }
1632
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1633
+ const payload = {};
1634
+ if (typeof documents !== "undefined") {
1635
+ payload["documents"] = documents;
1636
+ }
1637
+ const uri = new URL(this.client.config.endpoint + apiPath);
1638
+ const apiHeaders = {
1639
+ "content-type": "application/json"
1640
+ };
1641
+ return this.client.call(
1642
+ "put",
1643
+ uri,
1644
+ apiHeaders,
1645
+ payload
1646
+ );
1647
+ }
1648
+ /**
1649
+ * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.
1650
+ *
1651
+ * @param {string} databaseId
1652
+ * @param {string} collectionId
1653
+ * @param {object} data
1654
+ * @param {string[]} queries
1655
+ * @throws {AppwriteException}
1656
+ * @returns {Promise<Models.DocumentList<Document>>}
1657
+ */
1658
+ updateDocuments(databaseId, collectionId, data, queries) {
1659
+ if (typeof databaseId === "undefined") {
1660
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
1661
+ }
1662
+ if (typeof collectionId === "undefined") {
1663
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
1664
+ }
1665
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1666
+ const payload = {};
1667
+ if (typeof data !== "undefined") {
1668
+ payload["data"] = data;
1669
+ }
1670
+ if (typeof queries !== "undefined") {
1671
+ payload["queries"] = queries;
1672
+ }
1673
+ const uri = new URL(this.client.config.endpoint + apiPath);
1674
+ const apiHeaders = {
1675
+ "content-type": "application/json"
1676
+ };
1677
+ return this.client.call(
1678
+ "patch",
1679
+ uri,
1680
+ apiHeaders,
1681
+ payload
1682
+ );
1683
+ }
1684
+ /**
1685
+ * Bulk delete documents using queries, if no queries are passed then all documents are deleted.
1686
+ *
1687
+ * @param {string} databaseId
1688
+ * @param {string} collectionId
1689
+ * @param {string[]} queries
1690
+ * @throws {AppwriteException}
1691
+ * @returns {Promise<Models.DocumentList<Document>>}
1692
+ */
1693
+ deleteDocuments(databaseId, collectionId, queries) {
1694
+ if (typeof databaseId === "undefined") {
1695
+ throw new client.AppwriteException('Missing required parameter: "databaseId"');
1696
+ }
1697
+ if (typeof collectionId === "undefined") {
1698
+ throw new client.AppwriteException('Missing required parameter: "collectionId"');
1699
+ }
1700
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1701
+ const payload = {};
1702
+ if (typeof queries !== "undefined") {
1703
+ payload["queries"] = queries;
1704
+ }
1705
+ const uri = new URL(this.client.config.endpoint + apiPath);
1706
+ const apiHeaders = {
1707
+ "content-type": "application/json"
1708
+ };
1709
+ return this.client.call(
1710
+ "delete",
1711
+ uri,
1712
+ apiHeaders,
1713
+ payload
1714
+ );
1715
+ }
1581
1716
  /**
1582
1717
  * Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
1583
1718
  *
@@ -1724,10 +1859,11 @@ class Databases {
1724
1859
  * @param {IndexType} type
1725
1860
  * @param {string[]} attributes
1726
1861
  * @param {string[]} orders
1862
+ * @param {number[]} lengths
1727
1863
  * @throws {AppwriteException}
1728
1864
  * @returns {Promise<Models.Index>}
1729
1865
  */
1730
- createIndex(databaseId, collectionId, key, type, attributes, orders) {
1866
+ createIndex(databaseId, collectionId, key, type, attributes, orders, lengths) {
1731
1867
  if (typeof databaseId === "undefined") {
1732
1868
  throw new client.AppwriteException('Missing required parameter: "databaseId"');
1733
1869
  }
@@ -1757,6 +1893,9 @@ class Databases {
1757
1893
  if (typeof orders !== "undefined") {
1758
1894
  payload["orders"] = orders;
1759
1895
  }
1896
+ if (typeof lengths !== "undefined") {
1897
+ payload["lengths"] = lengths;
1898
+ }
1760
1899
  const uri = new URL(this.client.config.endpoint + apiPath);
1761
1900
  const apiHeaders = {
1762
1901
  "content-type": "application/json"