appwrite-cli 12.0.0 → 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 +8 -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} +410 -664
- 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} +122 -173
- 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 -48
- package/lib/type-generation/languages/{dart.js → dart.ts} +91 -80
- package/lib/type-generation/languages/{java.js → java.ts} +58 -47
- 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 -48
- package/lib/type-generation/languages/{swift.js → swift.ts} +59 -48
- 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 -16
- package/lib/type-generation/languages/javascript.js +0 -102
- package/lib/type-generation/languages/kotlin.js +0 -85
- package/lib/type-generation/languages/language.js +0 -125
- package/lib/type-generation/languages/typescript.js +0 -107
- package/lib/validations.js +0 -17
|
@@ -1,23 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import Client from './client';
|
|
3
|
+
import { localConfig, globalConfig } from './config';
|
|
4
|
+
import { projectsList } from './commands/projects';
|
|
5
|
+
import { organizationsList } from './commands/organizations';
|
|
6
|
+
import { teamsList } from './commands/teams';
|
|
7
|
+
import { functionsListRuntimes, functionsListSpecifications, functionsList } from './commands/functions';
|
|
8
|
+
import { accountListMFAFactors } from './commands/account';
|
|
9
|
+
import { sdkForConsole } from './sdks';
|
|
10
|
+
import { validateRequired } from './validations';
|
|
11
|
+
import { paginate } from './paginate';
|
|
12
|
+
import { isPortTaken, checkDeployConditions, isCloud } from './utils';
|
|
13
|
+
import { databasesList } from './commands/databases';
|
|
14
|
+
import JSONbig from 'json-bigint';
|
|
15
|
+
import { sitesListFrameworks, sitesListSpecifications, sitesList } from './commands/sites';
|
|
16
|
+
|
|
17
|
+
const JSONbigConfig = JSONbig({ storeAsString: false });
|
|
18
|
+
|
|
19
|
+
interface Answers {
|
|
20
|
+
override?: boolean;
|
|
21
|
+
method?: string;
|
|
22
|
+
start?: string;
|
|
23
|
+
organization?: string;
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface Choice {
|
|
28
|
+
name: string;
|
|
29
|
+
value: any;
|
|
30
|
+
disabled?: boolean | string;
|
|
31
|
+
current?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface Question {
|
|
35
|
+
type: string;
|
|
36
|
+
name: string;
|
|
37
|
+
message: string;
|
|
38
|
+
default?: any;
|
|
39
|
+
when?: ((answers: Answers) => boolean | Promise<boolean>) | boolean;
|
|
40
|
+
choices?: (() => Promise<Choice[]> | Choice[]) | Choice[];
|
|
41
|
+
validate?: (value: any) => boolean | string | Promise<boolean | string>;
|
|
42
|
+
mask?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const whenOverride = (answers: Answers): boolean => answers.override === undefined ? true : answers.override;
|
|
46
|
+
|
|
47
|
+
const getIgnores = (runtime: string): string[] => {
|
|
21
48
|
const languge = runtime.split("-").slice(0, -1).join("-");
|
|
22
49
|
|
|
23
50
|
switch (languge) {
|
|
@@ -51,7 +78,7 @@ const getIgnores = (runtime) => {
|
|
|
51
78
|
return [];
|
|
52
79
|
};
|
|
53
80
|
|
|
54
|
-
const getEntrypoint = (runtime) => {
|
|
81
|
+
const getEntrypoint = (runtime: string): string | undefined => {
|
|
55
82
|
const languge = runtime.split("-").slice(0, -1).join("-");
|
|
56
83
|
|
|
57
84
|
switch (languge) {
|
|
@@ -89,7 +116,7 @@ const getEntrypoint = (runtime) => {
|
|
|
89
116
|
return undefined;
|
|
90
117
|
};
|
|
91
118
|
|
|
92
|
-
const getInstallCommand = (runtime) => {
|
|
119
|
+
const getInstallCommand = (runtime: string): string | undefined => {
|
|
93
120
|
const languge = runtime.split("-").slice(0, -1).join("-");
|
|
94
121
|
|
|
95
122
|
switch (languge) {
|
|
@@ -122,7 +149,7 @@ const getInstallCommand = (runtime) => {
|
|
|
122
149
|
return undefined;
|
|
123
150
|
};
|
|
124
151
|
|
|
125
|
-
const questionsInitProject = [
|
|
152
|
+
export const questionsInitProject: Question[] = [
|
|
126
153
|
{
|
|
127
154
|
type: "confirm",
|
|
128
155
|
name: "override",
|
|
@@ -158,7 +185,7 @@ const questionsInitProject = [
|
|
|
158
185
|
? await paginate(organizationsList, { parseOutput: false, sdk: client }, 100, 'teams')
|
|
159
186
|
: await paginate(teamsList, { parseOutput: false, sdk: client }, 100, 'teams');
|
|
160
187
|
|
|
161
|
-
let choices = teams.map((team, idx) => {
|
|
188
|
+
let choices = teams.map((team: any, idx: number) => {
|
|
162
189
|
return {
|
|
163
190
|
name: `${team.name} (${team['$id']})`,
|
|
164
191
|
value: team['$id']
|
|
@@ -178,20 +205,20 @@ const questionsInitProject = [
|
|
|
178
205
|
name: "project",
|
|
179
206
|
message: "What would you like to name your project?",
|
|
180
207
|
default: "My Awesome Project",
|
|
181
|
-
when: (answer) => answer.start !== 'existing'
|
|
208
|
+
when: (answer: Answers) => answer.start !== 'existing'
|
|
182
209
|
},
|
|
183
210
|
{
|
|
184
211
|
type: "input",
|
|
185
212
|
name: "id",
|
|
186
213
|
message: "What ID would you like to have for your project?",
|
|
187
214
|
default: "unique()",
|
|
188
|
-
when: (answer) => answer.start !== 'existing'
|
|
215
|
+
when: (answer: Answers) => answer.start !== 'existing'
|
|
189
216
|
},
|
|
190
217
|
{
|
|
191
218
|
type: "search-list",
|
|
192
219
|
name: "project",
|
|
193
220
|
message: "Choose your Appwrite project.",
|
|
194
|
-
choices: async (answers) => {
|
|
221
|
+
choices: async (answers: Answers) => {
|
|
195
222
|
const queries = [
|
|
196
223
|
JSON.stringify({ method: 'equal', attribute: 'teamId', values: [answers.organization] }),
|
|
197
224
|
JSON.stringify({ method: 'orderDesc', attribute: '$id' })
|
|
@@ -199,7 +226,7 @@ const questionsInitProject = [
|
|
|
199
226
|
|
|
200
227
|
const { projects } = await paginate(projectsList, { parseOutput: false }, 100, 'projects', queries);
|
|
201
228
|
|
|
202
|
-
let choices = projects.map((project) => {
|
|
229
|
+
let choices = projects.map((project: any) => {
|
|
203
230
|
return {
|
|
204
231
|
name: `${project.name} (${project['$id']})`,
|
|
205
232
|
value: {
|
|
@@ -215,7 +242,7 @@ const questionsInitProject = [
|
|
|
215
242
|
|
|
216
243
|
return choices;
|
|
217
244
|
},
|
|
218
|
-
when: (answer) => answer.start === 'existing'
|
|
245
|
+
when: (answer: Answers) => answer.start === 'existing'
|
|
219
246
|
},
|
|
220
247
|
{
|
|
221
248
|
type: "list",
|
|
@@ -228,18 +255,19 @@ const questionsInitProject = [
|
|
|
228
255
|
if (!regions.length) {
|
|
229
256
|
throw new Error("No regions found. Please check your network or Appwrite Cloud availability.");
|
|
230
257
|
}
|
|
231
|
-
return regions.filter(region => !region.disabled).map(region => ({
|
|
258
|
+
return regions.filter((region: any) => !region.disabled).map((region: any) => ({
|
|
232
259
|
name: `${region.name} (${region.$id})`,
|
|
233
260
|
value: region.$id
|
|
234
261
|
}));
|
|
235
262
|
},
|
|
236
|
-
when: (answer) => {
|
|
263
|
+
when: (answer: Answers) => {
|
|
237
264
|
if (answer.start === 'existing') return false;
|
|
238
265
|
return isCloud();
|
|
239
266
|
}
|
|
240
267
|
}
|
|
241
268
|
];
|
|
242
|
-
|
|
269
|
+
|
|
270
|
+
export const questionsInitProjectAutopull: Question[] = [
|
|
243
271
|
{
|
|
244
272
|
type: "confirm",
|
|
245
273
|
name: "autopull",
|
|
@@ -247,7 +275,8 @@ const questionsInitProjectAutopull = [
|
|
|
247
275
|
`Would you like to pull all resources from project you just linked?`
|
|
248
276
|
},
|
|
249
277
|
];
|
|
250
|
-
|
|
278
|
+
|
|
279
|
+
export const questionsPullResources: Question[] = [
|
|
251
280
|
{
|
|
252
281
|
type: "list",
|
|
253
282
|
name: "resource",
|
|
@@ -262,21 +291,21 @@ const questionsPullResources = [
|
|
|
262
291
|
{ name: `Collections ${chalk.blackBright(`(Legacy Databases)`)}`, value: 'collections' }
|
|
263
292
|
]
|
|
264
293
|
}
|
|
265
|
-
]
|
|
294
|
+
];
|
|
266
295
|
|
|
267
|
-
const questionsPullFunctions = [
|
|
296
|
+
export const questionsPullFunctions: Question[] = [
|
|
268
297
|
{
|
|
269
298
|
type: "checkbox",
|
|
270
299
|
name: "functions",
|
|
271
300
|
message: "Which functions would you like to pull?",
|
|
272
|
-
validate: (value) => validateRequired('function', value),
|
|
301
|
+
validate: (value: any) => validateRequired('function', value),
|
|
273
302
|
choices: async () => {
|
|
274
303
|
const { functions } = await paginate(functionsList, { parseOutput: false }, 100, 'functions');
|
|
275
304
|
|
|
276
305
|
if (functions.length === 0) {
|
|
277
306
|
throw "We couldn't find any functions in your Appwrite project";
|
|
278
307
|
}
|
|
279
|
-
return functions.map(func => {
|
|
308
|
+
return functions.map((func: any) => {
|
|
280
309
|
return {
|
|
281
310
|
name: `${func.name} (${func.$id})`,
|
|
282
311
|
value: { ...func }
|
|
@@ -286,7 +315,7 @@ const questionsPullFunctions = [
|
|
|
286
315
|
}
|
|
287
316
|
];
|
|
288
317
|
|
|
289
|
-
const questionsPullFunctionsCode = [
|
|
318
|
+
export const questionsPullFunctionsCode: Question[] = [
|
|
290
319
|
{
|
|
291
320
|
type: "confirm",
|
|
292
321
|
name: "override",
|
|
@@ -294,19 +323,19 @@ const questionsPullFunctionsCode = [
|
|
|
294
323
|
},
|
|
295
324
|
];
|
|
296
325
|
|
|
297
|
-
const questionsPullSites = [
|
|
326
|
+
export const questionsPullSites: Question[] = [
|
|
298
327
|
{
|
|
299
328
|
type: "checkbox",
|
|
300
329
|
name: "sites",
|
|
301
330
|
message: "Which sites would you like to pull?",
|
|
302
|
-
validate: (value) => validateRequired('site', value),
|
|
331
|
+
validate: (value: any) => validateRequired('site', value),
|
|
303
332
|
choices: async () => {
|
|
304
333
|
const { sites } = await paginate(sitesList, { parseOutput: false }, 100, 'sites');
|
|
305
334
|
|
|
306
335
|
if (sites.length === 0) {
|
|
307
336
|
throw "We couldn't find any sites in your Appwrite project";
|
|
308
337
|
}
|
|
309
|
-
return sites.map(site => {
|
|
338
|
+
return sites.map((site: any) => {
|
|
310
339
|
return {
|
|
311
340
|
name: `${site.name} (${site.$id})`,
|
|
312
341
|
value: { ...site }
|
|
@@ -316,7 +345,7 @@ const questionsPullSites = [
|
|
|
316
345
|
}
|
|
317
346
|
];
|
|
318
347
|
|
|
319
|
-
const questionsPullSitesCode = [
|
|
348
|
+
export const questionsPullSitesCode: Question[] = [
|
|
320
349
|
{
|
|
321
350
|
type: "confirm",
|
|
322
351
|
name: "override",
|
|
@@ -324,7 +353,7 @@ const questionsPullSitesCode = [
|
|
|
324
353
|
},
|
|
325
354
|
];
|
|
326
355
|
|
|
327
|
-
const questionsCreateFunction = [
|
|
356
|
+
export const questionsCreateFunction: Question[] = [
|
|
328
357
|
{
|
|
329
358
|
type: "input",
|
|
330
359
|
name: "name",
|
|
@@ -346,7 +375,7 @@ const questionsCreateFunction = [
|
|
|
346
375
|
parseOutput: false
|
|
347
376
|
})
|
|
348
377
|
let runtimes = response["runtimes"]
|
|
349
|
-
let choices = runtimes.map((runtime, idx) => {
|
|
378
|
+
let choices = runtimes.map((runtime: any, idx: number) => {
|
|
350
379
|
return {
|
|
351
380
|
name: `${runtime.name} (${runtime['$id']})`,
|
|
352
381
|
value: {
|
|
@@ -370,7 +399,7 @@ const questionsCreateFunction = [
|
|
|
370
399
|
parseOutput: false
|
|
371
400
|
})
|
|
372
401
|
let specifications = response["specifications"]
|
|
373
|
-
let choices = specifications.map((spec, idx) => {
|
|
402
|
+
let choices = specifications.map((spec: any, idx: number) => {
|
|
374
403
|
return {
|
|
375
404
|
name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
|
|
376
405
|
value: spec.slug,
|
|
@@ -382,7 +411,7 @@ const questionsCreateFunction = [
|
|
|
382
411
|
}
|
|
383
412
|
];
|
|
384
413
|
|
|
385
|
-
const questionsCreateFunctionSelectTemplate = (templates) => {
|
|
414
|
+
export const questionsCreateFunctionSelectTemplate = (templates: string[]): Question[] => {
|
|
386
415
|
return [
|
|
387
416
|
{
|
|
388
417
|
type: "search-list",
|
|
@@ -397,9 +426,7 @@ const questionsCreateFunctionSelectTemplate = (templates) => {
|
|
|
397
426
|
];
|
|
398
427
|
};
|
|
399
428
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
const questionsCreateBucket = [
|
|
429
|
+
export const questionsCreateBucket: Question[] = [
|
|
403
430
|
{
|
|
404
431
|
type: "input",
|
|
405
432
|
name: "bucket",
|
|
@@ -420,7 +447,7 @@ const questionsCreateBucket = [
|
|
|
420
447
|
}
|
|
421
448
|
];
|
|
422
449
|
|
|
423
|
-
const questionsCreateTeam = [
|
|
450
|
+
export const questionsCreateTeam: Question[] = [
|
|
424
451
|
{
|
|
425
452
|
type: "input",
|
|
426
453
|
name: "bucket",
|
|
@@ -435,7 +462,7 @@ const questionsCreateTeam = [
|
|
|
435
462
|
}
|
|
436
463
|
];
|
|
437
464
|
|
|
438
|
-
const questionsCreateCollection = [
|
|
465
|
+
export const questionsCreateCollection: Question[] = [
|
|
439
466
|
{
|
|
440
467
|
type: "list",
|
|
441
468
|
name: "method",
|
|
@@ -452,7 +479,7 @@ const questionsCreateCollection = [
|
|
|
452
479
|
choices: async () => {
|
|
453
480
|
const databases = localConfig.getDatabases();
|
|
454
481
|
|
|
455
|
-
let choices = databases.map((database, idx) => {
|
|
482
|
+
let choices = databases.map((database: any, idx: number) => {
|
|
456
483
|
return {
|
|
457
484
|
name: `${database.name} (${database.$id})`,
|
|
458
485
|
value: database.$id
|
|
@@ -465,21 +492,21 @@ const questionsCreateCollection = [
|
|
|
465
492
|
|
|
466
493
|
return choices;
|
|
467
494
|
},
|
|
468
|
-
when: (answers) => (answers.method ?? '').toLowerCase() === 'existing'
|
|
495
|
+
when: (answers: Answers) => (answers.method ?? '').toLowerCase() === 'existing'
|
|
469
496
|
},
|
|
470
497
|
{
|
|
471
498
|
type: "input",
|
|
472
499
|
name: "databaseName",
|
|
473
500
|
message: "What would you like to name your database?",
|
|
474
501
|
default: "My Awesome Database",
|
|
475
|
-
when: (answers) => (answers.method ?? '').toLowerCase() !== 'existing'
|
|
502
|
+
when: (answers: Answers) => (answers.method ?? '').toLowerCase() !== 'existing'
|
|
476
503
|
},
|
|
477
504
|
{
|
|
478
505
|
type: "input",
|
|
479
506
|
name: "databaseId",
|
|
480
507
|
message: "What ID would you like to have for your database?",
|
|
481
508
|
default: "unique()",
|
|
482
|
-
when: (answers) => (answers.method ?? '').toLowerCase() !== 'existing'
|
|
509
|
+
when: (answers: Answers) => (answers.method ?? '').toLowerCase() !== 'existing'
|
|
483
510
|
},
|
|
484
511
|
{
|
|
485
512
|
type: "input",
|
|
@@ -501,7 +528,7 @@ const questionsCreateCollection = [
|
|
|
501
528
|
}
|
|
502
529
|
];
|
|
503
530
|
|
|
504
|
-
const questionsCreateTable = [
|
|
531
|
+
export const questionsCreateTable: Question[] = [
|
|
505
532
|
{
|
|
506
533
|
type: "list",
|
|
507
534
|
name: "method",
|
|
@@ -518,7 +545,7 @@ const questionsCreateTable = [
|
|
|
518
545
|
choices: async () => {
|
|
519
546
|
const databases = localConfig.getTablesDBs();
|
|
520
547
|
|
|
521
|
-
let choices = databases.map((database, idx) => {
|
|
548
|
+
let choices = databases.map((database: any, idx: number) => {
|
|
522
549
|
return {
|
|
523
550
|
name: `${database.name} (${database.$id})`,
|
|
524
551
|
value: database.$id
|
|
@@ -531,21 +558,21 @@ const questionsCreateTable = [
|
|
|
531
558
|
|
|
532
559
|
return choices;
|
|
533
560
|
},
|
|
534
|
-
when: (answers) => (answers.method ?? '').toLowerCase() === 'existing'
|
|
561
|
+
when: (answers: Answers) => (answers.method ?? '').toLowerCase() === 'existing'
|
|
535
562
|
},
|
|
536
563
|
{
|
|
537
564
|
type: "input",
|
|
538
565
|
name: "databaseName",
|
|
539
566
|
message: "What would you like to name your database?",
|
|
540
567
|
default: "My Awesome Database",
|
|
541
|
-
when: (answers) => (answers.method ?? '').toLowerCase() !== 'existing'
|
|
568
|
+
when: (answers: Answers) => (answers.method ?? '').toLowerCase() !== 'existing'
|
|
542
569
|
},
|
|
543
570
|
{
|
|
544
571
|
type: "input",
|
|
545
572
|
name: "databaseId",
|
|
546
573
|
message: "What ID would you like to have for your database?",
|
|
547
574
|
default: "unique()",
|
|
548
|
-
when: (answers) => (answers.method ?? '').toLowerCase() !== 'existing'
|
|
575
|
+
when: (answers: Answers) => (answers.method ?? '').toLowerCase() !== 'existing'
|
|
549
576
|
},
|
|
550
577
|
{
|
|
551
578
|
type: "input",
|
|
@@ -567,7 +594,7 @@ const questionsCreateTable = [
|
|
|
567
594
|
}
|
|
568
595
|
];
|
|
569
596
|
|
|
570
|
-
const questionsCreateMessagingTopic = [
|
|
597
|
+
export const questionsCreateMessagingTopic: Question[] = [
|
|
571
598
|
{
|
|
572
599
|
type: "input",
|
|
573
600
|
name: "topic",
|
|
@@ -582,12 +609,12 @@ const questionsCreateMessagingTopic = [
|
|
|
582
609
|
}
|
|
583
610
|
];
|
|
584
611
|
|
|
585
|
-
const questionsPullCollection = [
|
|
612
|
+
export const questionsPullCollection: Question[] = [
|
|
586
613
|
{
|
|
587
614
|
type: "checkbox",
|
|
588
615
|
name: "databases",
|
|
589
616
|
message: "From which database would you like to pull collections?",
|
|
590
|
-
validate: (value) => validateRequired('collection', value),
|
|
617
|
+
validate: (value: any) => validateRequired('collection', value),
|
|
591
618
|
choices: async () => {
|
|
592
619
|
let response = await databasesList({
|
|
593
620
|
parseOutput: false
|
|
@@ -597,7 +624,7 @@ const questionsPullCollection = [
|
|
|
597
624
|
if (databases.length <= 0) {
|
|
598
625
|
throw new Error("No databases found. Please create one in project console.")
|
|
599
626
|
}
|
|
600
|
-
let choices = databases.map((database, idx) => {
|
|
627
|
+
let choices = databases.map((database: any, idx: number) => {
|
|
601
628
|
return {
|
|
602
629
|
name: `${database.name} (${database.$id})`,
|
|
603
630
|
value: database.$id
|
|
@@ -608,7 +635,7 @@ const questionsPullCollection = [
|
|
|
608
635
|
}
|
|
609
636
|
];
|
|
610
637
|
|
|
611
|
-
const questionsLogin = [
|
|
638
|
+
export const questionsLogin: Question[] = [
|
|
612
639
|
{
|
|
613
640
|
type: "list",
|
|
614
641
|
name: "method",
|
|
@@ -623,26 +650,26 @@ const questionsLogin = [
|
|
|
623
650
|
type: "input",
|
|
624
651
|
name: "email",
|
|
625
652
|
message: "Enter your email",
|
|
626
|
-
validate(value) {
|
|
653
|
+
validate(value: string) {
|
|
627
654
|
if (!value) {
|
|
628
655
|
return "Please enter your email";
|
|
629
656
|
}
|
|
630
657
|
return true;
|
|
631
658
|
},
|
|
632
|
-
when: (answers) => answers.method !== 'select'
|
|
659
|
+
when: (answers: Answers) => answers.method !== 'select'
|
|
633
660
|
},
|
|
634
661
|
{
|
|
635
662
|
type: "password",
|
|
636
663
|
name: "password",
|
|
637
664
|
message: "Enter your password",
|
|
638
665
|
mask: "*",
|
|
639
|
-
validate(value) {
|
|
666
|
+
validate(value: string) {
|
|
640
667
|
if (!value) {
|
|
641
668
|
return "Please enter your password";
|
|
642
669
|
}
|
|
643
670
|
return true;
|
|
644
671
|
},
|
|
645
|
-
when: (answers) => answers.method !== 'select'
|
|
672
|
+
when: (answers: Answers) => answers.method !== 'select'
|
|
646
673
|
},
|
|
647
674
|
{
|
|
648
675
|
type: "search-list",
|
|
@@ -652,11 +679,11 @@ const questionsLogin = [
|
|
|
652
679
|
const sessions = globalConfig.getSessions();
|
|
653
680
|
const current = globalConfig.getCurrentSession();
|
|
654
681
|
|
|
655
|
-
const data = [];
|
|
682
|
+
const data: Choice[] = [];
|
|
656
683
|
|
|
657
|
-
const longestEmail = sessions.reduce((prev, current) => (prev && (prev.email ?? '').length > (current.email ?? '').length) ? prev : current).email.length;
|
|
684
|
+
const longestEmail = sessions.reduce((prev: any, current: any) => (prev && (prev.email ?? '').length > (current.email ?? '').length) ? prev : current).email.length;
|
|
658
685
|
|
|
659
|
-
sessions.forEach((session) => {
|
|
686
|
+
sessions.forEach((session: any) => {
|
|
660
687
|
if (session.email) {
|
|
661
688
|
data.push({
|
|
662
689
|
current: current === session.id,
|
|
@@ -668,16 +695,17 @@ const questionsLogin = [
|
|
|
668
695
|
|
|
669
696
|
return data.sort((a, b) => Number(b.current) - Number(a.current))
|
|
670
697
|
},
|
|
671
|
-
when: (answers) => answers.method === 'select'
|
|
698
|
+
when: (answers: Answers) => answers.method === 'select'
|
|
672
699
|
},
|
|
673
700
|
];
|
|
674
|
-
|
|
701
|
+
|
|
702
|
+
export const questionGetEndpoint: Question[] = [
|
|
675
703
|
{
|
|
676
704
|
type: "input",
|
|
677
705
|
name: "endpoint",
|
|
678
706
|
message: "Enter the endpoint of your Appwrite server",
|
|
679
707
|
default: "http://localhost/v1",
|
|
680
|
-
async validate(value) {
|
|
708
|
+
async validate(value: string) {
|
|
681
709
|
if (!value) {
|
|
682
710
|
return "Please enter a valid endpoint.";
|
|
683
711
|
}
|
|
@@ -696,21 +724,21 @@ const questionGetEndpoint = [
|
|
|
696
724
|
}
|
|
697
725
|
];
|
|
698
726
|
|
|
699
|
-
const questionsLogout = [
|
|
727
|
+
export const questionsLogout: Question[] = [
|
|
700
728
|
{
|
|
701
729
|
type: "checkbox",
|
|
702
730
|
name: "accounts",
|
|
703
731
|
message: "Select accounts to logout from",
|
|
704
|
-
validate: (value) => validateRequired('account', value),
|
|
732
|
+
validate: (value: any) => validateRequired('account', value),
|
|
705
733
|
choices() {
|
|
706
734
|
const sessions = globalConfig.getSessions();
|
|
707
735
|
const current = globalConfig.getCurrentSession();
|
|
708
736
|
|
|
709
|
-
const data = [];
|
|
737
|
+
const data: Choice[] = [];
|
|
710
738
|
|
|
711
|
-
const longestEmail = sessions.reduce((prev, current) => (prev && (prev.email ?? '').length > (current.email ?? '').length) ? prev : current).email.length;
|
|
739
|
+
const longestEmail = sessions.reduce((prev: any, current: any) => (prev && (prev.email ?? '').length > (current.email ?? '').length) ? prev : current).email.length;
|
|
712
740
|
|
|
713
|
-
sessions.forEach((session) => {
|
|
741
|
+
sessions.forEach((session: any) => {
|
|
714
742
|
if (session.email) {
|
|
715
743
|
data.push({
|
|
716
744
|
current: current === session.id,
|
|
@@ -725,7 +753,7 @@ const questionsLogout = [
|
|
|
725
753
|
}
|
|
726
754
|
];
|
|
727
755
|
|
|
728
|
-
const questionsPushResources = [
|
|
756
|
+
export const questionsPushResources: Question[] = [
|
|
729
757
|
{
|
|
730
758
|
type: "list",
|
|
731
759
|
name: "resource",
|
|
@@ -742,7 +770,7 @@ const questionsPushResources = [
|
|
|
742
770
|
}
|
|
743
771
|
];
|
|
744
772
|
|
|
745
|
-
const questionsInitResources = [
|
|
773
|
+
export const questionsInitResources: Question[] = [
|
|
746
774
|
{
|
|
747
775
|
type: "list",
|
|
748
776
|
name: "resource",
|
|
@@ -759,17 +787,17 @@ const questionsInitResources = [
|
|
|
759
787
|
}
|
|
760
788
|
];
|
|
761
789
|
|
|
762
|
-
const questionsPushSites = [
|
|
790
|
+
export const questionsPushSites: Question[] = [
|
|
763
791
|
{
|
|
764
792
|
type: "checkbox",
|
|
765
793
|
name: "sites",
|
|
766
794
|
message: "Which sites would you like to push?",
|
|
767
|
-
validate: (value) => validateRequired('site', value),
|
|
795
|
+
validate: (value: any) => validateRequired('site', value),
|
|
768
796
|
when: () => localConfig.getSites().length > 0,
|
|
769
797
|
choices: () => {
|
|
770
798
|
let sites = localConfig.getSites();
|
|
771
799
|
checkDeployConditions(localConfig)
|
|
772
|
-
let choices = sites.map((site, idx) => {
|
|
800
|
+
let choices = sites.map((site: any, idx: number) => {
|
|
773
801
|
return {
|
|
774
802
|
name: `${site.name} (${site.$id})`,
|
|
775
803
|
value: site.$id
|
|
@@ -780,17 +808,17 @@ const questionsPushSites = [
|
|
|
780
808
|
},
|
|
781
809
|
];
|
|
782
810
|
|
|
783
|
-
const questionsPushFunctions = [
|
|
811
|
+
export const questionsPushFunctions: Question[] = [
|
|
784
812
|
{
|
|
785
813
|
type: "checkbox",
|
|
786
814
|
name: "functions",
|
|
787
815
|
message: "Which functions would you like to push?",
|
|
788
|
-
validate: (value) => validateRequired('function', value),
|
|
816
|
+
validate: (value: any) => validateRequired('function', value),
|
|
789
817
|
when: () => localConfig.getFunctions().length > 0,
|
|
790
818
|
choices: () => {
|
|
791
819
|
let functions = localConfig.getFunctions();
|
|
792
820
|
checkDeployConditions(localConfig)
|
|
793
|
-
let choices = functions.map((func, idx) => {
|
|
821
|
+
let choices = functions.map((func: any, idx: number) => {
|
|
794
822
|
return {
|
|
795
823
|
name: `${func.name} (${func.$id})`,
|
|
796
824
|
value: func.$id
|
|
@@ -799,20 +827,20 @@ const questionsPushFunctions = [
|
|
|
799
827
|
return choices;
|
|
800
828
|
}
|
|
801
829
|
},
|
|
802
|
-
]
|
|
830
|
+
];
|
|
803
831
|
|
|
804
|
-
const questionsPushCollections = [
|
|
832
|
+
export const questionsPushCollections: Question[] = [
|
|
805
833
|
{
|
|
806
834
|
type: "checkbox",
|
|
807
835
|
name: "collections",
|
|
808
836
|
message: "Which collections would you like to push?",
|
|
809
|
-
validate: (value) => validateRequired('collection', value),
|
|
837
|
+
validate: (value: any) => validateRequired('collection', value),
|
|
810
838
|
when: () => localConfig.getCollections().length > 0,
|
|
811
839
|
choices: () => {
|
|
812
840
|
let collections = localConfig.getCollections();
|
|
813
841
|
checkDeployConditions(localConfig)
|
|
814
842
|
|
|
815
|
-
return collections.map(collection => {
|
|
843
|
+
return collections.map((collection: any) => {
|
|
816
844
|
return {
|
|
817
845
|
name: `${collection.name} (${collection['databaseId']} - ${collection['$id']})`,
|
|
818
846
|
value: `${collection['databaseId']}|${collection['$id']}`
|
|
@@ -822,18 +850,18 @@ const questionsPushCollections = [
|
|
|
822
850
|
}
|
|
823
851
|
];
|
|
824
852
|
|
|
825
|
-
const questionsPushTables = [
|
|
853
|
+
export const questionsPushTables: Question[] = [
|
|
826
854
|
{
|
|
827
855
|
type: "checkbox",
|
|
828
856
|
name: "tables",
|
|
829
857
|
message: "Which tables would you like to push?",
|
|
830
|
-
validate: (value) => validateRequired('table', value),
|
|
858
|
+
validate: (value: any) => validateRequired('table', value),
|
|
831
859
|
when: () => localConfig.getTables().length > 0,
|
|
832
860
|
choices: () => {
|
|
833
861
|
let tables = localConfig.getTables();
|
|
834
862
|
checkDeployConditions(localConfig)
|
|
835
863
|
|
|
836
|
-
return tables.map(table => {
|
|
864
|
+
return tables.map((table: any) => {
|
|
837
865
|
return {
|
|
838
866
|
name: `${table.name} (${table['databaseId']} - ${table['$id']})`,
|
|
839
867
|
value: `${table['databaseId']}|${table['$id']}`
|
|
@@ -843,7 +871,7 @@ const questionsPushTables = [
|
|
|
843
871
|
}
|
|
844
872
|
];
|
|
845
873
|
|
|
846
|
-
const questionPushChanges = [
|
|
874
|
+
export const questionPushChanges: Question[] = [
|
|
847
875
|
{
|
|
848
876
|
type: "input",
|
|
849
877
|
name: "changes",
|
|
@@ -851,7 +879,7 @@ const questionPushChanges = [
|
|
|
851
879
|
}
|
|
852
880
|
];
|
|
853
881
|
|
|
854
|
-
const questionPushChangesConfirmation = [
|
|
882
|
+
export const questionPushChangesConfirmation: Question[] = [
|
|
855
883
|
{
|
|
856
884
|
type: "input",
|
|
857
885
|
name: "changes",
|
|
@@ -859,18 +887,18 @@ const questionPushChangesConfirmation = [
|
|
|
859
887
|
}
|
|
860
888
|
];
|
|
861
889
|
|
|
862
|
-
const questionsPushBuckets = [
|
|
890
|
+
export const questionsPushBuckets: Question[] = [
|
|
863
891
|
{
|
|
864
892
|
type: "checkbox",
|
|
865
893
|
name: "buckets",
|
|
866
894
|
message: "Which buckets would you like to push?",
|
|
867
|
-
validate: (value) => validateRequired('bucket', value),
|
|
895
|
+
validate: (value: any) => validateRequired('bucket', value),
|
|
868
896
|
when: () => localConfig.getBuckets().length > 0,
|
|
869
897
|
choices: () => {
|
|
870
898
|
let buckets = localConfig.getBuckets();
|
|
871
899
|
checkDeployConditions(localConfig)
|
|
872
900
|
|
|
873
|
-
return buckets.map(bucket => {
|
|
901
|
+
return buckets.map((bucket: any) => {
|
|
874
902
|
return {
|
|
875
903
|
name: `${bucket.name} (${bucket['$id']})`,
|
|
876
904
|
value: bucket.$id
|
|
@@ -878,19 +906,19 @@ const questionsPushBuckets = [
|
|
|
878
906
|
});
|
|
879
907
|
}
|
|
880
908
|
}
|
|
881
|
-
]
|
|
909
|
+
];
|
|
882
910
|
|
|
883
|
-
const questionsPushMessagingTopics = [
|
|
911
|
+
export const questionsPushMessagingTopics: Question[] = [
|
|
884
912
|
{
|
|
885
913
|
type: "checkbox",
|
|
886
914
|
name: "topics",
|
|
887
915
|
message: "Which messaging topic would you like to push?",
|
|
888
|
-
validate: (value) => validateRequired('topics', value),
|
|
916
|
+
validate: (value: any) => validateRequired('topics', value),
|
|
889
917
|
when: () => localConfig.getMessagingTopics().length > 0,
|
|
890
918
|
choices: () => {
|
|
891
919
|
let topics = localConfig.getMessagingTopics();
|
|
892
920
|
|
|
893
|
-
return topics.map(topic => {
|
|
921
|
+
return topics.map((topic: any) => {
|
|
894
922
|
return {
|
|
895
923
|
name: `${topic.name} (${topic['$id']})`,
|
|
896
924
|
value: topic.$id
|
|
@@ -898,35 +926,35 @@ const questionsPushMessagingTopics = [
|
|
|
898
926
|
});
|
|
899
927
|
}
|
|
900
928
|
}
|
|
901
|
-
]
|
|
929
|
+
];
|
|
902
930
|
|
|
903
|
-
const questionsGetEntrypoint = [
|
|
931
|
+
export const questionsGetEntrypoint: Question[] = [
|
|
904
932
|
{
|
|
905
933
|
type: "input",
|
|
906
934
|
name: "entrypoint",
|
|
907
935
|
message: "Enter the entrypoint",
|
|
908
936
|
default: null,
|
|
909
|
-
validate(value) {
|
|
937
|
+
validate(value: string) {
|
|
910
938
|
if (!value) {
|
|
911
939
|
return "Please enter your entrypoint";
|
|
912
940
|
}
|
|
913
941
|
return true;
|
|
914
942
|
}
|
|
915
943
|
},
|
|
916
|
-
]
|
|
944
|
+
];
|
|
917
945
|
|
|
918
|
-
const questionsPushTeams = [
|
|
946
|
+
export const questionsPushTeams: Question[] = [
|
|
919
947
|
{
|
|
920
948
|
type: "checkbox",
|
|
921
949
|
name: "teams",
|
|
922
950
|
message: "Which teams would you like to push?",
|
|
923
|
-
validate: (value) => validateRequired('team', value),
|
|
951
|
+
validate: (value: any) => validateRequired('team', value),
|
|
924
952
|
when: () => localConfig.getTeams().length > 0,
|
|
925
953
|
choices: () => {
|
|
926
954
|
let teams = localConfig.getTeams();
|
|
927
955
|
checkDeployConditions(localConfig);
|
|
928
956
|
|
|
929
|
-
return teams.map(team => {
|
|
957
|
+
return teams.map((team: any) => {
|
|
930
958
|
return {
|
|
931
959
|
name: `${team.name} (${team['$id']})`,
|
|
932
960
|
value: team.$id
|
|
@@ -936,7 +964,7 @@ const questionsPushTeams = [
|
|
|
936
964
|
},
|
|
937
965
|
];
|
|
938
966
|
|
|
939
|
-
const questionsListFactors = [
|
|
967
|
+
export const questionsListFactors: Question[] = [
|
|
940
968
|
{
|
|
941
969
|
type: "list",
|
|
942
970
|
name: "factor",
|
|
@@ -972,12 +1000,12 @@ const questionsListFactors = [
|
|
|
972
1000
|
}
|
|
973
1001
|
];
|
|
974
1002
|
|
|
975
|
-
const questionsMFAChallenge = [
|
|
1003
|
+
export const questionsMFAChallenge: Question[] = [
|
|
976
1004
|
{
|
|
977
1005
|
type: "input",
|
|
978
1006
|
name: "otp",
|
|
979
1007
|
message: "Enter OTP",
|
|
980
|
-
validate(value) {
|
|
1008
|
+
validate(value: string) {
|
|
981
1009
|
if (!value) {
|
|
982
1010
|
return "Please enter OTP";
|
|
983
1011
|
}
|
|
@@ -986,18 +1014,18 @@ const questionsMFAChallenge = [
|
|
|
986
1014
|
}
|
|
987
1015
|
];
|
|
988
1016
|
|
|
989
|
-
const questionsRunFunctions = [
|
|
1017
|
+
export const questionsRunFunctions: Question[] = [
|
|
990
1018
|
{
|
|
991
1019
|
type: "list",
|
|
992
1020
|
name: "function",
|
|
993
1021
|
message: "Which function would you like to develop locally?",
|
|
994
|
-
validate: (value) => validateRequired('function', value),
|
|
1022
|
+
validate: (value: any) => validateRequired('function', value),
|
|
995
1023
|
choices: () => {
|
|
996
1024
|
let functions = localConfig.getFunctions();
|
|
997
1025
|
if (functions.length === 0) {
|
|
998
1026
|
throw new Error("No functions found. Use 'appwrite pull functions' to synchronize existing one, or use 'appwrite init function' to create a new one.");
|
|
999
1027
|
}
|
|
1000
|
-
let choices = functions.map((func, idx) => {
|
|
1028
|
+
let choices = functions.map((func: any, idx: number) => {
|
|
1001
1029
|
return {
|
|
1002
1030
|
name: `${func.name} (${func.$id})`,
|
|
1003
1031
|
value: func.$id
|
|
@@ -1008,7 +1036,7 @@ const questionsRunFunctions = [
|
|
|
1008
1036
|
}
|
|
1009
1037
|
];
|
|
1010
1038
|
|
|
1011
|
-
const questionsCreateSite = [
|
|
1039
|
+
export const questionsCreateSite: Question[] = [
|
|
1012
1040
|
{
|
|
1013
1041
|
type: "input",
|
|
1014
1042
|
name: "name",
|
|
@@ -1030,7 +1058,7 @@ const questionsCreateSite = [
|
|
|
1030
1058
|
parseOutput: false
|
|
1031
1059
|
});
|
|
1032
1060
|
let frameworks = response["frameworks"];
|
|
1033
|
-
let choices = frameworks.map((framework) => {
|
|
1061
|
+
let choices = frameworks.map((framework: any) => {
|
|
1034
1062
|
return {
|
|
1035
1063
|
name: `${framework.name} (${framework.key})`,
|
|
1036
1064
|
value: framework,
|
|
@@ -1048,7 +1076,7 @@ const questionsCreateSite = [
|
|
|
1048
1076
|
parseOutput: false
|
|
1049
1077
|
});
|
|
1050
1078
|
let specifications = response["specifications"];
|
|
1051
|
-
let choices = specifications.map((spec) => {
|
|
1079
|
+
let choices = specifications.map((spec: any) => {
|
|
1052
1080
|
return {
|
|
1053
1081
|
name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
|
|
1054
1082
|
value: spec.slug,
|
|
@@ -1060,39 +1088,3 @@ const questionsCreateSite = [
|
|
|
1060
1088
|
}
|
|
1061
1089
|
];
|
|
1062
1090
|
|
|
1063
|
-
module.exports = {
|
|
1064
|
-
questionsInitProject,
|
|
1065
|
-
questionsInitProjectAutopull,
|
|
1066
|
-
questionsCreateFunction,
|
|
1067
|
-
questionsCreateFunctionSelectTemplate,
|
|
1068
|
-
questionsCreateBucket,
|
|
1069
|
-
questionsCreateCollection,
|
|
1070
|
-
questionsCreateTable,
|
|
1071
|
-
questionsCreateMessagingTopic,
|
|
1072
|
-
questionsPullFunctions,
|
|
1073
|
-
questionsPullFunctionsCode,
|
|
1074
|
-
questionsPullSites,
|
|
1075
|
-
questionsPullSitesCode,
|
|
1076
|
-
questionsLogin,
|
|
1077
|
-
questionsPullResources,
|
|
1078
|
-
questionsLogout,
|
|
1079
|
-
questionsPullCollection,
|
|
1080
|
-
questionsPushResources,
|
|
1081
|
-
questionsPushFunctions,
|
|
1082
|
-
questionsPushSites,
|
|
1083
|
-
questionsPushCollections,
|
|
1084
|
-
questionsPushBuckets,
|
|
1085
|
-
questionsPushMessagingTopics,
|
|
1086
|
-
questionsPushTeams,
|
|
1087
|
-
questionsGetEntrypoint,
|
|
1088
|
-
questionsListFactors,
|
|
1089
|
-
questionsMFAChallenge,
|
|
1090
|
-
questionsRunFunctions,
|
|
1091
|
-
questionGetEndpoint,
|
|
1092
|
-
questionsInitResources,
|
|
1093
|
-
questionsCreateTeam,
|
|
1094
|
-
questionPushChanges,
|
|
1095
|
-
questionPushChangesConfirmation,
|
|
1096
|
-
questionsCreateSite,
|
|
1097
|
-
questionsPushTables
|
|
1098
|
-
};
|