@appwrite.io/console 2.1.1 → 2.1.3

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 (66) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/sdk.js +311 -17
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +310 -18
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +344 -70
  8. package/docs/examples/domains/list-suggestions.md +18 -0
  9. package/docs/examples/health/get-queue-audits.md +13 -0
  10. package/docs/examples/organizations/create.md +2 -2
  11. package/docs/examples/organizations/estimation-create-organization.md +2 -2
  12. package/docs/examples/organizations/estimation-update-plan.md +2 -2
  13. package/docs/examples/organizations/update-plan.md +2 -2
  14. package/package.json +3 -2
  15. package/src/channel.ts +134 -0
  16. package/src/client.ts +79 -9
  17. package/src/enums/billing-plan.ts +17 -0
  18. package/src/enums/filter-type.ts +4 -0
  19. package/src/enums/name.ts +1 -0
  20. package/src/enums/o-auth-provider.ts +0 -2
  21. package/src/index.ts +3 -0
  22. package/src/models.ts +437 -375
  23. package/src/query.ts +42 -0
  24. package/src/services/account.ts +20 -20
  25. package/src/services/avatars.ts +117 -117
  26. package/src/services/backups.ts +18 -18
  27. package/src/services/console.ts +24 -24
  28. package/src/services/databases.ts +89 -89
  29. package/src/services/domains.ts +295 -204
  30. package/src/services/functions.ts +30 -30
  31. package/src/services/health.ts +201 -152
  32. package/src/services/messaging.ts +54 -54
  33. package/src/services/migrations.ts +36 -36
  34. package/src/services/organizations.ts +67 -66
  35. package/src/services/projects.ts +81 -81
  36. package/src/services/realtime.ts +35 -12
  37. package/src/services/sites.ts +30 -30
  38. package/src/services/storage.ts +45 -45
  39. package/src/services/tables-db.ts +89 -89
  40. package/src/services/users.ts +39 -39
  41. package/types/channel.d.ts +71 -0
  42. package/types/client.d.ts +11 -3
  43. package/types/enums/billing-plan.d.ts +17 -0
  44. package/types/enums/filter-type.d.ts +4 -0
  45. package/types/enums/name.d.ts +1 -0
  46. package/types/enums/o-auth-provider.d.ts +0 -2
  47. package/types/index.d.ts +3 -0
  48. package/types/models.d.ts +434 -375
  49. package/types/query.d.ts +30 -0
  50. package/types/services/account.d.ts +11 -11
  51. package/types/services/avatars.d.ts +82 -82
  52. package/types/services/backups.d.ts +8 -8
  53. package/types/services/console.d.ts +14 -14
  54. package/types/services/databases.d.ts +50 -50
  55. package/types/services/domains.d.ts +139 -104
  56. package/types/services/functions.d.ts +15 -15
  57. package/types/services/health.d.ts +95 -78
  58. package/types/services/messaging.d.ts +24 -24
  59. package/types/services/migrations.d.ts +16 -16
  60. package/types/services/organizations.d.ts +37 -36
  61. package/types/services/projects.d.ts +36 -36
  62. package/types/services/realtime.d.ts +17 -8
  63. package/types/services/sites.d.ts +15 -15
  64. package/types/services/storage.d.ts +30 -30
  65. package/types/services/tables-db.d.ts +50 -50
  66. package/types/services/users.d.ts +24 -24
@@ -0,0 +1,71 @@
1
+ interface Database {
2
+ _db: any;
3
+ }
4
+ interface Collection {
5
+ _coll: any;
6
+ }
7
+ interface Document {
8
+ _doc: any;
9
+ }
10
+ interface TablesDB {
11
+ _tdb: any;
12
+ }
13
+ interface Table {
14
+ _tbl: any;
15
+ }
16
+ interface Row {
17
+ _row: any;
18
+ }
19
+ interface Bucket {
20
+ _bkt: any;
21
+ }
22
+ interface File {
23
+ _file: any;
24
+ }
25
+ interface Func {
26
+ _fn: any;
27
+ }
28
+ interface Execution {
29
+ _exec: any;
30
+ }
31
+ interface Team {
32
+ _team: any;
33
+ }
34
+ interface Membership {
35
+ _mem: any;
36
+ }
37
+ interface Resolved {
38
+ _res: any;
39
+ }
40
+ declare type Actionable = Document | Row | File | Execution | Team | Membership;
41
+ export declare class Channel<T> {
42
+ private readonly segments;
43
+ _type: T;
44
+ private constructor();
45
+ private next;
46
+ private resolve;
47
+ toString(): string;
48
+ collection(this: Channel<Database>, id?: string): Channel<Collection>;
49
+ document(this: Channel<Collection>, id?: string): Channel<Document>;
50
+ table(this: Channel<TablesDB>, id?: string): Channel<Table>;
51
+ row(this: Channel<Table>, id?: string): Channel<Row>;
52
+ file(this: Channel<Bucket>, id?: string): Channel<File>;
53
+ execution(this: Channel<Func>, id?: string): Channel<Execution>;
54
+ create(this: Channel<Actionable>): Channel<Resolved>;
55
+ update(this: Channel<Actionable>): Channel<Resolved>;
56
+ delete(this: Channel<Actionable>): Channel<Resolved>;
57
+ static database(id?: string): Channel<Database>;
58
+ static tablesdb(id?: string): Channel<TablesDB>;
59
+ static bucket(id?: string): Channel<Bucket>;
60
+ static function(id?: string): Channel<Func>;
61
+ static team(id?: string): Channel<Team>;
62
+ static membership(id?: string): Channel<Membership>;
63
+ static account(userId?: string): string;
64
+ static get documents(): string;
65
+ static get rows(): string;
66
+ static get files(): string;
67
+ static get executions(): string;
68
+ }
69
+ export declare type ActionableChannel = Channel<Document> | Channel<Row> | Channel<File> | Channel<Execution> | Channel<Team> | Channel<Membership>;
70
+ export declare type ResolvedChannel = Channel<Resolved>;
71
+ export {};
package/types/client.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Models } from './models';
2
+ import { Channel, ActionableChannel, ResolvedChannel } from './channel';
2
3
  /**
3
4
  * Payload type representing a key-value pair with string keys and any values.
4
5
  */
@@ -208,8 +209,8 @@ declare class Client {
208
209
  * @deprecated Use the Realtime service instead.
209
210
  * @see Realtime
210
211
  *
211
- * @param {string|string[]} channels
212
- * Channel to subscribe - pass a single channel as a string or multiple with an array of strings.
212
+ * @param {string|string[]|Channel<any>|ActionableChannel|ResolvedChannel|(Channel<any>|ActionableChannel|ResolvedChannel)[]} channels
213
+ * Channel to subscribe - pass a single channel as a string or Channel builder instance, or multiple with an array.
213
214
  *
214
215
  * Possible channels are:
215
216
  * - account
@@ -227,10 +228,17 @@ declare class Client {
227
228
  * - teams.[ID]
228
229
  * - memberships
229
230
  * - memberships.[ID]
231
+ *
232
+ * You can also use Channel builders:
233
+ * - Channel.database('db').collection('col').document('doc').create()
234
+ * - Channel.bucket('bucket').file('file').update()
235
+ * - Channel.function('func').execution('exec').delete()
236
+ * - Channel.team('team').create()
237
+ * - Channel.membership('membership').update()
230
238
  * @param {(payload: RealtimeMessage) => void} callback Is called on every realtime update.
231
239
  * @returns {() => void} Unsubscribes from events.
232
240
  */
233
- subscribe<T extends unknown>(channels: string | string[], callback: (payload: RealtimeResponseEvent<T>) => void): () => void;
241
+ subscribe<T extends unknown>(channels: string | string[] | Channel<any> | ActionableChannel | ResolvedChannel | (Channel<any> | ActionableChannel | ResolvedChannel)[], callback: (payload: RealtimeResponseEvent<T>) => void): () => void;
234
242
  prepareRequest(method: string, url: URL, headers?: Headers, params?: Payload): {
235
243
  uri: string;
236
244
  options: RequestInit;
@@ -0,0 +1,17 @@
1
+ export declare enum BillingPlan {
2
+ Tier0 = "tier-0",
3
+ Tier1 = "tier-1",
4
+ Tier2 = "tier-2",
5
+ Imaginetier0 = "imagine-tier-0",
6
+ Imaginetier1 = "imagine-tier-1",
7
+ Imaginetier150 = "imagine-tier-1-50",
8
+ Imaginetier1100 = "imagine-tier-1-100",
9
+ Imaginetier1200 = "imagine-tier-1-200",
10
+ Imaginetier1290 = "imagine-tier-1-290",
11
+ Imaginetier1480 = "imagine-tier-1-480",
12
+ Imaginetier1700 = "imagine-tier-1-700",
13
+ Imaginetier1900 = "imagine-tier-1-900",
14
+ Imaginetier11100 = "imagine-tier-1-1100",
15
+ Imaginetier11650 = "imagine-tier-1-1650",
16
+ Imaginetier12200 = "imagine-tier-1-2200"
17
+ }
@@ -0,0 +1,4 @@
1
+ export declare enum FilterType {
2
+ Premium = "premium",
3
+ Suggestion = "suggestion"
4
+ }
@@ -9,6 +9,7 @@ export declare enum Name {
9
9
  V1webhooks = "v1-webhooks",
10
10
  V1certificates = "v1-certificates",
11
11
  V1builds = "v1-builds",
12
+ V1screenshots = "v1-screenshots",
12
13
  V1messaging = "v1-messaging",
13
14
  V1migrations = "v1-migrations"
14
15
  }
@@ -38,8 +38,6 @@ export declare enum OAuthProvider {
38
38
  Yandex = "yandex",
39
39
  Zoho = "zoho",
40
40
  Zoom = "zoom",
41
- Mock = "mock",
42
- Mockunverified = "mock-unverified",
43
41
  GithubImagine = "githubImagine",
44
42
  GoogleImagine = "googleImagine"
45
43
  }
package/types/index.d.ts CHANGED
@@ -36,6 +36,7 @@ export type { QueryTypes, QueryTypesList } from './query';
36
36
  export { Permission } from './permission';
37
37
  export { Role } from './role';
38
38
  export { ID } from './id';
39
+ export { Channel } from './channel';
39
40
  export { Operator, Condition } from './operator';
40
41
  export { AuthenticatorType } from './enums/authenticator-type';
41
42
  export { AuthenticationFactor } from './enums/authentication-factor';
@@ -52,6 +53,7 @@ export { UsageRange } from './enums/usage-range';
52
53
  export { RelationshipType } from './enums/relationship-type';
53
54
  export { RelationMutate } from './enums/relation-mutate';
54
55
  export { IndexType } from './enums/index-type';
56
+ export { FilterType } from './enums/filter-type';
55
57
  export { Runtime } from './enums/runtime';
56
58
  export { TemplateReferenceType } from './enums/template-reference-type';
57
59
  export { VCSReferenceType } from './enums/vcs-reference-type';
@@ -60,6 +62,7 @@ export { ExecutionMethod } from './enums/execution-method';
60
62
  export { Name } from './enums/name';
61
63
  export { MessagePriority } from './enums/message-priority';
62
64
  export { SmtpEncryption } from './enums/smtp-encryption';
65
+ export { BillingPlan } from './enums/billing-plan';
63
66
  export { ProjectUsageRange } from './enums/project-usage-range';
64
67
  export { Region } from './enums/region';
65
68
  export { Api } from './enums/api';