appwrite-cli 12.0.1 → 13.0.0-rc.1
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.
- package/CHANGELOG.md +4 -0
- package/README.md +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +145 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/client.d.ts +89 -0
- package/dist/lib/client.d.ts.map +1 -0
- package/dist/lib/client.js +227 -0
- package/dist/lib/client.js.map +1 -0
- package/dist/lib/commands/account.d.ts +379 -0
- package/dist/lib/commands/account.d.ts.map +1 -0
- package/dist/lib/commands/account.js +1228 -0
- package/dist/lib/commands/account.js.map +1 -0
- package/dist/lib/commands/console.d.ts +20 -0
- package/dist/lib/commands/console.d.ts.map +1 -0
- package/dist/lib/commands/console.js +78 -0
- package/dist/lib/commands/console.js.map +1 -0
- package/dist/lib/commands/databases.d.ts +732 -0
- package/dist/lib/commands/databases.d.ts.map +1 -0
- package/dist/lib/commands/databases.js +2196 -0
- package/dist/lib/commands/databases.js.map +1 -0
- package/dist/lib/commands/functions.d.ts +310 -0
- package/dist/lib/commands/functions.d.ts.map +1 -0
- package/dist/lib/commands/functions.js +1100 -0
- package/dist/lib/commands/functions.js.map +1 -0
- package/dist/lib/commands/generic.d.ts +17 -0
- package/dist/lib/commands/generic.d.ts.map +1 -0
- package/dist/lib/commands/generic.js +279 -0
- package/dist/lib/commands/generic.js.map +1 -0
- package/dist/lib/commands/graphql.d.ts +19 -0
- package/dist/lib/commands/graphql.d.ts.map +1 -0
- package/dist/lib/commands/graphql.js +77 -0
- package/dist/lib/commands/graphql.js.map +1 -0
- package/dist/lib/commands/health.d.ts +153 -0
- package/dist/lib/commands/health.d.ts.map +1 -0
- package/dist/lib/commands/health.js +464 -0
- package/dist/lib/commands/health.js.map +1 -0
- package/dist/lib/commands/init.d.ts +3 -0
- package/dist/lib/commands/init.d.ts.map +1 -0
- package/dist/lib/commands/init.js +518 -0
- package/dist/lib/commands/init.js.map +1 -0
- package/dist/lib/commands/locale.d.ts +53 -0
- package/dist/lib/commands/locale.d.ts.map +1 -0
- package/dist/lib/commands/locale.js +165 -0
- package/dist/lib/commands/locale.js.map +1 -0
- package/dist/lib/commands/messaging.d.ts +588 -0
- package/dist/lib/commands/messaging.d.ts.map +1 -0
- package/dist/lib/commands/messaging.js +2042 -0
- package/dist/lib/commands/messaging.js.map +1 -0
- package/dist/lib/commands/migrations.d.ts +150 -0
- package/dist/lib/commands/migrations.d.ts.map +1 -0
- package/dist/lib/commands/migrations.js +524 -0
- package/dist/lib/commands/migrations.js.map +1 -0
- package/dist/lib/commands/organizations.d.ts +11 -0
- package/dist/lib/commands/organizations.d.ts.map +1 -0
- package/dist/lib/commands/organizations.js +31 -0
- package/dist/lib/commands/organizations.js.map +1 -0
- package/dist/lib/commands/project.d.ts +53 -0
- package/dist/lib/commands/project.d.ts.map +1 -0
- package/dist/lib/commands/project.js +176 -0
- package/dist/lib/commands/project.js.map +1 -0
- package/dist/lib/commands/projects.d.ts +516 -0
- package/dist/lib/commands/projects.d.ts.map +1 -0
- package/dist/lib/commands/projects.js +1590 -0
- package/dist/lib/commands/projects.js.map +1 -0
- package/dist/lib/commands/proxy.d.ts +71 -0
- package/dist/lib/commands/proxy.d.ts.map +1 -0
- package/dist/lib/commands/proxy.js +240 -0
- package/dist/lib/commands/proxy.js.map +1 -0
- package/dist/lib/commands/pull.d.ts +8 -0
- package/dist/lib/commands/pull.d.ts.map +1 -0
- package/dist/lib/commands/pull.js +455 -0
- package/dist/lib/commands/pull.js.map +1 -0
- package/dist/lib/commands/push.d.ts +4 -0
- package/dist/lib/commands/push.d.ts.map +1 -0
- package/dist/lib/commands/push.js +2154 -0
- package/dist/lib/commands/push.js.map +1 -0
- package/dist/lib/commands/run.d.ts +3 -0
- package/dist/lib/commands/run.d.ts.map +1 -0
- package/dist/lib/commands/run.js +287 -0
- package/dist/lib/commands/run.js.map +1 -0
- package/dist/lib/commands/sites.d.ts +296 -0
- package/dist/lib/commands/sites.d.ts.map +1 -0
- package/dist/lib/commands/sites.js +1046 -0
- package/dist/lib/commands/sites.js.map +1 -0
- package/dist/lib/commands/storage.d.ts +170 -0
- package/dist/lib/commands/storage.d.ts.map +1 -0
- package/dist/lib/commands/storage.js +651 -0
- package/dist/lib/commands/storage.js.map +1 -0
- package/dist/lib/commands/tables-db.d.ts +728 -0
- package/dist/lib/commands/tables-db.d.ts.map +1 -0
- package/dist/lib/commands/tables-db.js +2198 -0
- package/dist/lib/commands/tables-db.js.map +1 -0
- package/dist/lib/commands/teams.d.ts +129 -0
- package/dist/lib/commands/teams.d.ts.map +1 -0
- package/dist/lib/commands/teams.js +403 -0
- package/dist/lib/commands/teams.js.map +1 -0
- package/dist/lib/commands/tokens.d.ts +48 -0
- package/dist/lib/commands/tokens.d.ts.map +1 -0
- package/dist/lib/commands/tokens.js +156 -0
- package/dist/lib/commands/tokens.js.map +1 -0
- package/dist/lib/commands/types.d.ts +3 -0
- package/dist/lib/commands/types.d.ts.map +1 -0
- package/dist/lib/commands/types.js +155 -0
- package/dist/lib/commands/types.js.map +1 -0
- package/dist/lib/commands/update.d.ts +3 -0
- package/dist/lib/commands/update.d.ts.map +1 -0
- package/dist/lib/commands/update.js +202 -0
- package/dist/lib/commands/update.js.map +1 -0
- package/dist/lib/commands/users.d.ts +382 -0
- package/dist/lib/commands/users.d.ts.map +1 -0
- package/dist/lib/commands/users.js +1195 -0
- package/dist/lib/commands/users.js.map +1 -0
- package/dist/lib/commands/vcs.d.ts +92 -0
- package/dist/lib/commands/vcs.d.ts.map +1 -0
- package/dist/lib/commands/vcs.js +276 -0
- package/dist/lib/commands/vcs.js.map +1 -0
- package/dist/lib/config.d.ts +118 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/{lib → dist/lib}/config.js +204 -325
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/emulation/docker.d.ts +15 -0
- package/dist/lib/emulation/docker.d.ts.map +1 -0
- package/dist/lib/emulation/docker.js +220 -0
- package/dist/lib/emulation/docker.js.map +1 -0
- package/dist/lib/emulation/utils.d.ts +29 -0
- package/dist/lib/emulation/utils.d.ts.map +1 -0
- package/dist/lib/emulation/utils.js +168 -0
- package/dist/lib/emulation/utils.js.map +1 -0
- package/dist/lib/exception.d.ts +8 -0
- package/dist/lib/exception.d.ts.map +1 -0
- package/dist/lib/exception.js +16 -0
- package/dist/lib/exception.js.map +1 -0
- package/dist/lib/id.d.ts +7 -0
- package/dist/lib/id.d.ts.map +1 -0
- package/dist/lib/id.js +32 -0
- package/dist/lib/id.js.map +1 -0
- package/dist/lib/paginate.d.ts +10 -0
- package/dist/lib/paginate.d.ts.map +1 -0
- package/{lib → dist/lib}/paginate.js +9 -15
- package/dist/lib/paginate.js.map +1 -0
- package/dist/lib/parser.d.ts +18 -0
- package/dist/lib/parser.d.ts.map +1 -0
- package/dist/lib/parser.js +237 -0
- package/dist/lib/parser.js.map +1 -0
- package/dist/lib/questions.d.ts +59 -0
- package/dist/lib/questions.d.ts.map +1 -0
- package/dist/lib/questions.js +995 -0
- package/dist/lib/questions.js.map +1 -0
- package/dist/lib/sdks.d.ts +4 -0
- package/dist/lib/sdks.d.ts.map +1 -0
- package/dist/lib/sdks.js +51 -0
- package/dist/lib/sdks.js.map +1 -0
- package/dist/lib/spinner.d.ts +28 -0
- package/dist/lib/spinner.d.ts.map +1 -0
- package/{lib → dist/lib}/spinner.js +34 -45
- package/dist/lib/spinner.js.map +1 -0
- package/dist/lib/type-generation/attribute.d.ts +17 -0
- package/dist/lib/type-generation/attribute.d.ts.map +1 -0
- package/dist/lib/type-generation/attribute.js +19 -0
- package/dist/lib/type-generation/attribute.js.map +1 -0
- package/dist/lib/type-generation/languages/csharp.d.ts +7 -0
- package/dist/lib/type-generation/languages/csharp.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/csharp.js +180 -0
- package/dist/lib/type-generation/languages/csharp.js.map +1 -0
- package/dist/lib/type-generation/languages/dart.d.ts +8 -0
- package/dist/lib/type-generation/languages/dart.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/dart.js +197 -0
- package/dist/lib/type-generation/languages/dart.js.map +1 -0
- package/dist/lib/type-generation/languages/java.d.ts +7 -0
- package/dist/lib/type-generation/languages/java.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/java.js +140 -0
- package/dist/lib/type-generation/languages/java.js.map +1 -0
- package/dist/lib/type-generation/languages/javascript.d.ts +9 -0
- package/dist/lib/type-generation/languages/javascript.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/javascript.js +108 -0
- package/dist/lib/type-generation/languages/javascript.js.map +1 -0
- package/dist/lib/type-generation/languages/kotlin.d.ts +7 -0
- package/dist/lib/type-generation/languages/kotlin.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/kotlin.js +95 -0
- package/dist/lib/type-generation/languages/kotlin.js.map +1 -0
- package/dist/lib/type-generation/languages/language.d.ts +43 -0
- package/dist/lib/type-generation/languages/language.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/language.js +82 -0
- package/dist/lib/type-generation/languages/language.js.map +1 -0
- package/dist/lib/type-generation/languages/php.d.ts +7 -0
- package/dist/lib/type-generation/languages/php.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/php.js +116 -0
- package/dist/lib/type-generation/languages/php.js.map +1 -0
- package/dist/lib/type-generation/languages/swift.d.ts +7 -0
- package/dist/lib/type-generation/languages/swift.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/swift.js +179 -0
- package/dist/lib/type-generation/languages/swift.js.map +1 -0
- package/dist/lib/type-generation/languages/typescript.d.ts +9 -0
- package/dist/lib/type-generation/languages/typescript.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/typescript.js +112 -0
- package/dist/lib/type-generation/languages/typescript.js.map +1 -0
- package/dist/lib/types.d.ts +133 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +3 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.d.ts +15 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/{lib → dist/lib}/utils.js +74 -120
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/validations.d.ts +2 -0
- package/dist/lib/validations.d.ts.map +1 -0
- package/dist/lib/validations.js +20 -0
- package/dist/lib/validations.js.map +1 -0
- package/docs/examples/databases/upsert-document.md +1 -2
- package/index.ts +152 -0
- package/install.ps1 +2 -5
- package/install.sh +1 -2
- package/lib/client.ts +259 -0
- package/lib/commands/{account.js → account.ts} +408 -662
- package/lib/commands/console.ts +112 -0
- package/lib/commands/{databases.js → databases.ts} +818 -1136
- package/lib/commands/{functions.js → functions.ts} +381 -526
- package/lib/commands/{generic.js → generic.ts} +47 -39
- package/lib/commands/graphql.ts +110 -0
- package/lib/commands/{health.js → health.ts} +168 -284
- package/lib/commands/{init.js → init.ts} +68 -66
- package/lib/commands/{locale.js → locale.ts} +75 -121
- package/lib/commands/{messaging.js → messaging.ts} +699 -937
- package/lib/commands/{migrations.js → migrations.ts} +182 -258
- package/lib/commands/organizations.ts +46 -0
- package/lib/commands/{project.js → project.ts} +75 -111
- package/lib/commands/{projects.js → projects.ts} +587 -843
- package/lib/commands/{proxy.js → proxy.ts} +94 -140
- package/lib/commands/{pull.js → pull.ts} +54 -44
- package/lib/commands/{push.js → push.ts} +235 -191
- package/lib/commands/{run.js → run.ts} +61 -55
- package/lib/commands/{sites.js → sites.ts} +364 -504
- package/lib/commands/{storage.js → storage.ts} +216 -292
- package/lib/commands/{tables-db.js → tables-db.ts} +817 -1126
- package/lib/commands/{teams.js → teams.ts} +162 -236
- package/lib/commands/{tokens.js → tokens.ts} +70 -99
- package/lib/commands/{types.js → types.ts} +37 -35
- package/lib/commands/{update.js → update.ts} +25 -27
- package/lib/commands/{users.js → users.ts} +426 -644
- package/lib/commands/{vcs.js → vcs.ts} +118 -174
- package/lib/config.ts +854 -0
- package/lib/emulation/{docker.js → docker.ts} +39 -38
- package/lib/emulation/utils.ts +193 -0
- package/lib/exception.ts +20 -0
- package/lib/{id.js → id.ts} +5 -5
- package/lib/paginate.ts +63 -0
- package/lib/parser.ts +238 -0
- package/lib/{questions.js → questions.ts} +148 -156
- package/lib/sdks.ts +55 -0
- package/lib/spinner.ts +118 -0
- package/lib/type-generation/attribute.ts +17 -0
- package/lib/type-generation/languages/{csharp.js → csharp.ts} +59 -57
- package/lib/type-generation/languages/{dart.js → dart.ts} +91 -89
- package/lib/type-generation/languages/{java.js → java.ts} +58 -56
- package/lib/type-generation/languages/javascript.ts +111 -0
- package/lib/type-generation/languages/kotlin.ts +96 -0
- package/lib/type-generation/languages/language.ts +119 -0
- package/lib/type-generation/languages/{php.js → php.ts} +55 -53
- package/lib/type-generation/languages/{swift.js → swift.ts} +59 -57
- package/lib/type-generation/languages/typescript.ts +116 -0
- package/lib/types.ts +150 -0
- package/lib/utils.ts +322 -0
- package/lib/validations.ts +17 -0
- package/package.json +21 -12
- package/scoop/appwrite.config.json +3 -3
- package/tsconfig.json +30 -0
- package/index.js +0 -147
- package/lib/client.js +0 -254
- package/lib/commands/console.js +0 -127
- package/lib/commands/graphql.js +0 -126
- package/lib/commands/organizations.js +0 -48
- package/lib/emulation/utils.js +0 -186
- package/lib/exception.js +0 -9
- package/lib/parser.js +0 -250
- package/lib/sdks.js +0 -60
- package/lib/type-generation/attribute.js +0 -19
- package/lib/type-generation/languages/javascript.js +0 -111
- package/lib/type-generation/languages/kotlin.js +0 -94
- package/lib/type-generation/languages/language.js +0 -125
- package/lib/type-generation/languages/typescript.js +0 -116
- package/lib/validations.js +0 -17
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* @param {fs.ReadStream} readStream
|
|
17
|
-
* @returns {ReadableStream}
|
|
18
|
-
*/
|
|
19
|
-
function convertReadStreamToReadableStream(readStream) {
|
|
1
|
+
import fs = require('fs');
|
|
2
|
+
import pathLib = require('path');
|
|
3
|
+
import tar = require('tar');
|
|
4
|
+
import ignore = require('ignore');
|
|
5
|
+
import { promisify } from 'util';
|
|
6
|
+
import Client from '../client';
|
|
7
|
+
import { getAllFiles, showConsoleLink } from '../utils';
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
import { sdkForProject, sdkForConsole } from '../sdks';
|
|
10
|
+
import { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log, warn } from '../parser';
|
|
11
|
+
import { localConfig, globalConfig } from '../config';
|
|
12
|
+
import { File } from 'undici';
|
|
13
|
+
import { ReadableStream } from 'stream/web';
|
|
14
|
+
|
|
15
|
+
function convertReadStreamToReadableStream(readStream: fs.ReadStream): ReadableStream {
|
|
20
16
|
return new ReadableStream({
|
|
21
17
|
start(controller) {
|
|
22
|
-
readStream.on("data", (chunk) => {
|
|
18
|
+
readStream.on("data", (chunk: Buffer) => {
|
|
23
19
|
controller.enqueue(chunk);
|
|
24
20
|
});
|
|
25
21
|
readStream.on("end", () => {
|
|
26
22
|
controller.close();
|
|
27
23
|
});
|
|
28
|
-
readStream.on("error", (err) => {
|
|
24
|
+
readStream.on("error", (err: Error) => {
|
|
29
25
|
controller.error(err);
|
|
30
26
|
});
|
|
31
27
|
},
|
|
@@ -35,24 +31,20 @@ function convertReadStreamToReadableStream(readStream) {
|
|
|
35
31
|
});
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
const proxy = new Command("proxy").description(commandDescriptions['proxy'] ?? '').configureHelp({
|
|
34
|
+
export const proxy = new Command("proxy").description(commandDescriptions['proxy'] ?? '').configureHelp({
|
|
39
35
|
helpWidth: process.stdout.columns || 80
|
|
40
36
|
})
|
|
41
37
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @param {ProxyListRulesRequestParams} params
|
|
54
|
-
*/
|
|
55
|
-
const proxyListRules = async ({queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
38
|
+
interface ProxyListRulesRequestParams {
|
|
39
|
+
queries?: string[];
|
|
40
|
+
search?: string;
|
|
41
|
+
total?: boolean;
|
|
42
|
+
overrideForCli?: boolean;
|
|
43
|
+
parseOutput?: boolean;
|
|
44
|
+
sdk?: Client;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const proxyListRules = async ({queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined}: ProxyListRulesRequestParams): Promise<any> => {
|
|
56
48
|
let client = !sdk ? await sdkForProject() :
|
|
57
49
|
sdk;
|
|
58
50
|
let apiPath = '/proxy/rules';
|
|
@@ -79,18 +71,14 @@ const proxyListRules = async ({queries,search,total,parseOutput = true, override
|
|
|
79
71
|
return response;
|
|
80
72
|
|
|
81
73
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @param {ProxyCreateAPIRuleRequestParams} params
|
|
92
|
-
*/
|
|
93
|
-
const proxyCreateAPIRule = async ({domain,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
74
|
+
interface ProxyCreateAPIRuleRequestParams {
|
|
75
|
+
domain: string;
|
|
76
|
+
overrideForCli?: boolean;
|
|
77
|
+
parseOutput?: boolean;
|
|
78
|
+
sdk?: Client;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const proxyCreateAPIRule = async ({domain,parseOutput = true, overrideForCli = false, sdk = undefined}: ProxyCreateAPIRuleRequestParams): Promise<any> => {
|
|
94
82
|
let client = !sdk ? await sdkForProject() :
|
|
95
83
|
sdk;
|
|
96
84
|
let apiPath = '/proxy/rules/api';
|
|
@@ -112,20 +100,16 @@ const proxyCreateAPIRule = async ({domain,parseOutput = true, overrideForCli = f
|
|
|
112
100
|
return response;
|
|
113
101
|
|
|
114
102
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* @param {ProxyCreateFunctionRuleRequestParams} params
|
|
127
|
-
*/
|
|
128
|
-
const proxyCreateFunctionRule = async ({domain,functionId,branch,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
103
|
+
interface ProxyCreateFunctionRuleRequestParams {
|
|
104
|
+
domain: string;
|
|
105
|
+
functionId: string;
|
|
106
|
+
branch?: string;
|
|
107
|
+
overrideForCli?: boolean;
|
|
108
|
+
parseOutput?: boolean;
|
|
109
|
+
sdk?: Client;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const proxyCreateFunctionRule = async ({domain,functionId,branch,parseOutput = true, overrideForCli = false, sdk = undefined}: ProxyCreateFunctionRuleRequestParams): Promise<any> => {
|
|
129
113
|
let client = !sdk ? await sdkForProject() :
|
|
130
114
|
sdk;
|
|
131
115
|
let apiPath = '/proxy/rules/function';
|
|
@@ -153,22 +137,18 @@ const proxyCreateFunctionRule = async ({domain,functionId,branch,parseOutput = t
|
|
|
153
137
|
return response;
|
|
154
138
|
|
|
155
139
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* @param {ProxyCreateRedirectRuleRequestParams} params
|
|
170
|
-
*/
|
|
171
|
-
const proxyCreateRedirectRule = async ({domain,url,statusCode,resourceId,resourceType,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
140
|
+
interface ProxyCreateRedirectRuleRequestParams {
|
|
141
|
+
domain: string;
|
|
142
|
+
url: string;
|
|
143
|
+
statusCode: StatusCode;
|
|
144
|
+
resourceId: string;
|
|
145
|
+
resourceType: ProxyResourceType;
|
|
146
|
+
overrideForCli?: boolean;
|
|
147
|
+
parseOutput?: boolean;
|
|
148
|
+
sdk?: Client;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export const proxyCreateRedirectRule = async ({domain,url,statusCode,resourceId,resourceType,parseOutput = true, overrideForCli = false, sdk = undefined}: ProxyCreateRedirectRuleRequestParams): Promise<any> => {
|
|
172
152
|
let client = !sdk ? await sdkForProject() :
|
|
173
153
|
sdk;
|
|
174
154
|
let apiPath = '/proxy/rules/redirect';
|
|
@@ -202,20 +182,16 @@ const proxyCreateRedirectRule = async ({domain,url,statusCode,resourceId,resourc
|
|
|
202
182
|
return response;
|
|
203
183
|
|
|
204
184
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* @param {ProxyCreateSiteRuleRequestParams} params
|
|
217
|
-
*/
|
|
218
|
-
const proxyCreateSiteRule = async ({domain,siteId,branch,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
185
|
+
interface ProxyCreateSiteRuleRequestParams {
|
|
186
|
+
domain: string;
|
|
187
|
+
siteId: string;
|
|
188
|
+
branch?: string;
|
|
189
|
+
overrideForCli?: boolean;
|
|
190
|
+
parseOutput?: boolean;
|
|
191
|
+
sdk?: Client;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export const proxyCreateSiteRule = async ({domain,siteId,branch,parseOutput = true, overrideForCli = false, sdk = undefined}: ProxyCreateSiteRuleRequestParams): Promise<any> => {
|
|
219
195
|
let client = !sdk ? await sdkForProject() :
|
|
220
196
|
sdk;
|
|
221
197
|
let apiPath = '/proxy/rules/site';
|
|
@@ -243,18 +219,14 @@ const proxyCreateSiteRule = async ({domain,siteId,branch,parseOutput = true, ove
|
|
|
243
219
|
return response;
|
|
244
220
|
|
|
245
221
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* @param {ProxyGetRuleRequestParams} params
|
|
256
|
-
*/
|
|
257
|
-
const proxyGetRule = async ({ruleId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
222
|
+
interface ProxyGetRuleRequestParams {
|
|
223
|
+
ruleId: string;
|
|
224
|
+
overrideForCli?: boolean;
|
|
225
|
+
parseOutput?: boolean;
|
|
226
|
+
sdk?: Client;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export const proxyGetRule = async ({ruleId,parseOutput = true, overrideForCli = false, sdk = undefined}: ProxyGetRuleRequestParams): Promise<any> => {
|
|
258
230
|
let client = !sdk ? await sdkForProject() :
|
|
259
231
|
sdk;
|
|
260
232
|
let apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId);
|
|
@@ -272,18 +244,14 @@ const proxyGetRule = async ({ruleId,parseOutput = true, overrideForCli = false,
|
|
|
272
244
|
return response;
|
|
273
245
|
|
|
274
246
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* @param {ProxyDeleteRuleRequestParams} params
|
|
285
|
-
*/
|
|
286
|
-
const proxyDeleteRule = async ({ruleId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
247
|
+
interface ProxyDeleteRuleRequestParams {
|
|
248
|
+
ruleId: string;
|
|
249
|
+
overrideForCli?: boolean;
|
|
250
|
+
parseOutput?: boolean;
|
|
251
|
+
sdk?: Client;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export const proxyDeleteRule = async ({ruleId,parseOutput = true, overrideForCli = false, sdk = undefined}: ProxyDeleteRuleRequestParams): Promise<any> => {
|
|
287
255
|
let client = !sdk ? await sdkForProject() :
|
|
288
256
|
sdk;
|
|
289
257
|
let apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId);
|
|
@@ -302,18 +270,14 @@ const proxyDeleteRule = async ({ruleId,parseOutput = true, overrideForCli = fals
|
|
|
302
270
|
return response;
|
|
303
271
|
|
|
304
272
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* @param {ProxyUpdateRuleVerificationRequestParams} params
|
|
315
|
-
*/
|
|
316
|
-
const proxyUpdateRuleVerification = async ({ruleId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
273
|
+
interface ProxyUpdateRuleVerificationRequestParams {
|
|
274
|
+
ruleId: string;
|
|
275
|
+
overrideForCli?: boolean;
|
|
276
|
+
parseOutput?: boolean;
|
|
277
|
+
sdk?: Client;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export const proxyUpdateRuleVerification = async ({ruleId,parseOutput = true, overrideForCli = false, sdk = undefined}: ProxyUpdateRuleVerificationRequestParams): Promise<any> => {
|
|
317
281
|
let client = !sdk ? await sdkForProject() :
|
|
318
282
|
sdk;
|
|
319
283
|
let apiPath = '/proxy/rules/{ruleId}/verification'.replace('{ruleId}', ruleId);
|
|
@@ -337,7 +301,7 @@ proxy
|
|
|
337
301
|
.description(`Get a list of all the proxy rules. You can use the query params to filter your results.`)
|
|
338
302
|
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch`)
|
|
339
303
|
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
|
|
340
|
-
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value) => value === undefined ? true : parseBool(value))
|
|
304
|
+
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
341
305
|
.action(actionRunner(proxyListRules))
|
|
342
306
|
|
|
343
307
|
proxy
|
|
@@ -390,14 +354,4 @@ proxy
|
|
|
390
354
|
.requiredOption(`--rule-id <rule-id>`, `Rule ID.`)
|
|
391
355
|
.action(actionRunner(proxyUpdateRuleVerification))
|
|
392
356
|
|
|
393
|
-
|
|
394
|
-
proxy,
|
|
395
|
-
proxyListRules,
|
|
396
|
-
proxyCreateAPIRule,
|
|
397
|
-
proxyCreateFunctionRule,
|
|
398
|
-
proxyCreateRedirectRule,
|
|
399
|
-
proxyCreateSiteRule,
|
|
400
|
-
proxyGetRule,
|
|
401
|
-
proxyDeleteRule,
|
|
402
|
-
proxyUpdateRuleVerification
|
|
403
|
-
};
|
|
357
|
+
|
|
@@ -1,25 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import fs = require('fs');
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import tar = require('tar');
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
import inquirer from 'inquirer';
|
|
6
|
+
import { messagingListTopics } from './messaging';
|
|
7
|
+
import { teamsList } from './teams';
|
|
8
|
+
import { projectsGet } from './projects';
|
|
9
|
+
import { functionsList, functionsGetDeploymentDownload, functionsListDeployments } from './functions';
|
|
10
|
+
import { sitesList, sitesGetDeploymentDownload, sitesListDeployments } from './sites';
|
|
11
|
+
import { databasesGet, databasesListCollections, databasesList } from './databases';
|
|
12
|
+
import { tablesDBList, tablesDBGet, tablesDBListTables } from './tables-db';
|
|
13
|
+
import { storageListBuckets } from './storage';
|
|
14
|
+
import { localConfig } from '../config';
|
|
15
|
+
import { paginate } from '../paginate';
|
|
16
|
+
import { questionsPullCollection, questionsPullFunctions, questionsPullFunctionsCode, questionsPullSites, questionsPullSitesCode, questionsPullResources } from '../questions';
|
|
17
|
+
import { cliConfig, success, log, warn, actionRunner, commandDescriptions } from '../parser';
|
|
18
|
+
|
|
19
|
+
interface PullResourcesOptions {
|
|
20
|
+
skipDeprecated?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface PullFunctionsOptions {
|
|
24
|
+
code?: boolean;
|
|
25
|
+
withVariables?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface PullSitesOptions {
|
|
29
|
+
code?: boolean;
|
|
30
|
+
withVariables?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const pullResources = async ({
|
|
20
34
|
skipDeprecated = false
|
|
21
|
-
} = {}) => {
|
|
22
|
-
const actions = {
|
|
35
|
+
}: PullResourcesOptions = {}): Promise<void> => {
|
|
36
|
+
const actions: Record<string, (options?: any) => Promise<void>> = {
|
|
23
37
|
settings: pullSettings,
|
|
24
38
|
functions: pullFunctions,
|
|
25
39
|
sites: pullSites,
|
|
@@ -49,7 +63,7 @@ const pullResources = async ({
|
|
|
49
63
|
}
|
|
50
64
|
};
|
|
51
65
|
|
|
52
|
-
const pullSettings = async () => {
|
|
66
|
+
const pullSettings = async (): Promise<void> => {
|
|
53
67
|
log("Pulling project settings ...");
|
|
54
68
|
|
|
55
69
|
try {
|
|
@@ -66,7 +80,7 @@ const pullSettings = async () => {
|
|
|
66
80
|
}
|
|
67
81
|
}
|
|
68
82
|
|
|
69
|
-
const pullFunctions = async ({ code, withVariables }) => {
|
|
83
|
+
const pullFunctions = async ({ code, withVariables }: PullFunctionsOptions = {}): Promise<void> => {
|
|
70
84
|
process.chdir(localConfig.configDirectoryPath)
|
|
71
85
|
|
|
72
86
|
log("Fetching functions ...");
|
|
@@ -86,7 +100,7 @@ const pullFunctions = async ({ code, withVariables }) => {
|
|
|
86
100
|
? (await paginate(functionsList, { parseOutput: false }, 100, 'functions')).functions
|
|
87
101
|
: (await inquirer.prompt(questionsPullFunctions)).functions;
|
|
88
102
|
|
|
89
|
-
let allowCodePull = cliConfig.force === true ? true : null;
|
|
103
|
+
let allowCodePull: boolean | null = cliConfig.force === true ? true : null;
|
|
90
104
|
|
|
91
105
|
for (let func of functions) {
|
|
92
106
|
total++;
|
|
@@ -121,7 +135,7 @@ const pullFunctions = async ({ code, withVariables }) => {
|
|
|
121
135
|
continue;
|
|
122
136
|
}
|
|
123
137
|
|
|
124
|
-
let deploymentId = null;
|
|
138
|
+
let deploymentId: string | null = null;
|
|
125
139
|
|
|
126
140
|
try {
|
|
127
141
|
const fetchResponse = await functionsListDeployments({
|
|
@@ -172,14 +186,14 @@ const pullFunctions = async ({ code, withVariables }) => {
|
|
|
172
186
|
} catch {
|
|
173
187
|
}
|
|
174
188
|
|
|
175
|
-
fs.writeFileSync(envFileLocation, holdingVars.map(r => `${r.key}=${r.value}\n`).join(''))
|
|
189
|
+
fs.writeFileSync(envFileLocation, holdingVars.map((r: any) => `${r.key}=${r.value}\n`).join(''))
|
|
176
190
|
}
|
|
177
191
|
}
|
|
178
192
|
|
|
179
193
|
success(`Successfully pulled ${chalk.bold(total)} functions.`);
|
|
180
194
|
}
|
|
181
195
|
|
|
182
|
-
const pullSites = async ({ code, withVariables }) => {
|
|
196
|
+
const pullSites = async ({ code, withVariables }: PullSitesOptions = {}): Promise<void> => {
|
|
183
197
|
process.chdir(localConfig.configDirectoryPath)
|
|
184
198
|
|
|
185
199
|
log("Fetching sites ...");
|
|
@@ -199,7 +213,7 @@ const pullSites = async ({ code, withVariables }) => {
|
|
|
199
213
|
? (await paginate(sitesList, { parseOutput: false }, 100, 'sites')).sites
|
|
200
214
|
: (await inquirer.prompt(questionsPullSites)).sites;
|
|
201
215
|
|
|
202
|
-
let allowCodePull = cliConfig.force === true ? true : null;
|
|
216
|
+
let allowCodePull: boolean | null = cliConfig.force === true ? true : null;
|
|
203
217
|
|
|
204
218
|
for (let site of sites) {
|
|
205
219
|
total++;
|
|
@@ -234,7 +248,7 @@ const pullSites = async ({ code, withVariables }) => {
|
|
|
234
248
|
continue;
|
|
235
249
|
}
|
|
236
250
|
|
|
237
|
-
let deploymentId = null;
|
|
251
|
+
let deploymentId: string | null = null;
|
|
238
252
|
|
|
239
253
|
try {
|
|
240
254
|
const fetchResponse = await sitesListDeployments({
|
|
@@ -285,14 +299,14 @@ const pullSites = async ({ code, withVariables }) => {
|
|
|
285
299
|
} catch {
|
|
286
300
|
}
|
|
287
301
|
|
|
288
|
-
fs.writeFileSync(envFileLocation, holdingVars.map(r => `${r.key}=${r.value}\n`).join(''))
|
|
302
|
+
fs.writeFileSync(envFileLocation, holdingVars.map((r: any) => `${r.key}=${r.value}\n`).join(''))
|
|
289
303
|
}
|
|
290
304
|
}
|
|
291
305
|
|
|
292
306
|
success(`Successfully pulled ${chalk.bold(total)} sites.`);
|
|
293
307
|
}
|
|
294
308
|
|
|
295
|
-
const pullCollection = async () => {
|
|
309
|
+
const pullCollection = async (): Promise<void> => {
|
|
296
310
|
warn("appwrite pull collection has been deprecated. Please consider using 'appwrite pull tables' instead");
|
|
297
311
|
log("Fetching collections ...");
|
|
298
312
|
let totalDatabases = 0;
|
|
@@ -308,11 +322,11 @@ const pullCollection = async () => {
|
|
|
308
322
|
return;
|
|
309
323
|
}
|
|
310
324
|
|
|
311
|
-
let databases = cliConfig.ids;
|
|
325
|
+
let databases: string[] = cliConfig.ids;
|
|
312
326
|
|
|
313
327
|
if (databases.length === 0) {
|
|
314
328
|
if (cliConfig.all) {
|
|
315
|
-
databases = (await paginate(databasesList, { parseOutput: false }, 100, 'databases')).databases.map(database => database.$id);
|
|
329
|
+
databases = (await paginate(databasesList, { parseOutput: false }, 100, 'databases')).databases.map((database: any) => database.$id);
|
|
316
330
|
} else {
|
|
317
331
|
databases = (await inquirer.prompt(questionsPullCollection)).databases;
|
|
318
332
|
}
|
|
@@ -347,7 +361,7 @@ const pullCollection = async () => {
|
|
|
347
361
|
success(`Successfully pulled ${chalk.bold(totalCollections)} collections from ${chalk.bold(totalDatabases)} databases.`);
|
|
348
362
|
}
|
|
349
363
|
|
|
350
|
-
const pullTable = async () => {
|
|
364
|
+
const pullTable = async (): Promise<void> => {
|
|
351
365
|
log("Fetching tables ...");
|
|
352
366
|
let totalTablesDBs = 0;
|
|
353
367
|
let totalTables = 0;
|
|
@@ -362,11 +376,11 @@ const pullTable = async () => {
|
|
|
362
376
|
return;
|
|
363
377
|
}
|
|
364
378
|
|
|
365
|
-
let databases = cliConfig.ids;
|
|
379
|
+
let databases: string[] = cliConfig.ids;
|
|
366
380
|
|
|
367
381
|
if (databases.length === 0) {
|
|
368
382
|
if (cliConfig.all) {
|
|
369
|
-
databases = (await paginate(tablesDBList, { parseOutput: false }, 100, 'databases')).databases.map(database => database.$id);
|
|
383
|
+
databases = (await paginate(tablesDBList, { parseOutput: false }, 100, 'databases')).databases.map((database: any) => database.$id);
|
|
370
384
|
} else {
|
|
371
385
|
databases = (await inquirer.prompt(questionsPullCollection)).databases;
|
|
372
386
|
}
|
|
@@ -401,7 +415,7 @@ const pullTable = async () => {
|
|
|
401
415
|
success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} tableDBs.`);
|
|
402
416
|
}
|
|
403
417
|
|
|
404
|
-
const pullBucket = async () => {
|
|
418
|
+
const pullBucket = async (): Promise<void> => {
|
|
405
419
|
log("Fetching buckets ...");
|
|
406
420
|
let total = 0;
|
|
407
421
|
|
|
@@ -426,7 +440,7 @@ const pullBucket = async () => {
|
|
|
426
440
|
success(`Successfully pulled ${chalk.bold(total)} buckets.`);
|
|
427
441
|
}
|
|
428
442
|
|
|
429
|
-
const pullTeam = async () => {
|
|
443
|
+
const pullTeam = async (): Promise<void> => {
|
|
430
444
|
log("Fetching teams ...");
|
|
431
445
|
let total = 0;
|
|
432
446
|
|
|
@@ -451,7 +465,7 @@ const pullTeam = async () => {
|
|
|
451
465
|
success(`Successfully pulled ${chalk.bold(total)} teams.`);
|
|
452
466
|
}
|
|
453
467
|
|
|
454
|
-
const pullMessagingTopic = async () => {
|
|
468
|
+
const pullMessagingTopic = async (): Promise<void> => {
|
|
455
469
|
log("Fetching topics ...");
|
|
456
470
|
let total = 0;
|
|
457
471
|
|
|
@@ -476,7 +490,7 @@ const pullMessagingTopic = async () => {
|
|
|
476
490
|
success(`Successfully pulled ${chalk.bold(total)} topics.`);
|
|
477
491
|
}
|
|
478
492
|
|
|
479
|
-
const pull = new Command("pull")
|
|
493
|
+
export const pull = new Command("pull")
|
|
480
494
|
.description(commandDescriptions['pull'])
|
|
481
495
|
.action(actionRunner(() => pullResources({ skipDeprecated: true })));
|
|
482
496
|
|
|
@@ -541,7 +555,3 @@ pull
|
|
|
541
555
|
.description("Pull your Appwrite messaging topics")
|
|
542
556
|
.action(actionRunner(pullMessagingTopic))
|
|
543
557
|
|
|
544
|
-
module.exports = {
|
|
545
|
-
pull,
|
|
546
|
-
pullResources
|
|
547
|
-
};
|