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
@@ -1531,17 +1531,16 @@ var Databases = class {
1531
1531
  );
1532
1532
  }
1533
1533
  /**
1534
- * 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.
1535
-
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
- */
1534
+ * 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.
1535
+ *
1536
+ * @param {string} databaseId
1537
+ * @param {string} collectionId
1538
+ * @param {string} documentId
1539
+ * @param {Omit<Document, keyof Models.Document>} data
1540
+ * @param {string[]} permissions
1541
+ * @throws {AppwriteException}
1542
+ * @returns {Promise<Document>}
1543
+ */
1545
1544
  createDocument(databaseId, collectionId, documentId, data, permissions) {
1546
1545
  if (typeof databaseId === "undefined") {
1547
1546
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -1577,6 +1576,142 @@ var Databases = class {
1577
1576
  payload
1578
1577
  );
1579
1578
  }
1579
+ /**
1580
+ * 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.
1581
+ *
1582
+ * @param {string} databaseId
1583
+ * @param {string} collectionId
1584
+ * @param {object[]} documents
1585
+ * @throws {AppwriteException}
1586
+ * @returns {Promise<Models.DocumentList<Document>>}
1587
+ */
1588
+ createDocuments(databaseId, collectionId, documents) {
1589
+ if (typeof databaseId === "undefined") {
1590
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1591
+ }
1592
+ if (typeof collectionId === "undefined") {
1593
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1594
+ }
1595
+ if (typeof documents === "undefined") {
1596
+ throw new AppwriteException('Missing required parameter: "documents"');
1597
+ }
1598
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1599
+ const payload = {};
1600
+ if (typeof documents !== "undefined") {
1601
+ payload["documents"] = documents;
1602
+ }
1603
+ const uri = new URL(this.client.config.endpoint + apiPath);
1604
+ const apiHeaders = {
1605
+ "content-type": "application/json"
1606
+ };
1607
+ return this.client.call(
1608
+ "post",
1609
+ uri,
1610
+ apiHeaders,
1611
+ payload
1612
+ );
1613
+ }
1614
+ /**
1615
+ * 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.
1616
+
1617
+ *
1618
+ * @param {string} databaseId
1619
+ * @param {string} collectionId
1620
+ * @param {object[]} documents
1621
+ * @throws {AppwriteException}
1622
+ * @returns {Promise<Models.DocumentList<Document>>}
1623
+ */
1624
+ upsertDocuments(databaseId, collectionId, documents) {
1625
+ if (typeof databaseId === "undefined") {
1626
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1627
+ }
1628
+ if (typeof collectionId === "undefined") {
1629
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1630
+ }
1631
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1632
+ const payload = {};
1633
+ if (typeof documents !== "undefined") {
1634
+ payload["documents"] = documents;
1635
+ }
1636
+ const uri = new URL(this.client.config.endpoint + apiPath);
1637
+ const apiHeaders = {
1638
+ "content-type": "application/json"
1639
+ };
1640
+ return this.client.call(
1641
+ "put",
1642
+ uri,
1643
+ apiHeaders,
1644
+ payload
1645
+ );
1646
+ }
1647
+ /**
1648
+ * 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.
1649
+ *
1650
+ * @param {string} databaseId
1651
+ * @param {string} collectionId
1652
+ * @param {object} data
1653
+ * @param {string[]} queries
1654
+ * @throws {AppwriteException}
1655
+ * @returns {Promise<Models.DocumentList<Document>>}
1656
+ */
1657
+ updateDocuments(databaseId, collectionId, data, queries) {
1658
+ if (typeof databaseId === "undefined") {
1659
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1660
+ }
1661
+ if (typeof collectionId === "undefined") {
1662
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1663
+ }
1664
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1665
+ const payload = {};
1666
+ if (typeof data !== "undefined") {
1667
+ payload["data"] = data;
1668
+ }
1669
+ if (typeof queries !== "undefined") {
1670
+ payload["queries"] = queries;
1671
+ }
1672
+ const uri = new URL(this.client.config.endpoint + apiPath);
1673
+ const apiHeaders = {
1674
+ "content-type": "application/json"
1675
+ };
1676
+ return this.client.call(
1677
+ "patch",
1678
+ uri,
1679
+ apiHeaders,
1680
+ payload
1681
+ );
1682
+ }
1683
+ /**
1684
+ * Bulk delete documents using queries, if no queries are passed then all documents are deleted.
1685
+ *
1686
+ * @param {string} databaseId
1687
+ * @param {string} collectionId
1688
+ * @param {string[]} queries
1689
+ * @throws {AppwriteException}
1690
+ * @returns {Promise<Models.DocumentList<Document>>}
1691
+ */
1692
+ deleteDocuments(databaseId, collectionId, queries) {
1693
+ if (typeof databaseId === "undefined") {
1694
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1695
+ }
1696
+ if (typeof collectionId === "undefined") {
1697
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1698
+ }
1699
+ const apiPath = "/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}", databaseId).replace("{collectionId}", collectionId);
1700
+ const payload = {};
1701
+ if (typeof queries !== "undefined") {
1702
+ payload["queries"] = queries;
1703
+ }
1704
+ const uri = new URL(this.client.config.endpoint + apiPath);
1705
+ const apiHeaders = {
1706
+ "content-type": "application/json"
1707
+ };
1708
+ return this.client.call(
1709
+ "delete",
1710
+ uri,
1711
+ apiHeaders,
1712
+ payload
1713
+ );
1714
+ }
1580
1715
  /**
1581
1716
  * Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
1582
1717
  *
@@ -1723,10 +1858,11 @@ var Databases = class {
1723
1858
  * @param {IndexType} type
1724
1859
  * @param {string[]} attributes
1725
1860
  * @param {string[]} orders
1861
+ * @param {number[]} lengths
1726
1862
  * @throws {AppwriteException}
1727
1863
  * @returns {Promise<Models.Index>}
1728
1864
  */
1729
- createIndex(databaseId, collectionId, key, type, attributes, orders) {
1865
+ createIndex(databaseId, collectionId, key, type, attributes, orders, lengths) {
1730
1866
  if (typeof databaseId === "undefined") {
1731
1867
  throw new AppwriteException('Missing required parameter: "databaseId"');
1732
1868
  }
@@ -1756,6 +1892,9 @@ var Databases = class {
1756
1892
  if (typeof orders !== "undefined") {
1757
1893
  payload["orders"] = orders;
1758
1894
  }
1895
+ if (typeof lengths !== "undefined") {
1896
+ payload["lengths"] = lengths;
1897
+ }
1759
1898
  const uri = new URL(this.client.config.endpoint + apiPath);
1760
1899
  const apiHeaders = {
1761
1900
  "content-type": "application/json"