@appwrite.io/console 0.6.0-rc.12 → 0.6.0-rc.13

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 (318) hide show
  1. package/.travis.yml +32 -0
  2. package/README.md +3 -3
  3. package/dist/cjs/sdk.js +101 -42
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +102 -43
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +101 -42
  8. package/docs/examples/account/{create2f-a-challenge.md → create-challenge.md} +1 -1
  9. package/docs/examples/account/create-email-token.md +1 -1
  10. package/docs/examples/account/create-magic-u-r-l-token.md +1 -1
  11. package/docs/examples/account/create-o-auth2session.md +0 -1
  12. package/docs/examples/account/create-o-auth2token.md +15 -0
  13. package/docs/examples/account/create-phone-token.md +1 -1
  14. package/docs/examples/account/create-push-target.md +3 -3
  15. package/docs/examples/account/create-session.md +2 -2
  16. package/docs/examples/account/create.md +2 -2
  17. package/docs/examples/account/delete-authenticator.md +1 -1
  18. package/docs/examples/account/delete-identity.md +1 -1
  19. package/docs/examples/account/delete-push-target.md +1 -1
  20. package/docs/examples/account/delete-session.md +1 -1
  21. package/docs/examples/account/get-session.md +1 -1
  22. package/docs/examples/account/update-challenge.md +2 -2
  23. package/docs/examples/account/update-magic-u-r-l-session.md +2 -2
  24. package/docs/examples/account/update-name.md +1 -1
  25. package/docs/examples/account/update-phone-verification.md +2 -2
  26. package/docs/examples/account/update-push-target.md +2 -2
  27. package/docs/examples/account/update-recovery.md +2 -2
  28. package/docs/examples/account/update-session.md +1 -1
  29. package/docs/examples/account/update-verification.md +2 -2
  30. package/docs/examples/account/verify-authenticator.md +1 -1
  31. package/docs/examples/assistant/chat.md +1 -1
  32. package/docs/examples/avatars/get-initials.md +1 -1
  33. package/docs/examples/avatars/get-q-r.md +1 -1
  34. package/docs/examples/databases/create-boolean-attribute.md +2 -2
  35. package/docs/examples/databases/create-collection.md +3 -3
  36. package/docs/examples/databases/create-datetime-attribute.md +2 -2
  37. package/docs/examples/databases/create-document.md +3 -3
  38. package/docs/examples/databases/create-email-attribute.md +2 -2
  39. package/docs/examples/databases/create-enum-attribute.md +3 -3
  40. package/docs/examples/databases/create-float-attribute.md +2 -2
  41. package/docs/examples/databases/create-index.md +2 -2
  42. package/docs/examples/databases/create-integer-attribute.md +2 -2
  43. package/docs/examples/databases/create-ip-attribute.md +2 -2
  44. package/docs/examples/databases/create-relationship-attribute.md +3 -3
  45. package/docs/examples/databases/create-string-attribute.md +3 -3
  46. package/docs/examples/databases/create-url-attribute.md +2 -2
  47. package/docs/examples/databases/create.md +2 -2
  48. package/docs/examples/databases/delete-attribute.md +2 -2
  49. package/docs/examples/databases/delete-collection.md +2 -2
  50. package/docs/examples/databases/delete-document.md +3 -3
  51. package/docs/examples/databases/delete-index.md +2 -2
  52. package/docs/examples/databases/delete.md +1 -1
  53. package/docs/examples/databases/get-attribute.md +2 -2
  54. package/docs/examples/databases/get-collection-usage.md +2 -2
  55. package/docs/examples/databases/get-collection.md +2 -2
  56. package/docs/examples/databases/get-database-usage.md +1 -1
  57. package/docs/examples/databases/get-document.md +3 -3
  58. package/docs/examples/databases/get-index.md +2 -2
  59. package/docs/examples/databases/get.md +1 -1
  60. package/docs/examples/databases/list-attributes.md +2 -2
  61. package/docs/examples/databases/list-collection-logs.md +2 -2
  62. package/docs/examples/databases/list-collections.md +2 -2
  63. package/docs/examples/databases/list-document-logs.md +3 -3
  64. package/docs/examples/databases/list-documents.md +2 -2
  65. package/docs/examples/databases/list-indexes.md +2 -2
  66. package/docs/examples/databases/list-logs.md +1 -1
  67. package/docs/examples/databases/list.md +1 -1
  68. package/docs/examples/databases/update-boolean-attribute.md +2 -2
  69. package/docs/examples/databases/update-collection.md +3 -3
  70. package/docs/examples/databases/update-datetime-attribute.md +2 -2
  71. package/docs/examples/databases/update-document.md +3 -3
  72. package/docs/examples/databases/update-email-attribute.md +2 -2
  73. package/docs/examples/databases/update-enum-attribute.md +3 -3
  74. package/docs/examples/databases/update-float-attribute.md +2 -2
  75. package/docs/examples/databases/update-integer-attribute.md +2 -2
  76. package/docs/examples/databases/update-ip-attribute.md +2 -2
  77. package/docs/examples/databases/update-relationship-attribute.md +2 -2
  78. package/docs/examples/databases/update-string-attribute.md +3 -3
  79. package/docs/examples/databases/update-url-attribute.md +2 -2
  80. package/docs/examples/databases/update.md +2 -2
  81. package/docs/examples/functions/create-build.md +3 -3
  82. package/docs/examples/functions/create-deployment.md +3 -3
  83. package/docs/examples/functions/create-execution.md +3 -3
  84. package/docs/examples/functions/create-variable.md +3 -3
  85. package/docs/examples/functions/create.md +12 -12
  86. package/docs/examples/functions/delete-deployment.md +2 -2
  87. package/docs/examples/functions/delete-variable.md +2 -2
  88. package/docs/examples/functions/delete.md +1 -1
  89. package/docs/examples/functions/download-deployment.md +2 -2
  90. package/docs/examples/functions/get-deployment.md +2 -2
  91. package/docs/examples/functions/get-execution.md +2 -2
  92. package/docs/examples/functions/get-function-usage.md +1 -1
  93. package/docs/examples/functions/get-variable.md +2 -2
  94. package/docs/examples/functions/get.md +1 -1
  95. package/docs/examples/functions/list-deployments.md +2 -2
  96. package/docs/examples/functions/list-executions.md +2 -2
  97. package/docs/examples/functions/list-variables.md +1 -1
  98. package/docs/examples/functions/list.md +1 -1
  99. package/docs/examples/functions/update-deployment.md +2 -2
  100. package/docs/examples/functions/update-variable.md +4 -4
  101. package/docs/examples/functions/update.md +8 -8
  102. package/docs/examples/health/get-queue-databases.md +1 -1
  103. package/docs/examples/messaging/create-apns-provider.md +7 -6
  104. package/docs/examples/messaging/create-email.md +3 -3
  105. package/docs/examples/messaging/create-fcm-provider.md +2 -2
  106. package/docs/examples/messaging/create-mailgun-provider.md +6 -6
  107. package/docs/examples/messaging/create-msg91provider.md +4 -4
  108. package/docs/examples/messaging/create-push.md +9 -9
  109. package/docs/examples/messaging/create-sendgrid-provider.md +5 -5
  110. package/docs/examples/messaging/create-sms.md +2 -2
  111. package/docs/examples/messaging/create-smtp-provider.md +10 -10
  112. package/docs/examples/messaging/create-subscriber.md +3 -3
  113. package/docs/examples/messaging/create-telesign-provider.md +4 -4
  114. package/docs/examples/messaging/create-textmagic-provider.md +4 -4
  115. package/docs/examples/messaging/create-topic.md +2 -2
  116. package/docs/examples/messaging/create-twilio-provider.md +4 -4
  117. package/docs/examples/messaging/create-vonage-provider.md +4 -4
  118. package/docs/examples/messaging/delete-provider.md +1 -1
  119. package/docs/examples/messaging/delete-subscriber.md +2 -2
  120. package/docs/examples/messaging/delete-topic.md +1 -1
  121. package/docs/examples/messaging/delete.md +1 -1
  122. package/docs/examples/messaging/get-message.md +1 -1
  123. package/docs/examples/messaging/get-provider.md +1 -1
  124. package/docs/examples/messaging/get-subscriber.md +2 -2
  125. package/docs/examples/messaging/get-topic.md +1 -1
  126. package/docs/examples/messaging/list-message-logs.md +1 -1
  127. package/docs/examples/messaging/list-messages.md +1 -1
  128. package/docs/examples/messaging/list-provider-logs.md +1 -1
  129. package/docs/examples/messaging/list-providers.md +1 -1
  130. package/docs/examples/messaging/list-subscriber-logs.md +1 -1
  131. package/docs/examples/messaging/list-subscribers.md +2 -2
  132. package/docs/examples/messaging/list-targets.md +1 -1
  133. package/docs/examples/messaging/list-topic-logs.md +1 -1
  134. package/docs/examples/messaging/list-topics.md +1 -1
  135. package/docs/examples/messaging/update-apns-provider.md +20 -0
  136. package/docs/examples/messaging/update-email.md +3 -3
  137. package/docs/examples/messaging/{update-f-c-m-provider.md → update-fcm-provider.md} +3 -3
  138. package/docs/examples/messaging/update-mailgun-provider.md +7 -7
  139. package/docs/examples/messaging/update-msg91provider.md +5 -5
  140. package/docs/examples/messaging/update-push.md +8 -8
  141. package/docs/examples/messaging/update-sendgrid-provider.md +6 -6
  142. package/docs/examples/messaging/update-sms.md +2 -2
  143. package/docs/examples/messaging/update-smtp-provider.md +11 -11
  144. package/docs/examples/messaging/update-telesign-provider.md +5 -5
  145. package/docs/examples/messaging/update-textmagic-provider.md +5 -5
  146. package/docs/examples/messaging/update-topic.md +3 -2
  147. package/docs/examples/messaging/update-twilio-provider.md +5 -5
  148. package/docs/examples/messaging/update-vonage-provider.md +5 -5
  149. package/docs/examples/migrations/create-appwrite-migration.md +2 -2
  150. package/docs/examples/migrations/create-firebase-migration.md +1 -1
  151. package/docs/examples/migrations/create-firebase-o-auth-migration.md +1 -1
  152. package/docs/examples/migrations/create-n-host-migration.md +6 -6
  153. package/docs/examples/migrations/create-supabase-migration.md +4 -4
  154. package/docs/examples/migrations/delete.md +1 -1
  155. package/docs/examples/migrations/get-appwrite-report.md +2 -2
  156. package/docs/examples/migrations/get-firebase-report-o-auth.md +1 -1
  157. package/docs/examples/migrations/get-firebase-report.md +1 -1
  158. package/docs/examples/migrations/get-n-host-report.md +6 -6
  159. package/docs/examples/migrations/get-supabase-report.md +4 -4
  160. package/docs/examples/migrations/get.md +1 -1
  161. package/docs/examples/migrations/list.md +1 -1
  162. package/docs/examples/migrations/retry.md +1 -1
  163. package/docs/examples/project/create-variable.md +2 -2
  164. package/docs/examples/project/delete-variable.md +1 -1
  165. package/docs/examples/project/get-variable.md +1 -1
  166. package/docs/examples/project/update-variable.md +3 -3
  167. package/docs/examples/projects/create-key.md +2 -2
  168. package/docs/examples/projects/create-platform.md +4 -4
  169. package/docs/examples/projects/create-smtp-test.md +4 -4
  170. package/docs/examples/projects/create-webhook.md +4 -4
  171. package/docs/examples/projects/create.md +10 -10
  172. package/docs/examples/projects/delete-email-template.md +1 -1
  173. package/docs/examples/projects/delete-key.md +2 -2
  174. package/docs/examples/projects/delete-platform.md +2 -2
  175. package/docs/examples/projects/delete-sms-template.md +1 -1
  176. package/docs/examples/projects/delete-webhook.md +2 -2
  177. package/docs/examples/projects/delete.md +1 -1
  178. package/docs/examples/projects/get-email-template.md +1 -1
  179. package/docs/examples/projects/get-key.md +2 -2
  180. package/docs/examples/projects/get-platform.md +2 -2
  181. package/docs/examples/projects/get-sms-template.md +1 -1
  182. package/docs/examples/projects/get-webhook.md +2 -2
  183. package/docs/examples/projects/get.md +1 -1
  184. package/docs/examples/projects/list-keys.md +1 -1
  185. package/docs/examples/projects/list-platforms.md +1 -1
  186. package/docs/examples/projects/list-webhooks.md +1 -1
  187. package/docs/examples/projects/list.md +1 -1
  188. package/docs/examples/projects/update-auth-duration.md +1 -1
  189. package/docs/examples/projects/update-auth-limit.md +1 -1
  190. package/docs/examples/projects/update-auth-password-dictionary.md +1 -1
  191. package/docs/examples/projects/update-auth-password-history.md +1 -1
  192. package/docs/examples/projects/update-auth-sessions-limit.md +1 -1
  193. package/docs/examples/projects/update-auth-status.md +1 -1
  194. package/docs/examples/projects/update-email-template.md +4 -4
  195. package/docs/examples/projects/update-key.md +3 -3
  196. package/docs/examples/projects/update-o-auth2.md +3 -3
  197. package/docs/examples/projects/update-personal-data-check.md +1 -1
  198. package/docs/examples/projects/update-platform.md +5 -5
  199. package/docs/examples/projects/update-service-status-all.md +1 -1
  200. package/docs/examples/projects/update-service-status.md +1 -1
  201. package/docs/examples/projects/update-sms-template.md +2 -2
  202. package/docs/examples/projects/update-smtp.md +4 -4
  203. package/docs/examples/projects/update-team.md +2 -2
  204. package/docs/examples/projects/update-webhook-signature.md +2 -2
  205. package/docs/examples/projects/update-webhook.md +5 -5
  206. package/docs/examples/projects/update.md +10 -10
  207. package/docs/examples/proxy/create-rule.md +1 -1
  208. package/docs/examples/proxy/delete-rule.md +1 -1
  209. package/docs/examples/proxy/get-rule.md +1 -1
  210. package/docs/examples/proxy/list-rules.md +1 -1
  211. package/docs/examples/proxy/update-rule-verification.md +1 -1
  212. package/docs/examples/storage/create-bucket.md +2 -2
  213. package/docs/examples/storage/create-file.md +2 -2
  214. package/docs/examples/storage/delete-bucket.md +1 -1
  215. package/docs/examples/storage/delete-file.md +2 -2
  216. package/docs/examples/storage/get-bucket-usage.md +1 -1
  217. package/docs/examples/storage/get-bucket.md +1 -1
  218. package/docs/examples/storage/get-file-download.md +2 -2
  219. package/docs/examples/storage/get-file-preview.md +2 -2
  220. package/docs/examples/storage/get-file-view.md +2 -2
  221. package/docs/examples/storage/get-file.md +2 -2
  222. package/docs/examples/storage/list-buckets.md +1 -1
  223. package/docs/examples/storage/list-files.md +2 -2
  224. package/docs/examples/storage/update-bucket.md +2 -2
  225. package/docs/examples/storage/update-file.md +3 -3
  226. package/docs/examples/teams/create-membership.md +3 -3
  227. package/docs/examples/teams/create.md +2 -2
  228. package/docs/examples/teams/delete-membership.md +2 -2
  229. package/docs/examples/teams/delete.md +1 -1
  230. package/docs/examples/teams/get-membership.md +2 -2
  231. package/docs/examples/teams/get-prefs.md +1 -1
  232. package/docs/examples/teams/get.md +1 -1
  233. package/docs/examples/teams/list-logs.md +1 -1
  234. package/docs/examples/teams/list-memberships.md +2 -2
  235. package/docs/examples/teams/list.md +1 -1
  236. package/docs/examples/teams/update-membership-status.md +4 -4
  237. package/docs/examples/teams/update-membership.md +2 -2
  238. package/docs/examples/teams/update-name.md +2 -2
  239. package/docs/examples/teams/update-prefs.md +1 -1
  240. package/docs/examples/users/create-argon2user.md +2 -2
  241. package/docs/examples/users/create-bcrypt-user.md +2 -2
  242. package/docs/examples/users/create-m-d5user.md +2 -2
  243. package/docs/examples/users/create-p-h-pass-user.md +2 -2
  244. package/docs/examples/users/create-s-h-a-user.md +2 -2
  245. package/docs/examples/users/create-scrypt-modified-user.md +5 -5
  246. package/docs/examples/users/create-scrypt-user.md +3 -3
  247. package/docs/examples/users/create-session.md +1 -1
  248. package/docs/examples/users/create-target.md +5 -5
  249. package/docs/examples/users/create-token.md +1 -1
  250. package/docs/examples/users/create.md +2 -2
  251. package/docs/examples/users/delete-authenticator.md +2 -2
  252. package/docs/examples/users/delete-identity.md +1 -1
  253. package/docs/examples/users/delete-session.md +2 -2
  254. package/docs/examples/users/delete-sessions.md +1 -1
  255. package/docs/examples/users/delete-target.md +2 -2
  256. package/docs/examples/users/delete.md +1 -1
  257. package/docs/examples/users/get-prefs.md +1 -1
  258. package/docs/examples/users/get-target.md +2 -2
  259. package/docs/examples/users/get.md +1 -1
  260. package/docs/examples/users/list-factors.md +1 -1
  261. package/docs/examples/users/list-identities.md +1 -1
  262. package/docs/examples/users/list-logs.md +1 -1
  263. package/docs/examples/users/list-memberships.md +1 -1
  264. package/docs/examples/users/list-sessions.md +1 -1
  265. package/docs/examples/users/list-targets.md +1 -1
  266. package/docs/examples/users/list.md +1 -1
  267. package/docs/examples/users/update-email-verification.md +1 -1
  268. package/docs/examples/users/update-email.md +1 -1
  269. package/docs/examples/users/update-labels.md +1 -1
  270. package/docs/examples/users/update-mfa.md +1 -1
  271. package/docs/examples/users/update-name.md +2 -2
  272. package/docs/examples/users/update-password.md +1 -1
  273. package/docs/examples/users/update-phone-verification.md +1 -1
  274. package/docs/examples/users/update-phone.md +1 -1
  275. package/docs/examples/users/update-prefs.md +1 -1
  276. package/docs/examples/users/update-status.md +1 -1
  277. package/docs/examples/users/update-target.md +5 -5
  278. package/docs/examples/vcs/create-repository-detection.md +3 -3
  279. package/docs/examples/vcs/create-repository.md +2 -2
  280. package/docs/examples/vcs/delete-installation.md +1 -1
  281. package/docs/examples/vcs/get-installation.md +1 -1
  282. package/docs/examples/vcs/get-repository.md +2 -2
  283. package/docs/examples/vcs/list-installations.md +1 -1
  284. package/docs/examples/vcs/list-repositories.md +2 -2
  285. package/docs/examples/vcs/list-repository-branches.md +2 -2
  286. package/docs/examples/vcs/update-external-deployments.md +3 -3
  287. package/package.json +1 -1
  288. package/src/client.ts +1 -1
  289. package/src/enums/email-template-type.ts +1 -0
  290. package/src/enums/sms-template-type.ts +1 -0
  291. package/src/enums/{encryption.ts → smtp-encryption.ts} +1 -1
  292. package/src/index.ts +1 -1
  293. package/src/service.ts +0 -3
  294. package/src/services/account.ts +61 -8
  295. package/src/services/assistant.ts +0 -1
  296. package/src/services/avatars.ts +0 -1
  297. package/src/services/console.ts +0 -1
  298. package/src/services/databases.ts +0 -1
  299. package/src/services/functions.ts +0 -1
  300. package/src/services/graphql.ts +0 -1
  301. package/src/services/health.ts +0 -1
  302. package/src/services/locale.ts +0 -1
  303. package/src/services/messaging.ts +24 -10
  304. package/src/services/migrations.ts +0 -1
  305. package/src/services/project.ts +0 -1
  306. package/src/services/projects.ts +0 -1
  307. package/src/services/proxy.ts +0 -1
  308. package/src/services/storage.ts +0 -1
  309. package/src/services/teams.ts +0 -1
  310. package/src/services/users.ts +0 -1
  311. package/src/services/vcs.ts +0 -1
  312. package/types/enums/email-template-type.d.ts +2 -1
  313. package/types/enums/sms-template-type.d.ts +2 -1
  314. package/types/enums/{encryption.d.ts → smtp-encryption.d.ts} +1 -1
  315. package/types/index.d.ts +1 -1
  316. package/types/services/account.d.ts +28 -3
  317. package/types/services/messaging.d.ts +12 -9
  318. package/docs/examples/messaging/update-a-p-n-s-provider.md +0 -19
package/.travis.yml ADDED
@@ -0,0 +1,32 @@
1
+ language: node_js
2
+ node_js:
3
+ - "14.16"
4
+
5
+ jobs:
6
+ include:
7
+ - stage: NPM RC Release
8
+ if: tag == *-rc*
9
+ node_js: "14.16"
10
+ script:
11
+ - npm install
12
+ - npm run build
13
+ - echo "Deploying RC to NPM..."
14
+ deploy:
15
+ provider: npm
16
+ email: $NPM_EMAIL
17
+ api_key: $NPM_API_KEY
18
+ tag: next
19
+ - stage: NPM Release
20
+ if: tag != *-rc*
21
+ node_js: "14.16"
22
+ script:
23
+ - npm install
24
+ - npm run build
25
+ - echo "Deploying to NPM..."
26
+ deploy:
27
+ provider: npm
28
+ email: $NPM_EMAIL
29
+ api_key: $NPM_API_KEY
30
+ skip_cleanup: true
31
+ on:
32
+ tags: true
package/README.md CHANGED
@@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
33
33
  To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:
34
34
 
35
35
  ```html
36
- <script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.6.0-rc.12"></script>
36
+ <script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.6.0-rc.13"></script>
37
37
  ```
38
38
 
39
39
 
@@ -64,7 +64,7 @@ Once your SDK object is set, access any of the Appwrite services and choose any
64
64
  const account = new Account(client);
65
65
 
66
66
  // Register User
67
- account.create(ID.unique(), 'me@example.com', 'password', 'Jane Doe')
67
+ account.create(ID.unique(), "email@example.com", "password", "Walter O'Brien")
68
68
  .then(function (response) {
69
69
  console.log(response);
70
70
  }, function (error) {
@@ -86,7 +86,7 @@ client
86
86
  const account = new Account(client);
87
87
 
88
88
  // Register User
89
- account.create(ID.unique(), 'me@example.com', 'password', 'Jane Doe')
89
+ account.create(ID.unique(), "email@example.com", "password", "Walter O'Brien")
90
90
  .then(function (response) {
91
91
  console.log(response);
92
92
  }, function (error) {
package/dist/cjs/sdk.js CHANGED
@@ -28,6 +28,26 @@ function __awaiter(thisArg, _arguments, P, generator) {
28
28
  });
29
29
  }
30
30
 
31
+ class Service {
32
+ constructor(client) {
33
+ this.client = client;
34
+ }
35
+ static flatten(data, prefix = '') {
36
+ let output = {};
37
+ for (const [key, value] of Object.entries(data)) {
38
+ let finalKey = prefix ? prefix + '[' + key + ']' : key;
39
+ if (Array.isArray(value)) {
40
+ output = Object.assign(Object.assign({}, output), Service.flatten(value, finalKey));
41
+ }
42
+ else {
43
+ output[finalKey] = value;
44
+ }
45
+ }
46
+ return output;
47
+ }
48
+ }
49
+ Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
50
+
31
51
  class Query {
32
52
  constructor(method, attribute, values) {
33
53
  this.method = method;
@@ -72,29 +92,6 @@ Query.contains = (attribute, value) => new Query("contains", attribute, value).t
72
92
  Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
73
93
  Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
74
94
 
75
- class Service {
76
- constructor(client) {
77
- this.client = client;
78
- }
79
- static flatten(data, prefix = '') {
80
- let output = {};
81
- for (const [key, value] of Object.entries(data)) {
82
- let finalKey = prefix ? prefix + '[' + key + ']' : key;
83
- if (Array.isArray(value)) {
84
- output = Object.assign(Object.assign({}, output), Service.flatten(value, finalKey));
85
- }
86
- else if (value instanceof Query) {
87
- output[finalKey] = JSON.stringify(value);
88
- }
89
- else {
90
- output[finalKey] = value;
91
- }
92
- }
93
- return output;
94
- }
95
- }
96
- Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
97
-
98
95
  class AppwriteException extends Error {
99
96
  constructor(message, code = 0, type = '', response = '') {
100
97
  super(message);
@@ -120,7 +117,7 @@ class Client {
120
117
  'x-sdk-name': 'Console',
121
118
  'x-sdk-platform': 'console',
122
119
  'x-sdk-language': 'web',
123
- 'x-sdk-version': '0.6.0-rc.12',
120
+ 'x-sdk-version': '0.6.0-rc.13',
124
121
  'X-Appwrite-Response-Format': '1.5.0',
125
122
  };
126
123
  this.realtime = {
@@ -702,7 +699,7 @@ class Account extends Service {
702
699
  * @throws {AppwriteException}
703
700
  * @returns {Promise}
704
701
  */
705
- create2FAChallenge(factor) {
702
+ createChallenge(factor) {
706
703
  return __awaiter(this, void 0, void 0, function* () {
707
704
  if (typeof factor === 'undefined') {
708
705
  throw new AppwriteException('Missing required parameter: "factor"');
@@ -1223,12 +1220,11 @@ class Account extends Service {
1223
1220
  * @param {OAuthProvider} provider
1224
1221
  * @param {string} success
1225
1222
  * @param {string} failure
1226
- * @param {boolean} token
1227
1223
  * @param {string[]} scopes
1228
1224
  * @throws {AppwriteException}
1229
1225
  * @returns {void|string}
1230
1226
  */
1231
- createOAuth2Session(provider, success, failure, token, scopes) {
1227
+ createOAuth2Session(provider, success, failure, scopes) {
1232
1228
  if (typeof provider === 'undefined') {
1233
1229
  throw new AppwriteException('Missing required parameter: "provider"');
1234
1230
  }
@@ -1240,9 +1236,6 @@ class Account extends Service {
1240
1236
  if (typeof failure !== 'undefined') {
1241
1237
  payload['failure'] = failure;
1242
1238
  }
1243
- if (typeof token !== 'undefined') {
1244
- payload['token'] = token;
1245
- }
1246
1239
  if (typeof scopes !== 'undefined') {
1247
1240
  payload['scopes'] = scopes;
1248
1241
  }
@@ -1568,6 +1561,58 @@ class Account extends Service {
1568
1561
  }, payload);
1569
1562
  });
1570
1563
  }
1564
+ /**
1565
+ * Create OAuth2 token
1566
+ *
1567
+ * Allow the user to login to their account using the OAuth2 provider of their
1568
+ * choice. Each OAuth2 provider should be enabled from the Appwrite console
1569
+ * first. Use the success and failure arguments to provide a redirect URL's
1570
+ * back to your app when login is completed.
1571
+ *
1572
+ * If authentication succeeds, `userId` and `secret` of a token will be
1573
+ * appended to the success URL as query parameters. These can be used to
1574
+ * create a new session using the [Create
1575
+ * session](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
1576
+ * endpoint.
1577
+ *
1578
+ * A user is limited to 10 active sessions at a time by default. [Learn more
1579
+ * about session
1580
+ * limits](https://appwrite.io/docs/authentication-security#limits).
1581
+ *
1582
+ * @param {OAuthProvider} provider
1583
+ * @param {string} success
1584
+ * @param {string} failure
1585
+ * @param {string[]} scopes
1586
+ * @throws {AppwriteException}
1587
+ * @returns {void|string}
1588
+ */
1589
+ createOAuth2Token(provider, success, failure, scopes) {
1590
+ if (typeof provider === 'undefined') {
1591
+ throw new AppwriteException('Missing required parameter: "provider"');
1592
+ }
1593
+ const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider);
1594
+ const payload = {};
1595
+ if (typeof success !== 'undefined') {
1596
+ payload['success'] = success;
1597
+ }
1598
+ if (typeof failure !== 'undefined') {
1599
+ payload['failure'] = failure;
1600
+ }
1601
+ if (typeof scopes !== 'undefined') {
1602
+ payload['scopes'] = scopes;
1603
+ }
1604
+ const uri = new URL(this.client.config.endpoint + apiPath);
1605
+ payload['project'] = this.client.config.project;
1606
+ for (const [key, value] of Object.entries(Service.flatten(payload))) {
1607
+ uri.searchParams.append(key, value);
1608
+ }
1609
+ if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
1610
+ window.location.href = uri.toString();
1611
+ }
1612
+ else {
1613
+ return uri;
1614
+ }
1615
+ }
1571
1616
  /**
1572
1617
  * Create phone token
1573
1618
  *
@@ -6076,11 +6121,12 @@ class Messaging extends Service {
6076
6121
  * @param {string} authKeyId
6077
6122
  * @param {string} teamId
6078
6123
  * @param {string} bundleId
6124
+ * @param {boolean} sandbox
6079
6125
  * @param {boolean} enabled
6080
6126
  * @throws {AppwriteException}
6081
6127
  * @returns {Promise}
6082
6128
  */
6083
- createApnsProvider(providerId, name, authKey, authKeyId, teamId, bundleId, enabled) {
6129
+ createApnsProvider(providerId, name, authKey, authKeyId, teamId, bundleId, sandbox, enabled) {
6084
6130
  return __awaiter(this, void 0, void 0, function* () {
6085
6131
  if (typeof providerId === 'undefined') {
6086
6132
  throw new AppwriteException('Missing required parameter: "providerId"');
@@ -6108,6 +6154,9 @@ class Messaging extends Service {
6108
6154
  if (typeof bundleId !== 'undefined') {
6109
6155
  payload['bundleId'] = bundleId;
6110
6156
  }
6157
+ if (typeof sandbox !== 'undefined') {
6158
+ payload['sandbox'] = sandbox;
6159
+ }
6111
6160
  if (typeof enabled !== 'undefined') {
6112
6161
  payload['enabled'] = enabled;
6113
6162
  }
@@ -6129,10 +6178,11 @@ class Messaging extends Service {
6129
6178
  * @param {string} authKeyId
6130
6179
  * @param {string} teamId
6131
6180
  * @param {string} bundleId
6181
+ * @param {boolean} sandbox
6132
6182
  * @throws {AppwriteException}
6133
6183
  * @returns {Promise}
6134
6184
  */
6135
- updateAPNSProvider(providerId, name, enabled, authKey, authKeyId, teamId, bundleId) {
6185
+ updateApnsProvider(providerId, name, enabled, authKey, authKeyId, teamId, bundleId, sandbox) {
6136
6186
  return __awaiter(this, void 0, void 0, function* () {
6137
6187
  if (typeof providerId === 'undefined') {
6138
6188
  throw new AppwriteException('Missing required parameter: "providerId"');
@@ -6157,6 +6207,9 @@ class Messaging extends Service {
6157
6207
  if (typeof bundleId !== 'undefined') {
6158
6208
  payload['bundleId'] = bundleId;
6159
6209
  }
6210
+ if (typeof sandbox !== 'undefined') {
6211
+ payload['sandbox'] = sandbox;
6212
+ }
6160
6213
  const uri = new URL(this.client.config.endpoint + apiPath);
6161
6214
  return yield this.client.call('patch', uri, {
6162
6215
  'content-type': 'application/json',
@@ -6215,7 +6268,7 @@ class Messaging extends Service {
6215
6268
  * @throws {AppwriteException}
6216
6269
  * @returns {Promise}
6217
6270
  */
6218
- updateFCMProvider(providerId, name, enabled, serviceAccountJSON) {
6271
+ updateFcmProvider(providerId, name, enabled, serviceAccountJSON) {
6219
6272
  return __awaiter(this, void 0, void 0, function* () {
6220
6273
  if (typeof providerId === 'undefined') {
6221
6274
  throw new AppwriteException('Missing required parameter: "providerId"');
@@ -6565,7 +6618,7 @@ class Messaging extends Service {
6565
6618
  * @param {number} port
6566
6619
  * @param {string} username
6567
6620
  * @param {string} password
6568
- * @param {Encryption} encryption
6621
+ * @param {SmtpEncryption} encryption
6569
6622
  * @param {boolean} autoTLS
6570
6623
  * @param {string} mailer
6571
6624
  * @param {string} fromName
@@ -6648,7 +6701,7 @@ class Messaging extends Service {
6648
6701
  * @param {number} port
6649
6702
  * @param {string} username
6650
6703
  * @param {string} password
6651
- * @param {Encryption} encryption
6704
+ * @param {SmtpEncryption} encryption
6652
6705
  * @param {boolean} autoTLS
6653
6706
  * @param {string} mailer
6654
6707
  * @param {string} fromName
@@ -7261,10 +7314,11 @@ class Messaging extends Service {
7261
7314
  *
7262
7315
  * @param {string} topicId
7263
7316
  * @param {string} name
7317
+ * @param {string[]} subscribe
7264
7318
  * @throws {AppwriteException}
7265
7319
  * @returns {Promise}
7266
7320
  */
7267
- updateTopic(topicId, name) {
7321
+ updateTopic(topicId, name, subscribe) {
7268
7322
  return __awaiter(this, void 0, void 0, function* () {
7269
7323
  if (typeof topicId === 'undefined') {
7270
7324
  throw new AppwriteException('Missing required parameter: "topicId"');
@@ -7274,6 +7328,9 @@ class Messaging extends Service {
7274
7328
  if (typeof name !== 'undefined') {
7275
7329
  payload['name'] = name;
7276
7330
  }
7331
+ if (typeof subscribe !== 'undefined') {
7332
+ payload['subscribe'] = subscribe;
7333
+ }
7277
7334
  const uri = new URL(this.client.config.endpoint + apiPath);
7278
7335
  return yield this.client.call('patch', uri, {
7279
7336
  'content-type': 'application/json',
@@ -12894,12 +12951,12 @@ exports.MessageStatus = void 0;
12894
12951
  MessageStatus["Processing"] = "processing";
12895
12952
  })(exports.MessageStatus || (exports.MessageStatus = {}));
12896
12953
 
12897
- exports.Encryption = void 0;
12898
- (function (Encryption) {
12899
- Encryption["None"] = "none";
12900
- Encryption["Ssl"] = "ssl";
12901
- Encryption["Tls"] = "tls";
12902
- })(exports.Encryption || (exports.Encryption = {}));
12954
+ exports.SmtpEncryption = void 0;
12955
+ (function (SmtpEncryption) {
12956
+ SmtpEncryption["None"] = "none";
12957
+ SmtpEncryption["Ssl"] = "ssl";
12958
+ SmtpEncryption["Tls"] = "tls";
12959
+ })(exports.SmtpEncryption || (exports.SmtpEncryption = {}));
12903
12960
 
12904
12961
  exports.ProjectUsageRange = void 0;
12905
12962
  (function (ProjectUsageRange) {
@@ -12967,6 +13024,7 @@ exports.EmailTemplateType = void 0;
12967
13024
  EmailTemplateType["Magicsession"] = "magicsession";
12968
13025
  EmailTemplateType["Recovery"] = "recovery";
12969
13026
  EmailTemplateType["Invitation"] = "invitation";
13027
+ EmailTemplateType["Mfachallenge"] = "mfachallenge";
12970
13028
  })(exports.EmailTemplateType || (exports.EmailTemplateType = {}));
12971
13029
 
12972
13030
  exports.EmailTemplateLocale = void 0;
@@ -13109,6 +13167,7 @@ exports.SmsTemplateType = void 0;
13109
13167
  SmsTemplateType["Verification"] = "verification";
13110
13168
  SmsTemplateType["Login"] = "login";
13111
13169
  SmsTemplateType["Invitation"] = "invitation";
13170
+ SmsTemplateType["Mfachallenge"] = "mfachallenge";
13112
13171
  })(exports.SmsTemplateType || (exports.SmsTemplateType = {}));
13113
13172
 
13114
13173
  exports.SmsTemplateLocale = void 0;