appwrite-cli 6.0.0-rc.7 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/autoclose.yml +11 -0
- package/README.md +2 -2
- package/docs/examples/functions/create.md +1 -0
- package/docs/examples/functions/list-specifications.md +1 -0
- package/docs/examples/functions/update.md +1 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +2 -2
- package/lib/commands/functions.js +61 -10
- package/lib/commands/generic.js +2 -1
- package/lib/commands/init.js +9 -6
- package/lib/commands/pull.js +12 -10
- package/lib/commands/push.js +18 -7
- package/lib/config.js +21 -3
- package/lib/parser.js +1 -1
- package/lib/questions.js +1 -1
- package/package.json +1 -1
- package/scoop/appwrite.json +3 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
name: Auto-close External Pull Requests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target:
|
|
5
|
+
types: [opened, reopened]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
auto_close:
|
|
9
|
+
uses: appwrite/.github/.github/workflows/autoclose.yml@main
|
|
10
|
+
secrets:
|
|
11
|
+
GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
|
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
$ appwrite -v
|
|
32
|
-
6.0.0
|
|
32
|
+
6.0.0
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
### Install using prebuilt binaries
|
|
@@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
|
|
|
60
60
|
Once the installation completes, you can verify your install using
|
|
61
61
|
```
|
|
62
62
|
$ appwrite -v
|
|
63
|
-
6.0.0
|
|
63
|
+
6.0.0
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## Getting Started
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
appwrite functions listSpecifications
|
package/install.ps1
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
# You can use "View source" of this page to see the full script.
|
|
14
14
|
|
|
15
15
|
# REPO
|
|
16
|
-
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0
|
|
17
|
-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0
|
|
16
|
+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0/appwrite-cli-win-x64.exe"
|
|
17
|
+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0/appwrite-cli-win-arm64.exe"
|
|
18
18
|
|
|
19
19
|
$APPWRITE_BINARY_NAME = "appwrite.exe"
|
|
20
20
|
|
package/install.sh
CHANGED
|
@@ -97,7 +97,7 @@ printSuccess() {
|
|
|
97
97
|
downloadBinary() {
|
|
98
98
|
echo "[2/4] Downloading executable for $OS ($ARCH) ..."
|
|
99
99
|
|
|
100
|
-
GITHUB_LATEST_VERSION="6.0.0
|
|
100
|
+
GITHUB_LATEST_VERSION="6.0.0"
|
|
101
101
|
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
|
|
102
102
|
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
|
|
103
103
|
|
package/lib/client.js
CHANGED
|
@@ -16,8 +16,8 @@ class Client {
|
|
|
16
16
|
'x-sdk-name': 'Command Line',
|
|
17
17
|
'x-sdk-platform': 'console',
|
|
18
18
|
'x-sdk-language': 'cli',
|
|
19
|
-
'x-sdk-version': '6.0.0
|
|
20
|
-
'user-agent' : `AppwriteCLI/6.0.0
|
|
19
|
+
'x-sdk-version': '6.0.0',
|
|
20
|
+
'user-agent' : `AppwriteCLI/6.0.0 (${os.type()} ${os.version()}; ${os.arch()})`,
|
|
21
21
|
'X-Appwrite-Response-Format' : '1.6.0',
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -103,7 +103,8 @@ const functionsList = async ({queries,search,parseOutput = true, overrideForCli
|
|
|
103
103
|
* @property {string} templateRepository Repository name of the template.
|
|
104
104
|
* @property {string} templateOwner The name of the owner of the template.
|
|
105
105
|
* @property {string} templateRootDirectory Path to function code in the template repo.
|
|
106
|
-
* @property {string}
|
|
106
|
+
* @property {string} templateVersion Version (tag) for the repo linked to the function template.
|
|
107
|
+
* @property {string} specification Runtime specification for the function and builds.
|
|
107
108
|
* @property {boolean} overrideForCli
|
|
108
109
|
* @property {boolean} parseOutput
|
|
109
110
|
* @property {libClient | undefined} sdk
|
|
@@ -112,7 +113,7 @@ const functionsList = async ({queries,search,parseOutput = true, overrideForCli
|
|
|
112
113
|
/**
|
|
113
114
|
* @param {FunctionsCreateRequestParams} params
|
|
114
115
|
*/
|
|
115
|
-
const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,templateRepository,templateOwner,templateRootDirectory,
|
|
116
|
+
const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,templateRepository,templateOwner,templateRootDirectory,templateVersion,specification,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
116
117
|
let client = !sdk ? await sdkForProject() :
|
|
117
118
|
sdk;
|
|
118
119
|
let apiPath = '/functions';
|
|
@@ -180,8 +181,11 @@ const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,
|
|
|
180
181
|
if (typeof templateRootDirectory !== 'undefined') {
|
|
181
182
|
payload['templateRootDirectory'] = templateRootDirectory;
|
|
182
183
|
}
|
|
183
|
-
if (typeof
|
|
184
|
-
payload['
|
|
184
|
+
if (typeof templateVersion !== 'undefined') {
|
|
185
|
+
payload['templateVersion'] = templateVersion;
|
|
186
|
+
}
|
|
187
|
+
if (typeof specification !== 'undefined') {
|
|
188
|
+
payload['specification'] = specification;
|
|
185
189
|
}
|
|
186
190
|
|
|
187
191
|
let response = undefined;
|
|
@@ -228,6 +232,40 @@ const functionsListRuntimes = async ({parseOutput = true, overrideForCli = false
|
|
|
228
232
|
|
|
229
233
|
}
|
|
230
234
|
|
|
235
|
+
/**
|
|
236
|
+
* @typedef {Object} FunctionsListSpecificationsRequestParams
|
|
237
|
+
* @property {boolean} overrideForCli
|
|
238
|
+
* @property {boolean} parseOutput
|
|
239
|
+
* @property {libClient | undefined} sdk
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @param {FunctionsListSpecificationsRequestParams} params
|
|
244
|
+
*/
|
|
245
|
+
const functionsListSpecifications = async ({parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
|
|
246
|
+
let client = !sdk ? await sdkForProject() :
|
|
247
|
+
sdk;
|
|
248
|
+
let apiPath = '/functions/specifications';
|
|
249
|
+
let payload = {};
|
|
250
|
+
|
|
251
|
+
let response = undefined;
|
|
252
|
+
|
|
253
|
+
response = await client.call('get', apiPath, {
|
|
254
|
+
'content-type': 'application/json',
|
|
255
|
+
}, payload);
|
|
256
|
+
|
|
257
|
+
if (parseOutput) {
|
|
258
|
+
if(console) {
|
|
259
|
+
showConsoleLink('functions', 'listSpecifications');
|
|
260
|
+
} else {
|
|
261
|
+
parse(response)
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return response;
|
|
266
|
+
|
|
267
|
+
}
|
|
268
|
+
|
|
231
269
|
/**
|
|
232
270
|
* @typedef {Object} FunctionsListTemplatesRequestParams
|
|
233
271
|
* @property {string[]} runtimes List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed.
|
|
@@ -401,6 +439,7 @@ const functionsGet = async ({functionId,parseOutput = true, overrideForCli = fal
|
|
|
401
439
|
* @property {string} providerBranch Production branch for the repo linked to the function
|
|
402
440
|
* @property {boolean} providerSilentMode Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
|
|
403
441
|
* @property {string} providerRootDirectory Path to function code in the linked repo.
|
|
442
|
+
* @property {string} specification Runtime specification for the function and builds.
|
|
404
443
|
* @property {boolean} overrideForCli
|
|
405
444
|
* @property {boolean} parseOutput
|
|
406
445
|
* @property {libClient | undefined} sdk
|
|
@@ -409,7 +448,7 @@ const functionsGet = async ({functionId,parseOutput = true, overrideForCli = fal
|
|
|
409
448
|
/**
|
|
410
449
|
* @param {FunctionsUpdateRequestParams} params
|
|
411
450
|
*/
|
|
412
|
-
const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
451
|
+
const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,specification,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
413
452
|
let client = !sdk ? await sdkForProject() :
|
|
414
453
|
sdk;
|
|
415
454
|
let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
@@ -465,6 +504,9 @@ const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,
|
|
|
465
504
|
if (typeof providerRootDirectory !== 'undefined') {
|
|
466
505
|
payload['providerRootDirectory'] = providerRootDirectory;
|
|
467
506
|
}
|
|
507
|
+
if (typeof specification !== 'undefined') {
|
|
508
|
+
payload['specification'] = specification;
|
|
509
|
+
}
|
|
468
510
|
|
|
469
511
|
let response = undefined;
|
|
470
512
|
|
|
@@ -514,7 +556,7 @@ const functionsDelete = async ({functionId,parseOutput = true, overrideForCli =
|
|
|
514
556
|
/**
|
|
515
557
|
* @typedef {Object} FunctionsListDeploymentsRequestParams
|
|
516
558
|
* @property {string} functionId Function ID.
|
|
517
|
-
* @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: size, buildId, activate, entrypoint, commands
|
|
559
|
+
* @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: size, buildId, activate, entrypoint, commands, type, size
|
|
518
560
|
* @property {string} search Search term to filter your list results. Max length: 256 chars.
|
|
519
561
|
* @property {boolean} overrideForCli
|
|
520
562
|
* @property {boolean} parseOutput
|
|
@@ -985,7 +1027,7 @@ const functionsListExecutions = async ({functionId,queries,search,parseOutput =
|
|
|
985
1027
|
* @property {string} xpath HTTP path of execution. Path can include query params. Default value is /
|
|
986
1028
|
* @property {ExecutionMethod} method HTTP method of execution. Default value is GET.
|
|
987
1029
|
* @property {object} headers HTTP headers of execution. Defaults to empty.
|
|
988
|
-
* @property {string} scheduledAt Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.
|
|
1030
|
+
* @property {string} scheduledAt Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
|
|
989
1031
|
* @property {boolean} overrideForCli
|
|
990
1032
|
* @property {boolean} parseOutput
|
|
991
1033
|
* @property {libClient | undefined} sdk
|
|
@@ -1344,7 +1386,8 @@ functions
|
|
|
1344
1386
|
.option(`--template-repository <template-repository>`, `Repository name of the template.`)
|
|
1345
1387
|
.option(`--template-owner <template-owner>`, `The name of the owner of the template.`)
|
|
1346
1388
|
.option(`--template-root-directory <template-root-directory>`, `Path to function code in the template repo.`)
|
|
1347
|
-
.option(`--template-
|
|
1389
|
+
.option(`--template-version <template-version>`, `Version (tag) for the repo linked to the function template.`)
|
|
1390
|
+
.option(`--specification <specification>`, `Runtime specification for the function and builds.`)
|
|
1348
1391
|
.action(actionRunner(functionsCreate))
|
|
1349
1392
|
|
|
1350
1393
|
functions
|
|
@@ -1352,6 +1395,12 @@ functions
|
|
|
1352
1395
|
.description(`Get a list of all runtimes that are currently active on your instance.`)
|
|
1353
1396
|
.action(actionRunner(functionsListRuntimes))
|
|
1354
1397
|
|
|
1398
|
+
functions
|
|
1399
|
+
.command(`list-specifications`)
|
|
1400
|
+
.description(`List allowed function specifications for this instance. `)
|
|
1401
|
+
.option(`--console`, `Get the resource console url`)
|
|
1402
|
+
.action(actionRunner(functionsListSpecifications))
|
|
1403
|
+
|
|
1355
1404
|
functions
|
|
1356
1405
|
.command(`list-templates`)
|
|
1357
1406
|
.description(`List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.`)
|
|
@@ -1402,6 +1451,7 @@ functions
|
|
|
1402
1451
|
.option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function`)
|
|
1403
1452
|
.option(`--provider-silent-mode <provider-silent-mode>`, `Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.`, parseBool)
|
|
1404
1453
|
.option(`--provider-root-directory <provider-root-directory>`, `Path to function code in the linked repo.`)
|
|
1454
|
+
.option(`--specification <specification>`, `Runtime specification for the function and builds.`)
|
|
1405
1455
|
.action(actionRunner(functionsUpdate))
|
|
1406
1456
|
|
|
1407
1457
|
functions
|
|
@@ -1414,7 +1464,7 @@ functions
|
|
|
1414
1464
|
.command(`list-deployments`)
|
|
1415
1465
|
.description(`Get a list of all the project's code deployments. You can use the query params to filter your results.`)
|
|
1416
1466
|
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1417
|
-
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: size, buildId, activate, entrypoint, commands`)
|
|
1467
|
+
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: size, buildId, activate, entrypoint, commands, type, size`)
|
|
1418
1468
|
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
|
|
1419
1469
|
.option(`--console`, `Get the resource console url`)
|
|
1420
1470
|
.action(actionRunner(functionsListDeployments))
|
|
@@ -1493,7 +1543,7 @@ functions
|
|
|
1493
1543
|
.option(`--xpath <xpath>`, `HTTP path of execution. Path can include query params. Default value is /`)
|
|
1494
1544
|
.option(`--method <method>`, `HTTP method of execution. Default value is GET.`)
|
|
1495
1545
|
.option(`--headers <headers>`, `HTTP headers of execution. Defaults to empty.`)
|
|
1496
|
-
.option(`--scheduled-at <scheduled-at>`, `Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future.`)
|
|
1546
|
+
.option(`--scheduled-at <scheduled-at>`, `Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.`)
|
|
1497
1547
|
.action(actionRunner(functionsCreateExecution))
|
|
1498
1548
|
|
|
1499
1549
|
functions
|
|
@@ -1561,6 +1611,7 @@ module.exports = {
|
|
|
1561
1611
|
functionsList,
|
|
1562
1612
|
functionsCreate,
|
|
1563
1613
|
functionsListRuntimes,
|
|
1614
|
+
functionsListSpecifications,
|
|
1564
1615
|
functionsListTemplates,
|
|
1565
1616
|
functionsGetTemplate,
|
|
1566
1617
|
functionsGetUsage,
|
package/lib/commands/generic.js
CHANGED
|
@@ -12,7 +12,8 @@ const DEFAULT_ENDPOINT = 'https://cloud.appwrite.io/v1';
|
|
|
12
12
|
|
|
13
13
|
const loginCommand = async ({ email, password, endpoint, mfa, code }) => {
|
|
14
14
|
const oldCurrent = globalConfig.getCurrentSession();
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
const configEndpoint = endpoint ?? globalConfig.getEndpoint() ?? DEFAULT_ENDPOINT;
|
|
16
17
|
|
|
17
18
|
if (globalConfig.getCurrentSession() !== '') {
|
|
18
19
|
log('You are currently signed in as ' + globalConfig.getEmail());
|
package/lib/commands/init.js
CHANGED
|
@@ -192,6 +192,8 @@ const initTopic = async () => {
|
|
|
192
192
|
};
|
|
193
193
|
|
|
194
194
|
const initFunction = async () => {
|
|
195
|
+
process.chdir(localConfig.configDirectoryPath)
|
|
196
|
+
|
|
195
197
|
// TODO: Add CI/CD support (ID, name, runtime)
|
|
196
198
|
const answers = await inquirer.prompt(questionsCreateFunction)
|
|
197
199
|
const functionFolder = path.join(process.cwd(), 'functions');
|
|
@@ -203,12 +205,13 @@ const initFunction = async () => {
|
|
|
203
205
|
}
|
|
204
206
|
|
|
205
207
|
const functionId = answers.id === 'unique()' ? ID.unique() : answers.id;
|
|
206
|
-
const
|
|
208
|
+
const functionName = answers.name;
|
|
209
|
+
const functionDir = path.join(functionFolder, functionName);
|
|
207
210
|
const templatesDir = path.join(functionFolder, `${functionId}-templates`);
|
|
208
211
|
const runtimeDir = path.join(templatesDir, answers.runtime.name);
|
|
209
212
|
|
|
210
213
|
if (fs.existsSync(functionDir)) {
|
|
211
|
-
throw new Error(`( ${
|
|
214
|
+
throw new Error(`( ${functionName} ) already exists in the current directory. Please choose another name.`);
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
if (!answers.runtime.entrypoint) {
|
|
@@ -285,7 +288,7 @@ const initFunction = async () => {
|
|
|
285
288
|
|
|
286
289
|
fs.rmSync(templatesDir, { recursive: true, force: true });
|
|
287
290
|
|
|
288
|
-
const readmePath = path.join(process.cwd(), 'functions',
|
|
291
|
+
const readmePath = path.join(process.cwd(), 'functions', functionName, 'README.md');
|
|
289
292
|
const readmeFile = fs.readFileSync(readmePath).toString();
|
|
290
293
|
const newReadmeFile = readmeFile.split('\n');
|
|
291
294
|
newReadmeFile[0] = `# ${answers.name}`;
|
|
@@ -296,9 +299,9 @@ const initFunction = async () => {
|
|
|
296
299
|
$id: functionId,
|
|
297
300
|
name: answers.name,
|
|
298
301
|
runtime: answers.runtime.id,
|
|
299
|
-
execute: [],
|
|
302
|
+
execute: ["any"],
|
|
300
303
|
events: [],
|
|
301
|
-
scopes: [],
|
|
304
|
+
scopes: ["users.read"],
|
|
302
305
|
schedule: "",
|
|
303
306
|
timeout: 15,
|
|
304
307
|
enabled: true,
|
|
@@ -306,7 +309,7 @@ const initFunction = async () => {
|
|
|
306
309
|
entrypoint: answers.runtime.entrypoint || '',
|
|
307
310
|
commands: answers.runtime.commands || '',
|
|
308
311
|
ignore: answers.runtime.ignore || null,
|
|
309
|
-
path: `functions/${
|
|
312
|
+
path: `functions/${functionName}`,
|
|
310
313
|
};
|
|
311
314
|
|
|
312
315
|
localConfig.addFunction(data);
|
package/lib/commands/pull.js
CHANGED
|
@@ -57,6 +57,8 @@ const pullSettings = async () => {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
const pullFunctions = async ({ code, withVariables }) => {
|
|
60
|
+
process.chdir(localConfig.configDirectoryPath)
|
|
61
|
+
|
|
60
62
|
log("Fetching functions ...");
|
|
61
63
|
let total = 0;
|
|
62
64
|
|
|
@@ -84,11 +86,11 @@ const pullFunctions = async ({ code, withVariables }) => {
|
|
|
84
86
|
|
|
85
87
|
func['path'] = localFunction['path'];
|
|
86
88
|
if (!localFunction['path']) {
|
|
87
|
-
func['path'] = `functions/${func
|
|
88
|
-
}
|
|
89
|
-
if (!withVariables) {
|
|
90
|
-
delete func['vars'];
|
|
89
|
+
func['path'] = `functions/${func.name}`;
|
|
91
90
|
}
|
|
91
|
+
const holdingVars = func['vars'];
|
|
92
|
+
// We don't save var in to the config
|
|
93
|
+
delete func['vars'];
|
|
92
94
|
localConfig.addFunction(func);
|
|
93
95
|
|
|
94
96
|
if (!fs.existsSync(func['path'])) {
|
|
@@ -160,7 +162,7 @@ const pullFunctions = async ({ code, withVariables }) => {
|
|
|
160
162
|
} catch {
|
|
161
163
|
}
|
|
162
164
|
|
|
163
|
-
fs.writeFileSync(envFileLocation,
|
|
165
|
+
fs.writeFileSync(envFileLocation, holdingVars.map(r => `${r.key}=${r.value}\n`).join(''))
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
168
|
|
|
@@ -314,7 +316,7 @@ pull
|
|
|
314
316
|
pull
|
|
315
317
|
.command("function")
|
|
316
318
|
.alias("functions")
|
|
317
|
-
.description("
|
|
319
|
+
.description("Pull your Appwrite cloud function")
|
|
318
320
|
.option("--no-code", "Don't pull the function's code")
|
|
319
321
|
.option("--with-variables", `Pull function variables. ${chalk.red('recommend for testing purposes only')}`)
|
|
320
322
|
.action(actionRunner(pullFunctions))
|
|
@@ -322,25 +324,25 @@ pull
|
|
|
322
324
|
pull
|
|
323
325
|
.command("collection")
|
|
324
326
|
.alias("collections")
|
|
325
|
-
.description("
|
|
327
|
+
.description("Pull your Appwrite collections")
|
|
326
328
|
.action(actionRunner(pullCollection))
|
|
327
329
|
|
|
328
330
|
pull
|
|
329
331
|
.command("bucket")
|
|
330
332
|
.alias("buckets")
|
|
331
|
-
.description("
|
|
333
|
+
.description("Pull your Appwrite buckets")
|
|
332
334
|
.action(actionRunner(pullBucket))
|
|
333
335
|
|
|
334
336
|
pull
|
|
335
337
|
.command("team")
|
|
336
338
|
.alias("teams")
|
|
337
|
-
.description("
|
|
339
|
+
.description("Pull your Appwrite teams")
|
|
338
340
|
.action(actionRunner(pullTeam))
|
|
339
341
|
|
|
340
342
|
pull
|
|
341
343
|
.command("topic")
|
|
342
344
|
.alias("topics")
|
|
343
|
-
.description("
|
|
345
|
+
.description("Pull your Appwrite messaging topics")
|
|
344
346
|
.action(actionRunner(pullMessagingTopic))
|
|
345
347
|
|
|
346
348
|
module.exports = {
|
package/lib/commands/push.js
CHANGED
|
@@ -64,6 +64,8 @@ const {
|
|
|
64
64
|
projectsUpdateAuthPasswordDictionary,
|
|
65
65
|
projectsUpdateAuthPasswordHistory,
|
|
66
66
|
projectsUpdatePersonalDataCheck,
|
|
67
|
+
projectsUpdateSessionAlerts,
|
|
68
|
+
projectsUpdateMockNumbers,
|
|
67
69
|
} = require("./projects");
|
|
68
70
|
const { checkDeployConditions } = require('../utils');
|
|
69
71
|
|
|
@@ -368,6 +370,7 @@ const getConfirmation = async () => {
|
|
|
368
370
|
return false;
|
|
369
371
|
|
|
370
372
|
};
|
|
373
|
+
const isEmpty = (value) => (value === null || value === undefined || (typeof value === "string" && value.trim().length === 0) || (Array.isArray(value) && value.length === 0));
|
|
371
374
|
|
|
372
375
|
const approveChanges = async (resource, resourceGetFunction, keys, resourceName, resourcePlural, skipKeys = [], secondId = '', secondResourceName = '') => {
|
|
373
376
|
log('Checking for changes ...');
|
|
@@ -390,6 +393,11 @@ const approveChanges = async (resource, resourceGetFunction, keys, resourceName,
|
|
|
390
393
|
if (skipKeys.includes(key)) {
|
|
391
394
|
continue;
|
|
392
395
|
}
|
|
396
|
+
|
|
397
|
+
if (isEmpty(value) && isEmpty(localResource[key])) {
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
|
|
393
401
|
if (Array.isArray(value) && Array.isArray(localResource[key])) {
|
|
394
402
|
if (JSON.stringify(value) !== JSON.stringify(localResource[key])) {
|
|
395
403
|
changes.push({
|
|
@@ -697,6 +705,10 @@ const deleteAttribute = async (collection, attribute, isIndex = false) => {
|
|
|
697
705
|
}
|
|
698
706
|
|
|
699
707
|
const compareAttribute = (remote, local, reason, key) => {
|
|
708
|
+
if (isEmpty(remote) && isEmpty(local)) {
|
|
709
|
+
return reason;
|
|
710
|
+
}
|
|
711
|
+
|
|
700
712
|
if (Array.isArray(remote) && Array.isArray(local)) {
|
|
701
713
|
if (JSON.stringify(remote) !== JSON.stringify(local)) {
|
|
702
714
|
const bol = reason === '' ? '' : '\n';
|
|
@@ -970,6 +982,8 @@ const pushSettings = async () => {
|
|
|
970
982
|
await projectsUpdateAuthPasswordDictionary({ projectId, enabled: settings.auth.security.passwordDictionary, parseOutput: false });
|
|
971
983
|
await projectsUpdateAuthPasswordHistory({ projectId, limit: settings.auth.security.passwordHistory, parseOutput: false });
|
|
972
984
|
await projectsUpdatePersonalDataCheck({ projectId, enabled: settings.auth.security.personalDataCheck, parseOutput: false });
|
|
985
|
+
await projectsUpdateSessionAlerts({ projectId, alerts: settings.auth.security.sessionAlerts, parseOutput: false });
|
|
986
|
+
await projectsUpdateMockNumbers({ projectId, numbers: settings.auth.security.mockNumbers, parseOutput: false });
|
|
973
987
|
}
|
|
974
988
|
|
|
975
989
|
if (settings.auth.methods) {
|
|
@@ -993,6 +1007,8 @@ const pushSettings = async () => {
|
|
|
993
1007
|
}
|
|
994
1008
|
|
|
995
1009
|
const pushFunction = async ({ functionId, async, code, withVariables } = { returnOnZero: false }) => {
|
|
1010
|
+
process.chdir(localConfig.configDirectoryPath)
|
|
1011
|
+
|
|
996
1012
|
const functionIds = [];
|
|
997
1013
|
|
|
998
1014
|
if (functionId) {
|
|
@@ -1088,11 +1104,6 @@ const pushFunction = async ({ functionId, async, code, withVariables } = { retur
|
|
|
1088
1104
|
entrypoint: func.entrypoint,
|
|
1089
1105
|
commands: func.commands,
|
|
1090
1106
|
scopes: func.scopes,
|
|
1091
|
-
providerRepositoryId: func.providerRepositoryId ?? "",
|
|
1092
|
-
installationId: func.installationId ?? '',
|
|
1093
|
-
providerBranch: func.providerBranch ?? '',
|
|
1094
|
-
providerRootDirectory: func.providerRootDirectory ?? '',
|
|
1095
|
-
providerSilentMode: func.providerSilentMode ?? false,
|
|
1096
1107
|
vars: JSON.stringify(response.vars),
|
|
1097
1108
|
parseOutput: false
|
|
1098
1109
|
});
|
|
@@ -1710,9 +1721,9 @@ push
|
|
|
1710
1721
|
.action(actionRunner(pushMessagingTopic));
|
|
1711
1722
|
|
|
1712
1723
|
const deploy = new Command("deploy")
|
|
1713
|
-
.description(
|
|
1724
|
+
.description('Removed. Use appwrite push instead')
|
|
1714
1725
|
.action(actionRunner(async () => {
|
|
1715
|
-
warn("
|
|
1726
|
+
warn("appwrite deploy has been removed. Please use 'appwrite push' instead");
|
|
1716
1727
|
}));
|
|
1717
1728
|
|
|
1718
1729
|
module.exports = {
|
package/lib/config.js
CHANGED
|
@@ -123,10 +123,26 @@ class Config {
|
|
|
123
123
|
|
|
124
124
|
class Local extends Config {
|
|
125
125
|
static CONFIG_FILE_PATH = "appwrite.json";
|
|
126
|
+
configDirectoryPath = ""
|
|
126
127
|
|
|
127
128
|
constructor(path = Local.CONFIG_FILE_PATH) {
|
|
128
|
-
let
|
|
129
|
+
let currentPath = process.cwd();
|
|
130
|
+
let absolutePath = `${currentPath}/${path}`;
|
|
131
|
+
|
|
132
|
+
while (true) {
|
|
133
|
+
if (fs.existsSync(`${currentPath}/${path}`)) {
|
|
134
|
+
absolutePath = `${currentPath}/${path}`;
|
|
135
|
+
break
|
|
136
|
+
} else {
|
|
137
|
+
const parentDirectory = _path.dirname(currentPath);
|
|
138
|
+
if (parentDirectory === currentPath) { // we hit the top directory
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
currentPath = parentDirectory
|
|
142
|
+
}
|
|
143
|
+
}
|
|
129
144
|
super(absolutePath);
|
|
145
|
+
this.configDirectoryPath =_path.dirname(absolutePath);
|
|
130
146
|
}
|
|
131
147
|
|
|
132
148
|
getFunctions() {
|
|
@@ -440,8 +456,10 @@ class Local extends Config {
|
|
|
440
456
|
sessionsLimit: projectSettings.authSessionsLimit,
|
|
441
457
|
passwordHistory: projectSettings.authPasswordHistory,
|
|
442
458
|
passwordDictionary: projectSettings.authPasswordDictionary,
|
|
443
|
-
personalDataCheck: projectSettings.authPersonalDataCheck
|
|
444
|
-
|
|
459
|
+
personalDataCheck: projectSettings.authPersonalDataCheck,
|
|
460
|
+
sessionAlerts: projectSettings.authSessionAlerts,
|
|
461
|
+
mockNumbers: projectSettings.authMockNumbers
|
|
462
|
+
},
|
|
445
463
|
}
|
|
446
464
|
};
|
|
447
465
|
}
|
package/lib/parser.js
CHANGED
|
@@ -120,7 +120,7 @@ const parseError = (err) => {
|
|
|
120
120
|
} catch {
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
const version = '6.0.0
|
|
123
|
+
const version = '6.0.0';
|
|
124
124
|
const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``;
|
|
125
125
|
const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`;
|
|
126
126
|
|
package/lib/questions.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "appwrite-cli",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
|
5
|
-
"version": "6.0.0
|
|
5
|
+
"version": "6.0.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"bin": {
|
package/scoop/appwrite.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json",
|
|
3
|
-
"version": "6.0.0
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.",
|
|
5
5
|
"homepage": "https://github.com/appwrite/sdk-for-cli",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"architecture": {
|
|
8
8
|
"64bit": {
|
|
9
|
-
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0
|
|
9
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0/appwrite-cli-win-x64.exe",
|
|
10
10
|
"bin": [
|
|
11
11
|
[
|
|
12
12
|
"appwrite-cli-win-x64.exe",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"arm64": {
|
|
18
|
-
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0
|
|
18
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/6.0.0/appwrite-cli-win-arm64.exe",
|
|
19
19
|
"bin": [
|
|
20
20
|
[
|
|
21
21
|
"appwrite-cli-win-arm64.exe",
|