@appwrite.io/console 2.2.0 → 2.3.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 (709) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/sdk.js +326 -194
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +327 -195
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +326 -194
  8. package/docs/examples/account/create-anonymous-session.md +2 -0
  9. package/docs/examples/account/create-billing-address.md +2 -0
  10. package/docs/examples/account/create-email-password-session.md +2 -0
  11. package/docs/examples/account/create-email-token.md +2 -0
  12. package/docs/examples/account/create-email-verification.md +2 -0
  13. package/docs/examples/account/create-jwt.md +2 -0
  14. package/docs/examples/account/create-key.md +2 -0
  15. package/docs/examples/account/create-magic-url-token.md +2 -0
  16. package/docs/examples/account/create-mfa-authenticator.md +2 -0
  17. package/docs/examples/account/create-mfa-challenge.md +2 -0
  18. package/docs/examples/account/create-mfa-recovery-codes.md +2 -0
  19. package/docs/examples/account/create-o-auth-2-session.md +2 -0
  20. package/docs/examples/account/create-o-auth-2-token.md +2 -0
  21. package/docs/examples/account/create-payment-method.md +2 -0
  22. package/docs/examples/account/create-phone-token.md +2 -0
  23. package/docs/examples/account/create-phone-verification.md +2 -0
  24. package/docs/examples/account/create-push-target.md +2 -0
  25. package/docs/examples/account/create-recovery.md +2 -0
  26. package/docs/examples/account/create-session.md +2 -0
  27. package/docs/examples/account/create-verification.md +2 -0
  28. package/docs/examples/account/create.md +2 -0
  29. package/docs/examples/account/delete-billing-address.md +2 -0
  30. package/docs/examples/account/delete-identity.md +2 -0
  31. package/docs/examples/account/delete-key.md +2 -0
  32. package/docs/examples/account/delete-mfa-authenticator.md +2 -0
  33. package/docs/examples/account/delete-payment-method.md +2 -0
  34. package/docs/examples/account/delete-push-target.md +2 -0
  35. package/docs/examples/account/delete-session.md +2 -0
  36. package/docs/examples/account/delete-sessions.md +2 -0
  37. package/docs/examples/account/delete.md +2 -0
  38. package/docs/examples/account/get-billing-address.md +2 -0
  39. package/docs/examples/account/get-coupon.md +2 -0
  40. package/docs/examples/account/get-key.md +2 -0
  41. package/docs/examples/account/get-mfa-recovery-codes.md +2 -0
  42. package/docs/examples/account/get-payment-method.md +2 -0
  43. package/docs/examples/account/get-prefs.md +2 -0
  44. package/docs/examples/account/get-session.md +2 -0
  45. package/docs/examples/account/get.md +2 -0
  46. package/docs/examples/account/list-billing-addresses.md +2 -0
  47. package/docs/examples/account/list-identities.md +2 -0
  48. package/docs/examples/account/list-invoices.md +2 -0
  49. package/docs/examples/account/list-keys.md +2 -0
  50. package/docs/examples/account/list-logs.md +2 -0
  51. package/docs/examples/account/list-mfa-factors.md +2 -0
  52. package/docs/examples/account/list-payment-methods.md +2 -0
  53. package/docs/examples/account/list-sessions.md +2 -0
  54. package/docs/examples/account/update-billing-address.md +2 -0
  55. package/docs/examples/account/update-email-verification.md +2 -0
  56. package/docs/examples/account/update-email.md +2 -0
  57. package/docs/examples/account/update-key.md +2 -0
  58. package/docs/examples/account/update-magic-url-session.md +2 -0
  59. package/docs/examples/account/update-mfa-authenticator.md +2 -0
  60. package/docs/examples/account/update-mfa-challenge.md +2 -0
  61. package/docs/examples/account/update-mfa-recovery-codes.md +2 -0
  62. package/docs/examples/account/update-mfa.md +2 -0
  63. package/docs/examples/account/update-name.md +2 -0
  64. package/docs/examples/account/update-password.md +2 -0
  65. package/docs/examples/account/update-payment-method-mandate-options.md +2 -0
  66. package/docs/examples/account/update-payment-method-provider.md +2 -0
  67. package/docs/examples/account/update-payment-method.md +2 -0
  68. package/docs/examples/account/update-phone-session.md +2 -0
  69. package/docs/examples/account/update-phone-verification.md +2 -0
  70. package/docs/examples/account/update-phone.md +2 -0
  71. package/docs/examples/account/update-prefs.md +2 -0
  72. package/docs/examples/account/update-push-target.md +2 -0
  73. package/docs/examples/account/update-recovery.md +2 -0
  74. package/docs/examples/account/update-session.md +2 -0
  75. package/docs/examples/account/update-status.md +2 -0
  76. package/docs/examples/account/update-verification.md +2 -0
  77. package/docs/examples/assistant/chat.md +2 -0
  78. package/docs/examples/avatars/get-browser.md +2 -0
  79. package/docs/examples/avatars/get-credit-card.md +2 -0
  80. package/docs/examples/avatars/get-favicon.md +2 -0
  81. package/docs/examples/avatars/get-flag.md +2 -0
  82. package/docs/examples/avatars/get-image.md +2 -0
  83. package/docs/examples/avatars/get-initials.md +2 -0
  84. package/docs/examples/avatars/get-qr.md +2 -0
  85. package/docs/examples/avatars/get-screenshot.md +2 -0
  86. package/docs/examples/backups/create-archive.md +4 -2
  87. package/docs/examples/backups/create-policy.md +4 -2
  88. package/docs/examples/backups/create-restoration.md +4 -2
  89. package/docs/examples/backups/delete-archive.md +2 -0
  90. package/docs/examples/backups/delete-policy.md +2 -0
  91. package/docs/examples/backups/get-archive.md +2 -0
  92. package/docs/examples/backups/get-policy.md +2 -0
  93. package/docs/examples/backups/get-restoration.md +2 -0
  94. package/docs/examples/backups/list-archives.md +2 -0
  95. package/docs/examples/backups/list-policies.md +2 -0
  96. package/docs/examples/backups/list-restorations.md +2 -0
  97. package/docs/examples/backups/update-policy.md +2 -0
  98. package/docs/examples/console/create-program-membership.md +2 -0
  99. package/docs/examples/console/create-source.md +2 -0
  100. package/docs/examples/console/get-campaign.md +2 -0
  101. package/docs/examples/console/get-coupon.md +2 -0
  102. package/docs/examples/console/get-plan.md +2 -0
  103. package/docs/examples/console/get-plans.md +2 -0
  104. package/docs/examples/console/get-program.md +2 -0
  105. package/docs/examples/console/get-resource.md +2 -0
  106. package/docs/examples/console/list-regions.md +2 -0
  107. package/docs/examples/console/suggest-columns.md +2 -0
  108. package/docs/examples/console/suggest-indexes.md +2 -0
  109. package/docs/examples/console/variables.md +2 -0
  110. package/docs/examples/databases/create-boolean-attribute.md +2 -0
  111. package/docs/examples/databases/create-collection.md +2 -0
  112. package/docs/examples/databases/create-datetime-attribute.md +2 -0
  113. package/docs/examples/databases/create-document.md +2 -0
  114. package/docs/examples/databases/create-documents.md +2 -0
  115. package/docs/examples/databases/create-email-attribute.md +2 -0
  116. package/docs/examples/databases/create-enum-attribute.md +2 -0
  117. package/docs/examples/databases/create-float-attribute.md +2 -0
  118. package/docs/examples/databases/create-index.md +2 -0
  119. package/docs/examples/databases/create-integer-attribute.md +2 -0
  120. package/docs/examples/databases/create-ip-attribute.md +2 -0
  121. package/docs/examples/databases/create-line-attribute.md +2 -0
  122. package/docs/examples/databases/create-longtext-attribute.md +2 -0
  123. package/docs/examples/databases/create-mediumtext-attribute.md +2 -0
  124. package/docs/examples/databases/create-operations.md +2 -0
  125. package/docs/examples/databases/create-point-attribute.md +2 -0
  126. package/docs/examples/databases/create-polygon-attribute.md +2 -0
  127. package/docs/examples/databases/create-relationship-attribute.md +2 -0
  128. package/docs/examples/databases/create-string-attribute.md +2 -0
  129. package/docs/examples/databases/create-text-attribute.md +2 -0
  130. package/docs/examples/databases/create-transaction.md +2 -0
  131. package/docs/examples/databases/create-url-attribute.md +2 -0
  132. package/docs/examples/databases/create-varchar-attribute.md +2 -0
  133. package/docs/examples/databases/create.md +2 -0
  134. package/docs/examples/databases/decrement-document-attribute.md +2 -0
  135. package/docs/examples/databases/delete-attribute.md +2 -0
  136. package/docs/examples/databases/delete-collection.md +2 -0
  137. package/docs/examples/databases/delete-document.md +2 -0
  138. package/docs/examples/databases/delete-documents.md +2 -0
  139. package/docs/examples/databases/delete-index.md +2 -0
  140. package/docs/examples/databases/delete-transaction.md +2 -0
  141. package/docs/examples/databases/delete.md +2 -0
  142. package/docs/examples/databases/get-attribute.md +2 -0
  143. package/docs/examples/databases/get-collection-usage.md +2 -0
  144. package/docs/examples/databases/get-collection.md +2 -0
  145. package/docs/examples/databases/get-document.md +2 -0
  146. package/docs/examples/databases/get-index.md +2 -0
  147. package/docs/examples/databases/get-transaction.md +2 -0
  148. package/docs/examples/databases/get-usage.md +2 -0
  149. package/docs/examples/databases/get.md +2 -0
  150. package/docs/examples/databases/increment-document-attribute.md +2 -0
  151. package/docs/examples/databases/list-attributes.md +2 -0
  152. package/docs/examples/databases/list-collection-logs.md +2 -0
  153. package/docs/examples/databases/list-collections.md +2 -0
  154. package/docs/examples/databases/list-document-logs.md +2 -0
  155. package/docs/examples/databases/list-documents.md +2 -0
  156. package/docs/examples/databases/list-indexes.md +2 -0
  157. package/docs/examples/databases/list-logs.md +2 -0
  158. package/docs/examples/databases/list-transactions.md +2 -0
  159. package/docs/examples/databases/list-usage.md +2 -0
  160. package/docs/examples/databases/list.md +2 -0
  161. package/docs/examples/databases/update-boolean-attribute.md +2 -0
  162. package/docs/examples/databases/update-collection.md +2 -0
  163. package/docs/examples/databases/update-datetime-attribute.md +2 -0
  164. package/docs/examples/databases/update-document.md +2 -0
  165. package/docs/examples/databases/update-documents.md +2 -0
  166. package/docs/examples/databases/update-email-attribute.md +2 -0
  167. package/docs/examples/databases/update-enum-attribute.md +2 -0
  168. package/docs/examples/databases/update-float-attribute.md +2 -0
  169. package/docs/examples/databases/update-integer-attribute.md +2 -0
  170. package/docs/examples/databases/update-ip-attribute.md +2 -0
  171. package/docs/examples/databases/update-line-attribute.md +2 -0
  172. package/docs/examples/databases/update-longtext-attribute.md +2 -0
  173. package/docs/examples/databases/update-mediumtext-attribute.md +2 -0
  174. package/docs/examples/databases/update-point-attribute.md +2 -0
  175. package/docs/examples/databases/update-polygon-attribute.md +2 -0
  176. package/docs/examples/databases/update-relationship-attribute.md +2 -0
  177. package/docs/examples/databases/update-string-attribute.md +2 -0
  178. package/docs/examples/databases/update-text-attribute.md +2 -0
  179. package/docs/examples/databases/update-transaction.md +2 -0
  180. package/docs/examples/databases/update-url-attribute.md +2 -0
  181. package/docs/examples/databases/update-varchar-attribute.md +2 -0
  182. package/docs/examples/databases/update.md +2 -0
  183. package/docs/examples/databases/upsert-document.md +2 -0
  184. package/docs/examples/databases/upsert-documents.md +2 -0
  185. package/docs/examples/domains/create-preset-google-workspace.md +2 -0
  186. package/docs/examples/domains/create-preset-i-cloud.md +2 -0
  187. package/docs/examples/domains/create-preset-mailgun.md +2 -0
  188. package/docs/examples/domains/create-preset-outlook.md +2 -0
  189. package/docs/examples/domains/create-preset-proton-mail.md +2 -0
  190. package/docs/examples/domains/create-preset-zoho.md +2 -0
  191. package/docs/examples/domains/create-record-a.md +2 -0
  192. package/docs/examples/domains/create-record-aaaa.md +2 -0
  193. package/docs/examples/domains/create-record-alias.md +2 -0
  194. package/docs/examples/domains/create-record-caa.md +2 -0
  195. package/docs/examples/domains/create-record-cname.md +2 -0
  196. package/docs/examples/domains/create-record-https.md +2 -0
  197. package/docs/examples/domains/create-record-mx.md +2 -0
  198. package/docs/examples/domains/create-record-ns.md +2 -0
  199. package/docs/examples/domains/create-record-srv.md +2 -0
  200. package/docs/examples/domains/create-record-txt.md +2 -0
  201. package/docs/examples/domains/create.md +2 -0
  202. package/docs/examples/domains/delete-record.md +2 -0
  203. package/docs/examples/domains/delete.md +2 -0
  204. package/docs/examples/domains/get-preset-google-workspace.md +2 -0
  205. package/docs/examples/domains/get-preset-i-cloud.md +2 -0
  206. package/docs/examples/domains/get-preset-mailgun.md +2 -0
  207. package/docs/examples/domains/get-preset-outlook.md +2 -0
  208. package/docs/examples/domains/get-preset-proton-mail.md +2 -0
  209. package/docs/examples/domains/get-preset-zoho.md +2 -0
  210. package/docs/examples/domains/get-price.md +17 -0
  211. package/docs/examples/domains/get-record.md +2 -0
  212. package/docs/examples/domains/get-zone.md +2 -0
  213. package/docs/examples/domains/get.md +2 -0
  214. package/docs/examples/domains/list-records.md +2 -0
  215. package/docs/examples/domains/list-suggestions.md +2 -0
  216. package/docs/examples/domains/list.md +2 -0
  217. package/docs/examples/domains/update-nameservers.md +2 -0
  218. package/docs/examples/domains/update-record-a.md +2 -0
  219. package/docs/examples/domains/update-record-aaaa.md +2 -0
  220. package/docs/examples/domains/update-record-alias.md +2 -0
  221. package/docs/examples/domains/update-record-caa.md +2 -0
  222. package/docs/examples/domains/update-record-cname.md +2 -0
  223. package/docs/examples/domains/update-record-https.md +2 -0
  224. package/docs/examples/domains/update-record-mx.md +2 -0
  225. package/docs/examples/domains/update-record-ns.md +2 -0
  226. package/docs/examples/domains/update-record-srv.md +2 -0
  227. package/docs/examples/domains/update-record-txt.md +2 -0
  228. package/docs/examples/domains/update-team.md +2 -0
  229. package/docs/examples/domains/update-zone.md +2 -0
  230. package/docs/examples/functions/create-deployment.md +2 -0
  231. package/docs/examples/functions/create-duplicate-deployment.md +2 -0
  232. package/docs/examples/functions/create-execution.md +2 -0
  233. package/docs/examples/functions/create-template-deployment.md +2 -0
  234. package/docs/examples/functions/create-variable.md +2 -0
  235. package/docs/examples/functions/create-vcs-deployment.md +2 -0
  236. package/docs/examples/functions/create.md +2 -0
  237. package/docs/examples/functions/delete-deployment.md +2 -0
  238. package/docs/examples/functions/delete-execution.md +2 -0
  239. package/docs/examples/functions/delete-variable.md +2 -0
  240. package/docs/examples/functions/delete.md +2 -0
  241. package/docs/examples/functions/get-deployment-download.md +2 -0
  242. package/docs/examples/functions/get-deployment.md +2 -0
  243. package/docs/examples/functions/get-execution.md +2 -0
  244. package/docs/examples/functions/get-template.md +2 -0
  245. package/docs/examples/functions/get-usage.md +2 -0
  246. package/docs/examples/functions/get-variable.md +2 -0
  247. package/docs/examples/functions/get.md +2 -0
  248. package/docs/examples/functions/list-deployments.md +2 -0
  249. package/docs/examples/functions/list-executions.md +2 -0
  250. package/docs/examples/functions/list-runtimes.md +2 -0
  251. package/docs/examples/functions/list-specifications.md +2 -0
  252. package/docs/examples/functions/list-templates.md +2 -0
  253. package/docs/examples/functions/list-usage.md +2 -0
  254. package/docs/examples/functions/list-variables.md +2 -0
  255. package/docs/examples/functions/list.md +2 -0
  256. package/docs/examples/functions/update-deployment-status.md +2 -0
  257. package/docs/examples/functions/update-function-deployment.md +2 -0
  258. package/docs/examples/functions/update-variable.md +2 -0
  259. package/docs/examples/functions/update.md +2 -0
  260. package/docs/examples/graphql/mutation.md +2 -0
  261. package/docs/examples/graphql/query.md +2 -0
  262. package/docs/examples/health/get-antivirus.md +2 -0
  263. package/docs/examples/health/get-cache.md +2 -0
  264. package/docs/examples/health/get-certificate.md +2 -0
  265. package/docs/examples/health/get-db.md +2 -0
  266. package/docs/examples/health/get-failed-jobs.md +2 -0
  267. package/docs/examples/health/get-pub-sub.md +2 -0
  268. package/docs/examples/health/get-queue-audits.md +2 -0
  269. package/docs/examples/health/get-queue-billing-project-aggregation.md +2 -0
  270. package/docs/examples/health/get-queue-billing-team-aggregation.md +2 -0
  271. package/docs/examples/health/get-queue-builds.md +2 -0
  272. package/docs/examples/health/get-queue-certificates.md +2 -0
  273. package/docs/examples/health/get-queue-databases.md +2 -0
  274. package/docs/examples/health/get-queue-deletes.md +2 -0
  275. package/docs/examples/health/get-queue-functions.md +2 -0
  276. package/docs/examples/health/get-queue-logs.md +2 -0
  277. package/docs/examples/health/get-queue-mails.md +2 -0
  278. package/docs/examples/health/get-queue-messaging.md +2 -0
  279. package/docs/examples/health/get-queue-migrations.md +2 -0
  280. package/docs/examples/health/get-queue-priority-builds.md +2 -0
  281. package/docs/examples/health/get-queue-region-manager.md +2 -0
  282. package/docs/examples/health/get-queue-stats-resources.md +2 -0
  283. package/docs/examples/health/get-queue-threats.md +2 -0
  284. package/docs/examples/health/get-queue-usage.md +2 -0
  285. package/docs/examples/health/get-queue-webhooks.md +2 -0
  286. package/docs/examples/health/get-storage-local.md +2 -0
  287. package/docs/examples/health/get-storage.md +2 -0
  288. package/docs/examples/health/get-time.md +2 -0
  289. package/docs/examples/health/get.md +2 -0
  290. package/docs/examples/locale/get.md +2 -0
  291. package/docs/examples/locale/list-codes.md +2 -0
  292. package/docs/examples/locale/list-continents.md +2 -0
  293. package/docs/examples/locale/list-countries-eu.md +2 -0
  294. package/docs/examples/locale/list-countries-phones.md +2 -0
  295. package/docs/examples/locale/list-countries.md +2 -0
  296. package/docs/examples/locale/list-currencies.md +2 -0
  297. package/docs/examples/locale/list-languages.md +2 -0
  298. package/docs/examples/messaging/create-apns-provider.md +2 -0
  299. package/docs/examples/messaging/create-email.md +2 -0
  300. package/docs/examples/messaging/create-fcm-provider.md +2 -0
  301. package/docs/examples/messaging/create-mailgun-provider.md +2 -0
  302. package/docs/examples/messaging/create-msg-91-provider.md +2 -0
  303. package/docs/examples/messaging/create-push.md +2 -0
  304. package/docs/examples/messaging/create-resend-provider.md +2 -0
  305. package/docs/examples/messaging/create-sendgrid-provider.md +2 -0
  306. package/docs/examples/messaging/create-sms.md +2 -0
  307. package/docs/examples/messaging/create-smtp-provider.md +2 -0
  308. package/docs/examples/messaging/create-subscriber.md +2 -0
  309. package/docs/examples/messaging/create-telesign-provider.md +2 -0
  310. package/docs/examples/messaging/create-textmagic-provider.md +2 -0
  311. package/docs/examples/messaging/create-topic.md +2 -0
  312. package/docs/examples/messaging/create-twilio-provider.md +2 -0
  313. package/docs/examples/messaging/create-vonage-provider.md +2 -0
  314. package/docs/examples/messaging/delete-provider.md +2 -0
  315. package/docs/examples/messaging/delete-subscriber.md +2 -0
  316. package/docs/examples/messaging/delete-topic.md +2 -0
  317. package/docs/examples/messaging/delete.md +2 -0
  318. package/docs/examples/messaging/get-message.md +2 -0
  319. package/docs/examples/messaging/get-provider.md +2 -0
  320. package/docs/examples/messaging/get-subscriber.md +2 -0
  321. package/docs/examples/messaging/get-topic.md +2 -0
  322. package/docs/examples/messaging/list-message-logs.md +2 -0
  323. package/docs/examples/messaging/list-messages.md +2 -0
  324. package/docs/examples/messaging/list-provider-logs.md +2 -0
  325. package/docs/examples/messaging/list-providers.md +2 -0
  326. package/docs/examples/messaging/list-subscriber-logs.md +2 -0
  327. package/docs/examples/messaging/list-subscribers.md +2 -0
  328. package/docs/examples/messaging/list-targets.md +2 -0
  329. package/docs/examples/messaging/list-topic-logs.md +2 -0
  330. package/docs/examples/messaging/list-topics.md +2 -0
  331. package/docs/examples/messaging/update-apns-provider.md +2 -0
  332. package/docs/examples/messaging/update-email.md +2 -0
  333. package/docs/examples/messaging/update-fcm-provider.md +2 -0
  334. package/docs/examples/messaging/update-mailgun-provider.md +2 -0
  335. package/docs/examples/messaging/update-msg-91-provider.md +2 -0
  336. package/docs/examples/messaging/update-push.md +2 -0
  337. package/docs/examples/messaging/update-resend-provider.md +2 -0
  338. package/docs/examples/messaging/update-sendgrid-provider.md +2 -0
  339. package/docs/examples/messaging/update-sms.md +2 -0
  340. package/docs/examples/messaging/update-smtp-provider.md +2 -0
  341. package/docs/examples/messaging/update-telesign-provider.md +2 -0
  342. package/docs/examples/messaging/update-textmagic-provider.md +2 -0
  343. package/docs/examples/messaging/update-topic.md +2 -0
  344. package/docs/examples/messaging/update-twilio-provider.md +2 -0
  345. package/docs/examples/messaging/update-vonage-provider.md +2 -0
  346. package/docs/examples/migrations/create-appwrite-migration.md +2 -0
  347. package/docs/examples/migrations/create-csv-export.md +2 -0
  348. package/docs/examples/migrations/create-csv-import.md +2 -0
  349. package/docs/examples/migrations/create-firebase-migration.md +2 -0
  350. package/docs/examples/migrations/create-n-host-migration.md +2 -0
  351. package/docs/examples/migrations/create-supabase-migration.md +2 -0
  352. package/docs/examples/migrations/delete.md +2 -0
  353. package/docs/examples/migrations/get-appwrite-report.md +2 -0
  354. package/docs/examples/migrations/get-firebase-report.md +2 -0
  355. package/docs/examples/migrations/get-n-host-report.md +2 -0
  356. package/docs/examples/migrations/get-supabase-report.md +2 -0
  357. package/docs/examples/migrations/get.md +2 -0
  358. package/docs/examples/migrations/list.md +2 -0
  359. package/docs/examples/migrations/retry.md +2 -0
  360. package/docs/examples/organizations/add-credit.md +2 -0
  361. package/docs/examples/organizations/cancel-downgrade.md +2 -0
  362. package/docs/examples/organizations/create-downgrade-feedback.md +2 -0
  363. package/docs/examples/organizations/create-invoice-payment.md +2 -0
  364. package/docs/examples/organizations/create-key.md +2 -0
  365. package/docs/examples/organizations/create.md +2 -0
  366. package/docs/examples/organizations/delete-backup-payment-method.md +2 -0
  367. package/docs/examples/organizations/delete-billing-address.md +2 -0
  368. package/docs/examples/organizations/delete-default-payment-method.md +2 -0
  369. package/docs/examples/organizations/delete-key.md +2 -0
  370. package/docs/examples/organizations/delete.md +2 -0
  371. package/docs/examples/organizations/estimation-create-organization.md +2 -0
  372. package/docs/examples/organizations/estimation-delete-organization.md +2 -0
  373. package/docs/examples/organizations/estimation-update-plan.md +2 -0
  374. package/docs/examples/organizations/get-aggregation.md +2 -0
  375. package/docs/examples/organizations/get-available-credits.md +2 -0
  376. package/docs/examples/organizations/get-billing-address.md +2 -0
  377. package/docs/examples/organizations/get-credit.md +2 -0
  378. package/docs/examples/organizations/get-invoice-download.md +2 -0
  379. package/docs/examples/organizations/get-invoice-view.md +2 -0
  380. package/docs/examples/organizations/get-invoice.md +2 -0
  381. package/docs/examples/organizations/get-key.md +2 -0
  382. package/docs/examples/organizations/get-payment-method.md +2 -0
  383. package/docs/examples/organizations/get-plan.md +2 -0
  384. package/docs/examples/organizations/get-scopes.md +2 -0
  385. package/docs/examples/organizations/get-usage.md +2 -0
  386. package/docs/examples/organizations/list-aggregations.md +2 -0
  387. package/docs/examples/organizations/list-credits.md +2 -0
  388. package/docs/examples/organizations/list-invoices.md +2 -0
  389. package/docs/examples/organizations/list-keys.md +2 -0
  390. package/docs/examples/organizations/list-regions.md +2 -0
  391. package/docs/examples/organizations/list.md +2 -0
  392. package/docs/examples/organizations/set-backup-payment-method.md +2 -0
  393. package/docs/examples/organizations/set-billing-address.md +2 -0
  394. package/docs/examples/organizations/set-billing-email.md +2 -0
  395. package/docs/examples/organizations/set-billing-tax-id.md +2 -0
  396. package/docs/examples/organizations/set-default-payment-method.md +2 -0
  397. package/docs/examples/organizations/update-budget.md +2 -0
  398. package/docs/examples/organizations/update-key.md +2 -0
  399. package/docs/examples/organizations/update-plan.md +2 -0
  400. package/docs/examples/organizations/validate-invoice.md +2 -0
  401. package/docs/examples/organizations/validate-payment.md +2 -0
  402. package/docs/examples/project/create-variable.md +2 -0
  403. package/docs/examples/project/delete-variable.md +2 -0
  404. package/docs/examples/project/get-usage.md +2 -0
  405. package/docs/examples/project/get-variable.md +2 -0
  406. package/docs/examples/project/list-variables.md +2 -0
  407. package/docs/examples/project/update-variable.md +2 -0
  408. package/docs/examples/projects/create-dev-key.md +2 -0
  409. package/docs/examples/projects/create-jwt.md +2 -0
  410. package/docs/examples/projects/create-key.md +3 -0
  411. package/docs/examples/projects/create-platform.md +2 -0
  412. package/docs/examples/projects/create-smtp-test.md +2 -0
  413. package/docs/examples/projects/create-webhook.md +2 -0
  414. package/docs/examples/projects/create.md +2 -0
  415. package/docs/examples/projects/delete-dev-key.md +2 -0
  416. package/docs/examples/projects/delete-email-template.md +2 -0
  417. package/docs/examples/projects/delete-key.md +2 -0
  418. package/docs/examples/projects/delete-platform.md +2 -0
  419. package/docs/examples/projects/delete-sms-template.md +2 -0
  420. package/docs/examples/projects/delete-webhook.md +2 -0
  421. package/docs/examples/projects/delete.md +2 -0
  422. package/docs/examples/projects/get-dev-key.md +2 -0
  423. package/docs/examples/projects/get-email-template.md +2 -0
  424. package/docs/examples/projects/get-key.md +2 -0
  425. package/docs/examples/projects/get-platform.md +2 -0
  426. package/docs/examples/projects/get-sms-template.md +2 -0
  427. package/docs/examples/projects/get-webhook.md +2 -0
  428. package/docs/examples/projects/get.md +2 -0
  429. package/docs/examples/projects/list-dev-keys.md +2 -0
  430. package/docs/examples/projects/list-keys.md +3 -0
  431. package/docs/examples/projects/list-platforms.md +2 -0
  432. package/docs/examples/projects/list-webhooks.md +2 -0
  433. package/docs/examples/projects/list.md +2 -0
  434. package/docs/examples/projects/update-api-status-all.md +2 -0
  435. package/docs/examples/projects/update-api-status.md +2 -0
  436. package/docs/examples/projects/update-auth-duration.md +2 -0
  437. package/docs/examples/projects/update-auth-limit.md +2 -0
  438. package/docs/examples/projects/update-auth-password-dictionary.md +2 -0
  439. package/docs/examples/projects/update-auth-password-history.md +2 -0
  440. package/docs/examples/projects/update-auth-sessions-limit.md +2 -0
  441. package/docs/examples/projects/update-auth-status.md +2 -0
  442. package/docs/examples/projects/update-dev-key.md +2 -0
  443. package/docs/examples/projects/update-email-template.md +2 -0
  444. package/docs/examples/projects/update-key.md +2 -0
  445. package/docs/examples/projects/update-labels.md +2 -0
  446. package/docs/examples/projects/update-memberships-privacy.md +2 -0
  447. package/docs/examples/projects/update-mock-numbers.md +2 -0
  448. package/docs/examples/projects/update-o-auth-2.md +2 -0
  449. package/docs/examples/projects/update-personal-data-check.md +2 -0
  450. package/docs/examples/projects/update-platform.md +2 -0
  451. package/docs/examples/projects/update-service-status-all.md +2 -0
  452. package/docs/examples/projects/update-service-status.md +2 -0
  453. package/docs/examples/projects/update-session-alerts.md +2 -0
  454. package/docs/examples/projects/update-session-invalidation.md +2 -0
  455. package/docs/examples/projects/update-sms-template.md +2 -0
  456. package/docs/examples/projects/update-smtp.md +2 -0
  457. package/docs/examples/projects/update-team.md +2 -0
  458. package/docs/examples/projects/update-webhook-signature.md +2 -0
  459. package/docs/examples/projects/update-webhook.md +2 -0
  460. package/docs/examples/projects/update.md +2 -0
  461. package/docs/examples/proxy/create-api-rule.md +2 -0
  462. package/docs/examples/proxy/create-function-rule.md +2 -0
  463. package/docs/examples/proxy/create-redirect-rule.md +2 -0
  464. package/docs/examples/proxy/create-site-rule.md +2 -0
  465. package/docs/examples/proxy/delete-rule.md +2 -0
  466. package/docs/examples/proxy/get-rule.md +2 -0
  467. package/docs/examples/proxy/list-rules.md +2 -0
  468. package/docs/examples/proxy/update-rule-verification.md +2 -0
  469. package/docs/examples/sites/create-deployment.md +2 -0
  470. package/docs/examples/sites/create-duplicate-deployment.md +2 -0
  471. package/docs/examples/sites/create-template-deployment.md +2 -0
  472. package/docs/examples/sites/create-variable.md +2 -0
  473. package/docs/examples/sites/create-vcs-deployment.md +2 -0
  474. package/docs/examples/sites/create.md +2 -0
  475. package/docs/examples/sites/delete-deployment.md +2 -0
  476. package/docs/examples/sites/delete-log.md +2 -0
  477. package/docs/examples/sites/delete-variable.md +2 -0
  478. package/docs/examples/sites/delete.md +2 -0
  479. package/docs/examples/sites/get-deployment-download.md +2 -0
  480. package/docs/examples/sites/get-deployment.md +2 -0
  481. package/docs/examples/sites/get-log.md +2 -0
  482. package/docs/examples/sites/get-template.md +2 -0
  483. package/docs/examples/sites/get-usage.md +2 -0
  484. package/docs/examples/sites/get-variable.md +2 -0
  485. package/docs/examples/sites/get.md +2 -0
  486. package/docs/examples/sites/list-deployments.md +2 -0
  487. package/docs/examples/sites/list-frameworks.md +2 -0
  488. package/docs/examples/sites/list-logs.md +2 -0
  489. package/docs/examples/sites/list-specifications.md +2 -0
  490. package/docs/examples/sites/list-templates.md +2 -0
  491. package/docs/examples/sites/list-usage.md +2 -0
  492. package/docs/examples/sites/list-variables.md +2 -0
  493. package/docs/examples/sites/list.md +2 -0
  494. package/docs/examples/sites/update-deployment-status.md +2 -0
  495. package/docs/examples/sites/update-site-deployment.md +2 -0
  496. package/docs/examples/sites/update-variable.md +2 -0
  497. package/docs/examples/sites/update.md +2 -0
  498. package/docs/examples/storage/create-bucket.md +2 -0
  499. package/docs/examples/storage/create-file.md +2 -0
  500. package/docs/examples/storage/delete-bucket.md +2 -0
  501. package/docs/examples/storage/delete-file.md +2 -0
  502. package/docs/examples/storage/get-bucket-usage.md +2 -0
  503. package/docs/examples/storage/get-bucket.md +2 -0
  504. package/docs/examples/storage/get-file-download.md +2 -0
  505. package/docs/examples/storage/get-file-preview.md +2 -0
  506. package/docs/examples/storage/get-file-view.md +2 -0
  507. package/docs/examples/storage/get-file.md +2 -0
  508. package/docs/examples/storage/get-usage.md +2 -0
  509. package/docs/examples/storage/list-buckets.md +2 -0
  510. package/docs/examples/storage/list-files.md +2 -0
  511. package/docs/examples/storage/update-bucket.md +2 -0
  512. package/docs/examples/storage/update-file.md +2 -0
  513. package/docs/examples/tablesdb/create-boolean-column.md +2 -0
  514. package/docs/examples/tablesdb/create-datetime-column.md +2 -0
  515. package/docs/examples/tablesdb/create-email-column.md +2 -0
  516. package/docs/examples/tablesdb/create-enum-column.md +2 -0
  517. package/docs/examples/tablesdb/create-float-column.md +2 -0
  518. package/docs/examples/tablesdb/create-index.md +2 -0
  519. package/docs/examples/tablesdb/create-integer-column.md +2 -0
  520. package/docs/examples/tablesdb/create-ip-column.md +2 -0
  521. package/docs/examples/tablesdb/create-line-column.md +2 -0
  522. package/docs/examples/tablesdb/create-longtext-column.md +2 -0
  523. package/docs/examples/tablesdb/create-mediumtext-column.md +2 -0
  524. package/docs/examples/tablesdb/create-operations.md +2 -0
  525. package/docs/examples/tablesdb/create-point-column.md +2 -0
  526. package/docs/examples/tablesdb/create-polygon-column.md +2 -0
  527. package/docs/examples/tablesdb/create-relationship-column.md +2 -0
  528. package/docs/examples/tablesdb/create-row.md +2 -0
  529. package/docs/examples/tablesdb/create-rows.md +2 -0
  530. package/docs/examples/tablesdb/create-string-column.md +2 -0
  531. package/docs/examples/tablesdb/create-table.md +2 -0
  532. package/docs/examples/tablesdb/create-text-column.md +2 -0
  533. package/docs/examples/tablesdb/create-transaction.md +2 -0
  534. package/docs/examples/tablesdb/create-url-column.md +2 -0
  535. package/docs/examples/tablesdb/create-varchar-column.md +2 -0
  536. package/docs/examples/tablesdb/create.md +2 -0
  537. package/docs/examples/tablesdb/decrement-row-column.md +2 -0
  538. package/docs/examples/tablesdb/delete-column.md +2 -0
  539. package/docs/examples/tablesdb/delete-index.md +2 -0
  540. package/docs/examples/tablesdb/delete-row.md +2 -0
  541. package/docs/examples/tablesdb/delete-rows.md +2 -0
  542. package/docs/examples/tablesdb/delete-table.md +2 -0
  543. package/docs/examples/tablesdb/delete-transaction.md +2 -0
  544. package/docs/examples/tablesdb/delete.md +2 -0
  545. package/docs/examples/tablesdb/get-column.md +2 -0
  546. package/docs/examples/tablesdb/get-index.md +2 -0
  547. package/docs/examples/tablesdb/get-row.md +2 -0
  548. package/docs/examples/tablesdb/get-table-usage.md +2 -0
  549. package/docs/examples/tablesdb/get-table.md +2 -0
  550. package/docs/examples/tablesdb/get-transaction.md +2 -0
  551. package/docs/examples/tablesdb/get-usage.md +2 -0
  552. package/docs/examples/tablesdb/get.md +2 -0
  553. package/docs/examples/tablesdb/increment-row-column.md +2 -0
  554. package/docs/examples/tablesdb/list-columns.md +2 -0
  555. package/docs/examples/tablesdb/list-indexes.md +2 -0
  556. package/docs/examples/tablesdb/list-row-logs.md +2 -0
  557. package/docs/examples/tablesdb/list-rows.md +2 -0
  558. package/docs/examples/tablesdb/list-table-logs.md +2 -0
  559. package/docs/examples/tablesdb/list-tables.md +2 -0
  560. package/docs/examples/tablesdb/list-transactions.md +2 -0
  561. package/docs/examples/tablesdb/list-usage.md +2 -0
  562. package/docs/examples/tablesdb/list.md +2 -0
  563. package/docs/examples/tablesdb/update-boolean-column.md +2 -0
  564. package/docs/examples/tablesdb/update-datetime-column.md +2 -0
  565. package/docs/examples/tablesdb/update-email-column.md +2 -0
  566. package/docs/examples/tablesdb/update-enum-column.md +2 -0
  567. package/docs/examples/tablesdb/update-float-column.md +2 -0
  568. package/docs/examples/tablesdb/update-integer-column.md +2 -0
  569. package/docs/examples/tablesdb/update-ip-column.md +2 -0
  570. package/docs/examples/tablesdb/update-line-column.md +2 -0
  571. package/docs/examples/tablesdb/update-longtext-column.md +2 -0
  572. package/docs/examples/tablesdb/update-mediumtext-column.md +2 -0
  573. package/docs/examples/tablesdb/update-point-column.md +2 -0
  574. package/docs/examples/tablesdb/update-polygon-column.md +2 -0
  575. package/docs/examples/tablesdb/update-relationship-column.md +2 -0
  576. package/docs/examples/tablesdb/update-row.md +2 -0
  577. package/docs/examples/tablesdb/update-rows.md +2 -0
  578. package/docs/examples/tablesdb/update-string-column.md +2 -0
  579. package/docs/examples/tablesdb/update-table.md +2 -0
  580. package/docs/examples/tablesdb/update-text-column.md +2 -0
  581. package/docs/examples/tablesdb/update-transaction.md +2 -0
  582. package/docs/examples/tablesdb/update-url-column.md +2 -0
  583. package/docs/examples/tablesdb/update-varchar-column.md +2 -0
  584. package/docs/examples/tablesdb/update.md +2 -0
  585. package/docs/examples/tablesdb/upsert-row.md +2 -0
  586. package/docs/examples/tablesdb/upsert-rows.md +2 -0
  587. package/docs/examples/teams/create-membership.md +4 -2
  588. package/docs/examples/teams/create.md +2 -0
  589. package/docs/examples/teams/delete-membership.md +2 -0
  590. package/docs/examples/teams/delete.md +2 -0
  591. package/docs/examples/teams/get-membership.md +2 -0
  592. package/docs/examples/teams/get-prefs.md +2 -0
  593. package/docs/examples/teams/get.md +2 -0
  594. package/docs/examples/teams/list-logs.md +2 -0
  595. package/docs/examples/teams/list-memberships.md +2 -0
  596. package/docs/examples/teams/list.md +2 -0
  597. package/docs/examples/teams/update-membership-status.md +2 -0
  598. package/docs/examples/teams/update-membership.md +4 -2
  599. package/docs/examples/teams/update-name.md +2 -0
  600. package/docs/examples/teams/update-prefs.md +2 -0
  601. package/docs/examples/tokens/create-file-token.md +2 -0
  602. package/docs/examples/tokens/delete.md +2 -0
  603. package/docs/examples/tokens/get.md +2 -0
  604. package/docs/examples/tokens/list.md +2 -0
  605. package/docs/examples/tokens/update.md +2 -0
  606. package/docs/examples/users/create-argon-2-user.md +2 -0
  607. package/docs/examples/users/create-bcrypt-user.md +2 -0
  608. package/docs/examples/users/create-jwt.md +2 -0
  609. package/docs/examples/users/create-md-5-user.md +2 -0
  610. package/docs/examples/users/create-mfa-recovery-codes.md +2 -0
  611. package/docs/examples/users/create-ph-pass-user.md +2 -0
  612. package/docs/examples/users/create-scrypt-modified-user.md +2 -0
  613. package/docs/examples/users/create-scrypt-user.md +2 -0
  614. package/docs/examples/users/create-session.md +2 -0
  615. package/docs/examples/users/create-sha-user.md +2 -0
  616. package/docs/examples/users/create-target.md +2 -0
  617. package/docs/examples/users/create-token.md +2 -0
  618. package/docs/examples/users/create.md +2 -0
  619. package/docs/examples/users/delete-identity.md +2 -0
  620. package/docs/examples/users/delete-mfa-authenticator.md +2 -0
  621. package/docs/examples/users/delete-session.md +2 -0
  622. package/docs/examples/users/delete-sessions.md +2 -0
  623. package/docs/examples/users/delete-target.md +2 -0
  624. package/docs/examples/users/delete.md +2 -0
  625. package/docs/examples/users/get-mfa-recovery-codes.md +2 -0
  626. package/docs/examples/users/get-prefs.md +2 -0
  627. package/docs/examples/users/get-target.md +2 -0
  628. package/docs/examples/users/get-usage.md +2 -0
  629. package/docs/examples/users/get.md +2 -0
  630. package/docs/examples/users/list-identities.md +2 -0
  631. package/docs/examples/users/list-logs.md +2 -0
  632. package/docs/examples/users/list-memberships.md +2 -0
  633. package/docs/examples/users/list-mfa-factors.md +2 -0
  634. package/docs/examples/users/list-sessions.md +2 -0
  635. package/docs/examples/users/list-targets.md +2 -0
  636. package/docs/examples/users/list.md +2 -0
  637. package/docs/examples/users/update-email-verification.md +2 -0
  638. package/docs/examples/users/update-email.md +2 -0
  639. package/docs/examples/users/update-labels.md +2 -0
  640. package/docs/examples/users/update-mfa-recovery-codes.md +2 -0
  641. package/docs/examples/users/update-mfa.md +2 -0
  642. package/docs/examples/users/update-name.md +2 -0
  643. package/docs/examples/users/update-password.md +2 -0
  644. package/docs/examples/users/update-phone-verification.md +2 -0
  645. package/docs/examples/users/update-phone.md +2 -0
  646. package/docs/examples/users/update-prefs.md +2 -0
  647. package/docs/examples/users/update-status.md +2 -0
  648. package/docs/examples/users/update-target.md +2 -0
  649. package/docs/examples/vcs/create-repository-detection.md +2 -0
  650. package/docs/examples/vcs/create-repository.md +2 -0
  651. package/docs/examples/vcs/delete-installation.md +2 -0
  652. package/docs/examples/vcs/get-installation.md +2 -0
  653. package/docs/examples/vcs/get-repository-contents.md +2 -0
  654. package/docs/examples/vcs/get-repository.md +2 -0
  655. package/docs/examples/vcs/list-installations.md +2 -0
  656. package/docs/examples/vcs/list-repositories.md +2 -0
  657. package/docs/examples/vcs/list-repository-branches.md +2 -0
  658. package/docs/examples/vcs/update-external-deployments.md +2 -0
  659. package/package.json +1 -1
  660. package/src/channel.ts +30 -18
  661. package/src/client.ts +108 -22
  662. package/src/enums/{services.ts → backup-services.ts} +1 -1
  663. package/src/enums/build-runtime.ts +5 -0
  664. package/src/enums/registration-type.ts +6 -0
  665. package/src/enums/runtime.ts +5 -0
  666. package/src/enums/runtimes.ts +5 -0
  667. package/src/enums/scopes.ts +1 -0
  668. package/src/index.ts +2 -3
  669. package/src/models.ts +45 -3
  670. package/src/services/account.ts +11 -11
  671. package/src/services/avatars.ts +3 -3
  672. package/src/services/backups.ts +28 -28
  673. package/src/services/console.ts +1 -1
  674. package/src/services/databases.ts +1 -1
  675. package/src/services/domains.ts +70 -0
  676. package/src/services/functions.ts +2 -2
  677. package/src/services/graphql.ts +2 -2
  678. package/src/services/health.ts +1 -1
  679. package/src/services/migrations.ts +8 -8
  680. package/src/services/organizations.ts +0 -60
  681. package/src/services/projects.ts +28 -78
  682. package/src/services/realtime.ts +135 -58
  683. package/src/services/sites.ts +2 -2
  684. package/src/services/storage.ts +1 -1
  685. package/src/services/tables-db.ts +1 -1
  686. package/src/services/teams.ts +18 -19
  687. package/src/services/users.ts +1 -1
  688. package/types/channel.d.ts +4 -3
  689. package/types/client.d.ts +7 -2
  690. package/types/enums/{services.d.ts → backup-services.d.ts} +1 -1
  691. package/types/enums/build-runtime.d.ts +6 -1
  692. package/types/enums/registration-type.d.ts +6 -0
  693. package/types/enums/runtime.d.ts +6 -1
  694. package/types/enums/runtimes.d.ts +6 -1
  695. package/types/enums/scopes.d.ts +2 -1
  696. package/types/index.d.ts +2 -3
  697. package/types/models.d.ts +44 -3
  698. package/types/services/backups.d.ts +13 -13
  699. package/types/services/domains.d.ts +26 -0
  700. package/types/services/organizations.d.ts +0 -22
  701. package/types/services/projects.d.ts +8 -25
  702. package/types/services/realtime.d.ts +13 -6
  703. package/types/services/teams.d.ts +8 -9
  704. package/docs/examples/organizations/update-projects.md +0 -14
  705. package/docs/examples/projects/update-status.md +0 -14
  706. package/src/enums/roles.ts +0 -7
  707. package/src/enums/status.ts +0 -4
  708. package/types/enums/roles.d.ts +0 -7
  709. package/types/enums/status.d.ts +0 -4
package/dist/esm/sdk.js CHANGED
@@ -534,7 +534,7 @@ class Client {
534
534
  'x-sdk-name': 'Console',
535
535
  'x-sdk-platform': 'console',
536
536
  'x-sdk-language': 'web',
537
- 'x-sdk-version': '2.2.0',
537
+ 'x-sdk-version': '2.3.0',
538
538
  'X-Appwrite-Response-Format': '1.8.0',
539
539
  };
540
540
  this.realtime = {
@@ -543,7 +543,10 @@ class Client {
543
543
  heartbeat: undefined,
544
544
  url: '',
545
545
  channels: new Set(),
546
+ queries: new Set(),
546
547
  subscriptions: new Map(),
548
+ slotToSubscriptionId: new Map(),
549
+ subscriptionIdToSlot: new Map(),
547
550
  subscriptionsCounter: 0,
548
551
  reconnect: true,
549
552
  reconnectAttempts: 0,
@@ -578,26 +581,34 @@ class Client {
578
581
  }, 20000);
579
582
  },
580
583
  createSocket: () => {
581
- var _a, _b, _c;
582
- if (this.realtime.channels.size < 1) {
584
+ var _a, _b, _c, _d;
585
+ if (this.realtime.subscriptions.size < 1) {
583
586
  this.realtime.reconnect = false;
584
587
  (_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.close();
585
588
  return;
586
589
  }
587
- const channels = new URLSearchParams();
588
- if (this.config.project) {
589
- channels.set('project', this.config.project);
590
- }
590
+ const encodedProject = encodeURIComponent((_b = this.config.project) !== null && _b !== void 0 ? _b : '');
591
+ let queryParams = 'project=' + encodedProject;
591
592
  this.realtime.channels.forEach(channel => {
592
- channels.append('channels[]', channel);
593
+ queryParams += '&channels[]=' + encodeURIComponent(channel);
593
594
  });
594
- const url = this.config.endpointRealtime + '/realtime?' + channels.toString();
595
+ // Per-subscription queries: channel[slot][]=query so server can route events by subscription
596
+ const selectAllQuery = Query.select(['*']).toString();
597
+ this.realtime.subscriptions.forEach((sub, slot) => {
598
+ const queries = sub.queries.length > 0 ? sub.queries : [selectAllQuery];
599
+ sub.channels.forEach(channel => {
600
+ queries.forEach(query => {
601
+ queryParams += '&' + encodeURIComponent(channel) + '[' + slot + '][]=' + encodeURIComponent(query);
602
+ });
603
+ });
604
+ });
605
+ const url = this.config.endpointRealtime + '/realtime?' + queryParams;
595
606
  if (url !== this.realtime.url || // Check if URL is present
596
607
  !this.realtime.socket || // Check if WebSocket has not been created
597
- ((_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.readyState) > WebSocket.OPEN // Check if WebSocket is CLOSING (3) or CLOSED (4)
608
+ ((_c = this.realtime.socket) === null || _c === void 0 ? void 0 : _c.readyState) > WebSocket.OPEN // Check if WebSocket is CLOSING (3) or CLOSED (4)
598
609
  ) {
599
610
  if (this.realtime.socket &&
600
- ((_c = this.realtime.socket) === null || _c === void 0 ? void 0 : _c.readyState) < WebSocket.CLOSING // Close WebSocket if it is CONNECTING (0) or OPEN (1)
611
+ ((_d = this.realtime.socket) === null || _d === void 0 ? void 0 : _d.readyState) < WebSocket.CLOSING // Close WebSocket if it is CONNECTING (0) or OPEN (1)
601
612
  ) {
602
613
  this.realtime.reconnect = false;
603
614
  this.realtime.socket.close();
@@ -633,14 +644,25 @@ class Client {
633
644
  const message = JSONbig.parse(event.data);
634
645
  this.realtime.lastMessage = message;
635
646
  switch (message.type) {
636
- case 'connected':
647
+ case 'connected': {
648
+ const messageData = message.data;
649
+ if (messageData === null || messageData === void 0 ? void 0 : messageData.subscriptions) {
650
+ this.realtime.slotToSubscriptionId.clear();
651
+ this.realtime.subscriptionIdToSlot.clear();
652
+ for (const [slotStr, subscriptionId] of Object.entries(messageData.subscriptions)) {
653
+ const slot = Number(slotStr);
654
+ if (!isNaN(slot) && typeof subscriptionId === 'string') {
655
+ this.realtime.slotToSubscriptionId.set(slot, subscriptionId);
656
+ this.realtime.subscriptionIdToSlot.set(subscriptionId, slot);
657
+ }
658
+ }
659
+ }
637
660
  let session = this.config.session;
638
661
  if (!session) {
639
662
  const cookie = JSONbig.parse((_a = window.localStorage.getItem('cookieFallback')) !== null && _a !== void 0 ? _a : '{}');
640
663
  session = cookie === null || cookie === void 0 ? void 0 : cookie[`a_session_${this.config.project}`];
641
664
  }
642
- const messageData = message.data;
643
- if (session && !messageData.user) {
665
+ if (session && !(messageData === null || messageData === void 0 ? void 0 : messageData.user)) {
644
666
  (_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.send(JSONbig.stringify({
645
667
  type: 'authentication',
646
668
  data: {
@@ -649,12 +671,27 @@ class Client {
649
671
  }));
650
672
  }
651
673
  break;
652
- case 'event':
653
- let data = message.data;
654
- if (data === null || data === void 0 ? void 0 : data.channels) {
674
+ }
675
+ case 'event': {
676
+ const data = message.data;
677
+ if (!(data === null || data === void 0 ? void 0 : data.channels))
678
+ break;
679
+ const eventSubIds = data.subscriptions;
680
+ if (eventSubIds && eventSubIds.length > 0) {
681
+ for (const subscriptionId of eventSubIds) {
682
+ const slot = this.realtime.subscriptionIdToSlot.get(subscriptionId);
683
+ if (slot !== undefined) {
684
+ const subscription = this.realtime.subscriptions.get(slot);
685
+ if (subscription) {
686
+ setTimeout(() => subscription.callback(data));
687
+ }
688
+ }
689
+ }
690
+ }
691
+ else {
655
692
  const isSubscribed = data.channels.some(channel => this.realtime.channels.has(channel));
656
693
  if (!isSubscribed)
657
- return;
694
+ break;
658
695
  this.realtime.subscriptions.forEach(subscription => {
659
696
  if (data.channels.some(channel => subscription.channels.includes(channel))) {
660
697
  setTimeout(() => subscription.callback(data));
@@ -662,6 +699,7 @@ class Client {
662
699
  });
663
700
  }
664
701
  break;
702
+ }
665
703
  case 'pong':
666
704
  break; // Handle pong response if needed
667
705
  case 'error':
@@ -674,7 +712,7 @@ class Client {
674
712
  console.error(e);
675
713
  }
676
714
  },
677
- cleanUp: channels => {
715
+ cleanUp: (channels, queries) => {
678
716
  this.realtime.channels.forEach(channel => {
679
717
  if (channels.includes(channel)) {
680
718
  let found = Array.from(this.realtime.subscriptions).some(([_key, subscription]) => {
@@ -685,6 +723,17 @@ class Client {
685
723
  }
686
724
  }
687
725
  });
726
+ this.realtime.queries.forEach(query => {
727
+ if (queries.includes(query)) {
728
+ let found = Array.from(this.realtime.subscriptions).some(([_key, subscription]) => {
729
+ var _a;
730
+ return (_a = subscription.queries) === null || _a === void 0 ? void 0 : _a.includes(query);
731
+ });
732
+ if (!found) {
733
+ this.realtime.queries.delete(query);
734
+ }
735
+ }
736
+ });
688
737
  }
689
738
  };
690
739
  }
@@ -865,7 +914,7 @@ class Client {
865
914
  * @param {(payload: RealtimeMessage) => void} callback Is called on every realtime update.
866
915
  * @returns {() => void} Unsubscribes from events.
867
916
  */
868
- subscribe(channels, callback) {
917
+ subscribe(channels, callback, queries = []) {
869
918
  const channelArray = Array.isArray(channels) ? channels : [channels];
870
919
  // Convert Channel instances to strings
871
920
  const channelStrings = channelArray.map(ch => {
@@ -880,15 +929,18 @@ class Client {
880
929
  return String(ch);
881
930
  });
882
931
  channelStrings.forEach(channel => this.realtime.channels.add(channel));
932
+ const queryStrings = (queries !== null && queries !== void 0 ? queries : []).map(q => typeof q === 'string' ? q : q.toString());
933
+ queryStrings.forEach(query => this.realtime.queries.add(query));
883
934
  const counter = this.realtime.subscriptionsCounter++;
884
935
  this.realtime.subscriptions.set(counter, {
885
936
  channels: channelStrings,
937
+ queries: queryStrings,
886
938
  callback
887
939
  });
888
940
  this.realtime.connect();
889
941
  return () => {
890
942
  this.realtime.subscriptions.delete(counter);
891
- this.realtime.cleanUp(channelStrings);
943
+ this.realtime.cleanUp(channelStrings, queryStrings);
892
944
  this.realtime.connect();
893
945
  };
894
946
  }
@@ -1660,7 +1712,7 @@ class Account {
1660
1712
  }
1661
1713
  createMfaAuthenticator(paramsOrFirst) {
1662
1714
  let params;
1663
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
1715
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) {
1664
1716
  params = (paramsOrFirst || {});
1665
1717
  }
1666
1718
  else {
@@ -1682,7 +1734,7 @@ class Account {
1682
1734
  }
1683
1735
  createMFAAuthenticator(paramsOrFirst) {
1684
1736
  let params;
1685
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
1737
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) {
1686
1738
  params = (paramsOrFirst || {});
1687
1739
  }
1688
1740
  else {
@@ -1704,7 +1756,7 @@ class Account {
1704
1756
  }
1705
1757
  updateMfaAuthenticator(paramsOrFirst, ...rest) {
1706
1758
  let params;
1707
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
1759
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst || 'otp' in paramsOrFirst))) {
1708
1760
  params = (paramsOrFirst || {});
1709
1761
  }
1710
1762
  else {
@@ -1734,7 +1786,7 @@ class Account {
1734
1786
  }
1735
1787
  updateMFAAuthenticator(paramsOrFirst, ...rest) {
1736
1788
  let params;
1737
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
1789
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst || 'otp' in paramsOrFirst))) {
1738
1790
  params = (paramsOrFirst || {});
1739
1791
  }
1740
1792
  else {
@@ -1764,7 +1816,7 @@ class Account {
1764
1816
  }
1765
1817
  deleteMfaAuthenticator(paramsOrFirst) {
1766
1818
  let params;
1767
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
1819
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) {
1768
1820
  params = (paramsOrFirst || {});
1769
1821
  }
1770
1822
  else {
@@ -1786,7 +1838,7 @@ class Account {
1786
1838
  }
1787
1839
  deleteMFAAuthenticator(paramsOrFirst) {
1788
1840
  let params;
1789
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'type' in paramsOrFirst)) {
1841
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) {
1790
1842
  params = (paramsOrFirst || {});
1791
1843
  }
1792
1844
  else {
@@ -1808,7 +1860,7 @@ class Account {
1808
1860
  }
1809
1861
  createMfaChallenge(paramsOrFirst) {
1810
1862
  let params;
1811
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
1863
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('factor' in paramsOrFirst))) {
1812
1864
  params = (paramsOrFirst || {});
1813
1865
  }
1814
1866
  else {
@@ -1833,7 +1885,7 @@ class Account {
1833
1885
  }
1834
1886
  createMFAChallenge(paramsOrFirst) {
1835
1887
  let params;
1836
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'factor' in paramsOrFirst)) {
1888
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('factor' in paramsOrFirst))) {
1837
1889
  params = (paramsOrFirst || {});
1838
1890
  }
1839
1891
  else {
@@ -2326,7 +2378,7 @@ class Account {
2326
2378
  }
2327
2379
  updatePrefs(paramsOrFirst) {
2328
2380
  let params;
2329
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'prefs' in paramsOrFirst)) {
2381
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('prefs' in paramsOrFirst))) {
2330
2382
  params = (paramsOrFirst || {});
2331
2383
  }
2332
2384
  else {
@@ -2534,7 +2586,7 @@ class Account {
2534
2586
  }
2535
2587
  createOAuth2Session(paramsOrFirst, ...rest) {
2536
2588
  let params;
2537
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
2589
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('provider' in paramsOrFirst || 'success' in paramsOrFirst || 'failure' in paramsOrFirst || 'scopes' in paramsOrFirst))) {
2538
2590
  params = (paramsOrFirst || {});
2539
2591
  }
2540
2592
  else {
@@ -2894,7 +2946,7 @@ class Account {
2894
2946
  }
2895
2947
  createOAuth2Token(paramsOrFirst, ...rest) {
2896
2948
  let params;
2897
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'provider' in paramsOrFirst)) {
2949
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('provider' in paramsOrFirst || 'success' in paramsOrFirst || 'failure' in paramsOrFirst || 'scopes' in paramsOrFirst))) {
2898
2950
  params = (paramsOrFirst || {});
2899
2951
  }
2900
2952
  else {
@@ -3141,7 +3193,7 @@ class Avatars {
3141
3193
  }
3142
3194
  getBrowser(paramsOrFirst, ...rest) {
3143
3195
  let params;
3144
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
3196
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) {
3145
3197
  params = (paramsOrFirst || {});
3146
3198
  }
3147
3199
  else {
@@ -3179,7 +3231,7 @@ class Avatars {
3179
3231
  }
3180
3232
  getCreditCard(paramsOrFirst, ...rest) {
3181
3233
  let params;
3182
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
3234
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) {
3183
3235
  params = (paramsOrFirst || {});
3184
3236
  }
3185
3237
  else {
@@ -3243,7 +3295,7 @@ class Avatars {
3243
3295
  }
3244
3296
  getFlag(paramsOrFirst, ...rest) {
3245
3297
  let params;
3246
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'code' in paramsOrFirst)) {
3298
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) {
3247
3299
  params = (paramsOrFirst || {});
3248
3300
  }
3249
3301
  else {
@@ -3543,7 +3595,7 @@ class Backups {
3543
3595
  }
3544
3596
  createArchive(paramsOrFirst, ...rest) {
3545
3597
  let params;
3546
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'services' in paramsOrFirst)) {
3598
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('services' in paramsOrFirst || 'resourceId' in paramsOrFirst))) {
3547
3599
  params = (paramsOrFirst || {});
3548
3600
  }
3549
3601
  else {
@@ -3943,7 +3995,7 @@ class Console {
3943
3995
  }
3944
3996
  getPlans(paramsOrFirst) {
3945
3997
  let params;
3946
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'platform' in paramsOrFirst)) {
3998
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('platform' in paramsOrFirst))) {
3947
3999
  params = (paramsOrFirst || {});
3948
4000
  }
3949
4001
  else {
@@ -4428,7 +4480,7 @@ class Databases {
4428
4480
  }
4429
4481
  listUsage(paramsOrFirst) {
4430
4482
  let params;
4431
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'range' in paramsOrFirst)) {
4483
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('range' in paramsOrFirst))) {
4432
4484
  params = (paramsOrFirst || {});
4433
4485
  }
4434
4486
  else {
@@ -7572,6 +7624,39 @@ class Domains {
7572
7624
  };
7573
7625
  return this.client.call('post', uri, apiHeaders, payload);
7574
7626
  }
7627
+ getPrice(paramsOrFirst, ...rest) {
7628
+ let params;
7629
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
7630
+ params = (paramsOrFirst || {});
7631
+ }
7632
+ else {
7633
+ params = {
7634
+ domain: paramsOrFirst,
7635
+ periodYears: rest[0],
7636
+ registrationType: rest[1]
7637
+ };
7638
+ }
7639
+ const domain = params.domain;
7640
+ const periodYears = params.periodYears;
7641
+ const registrationType = params.registrationType;
7642
+ if (typeof domain === 'undefined') {
7643
+ throw new AppwriteException('Missing required parameter: "domain"');
7644
+ }
7645
+ const apiPath = '/domains/price';
7646
+ const payload = {};
7647
+ if (typeof domain !== 'undefined') {
7648
+ payload['domain'] = domain;
7649
+ }
7650
+ if (typeof periodYears !== 'undefined') {
7651
+ payload['periodYears'] = periodYears;
7652
+ }
7653
+ if (typeof registrationType !== 'undefined') {
7654
+ payload['registrationType'] = registrationType;
7655
+ }
7656
+ const uri = new URL(this.client.config.endpoint + apiPath);
7657
+ const apiHeaders = {};
7658
+ return this.client.call('get', uri, apiHeaders, payload);
7659
+ }
7575
7660
  listSuggestions(paramsOrFirst, ...rest) {
7576
7661
  let params;
7577
7662
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -9404,7 +9489,7 @@ class Functions {
9404
9489
  }
9405
9490
  listTemplates(paramsOrFirst, ...rest) {
9406
9491
  let params;
9407
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'runtimes' in paramsOrFirst)) {
9492
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('runtimes' in paramsOrFirst || 'useCases' in paramsOrFirst || 'limit' in paramsOrFirst || 'offset' in paramsOrFirst || 'total' in paramsOrFirst))) {
9408
9493
  params = (paramsOrFirst || {});
9409
9494
  }
9410
9495
  else {
@@ -9464,7 +9549,7 @@ class Functions {
9464
9549
  }
9465
9550
  listUsage(paramsOrFirst) {
9466
9551
  let params;
9467
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'range' in paramsOrFirst)) {
9552
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('range' in paramsOrFirst))) {
9468
9553
  params = (paramsOrFirst || {});
9469
9554
  }
9470
9555
  else {
@@ -10334,7 +10419,7 @@ class Graphql {
10334
10419
  }
10335
10420
  query(paramsOrFirst) {
10336
10421
  let params;
10337
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
10422
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('query' in paramsOrFirst))) {
10338
10423
  params = (paramsOrFirst || {});
10339
10424
  }
10340
10425
  else {
@@ -10360,7 +10445,7 @@ class Graphql {
10360
10445
  }
10361
10446
  mutation(paramsOrFirst) {
10362
10447
  let params;
10363
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'query' in paramsOrFirst)) {
10448
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('query' in paramsOrFirst))) {
10364
10449
  params = (paramsOrFirst || {});
10365
10450
  }
10366
10451
  else {
@@ -10642,7 +10727,7 @@ class Health {
10642
10727
  }
10643
10728
  getFailedJobs(paramsOrFirst, ...rest) {
10644
10729
  let params;
10645
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'name' in paramsOrFirst)) {
10730
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('name' in paramsOrFirst || 'threshold' in paramsOrFirst))) {
10646
10731
  params = (paramsOrFirst || {});
10647
10732
  }
10648
10733
  else {
@@ -13877,7 +13962,7 @@ class Migrations {
13877
13962
  }
13878
13963
  createAppwriteMigration(paramsOrFirst, ...rest) {
13879
13964
  let params;
13880
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'resources' in paramsOrFirst)) {
13965
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'endpoint' in paramsOrFirst || 'projectId' in paramsOrFirst || 'apiKey' in paramsOrFirst))) {
13881
13966
  params = (paramsOrFirst || {});
13882
13967
  }
13883
13968
  else {
@@ -13926,7 +14011,7 @@ class Migrations {
13926
14011
  }
13927
14012
  getAppwriteReport(paramsOrFirst, ...rest) {
13928
14013
  let params;
13929
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'resources' in paramsOrFirst)) {
14014
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'endpoint' in paramsOrFirst || 'projectID' in paramsOrFirst || 'key' in paramsOrFirst))) {
13930
14015
  params = (paramsOrFirst || {});
13931
14016
  }
13932
14017
  else {
@@ -14087,7 +14172,7 @@ class Migrations {
14087
14172
  }
14088
14173
  createFirebaseMigration(paramsOrFirst, ...rest) {
14089
14174
  let params;
14090
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'resources' in paramsOrFirst)) {
14175
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'serviceAccount' in paramsOrFirst))) {
14091
14176
  params = (paramsOrFirst || {});
14092
14177
  }
14093
14178
  else {
@@ -14120,7 +14205,7 @@ class Migrations {
14120
14205
  }
14121
14206
  getFirebaseReport(paramsOrFirst, ...rest) {
14122
14207
  let params;
14123
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'resources' in paramsOrFirst)) {
14208
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'serviceAccount' in paramsOrFirst))) {
14124
14209
  params = (paramsOrFirst || {});
14125
14210
  }
14126
14211
  else {
@@ -14151,7 +14236,7 @@ class Migrations {
14151
14236
  }
14152
14237
  createNHostMigration(paramsOrFirst, ...rest) {
14153
14238
  let params;
14154
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'resources' in paramsOrFirst)) {
14239
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'subdomain' in paramsOrFirst || 'region' in paramsOrFirst || 'adminSecret' in paramsOrFirst || 'database' in paramsOrFirst || 'username' in paramsOrFirst || 'password' in paramsOrFirst || 'port' in paramsOrFirst))) {
14155
14240
  params = (paramsOrFirst || {});
14156
14241
  }
14157
14242
  else {
@@ -14229,7 +14314,7 @@ class Migrations {
14229
14314
  }
14230
14315
  getNHostReport(paramsOrFirst, ...rest) {
14231
14316
  let params;
14232
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'resources' in paramsOrFirst)) {
14317
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'subdomain' in paramsOrFirst || 'region' in paramsOrFirst || 'adminSecret' in paramsOrFirst || 'database' in paramsOrFirst || 'username' in paramsOrFirst || 'password' in paramsOrFirst || 'port' in paramsOrFirst))) {
14233
14318
  params = (paramsOrFirst || {});
14234
14319
  }
14235
14320
  else {
@@ -14305,7 +14390,7 @@ class Migrations {
14305
14390
  }
14306
14391
  createSupabaseMigration(paramsOrFirst, ...rest) {
14307
14392
  let params;
14308
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'resources' in paramsOrFirst)) {
14393
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'endpoint' in paramsOrFirst || 'apiKey' in paramsOrFirst || 'databaseHost' in paramsOrFirst || 'username' in paramsOrFirst || 'password' in paramsOrFirst || 'port' in paramsOrFirst))) {
14309
14394
  params = (paramsOrFirst || {});
14310
14395
  }
14311
14396
  else {
@@ -14375,7 +14460,7 @@ class Migrations {
14375
14460
  }
14376
14461
  getSupabaseReport(paramsOrFirst, ...rest) {
14377
14462
  let params;
14378
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'resources' in paramsOrFirst)) {
14463
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('resources' in paramsOrFirst || 'endpoint' in paramsOrFirst || 'apiKey' in paramsOrFirst || 'databaseHost' in paramsOrFirst || 'username' in paramsOrFirst || 'password' in paramsOrFirst || 'port' in paramsOrFirst))) {
14379
14464
  params = (paramsOrFirst || {});
14380
14465
  }
14381
14466
  else {
@@ -15658,33 +15743,6 @@ class Organizations {
15658
15743
  };
15659
15744
  return this.client.call('patch', uri, apiHeaders, payload);
15660
15745
  }
15661
- updateProjects(paramsOrFirst, ...rest) {
15662
- let params;
15663
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
15664
- params = (paramsOrFirst || {});
15665
- }
15666
- else {
15667
- params = {
15668
- organizationId: paramsOrFirst,
15669
- projects: rest[0]
15670
- };
15671
- }
15672
- const organizationId = params.organizationId;
15673
- const projects = params.projects;
15674
- if (typeof organizationId === 'undefined') {
15675
- throw new AppwriteException('Missing required parameter: "organizationId"');
15676
- }
15677
- const apiPath = '/organizations/{organizationId}/projects'.replace('{organizationId}', organizationId);
15678
- const payload = {};
15679
- if (typeof projects !== 'undefined') {
15680
- payload['projects'] = projects;
15681
- }
15682
- const uri = new URL(this.client.config.endpoint + apiPath);
15683
- const apiHeaders = {
15684
- 'content-type': 'application/json',
15685
- };
15686
- return this.client.call('patch', uri, apiHeaders, payload);
15687
- }
15688
15746
  listRegions(paramsOrFirst) {
15689
15747
  let params;
15690
15748
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -16919,16 +16977,21 @@ class Projects {
16919
16977
  else {
16920
16978
  params = {
16921
16979
  projectId: paramsOrFirst,
16922
- total: rest[0]
16980
+ queries: rest[0],
16981
+ total: rest[1]
16923
16982
  };
16924
16983
  }
16925
16984
  const projectId = params.projectId;
16985
+ const queries = params.queries;
16926
16986
  const total = params.total;
16927
16987
  if (typeof projectId === 'undefined') {
16928
16988
  throw new AppwriteException('Missing required parameter: "projectId"');
16929
16989
  }
16930
16990
  const apiPath = '/projects/{projectId}/keys'.replace('{projectId}', projectId);
16931
16991
  const payload = {};
16992
+ if (typeof queries !== 'undefined') {
16993
+ payload['queries'] = queries;
16994
+ }
16932
16995
  if (typeof total !== 'undefined') {
16933
16996
  payload['total'] = total;
16934
16997
  }
@@ -16946,12 +17009,14 @@ class Projects {
16946
17009
  projectId: paramsOrFirst,
16947
17010
  name: rest[0],
16948
17011
  scopes: rest[1],
16949
- expire: rest[2]
17012
+ keyId: rest[2],
17013
+ expire: rest[3]
16950
17014
  };
16951
17015
  }
16952
17016
  const projectId = params.projectId;
16953
17017
  const name = params.name;
16954
17018
  const scopes = params.scopes;
17019
+ const keyId = params.keyId;
16955
17020
  const expire = params.expire;
16956
17021
  if (typeof projectId === 'undefined') {
16957
17022
  throw new AppwriteException('Missing required parameter: "projectId"');
@@ -16964,6 +17029,9 @@ class Projects {
16964
17029
  }
16965
17030
  const apiPath = '/projects/{projectId}/keys'.replace('{projectId}', projectId);
16966
17031
  const payload = {};
17032
+ if (typeof keyId !== 'undefined') {
17033
+ payload['keyId'] = keyId;
17034
+ }
16967
17035
  if (typeof name !== 'undefined') {
16968
17036
  payload['name'] = name;
16969
17037
  }
@@ -17700,36 +17768,6 @@ class Projects {
17700
17768
  };
17701
17769
  return this.client.call('post', uri, apiHeaders, payload);
17702
17770
  }
17703
- updateStatus(paramsOrFirst, ...rest) {
17704
- let params;
17705
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
17706
- params = (paramsOrFirst || {});
17707
- }
17708
- else {
17709
- params = {
17710
- projectId: paramsOrFirst,
17711
- status: rest[0]
17712
- };
17713
- }
17714
- const projectId = params.projectId;
17715
- const status = params.status;
17716
- if (typeof projectId === 'undefined') {
17717
- throw new AppwriteException('Missing required parameter: "projectId"');
17718
- }
17719
- if (typeof status === 'undefined') {
17720
- throw new AppwriteException('Missing required parameter: "status"');
17721
- }
17722
- const apiPath = '/projects/{projectId}/status'.replace('{projectId}', projectId);
17723
- const payload = {};
17724
- if (typeof status !== 'undefined') {
17725
- payload['status'] = status;
17726
- }
17727
- const uri = new URL(this.client.config.endpoint + apiPath);
17728
- const apiHeaders = {
17729
- 'content-type': 'application/json',
17730
- };
17731
- return this.client.call('patch', uri, apiHeaders, payload);
17732
- }
17733
17771
  updateTeam(paramsOrFirst, ...rest) {
17734
17772
  let params;
17735
17773
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -18777,7 +18815,7 @@ class Sites {
18777
18815
  }
18778
18816
  listTemplates(paramsOrFirst, ...rest) {
18779
18817
  let params;
18780
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'frameworks' in paramsOrFirst)) {
18818
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('frameworks' in paramsOrFirst || 'useCases' in paramsOrFirst || 'limit' in paramsOrFirst || 'offset' in paramsOrFirst))) {
18781
18819
  params = (paramsOrFirst || {});
18782
18820
  }
18783
18821
  else {
@@ -18832,7 +18870,7 @@ class Sites {
18832
18870
  }
18833
18871
  listUsage(paramsOrFirst) {
18834
18872
  let params;
18835
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'range' in paramsOrFirst)) {
18873
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('range' in paramsOrFirst))) {
18836
18874
  params = (paramsOrFirst || {});
18837
18875
  }
18838
18876
  else {
@@ -20202,7 +20240,7 @@ class Storage {
20202
20240
  }
20203
20241
  getUsage(paramsOrFirst) {
20204
20242
  let params;
20205
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'range' in paramsOrFirst)) {
20243
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('range' in paramsOrFirst))) {
20206
20244
  params = (paramsOrFirst || {});
20207
20245
  }
20208
20246
  else {
@@ -20464,7 +20502,7 @@ class TablesDB {
20464
20502
  }
20465
20503
  listUsage(paramsOrFirst) {
20466
20504
  let params;
20467
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'range' in paramsOrFirst)) {
20505
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('range' in paramsOrFirst))) {
20468
20506
  params = (paramsOrFirst || {});
20469
20507
  }
20470
20508
  else {
@@ -24633,7 +24671,7 @@ class Users {
24633
24671
  }
24634
24672
  getUsage(paramsOrFirst) {
24635
24673
  let params;
24636
- if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && 'range' in paramsOrFirst)) {
24674
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('range' in paramsOrFirst))) {
24637
24675
  params = (paramsOrFirst || {});
24638
24676
  }
24639
24677
  else {
@@ -26003,11 +26041,16 @@ class Realtime {
26003
26041
  this.TYPE_CONNECTED = 'connected';
26004
26042
  this.DEBOUNCE_MS = 1;
26005
26043
  this.HEARTBEAT_INTERVAL = 20000; // 20 seconds in milliseconds
26006
- this.activeChannels = new Set();
26044
+ // Slot-centric state: Map<slot, { channels: Set<string>, queries: string[], callback: Function }>
26007
26045
  this.activeSubscriptions = new Map();
26046
+ // Map slot index -> subscriptionId (from backend)
26047
+ this.slotToSubscriptionId = new Map();
26048
+ // Inverse map: subscriptionId -> slot index (for O(1) lookup)
26049
+ this.subscriptionIdToSlot = new Map();
26008
26050
  this.subCallDepth = 0;
26009
26051
  this.reconnectAttempts = 0;
26010
26052
  this.subscriptionsCounter = 0;
26053
+ this.connectionId = 0;
26011
26054
  this.reconnect = true;
26012
26055
  this.onErrorCallbacks = [];
26013
26056
  this.onCloseCallbacks = [];
@@ -26057,7 +26100,7 @@ class Realtime {
26057
26100
  }
26058
26101
  createSocket() {
26059
26102
  return __awaiter(this, void 0, void 0, function* () {
26060
- if (this.activeChannels.size === 0) {
26103
+ if (this.activeSubscriptions.size === 0) {
26061
26104
  this.reconnect = false;
26062
26105
  yield this.closeSocket();
26063
26106
  return;
@@ -26066,10 +26109,36 @@ class Realtime {
26066
26109
  if (!projectId) {
26067
26110
  throw new AppwriteException('Missing project ID');
26068
26111
  }
26112
+ // Collect all unique channels from all slots
26113
+ const allChannels = new Set();
26114
+ for (const subscription of this.activeSubscriptions.values()) {
26115
+ for (const channel of subscription.channels) {
26116
+ allChannels.add(channel);
26117
+ }
26118
+ }
26069
26119
  let queryParams = `project=${projectId}`;
26070
- for (const channel of this.activeChannels) {
26120
+ for (const channel of allChannels) {
26071
26121
  queryParams += `&channels[]=${encodeURIComponent(channel)}`;
26072
26122
  }
26123
+ // Build query string from slots → channels → queries
26124
+ // Format: channel[slot][]=query
26125
+ // For each slot, repeat its queries under each channel it subscribes to
26126
+ // Example: slot 1 → channels [tests, prod], queries [q1, q2]
26127
+ // Produces: tests[1][]=q1&tests[1][]=q2&prod[1][]=q1&prod[1][]=q2
26128
+ const selectAllQuery = Query.select(['*']).toString();
26129
+ for (const [slot, subscription] of this.activeSubscriptions) {
26130
+ // queries is string[] - iterate over each query string
26131
+ const queries = subscription.queries.length === 0
26132
+ ? [selectAllQuery]
26133
+ : subscription.queries;
26134
+ // Repeat this slot's queries under each channel it subscribes to
26135
+ // Each query is sent as a separate parameter: channel[slot][]=q1&channel[slot][]=q2
26136
+ for (const channel of subscription.channels) {
26137
+ for (const query of queries) {
26138
+ queryParams += `&${encodeURIComponent(channel)}[${slot}][]=${encodeURIComponent(query)}`;
26139
+ }
26140
+ }
26141
+ }
26073
26142
  const endpoint = this.client.config.endpointRealtime !== ''
26074
26143
  ? this.client.config.endpointRealtime
26075
26144
  : this.client.config.endpoint || '';
@@ -26079,18 +26148,29 @@ class Realtime {
26079
26148
  const url = `${realtimeEndpoint}/realtime?${queryParams}`;
26080
26149
  if (this.socket) {
26081
26150
  this.reconnect = false;
26082
- yield this.closeSocket();
26151
+ if (this.socket.readyState < WebSocket.CLOSING) {
26152
+ yield this.closeSocket();
26153
+ }
26154
+ // Ensure reconnect isn't stuck false if close event was missed.
26155
+ this.reconnect = true;
26083
26156
  }
26084
26157
  return new Promise((resolve, reject) => {
26085
26158
  try {
26086
- this.socket = new WebSocket(url);
26087
- this.socket.addEventListener('open', () => {
26159
+ const connectionId = ++this.connectionId;
26160
+ const socket = (this.socket = new WebSocket(url));
26161
+ socket.addEventListener('open', () => {
26162
+ if (connectionId !== this.connectionId) {
26163
+ return;
26164
+ }
26088
26165
  this.reconnectAttempts = 0;
26089
26166
  this.onOpenCallbacks.forEach(callback => callback());
26090
26167
  this.startHeartbeat();
26091
26168
  resolve();
26092
26169
  });
26093
- this.socket.addEventListener('message', (event) => {
26170
+ socket.addEventListener('message', (event) => {
26171
+ if (connectionId !== this.connectionId) {
26172
+ return;
26173
+ }
26094
26174
  try {
26095
26175
  const message = JSON.parse(event.data);
26096
26176
  this.handleMessage(message);
@@ -26099,7 +26179,10 @@ class Realtime {
26099
26179
  console.error('Failed to parse message:', error);
26100
26180
  }
26101
26181
  });
26102
- this.socket.addEventListener('close', (event) => __awaiter(this, void 0, void 0, function* () {
26182
+ socket.addEventListener('close', (event) => __awaiter(this, void 0, void 0, function* () {
26183
+ if (connectionId !== this.connectionId || socket !== this.socket) {
26184
+ return;
26185
+ }
26103
26186
  this.stopHeartbeat();
26104
26187
  this.onCloseCallbacks.forEach(callback => callback());
26105
26188
  if (!this.reconnect || event.code === RealtimeCode.POLICY_VIOLATION) {
@@ -26117,7 +26200,10 @@ class Realtime {
26117
26200
  console.error('Failed to reconnect:', error);
26118
26201
  }
26119
26202
  }));
26120
- this.socket.addEventListener('error', (event) => {
26203
+ socket.addEventListener('error', (event) => {
26204
+ if (connectionId !== this.connectionId || socket !== this.socket) {
26205
+ return;
26206
+ }
26121
26207
  this.stopHeartbeat();
26122
26208
  const error = new Error('WebSocket error');
26123
26209
  console.error('WebSocket error:', error.message);
@@ -26188,7 +26274,7 @@ class Realtime {
26188
26274
  }
26189
26275
  return String(channel);
26190
26276
  }
26191
- subscribe(channelsOrChannel, callback) {
26277
+ subscribe(channelsOrChannel, callback, queries = []) {
26192
26278
  return __awaiter(this, void 0, void 0, function* () {
26193
26279
  const channelArray = Array.isArray(channelsOrChannel)
26194
26280
  ? channelsOrChannel
@@ -26196,13 +26282,29 @@ class Realtime {
26196
26282
  // Convert all channels to strings
26197
26283
  const channelStrings = channelArray.map(ch => this.channelToString(ch));
26198
26284
  const channels = new Set(channelStrings);
26199
- this.subscriptionsCounter++;
26200
- const count = this.subscriptionsCounter;
26201
- for (const channel of channels) {
26202
- this.activeChannels.add(channel);
26285
+ // Convert queries to array of strings
26286
+ // Ensure each query is a separate string in the array
26287
+ const queryStrings = [];
26288
+ for (const q of (queries !== null && queries !== void 0 ? queries : [])) {
26289
+ if (Array.isArray(q)) {
26290
+ // Handle nested arrays: [[q1, q2]] -> [q1, q2]
26291
+ for (const inner of q) {
26292
+ queryStrings.push(typeof inner === 'string' ? inner : inner.toString());
26293
+ }
26294
+ }
26295
+ else {
26296
+ queryStrings.push(typeof q === 'string' ? q : q.toString());
26297
+ }
26203
26298
  }
26204
- this.activeSubscriptions.set(count, {
26299
+ // Allocate a new slot index
26300
+ this.subscriptionsCounter++;
26301
+ const slot = this.subscriptionsCounter;
26302
+ // Store slot-centric data: channels, queries, and callback belong to the slot
26303
+ // queries is stored as string[] (array of query strings)
26304
+ // No channel mutation occurs here - channels are derived from slots in createSocket()
26305
+ this.activeSubscriptions.set(slot, {
26205
26306
  channels,
26307
+ queries: queryStrings,
26206
26308
  callback
26207
26309
  });
26208
26310
  this.subCallDepth++;
@@ -26213,23 +26315,19 @@ class Realtime {
26213
26315
  this.subCallDepth--;
26214
26316
  return {
26215
26317
  close: () => __awaiter(this, void 0, void 0, function* () {
26216
- this.activeSubscriptions.delete(count);
26217
- this.cleanUp(channels);
26318
+ const subscriptionId = this.slotToSubscriptionId.get(slot);
26319
+ this.activeSubscriptions.delete(slot);
26320
+ this.slotToSubscriptionId.delete(slot);
26321
+ if (subscriptionId) {
26322
+ this.subscriptionIdToSlot.delete(subscriptionId);
26323
+ }
26218
26324
  yield this.createSocket();
26219
26325
  })
26220
26326
  };
26221
26327
  });
26222
26328
  }
26223
- cleanUp(channels) {
26224
- this.activeChannels = new Set(Array.from(this.activeChannels).filter(channel => {
26225
- if (!channels.has(channel)) {
26226
- return true;
26227
- }
26228
- const subsWithChannel = Array.from(this.activeSubscriptions.values())
26229
- .filter(sub => sub.channels.has(channel));
26230
- return subsWithChannel.length > 0;
26231
- }));
26232
- }
26329
+ // cleanUp is no longer needed - slots are removed directly in subscribe().close()
26330
+ // Channels are automatically rebuilt from remaining slots in createSocket()
26233
26331
  handleMessage(message) {
26234
26332
  if (!message.type) {
26235
26333
  return;
@@ -26255,6 +26353,19 @@ class Realtime {
26255
26353
  return;
26256
26354
  }
26257
26355
  const messageData = message.data;
26356
+ // Store subscription ID mappings from backend
26357
+ // Format: { "0": "sub_a1f9", "1": "sub_b83c", ... }
26358
+ if (messageData.subscriptions) {
26359
+ this.slotToSubscriptionId.clear();
26360
+ this.subscriptionIdToSlot.clear();
26361
+ for (const [slotStr, subscriptionId] of Object.entries(messageData.subscriptions)) {
26362
+ const slot = Number(slotStr);
26363
+ if (!isNaN(slot)) {
26364
+ this.slotToSubscriptionId.set(slot, subscriptionId);
26365
+ this.subscriptionIdToSlot.set(subscriptionId, slot);
26366
+ }
26367
+ }
26368
+ }
26258
26369
  let session = this.client.config.session;
26259
26370
  if (!session) {
26260
26371
  try {
@@ -26289,23 +26400,26 @@ class Realtime {
26289
26400
  const events = data.events;
26290
26401
  const payload = data.payload;
26291
26402
  const timestamp = data.timestamp;
26292
- if (!channels || !events || !payload) {
26293
- return;
26294
- }
26295
- const hasActiveChannel = channels.some(channel => this.activeChannels.has(channel));
26296
- if (!hasActiveChannel) {
26403
+ const subscriptions = data.subscriptions;
26404
+ if (!channels || !events || !payload || !subscriptions || subscriptions.length === 0) {
26297
26405
  return;
26298
26406
  }
26299
- for (const [_, subscription] of this.activeSubscriptions) {
26300
- const hasSubscribedChannel = channels.some(channel => subscription.channels.has(channel));
26301
- if (hasSubscribedChannel) {
26302
- const response = {
26303
- events,
26304
- channels,
26305
- timestamp,
26306
- payload
26307
- };
26308
- subscription.callback(response);
26407
+ // Iterate over all matching subscriptionIds and call callback for each
26408
+ for (const subscriptionId of subscriptions) {
26409
+ // O(1) lookup using subscriptionId
26410
+ const slot = this.subscriptionIdToSlot.get(subscriptionId);
26411
+ if (slot !== undefined) {
26412
+ const subscription = this.activeSubscriptions.get(slot);
26413
+ if (subscription) {
26414
+ const response = {
26415
+ events,
26416
+ channels,
26417
+ timestamp,
26418
+ payload,
26419
+ subscriptions
26420
+ };
26421
+ subscription.callback(response);
26422
+ }
26309
26423
  }
26310
26424
  }
26311
26425
  }
@@ -26507,8 +26621,11 @@ class Channel {
26507
26621
  constructor(segments) {
26508
26622
  this.segments = segments;
26509
26623
  }
26510
- next(segment, id = "*") {
26511
- return new Channel([...this.segments, segment, normalize(id)]);
26624
+ next(segment, id) {
26625
+ const segments = id === undefined
26626
+ ? [...this.segments, segment]
26627
+ : [...this.segments, segment, normalize(id)];
26628
+ return new Channel(segments);
26512
26629
  }
26513
26630
  resolve(action) {
26514
26631
  return new Channel([...this.segments, action]);
@@ -26518,28 +26635,29 @@ class Channel {
26518
26635
  }
26519
26636
  // --- DATABASE ROUTE ---
26520
26637
  // Only available on Channel<Database>
26521
- collection(id = "*") {
26522
- return this.next("collections", id);
26638
+ collection(id) {
26639
+ // Default: wildcard collection ID
26640
+ return this.next("collections", id !== null && id !== void 0 ? id : "*");
26523
26641
  }
26524
26642
  // Only available on Channel<Collection>
26525
- document(id = "*") {
26643
+ document(id) {
26644
+ // Default: no document ID segment
26526
26645
  return this.next("documents", id);
26527
26646
  }
26528
26647
  // --- TABLESDB ROUTE ---
26529
- table(id = "*") {
26530
- return this.next("tables", id);
26648
+ table(id) {
26649
+ // Default: wildcard table ID
26650
+ return this.next("tables", id !== null && id !== void 0 ? id : "*");
26531
26651
  }
26532
- row(id = "*") {
26652
+ row(id) {
26653
+ // Default: no row ID segment
26533
26654
  return this.next("rows", id);
26534
26655
  }
26535
26656
  // --- BUCKET ROUTE ---
26536
- file(id = "*") {
26657
+ file(id) {
26658
+ // Default: no file ID segment
26537
26659
  return this.next("files", id);
26538
26660
  }
26539
- // --- FUNCTION ROUTE ---
26540
- execution(id = "*") {
26541
- return this.next("executions", id);
26542
- }
26543
26661
  // --- TERMINAL ACTIONS ---
26544
26662
  // Restricted to the Actionable union
26545
26663
  create() {
@@ -26555,6 +26673,9 @@ class Channel {
26555
26673
  static database(id = "*") {
26556
26674
  return new Channel(["databases", normalize(id)]);
26557
26675
  }
26676
+ static execution(id = "*") {
26677
+ return new Channel(["executions", normalize(id)]);
26678
+ }
26558
26679
  static tablesdb(id = "*") {
26559
26680
  return new Channel(["tablesdb", normalize(id)]);
26560
26681
  }
@@ -26570,9 +26691,8 @@ class Channel {
26570
26691
  static membership(id = "*") {
26571
26692
  return new Channel(["memberships", normalize(id)]);
26572
26693
  }
26573
- static account(userId = "") {
26574
- const id = normalize(userId);
26575
- return id === "*" ? "account" : `account.${id}`;
26694
+ static account() {
26695
+ return "account";
26576
26696
  }
26577
26697
  // Global events
26578
26698
  static documents() {
@@ -26590,6 +26710,9 @@ class Channel {
26590
26710
  static teams() {
26591
26711
  return "teams";
26592
26712
  }
26713
+ static memberships() {
26714
+ return "memberships";
26715
+ }
26593
26716
  }
26594
26717
 
26595
26718
  var Condition;
@@ -26922,6 +27045,7 @@ var Scopes;
26922
27045
  Scopes["RestorationsWrite"] = "restorations.write";
26923
27046
  Scopes["DomainsRead"] = "domains.read";
26924
27047
  Scopes["DomainsWrite"] = "domains.write";
27048
+ Scopes["EventsRead"] = "events.read";
26925
27049
  })(Scopes || (Scopes = {}));
26926
27050
 
26927
27051
  var AuthenticatorType;
@@ -27684,12 +27808,12 @@ var ImageFormat;
27684
27808
  ImageFormat["Gif"] = "gif";
27685
27809
  })(ImageFormat || (ImageFormat = {}));
27686
27810
 
27687
- var Services;
27688
- (function (Services) {
27689
- Services["Databases"] = "databases";
27690
- Services["Functions"] = "functions";
27691
- Services["Storage"] = "storage";
27692
- })(Services || (Services = {}));
27811
+ var BackupServices;
27812
+ (function (BackupServices) {
27813
+ BackupServices["Databases"] = "databases";
27814
+ BackupServices["Functions"] = "functions";
27815
+ BackupServices["Storage"] = "storage";
27816
+ })(BackupServices || (BackupServices = {}));
27693
27817
 
27694
27818
  var Platform;
27695
27819
  (function (Platform) {
@@ -27738,6 +27862,14 @@ var OrderBy;
27738
27862
  OrderBy["Desc"] = "desc";
27739
27863
  })(OrderBy || (OrderBy = {}));
27740
27864
 
27865
+ var RegistrationType;
27866
+ (function (RegistrationType) {
27867
+ RegistrationType["New"] = "new";
27868
+ RegistrationType["Transfer"] = "transfer";
27869
+ RegistrationType["Renewal"] = "renewal";
27870
+ RegistrationType["Trade"] = "trade";
27871
+ })(RegistrationType || (RegistrationType = {}));
27872
+
27741
27873
  var FilterType;
27742
27874
  (function (FilterType) {
27743
27875
  FilterType["Premium"] = "premium";
@@ -27768,6 +27900,9 @@ var Runtime;
27768
27900
  Runtime["Python312"] = "python-3.12";
27769
27901
  Runtime["Pythonml311"] = "python-ml-3.11";
27770
27902
  Runtime["Pythonml312"] = "python-ml-3.12";
27903
+ Runtime["Deno121"] = "deno-1.21";
27904
+ Runtime["Deno124"] = "deno-1.24";
27905
+ Runtime["Deno135"] = "deno-1.35";
27771
27906
  Runtime["Deno140"] = "deno-1.40";
27772
27907
  Runtime["Deno146"] = "deno-1.46";
27773
27908
  Runtime["Deno20"] = "deno-2.0";
@@ -27782,6 +27917,7 @@ var Runtime;
27782
27917
  Runtime["Dart35"] = "dart-3.5";
27783
27918
  Runtime["Dart38"] = "dart-3.8";
27784
27919
  Runtime["Dart39"] = "dart-3.9";
27920
+ Runtime["Dart310"] = "dart-3.10";
27785
27921
  Runtime["Dotnet60"] = "dotnet-6.0";
27786
27922
  Runtime["Dotnet70"] = "dotnet-7.0";
27787
27923
  Runtime["Dotnet80"] = "dotnet-8.0";
@@ -27810,6 +27946,7 @@ var Runtime;
27810
27946
  Runtime["Flutter329"] = "flutter-3.29";
27811
27947
  Runtime["Flutter332"] = "flutter-3.32";
27812
27948
  Runtime["Flutter335"] = "flutter-3.35";
27949
+ Runtime["Flutter338"] = "flutter-3.38";
27813
27950
  })(Runtime || (Runtime = {}));
27814
27951
 
27815
27952
  var Runtimes;
@@ -27836,6 +27973,9 @@ var Runtimes;
27836
27973
  Runtimes["Python312"] = "python-3.12";
27837
27974
  Runtimes["Pythonml311"] = "python-ml-3.11";
27838
27975
  Runtimes["Pythonml312"] = "python-ml-3.12";
27976
+ Runtimes["Deno121"] = "deno-1.21";
27977
+ Runtimes["Deno124"] = "deno-1.24";
27978
+ Runtimes["Deno135"] = "deno-1.35";
27839
27979
  Runtimes["Deno140"] = "deno-1.40";
27840
27980
  Runtimes["Deno146"] = "deno-1.46";
27841
27981
  Runtimes["Deno20"] = "deno-2.0";
@@ -27850,6 +27990,7 @@ var Runtimes;
27850
27990
  Runtimes["Dart35"] = "dart-3.5";
27851
27991
  Runtimes["Dart38"] = "dart-3.8";
27852
27992
  Runtimes["Dart39"] = "dart-3.9";
27993
+ Runtimes["Dart310"] = "dart-3.10";
27853
27994
  Runtimes["Dotnet60"] = "dotnet-6.0";
27854
27995
  Runtimes["Dotnet70"] = "dotnet-7.0";
27855
27996
  Runtimes["Dotnet80"] = "dotnet-8.0";
@@ -27878,6 +28019,7 @@ var Runtimes;
27878
28019
  Runtimes["Flutter329"] = "flutter-3.29";
27879
28020
  Runtimes["Flutter332"] = "flutter-3.32";
27880
28021
  Runtimes["Flutter335"] = "flutter-3.35";
28022
+ Runtimes["Flutter338"] = "flutter-3.38";
27881
28023
  })(Runtimes || (Runtimes = {}));
27882
28024
 
27883
28025
  var UseCases;
@@ -28045,12 +28187,6 @@ var SMTPSecure;
28045
28187
  SMTPSecure["Ssl"] = "ssl";
28046
28188
  })(SMTPSecure || (SMTPSecure = {}));
28047
28189
 
28048
- var Status;
28049
- (function (Status) {
28050
- Status["Active"] = "active";
28051
- Status["Archived"] = "archived";
28052
- })(Status || (Status = {}));
28053
-
28054
28190
  var EmailTemplateType;
28055
28191
  (function (EmailTemplateType) {
28056
28192
  EmailTemplateType["Verification"] = "verification";
@@ -28397,6 +28533,9 @@ var BuildRuntime;
28397
28533
  BuildRuntime["Python312"] = "python-3.12";
28398
28534
  BuildRuntime["Pythonml311"] = "python-ml-3.11";
28399
28535
  BuildRuntime["Pythonml312"] = "python-ml-3.12";
28536
+ BuildRuntime["Deno121"] = "deno-1.21";
28537
+ BuildRuntime["Deno124"] = "deno-1.24";
28538
+ BuildRuntime["Deno135"] = "deno-1.35";
28400
28539
  BuildRuntime["Deno140"] = "deno-1.40";
28401
28540
  BuildRuntime["Deno146"] = "deno-1.46";
28402
28541
  BuildRuntime["Deno20"] = "deno-2.0";
@@ -28411,6 +28550,7 @@ var BuildRuntime;
28411
28550
  BuildRuntime["Dart35"] = "dart-3.5";
28412
28551
  BuildRuntime["Dart38"] = "dart-3.8";
28413
28552
  BuildRuntime["Dart39"] = "dart-3.9";
28553
+ BuildRuntime["Dart310"] = "dart-3.10";
28414
28554
  BuildRuntime["Dotnet60"] = "dotnet-6.0";
28415
28555
  BuildRuntime["Dotnet70"] = "dotnet-7.0";
28416
28556
  BuildRuntime["Dotnet80"] = "dotnet-8.0";
@@ -28439,6 +28579,7 @@ var BuildRuntime;
28439
28579
  BuildRuntime["Flutter329"] = "flutter-3.29";
28440
28580
  BuildRuntime["Flutter332"] = "flutter-3.32";
28441
28581
  BuildRuntime["Flutter335"] = "flutter-3.35";
28582
+ BuildRuntime["Flutter338"] = "flutter-3.38";
28442
28583
  })(BuildRuntime || (BuildRuntime = {}));
28443
28584
 
28444
28585
  var Adapter;
@@ -28486,15 +28627,6 @@ var ImageGravity;
28486
28627
  ImageGravity["Bottomright"] = "bottom-right";
28487
28628
  })(ImageGravity || (ImageGravity = {}));
28488
28629
 
28489
- var Roles;
28490
- (function (Roles) {
28491
- Roles["Developer"] = "developer";
28492
- Roles["Editor"] = "editor";
28493
- Roles["Analyst"] = "analyst";
28494
- Roles["Billing"] = "billing";
28495
- Roles["Owner"] = "owner";
28496
- })(Roles || (Roles = {}));
28497
-
28498
28630
  var PasswordHash;
28499
28631
  (function (PasswordHash) {
28500
28632
  PasswordHash["Sha1"] = "sha1";
@@ -28625,5 +28757,5 @@ var BillingPlanGroup;
28625
28757
  BillingPlanGroup["Scale"] = "scale";
28626
28758
  })(BillingPlanGroup || (BillingPlanGroup = {}));
28627
28759
 
28628
- export { Account, Adapter, Api, ApiService, AppwriteException, Assistant, AttributeStatus, AuthMethod, AuthenticationFactor, AuthenticatorType, Avatars, Backups, BillingPlanGroup, Browser, BrowserPermission, BuildRuntime, Channel, Client, ColumnStatus, Compression, Condition, Console, ConsoleResourceType, CreditCard, DatabaseType, Databases, DeploymentDownloadType, DeploymentStatus, Domains, EmailTemplateLocale, EmailTemplateType, ExecutionMethod, ExecutionStatus, ExecutionTrigger, FilterType, Flag, Framework, Frameworks, Functions, Graphql, Health, HealthAntivirusStatus, HealthCheckStatus, ID, ImageFormat, ImageGravity, IndexStatus, IndexType, Locale, MessagePriority, MessageStatus, Messaging, MessagingProviderType, Migrations, Name, OAuthProvider, Operator, OrderBy, Organizations, PasswordHash, Permission, Platform, PlatformType, Project, ProjectUsageRange, Projects, Proxy, ProxyResourceType, ProxyRuleDeploymentResourceType, ProxyRuleStatus, Query, Realtime, Region, RelationMutate, RelationshipType, Resources, Role, Roles, Runtime, Runtimes, SMTPSecure, Scopes, Services, Sites, SmsTemplateLocale, SmsTemplateType, SmtpEncryption, Status, StatusCode, Storage, TablesDB, Teams, TemplateReferenceType, Theme, Timezone, Tokens, UsageRange, UseCases, Users, VCSDetectionType, VCSReferenceType, Vcs };
28760
+ export { Account, Adapter, Api, ApiService, AppwriteException, Assistant, AttributeStatus, AuthMethod, AuthenticationFactor, AuthenticatorType, Avatars, BackupServices, Backups, BillingPlanGroup, Browser, BrowserPermission, BuildRuntime, Channel, Client, ColumnStatus, Compression, Condition, Console, ConsoleResourceType, CreditCard, DatabaseType, Databases, DeploymentDownloadType, DeploymentStatus, Domains, EmailTemplateLocale, EmailTemplateType, ExecutionMethod, ExecutionStatus, ExecutionTrigger, FilterType, Flag, Framework, Frameworks, Functions, Graphql, Health, HealthAntivirusStatus, HealthCheckStatus, ID, ImageFormat, ImageGravity, IndexStatus, IndexType, Locale, MessagePriority, MessageStatus, Messaging, MessagingProviderType, Migrations, Name, OAuthProvider, Operator, OrderBy, Organizations, PasswordHash, Permission, Platform, PlatformType, Project, ProjectUsageRange, Projects, Proxy, ProxyResourceType, ProxyRuleDeploymentResourceType, ProxyRuleStatus, Query, Realtime, Region, RegistrationType, RelationMutate, RelationshipType, Resources, Role, Runtime, Runtimes, SMTPSecure, Scopes, Sites, SmsTemplateLocale, SmsTemplateType, SmtpEncryption, StatusCode, Storage, TablesDB, Teams, TemplateReferenceType, Theme, Timezone, Tokens, UsageRange, UseCases, Users, VCSDetectionType, VCSReferenceType, Vcs };
28629
28761
  //# sourceMappingURL=sdk.js.map