appwrite-cli 9.0.1 → 9.1.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/README.md +2 -2
- package/docs/examples/databases/create-line-attribute.md +5 -0
- package/docs/examples/databases/create-point-attribute.md +5 -0
- package/docs/examples/databases/create-polygon-attribute.md +5 -0
- package/docs/examples/databases/update-line-attribute.md +5 -0
- package/docs/examples/databases/update-point-attribute.md +5 -0
- package/docs/examples/databases/update-polygon-attribute.md +5 -0
- package/docs/examples/tablesdb/create-line-column.md +5 -0
- package/docs/examples/tablesdb/create-point-column.md +5 -0
- package/docs/examples/tablesdb/create-polygon-column.md +5 -0
- package/docs/examples/tablesdb/update-line-column.md +5 -0
- package/docs/examples/tablesdb/update-point-column.md +5 -0
- package/docs/examples/tablesdb/update-polygon-column.md +5 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +2 -2
- package/lib/commands/account.js +2 -2
- package/lib/commands/avatars.js +2 -2
- package/lib/commands/databases.js +330 -0
- package/lib/commands/functions.js +2 -2
- package/lib/commands/generic.js +5 -5
- package/lib/commands/init.js +3 -1
- package/lib/commands/pull.js +10 -4
- package/lib/commands/push.js +27 -9
- package/lib/commands/tables-db.js +330 -0
- package/lib/commands/types.js +54 -15
- package/lib/config.js +57 -33
- package/lib/parser.js +1 -1
- package/lib/questions.js +6 -6
- package/lib/type-generation/languages/csharp.js +170 -0
- package/lib/type-generation/languages/javascript.js +2 -2
- package/lib/type-generation/languages/typescript.js +1 -1
- package/package.json +1 -1
- package/scoop/appwrite.config.json +3 -3
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
|
-
9.0
|
|
32
|
+
9.1.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
|
-
9.0
|
|
63
|
+
9.1.0
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## Getting Started
|
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/9.0
|
|
17
|
-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/9.0
|
|
16
|
+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/9.1.0/appwrite-cli-win-x64.exe"
|
|
17
|
+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/9.1.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="9.0
|
|
100
|
+
GITHUB_LATEST_VERSION="9.1.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': '9.0
|
|
20
|
-
'user-agent' : `AppwriteCLI/9.0
|
|
19
|
+
'x-sdk-version': '9.1.0',
|
|
20
|
+
'user-agent' : `AppwriteCLI/9.1.0 (${os.type()} ${os.version()}; ${os.arch()})`,
|
|
21
21
|
'X-Appwrite-Response-Format' : '1.8.0',
|
|
22
22
|
};
|
|
23
23
|
}
|
package/lib/commands/account.js
CHANGED
|
@@ -1843,7 +1843,7 @@ account
|
|
|
1843
1843
|
|
|
1844
1844
|
account
|
|
1845
1845
|
.command(`update-magic-url-session`)
|
|
1846
|
-
.description(`[**DEPRECATED** - This command is deprecated.] Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`)
|
|
1846
|
+
.description(`[**DEPRECATED** - This command is deprecated. Please use 'account create-session' instead] Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`)
|
|
1847
1847
|
.requiredOption(`--user-id <user-id>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1848
1848
|
.requiredOption(`--secret <secret>`, `Valid verification token.`)
|
|
1849
1849
|
.action(actionRunner(accountUpdateMagicURLSession))
|
|
@@ -1859,7 +1859,7 @@ account
|
|
|
1859
1859
|
|
|
1860
1860
|
account
|
|
1861
1861
|
.command(`update-phone-session`)
|
|
1862
|
-
.description(`[**DEPRECATED** - This command is deprecated.] Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`)
|
|
1862
|
+
.description(`[**DEPRECATED** - This command is deprecated. Please use 'account create-session' instead] Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.`)
|
|
1863
1863
|
.requiredOption(`--user-id <user-id>`, `User ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1864
1864
|
.requiredOption(`--secret <secret>`, `Valid verification token.`)
|
|
1865
1865
|
.action(actionRunner(accountUpdatePhoneSession))
|
package/lib/commands/avatars.js
CHANGED
|
@@ -94,7 +94,7 @@ const avatarsGetBrowser = async ({code,width,height,quality,parseOutput = true,
|
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* @typedef {Object} AvatarsGetCreditCardRequestParams
|
|
97
|
-
* @property {CreditCard} code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping,
|
|
97
|
+
* @property {CreditCard} code Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay.
|
|
98
98
|
* @property {number} width Image width. Pass an integer between 0 to 2000. Defaults to 100.
|
|
99
99
|
* @property {number} height Image height. Pass an integer between 0 to 2000. Defaults to 100.
|
|
100
100
|
* @property {number} quality Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
|
|
@@ -419,7 +419,7 @@ avatars
|
|
|
419
419
|
avatars
|
|
420
420
|
.command(`get-credit-card`)
|
|
421
421
|
.description(`The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. `)
|
|
422
|
-
.requiredOption(`--code <code>`, `Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping,
|
|
422
|
+
.requiredOption(`--code <code>`, `Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay.`)
|
|
423
423
|
.option(`--width <width>`, `Image width. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger)
|
|
424
424
|
.option(`--height <height>`, `Image height. Pass an integer between 0 to 2000. Defaults to 100.`, parseInteger)
|
|
425
425
|
.option(`--quality <quality>`, `Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.`, parseInteger)
|
|
@@ -1178,6 +1178,267 @@ const databasesUpdateIpAttribute = async ({databaseId,collectionId,key,required,
|
|
|
1178
1178
|
|
|
1179
1179
|
return response;
|
|
1180
1180
|
|
|
1181
|
+
}
|
|
1182
|
+
/**
|
|
1183
|
+
* @typedef {Object} DatabasesCreateLineAttributeRequestParams
|
|
1184
|
+
* @property {string} databaseId Database ID.
|
|
1185
|
+
* @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1186
|
+
* @property {string} key Attribute Key.
|
|
1187
|
+
* @property {boolean} required Is attribute required?
|
|
1188
|
+
* @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.
|
|
1189
|
+
* @property {boolean} overrideForCli
|
|
1190
|
+
* @property {boolean} parseOutput
|
|
1191
|
+
* @property {libClient | undefined} sdk
|
|
1192
|
+
*/
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* @param {DatabasesCreateLineAttributeRequestParams} params
|
|
1196
|
+
*/
|
|
1197
|
+
const databasesCreateLineAttribute = async ({databaseId,collectionId,key,required,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
1198
|
+
let client = !sdk ? await sdkForProject() :
|
|
1199
|
+
sdk;
|
|
1200
|
+
let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1201
|
+
let payload = {};
|
|
1202
|
+
if (typeof key !== 'undefined') {
|
|
1203
|
+
payload['key'] = key;
|
|
1204
|
+
}
|
|
1205
|
+
if (typeof required !== 'undefined') {
|
|
1206
|
+
payload['required'] = required;
|
|
1207
|
+
}
|
|
1208
|
+
if (typeof xdefault !== 'undefined') {
|
|
1209
|
+
payload['default'] = xdefault;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
let response = undefined;
|
|
1213
|
+
|
|
1214
|
+
response = await client.call('post', apiPath, {
|
|
1215
|
+
'content-type': 'application/json',
|
|
1216
|
+
}, payload);
|
|
1217
|
+
|
|
1218
|
+
if (parseOutput) {
|
|
1219
|
+
parse(response)
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
return response;
|
|
1223
|
+
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* @typedef {Object} DatabasesUpdateLineAttributeRequestParams
|
|
1227
|
+
* @property {string} databaseId Database ID.
|
|
1228
|
+
* @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection).
|
|
1229
|
+
* @property {string} key Attribute Key.
|
|
1230
|
+
* @property {boolean} required Is attribute required?
|
|
1231
|
+
* @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.
|
|
1232
|
+
* @property {string} newKey New attribute key.
|
|
1233
|
+
* @property {boolean} overrideForCli
|
|
1234
|
+
* @property {boolean} parseOutput
|
|
1235
|
+
* @property {libClient | undefined} sdk
|
|
1236
|
+
*/
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* @param {DatabasesUpdateLineAttributeRequestParams} params
|
|
1240
|
+
*/
|
|
1241
|
+
const databasesUpdateLineAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
1242
|
+
let client = !sdk ? await sdkForProject() :
|
|
1243
|
+
sdk;
|
|
1244
|
+
let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1245
|
+
let payload = {};
|
|
1246
|
+
if (typeof required !== 'undefined') {
|
|
1247
|
+
payload['required'] = required;
|
|
1248
|
+
}
|
|
1249
|
+
if (typeof xdefault !== 'undefined') {
|
|
1250
|
+
payload['default'] = xdefault;
|
|
1251
|
+
}
|
|
1252
|
+
if (typeof newKey !== 'undefined') {
|
|
1253
|
+
payload['newKey'] = newKey;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
let response = undefined;
|
|
1257
|
+
|
|
1258
|
+
response = await client.call('patch', apiPath, {
|
|
1259
|
+
'content-type': 'application/json',
|
|
1260
|
+
}, payload);
|
|
1261
|
+
|
|
1262
|
+
if (parseOutput) {
|
|
1263
|
+
parse(response)
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
return response;
|
|
1267
|
+
|
|
1268
|
+
}
|
|
1269
|
+
/**
|
|
1270
|
+
* @typedef {Object} DatabasesCreatePointAttributeRequestParams
|
|
1271
|
+
* @property {string} databaseId Database ID.
|
|
1272
|
+
* @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1273
|
+
* @property {string} key Attribute Key.
|
|
1274
|
+
* @property {boolean} required Is attribute required?
|
|
1275
|
+
* @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.
|
|
1276
|
+
* @property {boolean} overrideForCli
|
|
1277
|
+
* @property {boolean} parseOutput
|
|
1278
|
+
* @property {libClient | undefined} sdk
|
|
1279
|
+
*/
|
|
1280
|
+
|
|
1281
|
+
/**
|
|
1282
|
+
* @param {DatabasesCreatePointAttributeRequestParams} params
|
|
1283
|
+
*/
|
|
1284
|
+
const databasesCreatePointAttribute = async ({databaseId,collectionId,key,required,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
1285
|
+
let client = !sdk ? await sdkForProject() :
|
|
1286
|
+
sdk;
|
|
1287
|
+
let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1288
|
+
let payload = {};
|
|
1289
|
+
if (typeof key !== 'undefined') {
|
|
1290
|
+
payload['key'] = key;
|
|
1291
|
+
}
|
|
1292
|
+
if (typeof required !== 'undefined') {
|
|
1293
|
+
payload['required'] = required;
|
|
1294
|
+
}
|
|
1295
|
+
if (typeof xdefault !== 'undefined') {
|
|
1296
|
+
payload['default'] = xdefault;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
let response = undefined;
|
|
1300
|
+
|
|
1301
|
+
response = await client.call('post', apiPath, {
|
|
1302
|
+
'content-type': 'application/json',
|
|
1303
|
+
}, payload);
|
|
1304
|
+
|
|
1305
|
+
if (parseOutput) {
|
|
1306
|
+
parse(response)
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
return response;
|
|
1310
|
+
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* @typedef {Object} DatabasesUpdatePointAttributeRequestParams
|
|
1314
|
+
* @property {string} databaseId Database ID.
|
|
1315
|
+
* @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection).
|
|
1316
|
+
* @property {string} key Attribute Key.
|
|
1317
|
+
* @property {boolean} required Is attribute required?
|
|
1318
|
+
* @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.
|
|
1319
|
+
* @property {string} newKey New attribute key.
|
|
1320
|
+
* @property {boolean} overrideForCli
|
|
1321
|
+
* @property {boolean} parseOutput
|
|
1322
|
+
* @property {libClient | undefined} sdk
|
|
1323
|
+
*/
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* @param {DatabasesUpdatePointAttributeRequestParams} params
|
|
1327
|
+
*/
|
|
1328
|
+
const databasesUpdatePointAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
1329
|
+
let client = !sdk ? await sdkForProject() :
|
|
1330
|
+
sdk;
|
|
1331
|
+
let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1332
|
+
let payload = {};
|
|
1333
|
+
if (typeof required !== 'undefined') {
|
|
1334
|
+
payload['required'] = required;
|
|
1335
|
+
}
|
|
1336
|
+
if (typeof xdefault !== 'undefined') {
|
|
1337
|
+
payload['default'] = xdefault;
|
|
1338
|
+
}
|
|
1339
|
+
if (typeof newKey !== 'undefined') {
|
|
1340
|
+
payload['newKey'] = newKey;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
let response = undefined;
|
|
1344
|
+
|
|
1345
|
+
response = await client.call('patch', apiPath, {
|
|
1346
|
+
'content-type': 'application/json',
|
|
1347
|
+
}, payload);
|
|
1348
|
+
|
|
1349
|
+
if (parseOutput) {
|
|
1350
|
+
parse(response)
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
return response;
|
|
1354
|
+
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* @typedef {Object} DatabasesCreatePolygonAttributeRequestParams
|
|
1358
|
+
* @property {string} databaseId Database ID.
|
|
1359
|
+
* @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
|
1360
|
+
* @property {string} key Attribute Key.
|
|
1361
|
+
* @property {boolean} required Is attribute required?
|
|
1362
|
+
* @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.
|
|
1363
|
+
* @property {boolean} overrideForCli
|
|
1364
|
+
* @property {boolean} parseOutput
|
|
1365
|
+
* @property {libClient | undefined} sdk
|
|
1366
|
+
*/
|
|
1367
|
+
|
|
1368
|
+
/**
|
|
1369
|
+
* @param {DatabasesCreatePolygonAttributeRequestParams} params
|
|
1370
|
+
*/
|
|
1371
|
+
const databasesCreatePolygonAttribute = async ({databaseId,collectionId,key,required,xdefault,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
1372
|
+
let client = !sdk ? await sdkForProject() :
|
|
1373
|
+
sdk;
|
|
1374
|
+
let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
|
1375
|
+
let payload = {};
|
|
1376
|
+
if (typeof key !== 'undefined') {
|
|
1377
|
+
payload['key'] = key;
|
|
1378
|
+
}
|
|
1379
|
+
if (typeof required !== 'undefined') {
|
|
1380
|
+
payload['required'] = required;
|
|
1381
|
+
}
|
|
1382
|
+
if (typeof xdefault !== 'undefined') {
|
|
1383
|
+
payload['default'] = xdefault;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
let response = undefined;
|
|
1387
|
+
|
|
1388
|
+
response = await client.call('post', apiPath, {
|
|
1389
|
+
'content-type': 'application/json',
|
|
1390
|
+
}, payload);
|
|
1391
|
+
|
|
1392
|
+
if (parseOutput) {
|
|
1393
|
+
parse(response)
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
return response;
|
|
1397
|
+
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* @typedef {Object} DatabasesUpdatePolygonAttributeRequestParams
|
|
1401
|
+
* @property {string} databaseId Database ID.
|
|
1402
|
+
* @property {string} collectionId Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection).
|
|
1403
|
+
* @property {string} key Attribute Key.
|
|
1404
|
+
* @property {boolean} required Is attribute required?
|
|
1405
|
+
* @property {string} xdefault Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.
|
|
1406
|
+
* @property {string} newKey New attribute key.
|
|
1407
|
+
* @property {boolean} overrideForCli
|
|
1408
|
+
* @property {boolean} parseOutput
|
|
1409
|
+
* @property {libClient | undefined} sdk
|
|
1410
|
+
*/
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* @param {DatabasesUpdatePolygonAttributeRequestParams} params
|
|
1414
|
+
*/
|
|
1415
|
+
const databasesUpdatePolygonAttribute = async ({databaseId,collectionId,key,required,xdefault,newKey,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
1416
|
+
let client = !sdk ? await sdkForProject() :
|
|
1417
|
+
sdk;
|
|
1418
|
+
let apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
|
1419
|
+
let payload = {};
|
|
1420
|
+
if (typeof required !== 'undefined') {
|
|
1421
|
+
payload['required'] = required;
|
|
1422
|
+
}
|
|
1423
|
+
if (typeof xdefault !== 'undefined') {
|
|
1424
|
+
payload['default'] = xdefault;
|
|
1425
|
+
}
|
|
1426
|
+
if (typeof newKey !== 'undefined') {
|
|
1427
|
+
payload['newKey'] = newKey;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
let response = undefined;
|
|
1431
|
+
|
|
1432
|
+
response = await client.call('patch', apiPath, {
|
|
1433
|
+
'content-type': 'application/json',
|
|
1434
|
+
}, payload);
|
|
1435
|
+
|
|
1436
|
+
if (parseOutput) {
|
|
1437
|
+
parse(response)
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
return response;
|
|
1441
|
+
|
|
1181
1442
|
}
|
|
1182
1443
|
/**
|
|
1183
1444
|
* @typedef {Object} DatabasesCreateRelationshipAttributeRequestParams
|
|
@@ -2583,6 +2844,69 @@ databases
|
|
|
2583
2844
|
.option(`--new-key <new-key>`, `New Attribute Key.`)
|
|
2584
2845
|
.action(actionRunner(databasesUpdateIpAttribute))
|
|
2585
2846
|
|
|
2847
|
+
databases
|
|
2848
|
+
.command(`create-line-attribute`)
|
|
2849
|
+
.description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db create-line-column' instead] Create a geometric line attribute.`)
|
|
2850
|
+
.requiredOption(`--database-id <database-id>`, `Database ID.`)
|
|
2851
|
+
.requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
|
|
2852
|
+
.requiredOption(`--key <key>`, `Attribute Key.`)
|
|
2853
|
+
.requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
|
|
2854
|
+
.option(`--xdefault <xdefault>`, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`)
|
|
2855
|
+
.action(actionRunner(databasesCreateLineAttribute))
|
|
2856
|
+
|
|
2857
|
+
databases
|
|
2858
|
+
.command(`update-line-attribute`)
|
|
2859
|
+
.description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db update-line-column' instead] Update a line attribute. Changing the 'default' value will not update already existing documents.`)
|
|
2860
|
+
.requiredOption(`--database-id <database-id>`, `Database ID.`)
|
|
2861
|
+
.requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection).`)
|
|
2862
|
+
.requiredOption(`--key <key>`, `Attribute Key.`)
|
|
2863
|
+
.requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
|
|
2864
|
+
.option(`--xdefault <xdefault>`, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`)
|
|
2865
|
+
.option(`--new-key <new-key>`, `New attribute key.`)
|
|
2866
|
+
.action(actionRunner(databasesUpdateLineAttribute))
|
|
2867
|
+
|
|
2868
|
+
databases
|
|
2869
|
+
.command(`create-point-attribute`)
|
|
2870
|
+
.description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db create-point-column' instead] Create a geometric 2d point attribute.`)
|
|
2871
|
+
.requiredOption(`--database-id <database-id>`, `Database ID.`)
|
|
2872
|
+
.requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
|
|
2873
|
+
.requiredOption(`--key <key>`, `Attribute Key.`)
|
|
2874
|
+
.requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
|
|
2875
|
+
.option(`--xdefault <xdefault>`, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`)
|
|
2876
|
+
.action(actionRunner(databasesCreatePointAttribute))
|
|
2877
|
+
|
|
2878
|
+
databases
|
|
2879
|
+
.command(`update-point-attribute`)
|
|
2880
|
+
.description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db update-point-column' instead] Update a point attribute. Changing the 'default' value will not update already existing documents.`)
|
|
2881
|
+
.requiredOption(`--database-id <database-id>`, `Database ID.`)
|
|
2882
|
+
.requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection).`)
|
|
2883
|
+
.requiredOption(`--key <key>`, `Attribute Key.`)
|
|
2884
|
+
.requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
|
|
2885
|
+
.option(`--xdefault <xdefault>`, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`)
|
|
2886
|
+
.option(`--new-key <new-key>`, `New attribute key.`)
|
|
2887
|
+
.action(actionRunner(databasesUpdatePointAttribute))
|
|
2888
|
+
|
|
2889
|
+
databases
|
|
2890
|
+
.command(`create-polygon-attribute`)
|
|
2891
|
+
.description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db create-polygon-column' instead] Create a geometric polygon attribute.`)
|
|
2892
|
+
.requiredOption(`--database-id <database-id>`, `Database ID.`)
|
|
2893
|
+
.requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).`)
|
|
2894
|
+
.requiredOption(`--key <key>`, `Attribute Key.`)
|
|
2895
|
+
.requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
|
|
2896
|
+
.option(`--xdefault <xdefault>`, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`)
|
|
2897
|
+
.action(actionRunner(databasesCreatePolygonAttribute))
|
|
2898
|
+
|
|
2899
|
+
databases
|
|
2900
|
+
.command(`update-polygon-attribute`)
|
|
2901
|
+
.description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db update-polygon-column' instead] Update a polygon attribute. Changing the 'default' value will not update already existing documents.`)
|
|
2902
|
+
.requiredOption(`--database-id <database-id>`, `Database ID.`)
|
|
2903
|
+
.requiredOption(`--collection-id <collection-id>`, `Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection).`)
|
|
2904
|
+
.requiredOption(`--key <key>`, `Attribute Key.`)
|
|
2905
|
+
.requiredOption(`--required [value]`, `Is attribute required?`, (value) => value === undefined ? true : parseBool(value))
|
|
2906
|
+
.option(`--xdefault <xdefault>`, `Default value for attribute when not provided, as JSON string. Cannot be set when attribute is required.`)
|
|
2907
|
+
.option(`--new-key <new-key>`, `New attribute key.`)
|
|
2908
|
+
.action(actionRunner(databasesUpdatePolygonAttribute))
|
|
2909
|
+
|
|
2586
2910
|
databases
|
|
2587
2911
|
.command(`create-relationship-attribute`)
|
|
2588
2912
|
.description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db create-relationship-column' instead] Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). `)
|
|
@@ -2885,6 +3209,12 @@ module.exports = {
|
|
|
2885
3209
|
databasesUpdateIntegerAttribute,
|
|
2886
3210
|
databasesCreateIpAttribute,
|
|
2887
3211
|
databasesUpdateIpAttribute,
|
|
3212
|
+
databasesCreateLineAttribute,
|
|
3213
|
+
databasesUpdateLineAttribute,
|
|
3214
|
+
databasesCreatePointAttribute,
|
|
3215
|
+
databasesUpdatePointAttribute,
|
|
3216
|
+
databasesCreatePolygonAttribute,
|
|
3217
|
+
databasesUpdatePolygonAttribute,
|
|
2888
3218
|
databasesCreateRelationshipAttribute,
|
|
2889
3219
|
databasesCreateStringAttribute,
|
|
2890
3220
|
databasesUpdateStringAttribute,
|
|
@@ -1082,7 +1082,7 @@ const functionsListExecutions = async ({functionId,queries,parseOutput = true, o
|
|
|
1082
1082
|
* @property {string} body HTTP body of execution. Default value is empty string.
|
|
1083
1083
|
* @property {boolean} async Execute code in the background. Default value is false.
|
|
1084
1084
|
* @property {string} xpath HTTP path of execution. Path can include query params. Default value is /
|
|
1085
|
-
* @property {ExecutionMethod} method HTTP method of execution. Default value is
|
|
1085
|
+
* @property {ExecutionMethod} method HTTP method of execution. Default value is POST.
|
|
1086
1086
|
* @property {object} headers HTTP headers of execution. Defaults to empty.
|
|
1087
1087
|
* @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.
|
|
1088
1088
|
* @property {boolean} overrideForCli
|
|
@@ -1606,7 +1606,7 @@ functions
|
|
|
1606
1606
|
.option(`--body <body>`, `HTTP body of execution. Default value is empty string.`)
|
|
1607
1607
|
.option(`--async [value]`, `Execute code in the background. Default value is false.`, (value) => value === undefined ? true : parseBool(value))
|
|
1608
1608
|
.option(`--xpath <xpath>`, `HTTP path of execution. Path can include query params. Default value is /`)
|
|
1609
|
-
.option(`--method <method>`, `HTTP method of execution. Default value is
|
|
1609
|
+
.option(`--method <method>`, `HTTP method of execution. Default value is POST.`)
|
|
1610
1610
|
.option(`--headers <headers>`, `HTTP headers of execution. Defaults to empty.`)
|
|
1611
1611
|
.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.`)
|
|
1612
1612
|
.action(actionRunner(functionsCreateExecution))
|
package/lib/commands/generic.js
CHANGED
|
@@ -5,8 +5,8 @@ const { sdkForConsole } = require("../sdks");
|
|
|
5
5
|
const { globalConfig, localConfig } = require("../config");
|
|
6
6
|
const { actionRunner, success, parseBool, commandDescriptions, error, parse, hint, log, drawTable, cliConfig } = require("../parser");
|
|
7
7
|
const ID = require("../id");
|
|
8
|
-
const { questionsLogin, questionsLogout, questionsListFactors,
|
|
9
|
-
const {
|
|
8
|
+
const { questionsLogin, questionsLogout, questionsListFactors, questionsMFAChallenge } = require("../questions");
|
|
9
|
+
const { accountUpdateMFAChallenge, accountCreateMFAChallenge, accountGet, accountCreateEmailPasswordSession, accountDeleteSession } = require("./account");
|
|
10
10
|
|
|
11
11
|
const DEFAULT_ENDPOINT = 'https://cloud.appwrite.io/v1';
|
|
12
12
|
|
|
@@ -71,15 +71,15 @@ const loginCommand = async ({ email, password, endpoint, mfa, code }) => {
|
|
|
71
71
|
if (error.response === 'user_more_factors_required') {
|
|
72
72
|
const { factor } = mfa ? { factor: mfa } : await inquirer.prompt(questionsListFactors);
|
|
73
73
|
|
|
74
|
-
const challenge = await
|
|
74
|
+
const challenge = await accountCreateMFAChallenge({
|
|
75
75
|
factor,
|
|
76
76
|
parseOutput: false,
|
|
77
77
|
sdk: client
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
-
const { otp } = code ? { otp: code } : await inquirer.prompt(
|
|
80
|
+
const { otp } = code ? { otp: code } : await inquirer.prompt(questionsMFAChallenge);
|
|
81
81
|
|
|
82
|
-
await
|
|
82
|
+
await accountUpdateMFAChallenge({
|
|
83
83
|
challengeId: challenge.$id,
|
|
84
84
|
otp,
|
|
85
85
|
parseOutput: false,
|
package/lib/commands/init.js
CHANGED
|
@@ -124,7 +124,9 @@ const initProject = async ({ organizationId, projectId, projectName } = {}) => {
|
|
|
124
124
|
if(answers.autopull) {
|
|
125
125
|
cliConfig.all = true;
|
|
126
126
|
cliConfig.force = true;
|
|
127
|
-
await pullResources(
|
|
127
|
+
await pullResources({
|
|
128
|
+
skipDeprecated: true
|
|
129
|
+
});
|
|
128
130
|
} else {
|
|
129
131
|
log("You can run 'appwrite pull all' to synchronize all of your existing resources.");
|
|
130
132
|
}
|
package/lib/commands/pull.js
CHANGED
|
@@ -9,14 +9,16 @@ const { projectsGet } = require("./projects");
|
|
|
9
9
|
const { functionsList, functionsGetDeploymentDownload, functionsListDeployments } = require("./functions");
|
|
10
10
|
const { sitesList, sitesGetDeploymentDownload, sitesListDeployments } = require("./sites");
|
|
11
11
|
const { databasesGet, databasesListCollections, databasesList } = require("./databases");
|
|
12
|
-
const { tablesDBList,
|
|
12
|
+
const { tablesDBList, tablesDBGet, tablesDBListTables } = require("./tables-db");
|
|
13
13
|
const { storageListBuckets } = require("./storage");
|
|
14
14
|
const { localConfig } = require("../config");
|
|
15
15
|
const { paginate } = require("../paginate");
|
|
16
16
|
const { questionsPullCollection, questionsPullFunctions, questionsPullFunctionsCode, questionsPullSites, questionsPullSitesCode, questionsPullResources } = require("../questions");
|
|
17
17
|
const { cliConfig, success, log, warn, actionRunner, commandDescriptions } = require("../parser");
|
|
18
18
|
|
|
19
|
-
const pullResources = async (
|
|
19
|
+
const pullResources = async ({
|
|
20
|
+
skipDeprecated = false
|
|
21
|
+
} = {}) => {
|
|
20
22
|
const actions = {
|
|
21
23
|
settings: pullSettings,
|
|
22
24
|
functions: pullFunctions,
|
|
@@ -28,6 +30,10 @@ const pullResources = async () => {
|
|
|
28
30
|
messages: pullMessagingTopic
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
if (skipDeprecated) {
|
|
34
|
+
delete actions.collections;
|
|
35
|
+
}
|
|
36
|
+
|
|
31
37
|
if (cliConfig.all) {
|
|
32
38
|
for (let action of Object.values(actions)) {
|
|
33
39
|
cliConfig.all = true;
|
|
@@ -364,7 +370,7 @@ const pullTable = async () => {
|
|
|
364
370
|
}
|
|
365
371
|
|
|
366
372
|
for (const databaseId of databases) {
|
|
367
|
-
const database = await
|
|
373
|
+
const database = await tablesDBGet({
|
|
368
374
|
databaseId,
|
|
369
375
|
parseOutput: false
|
|
370
376
|
});
|
|
@@ -372,7 +378,7 @@ const pullTable = async () => {
|
|
|
372
378
|
total++;
|
|
373
379
|
log(`Pulling all tables from ${chalk.bold(database['name'])} database ...`);
|
|
374
380
|
|
|
375
|
-
localConfig.
|
|
381
|
+
localConfig.addTablesDB(database);
|
|
376
382
|
|
|
377
383
|
const { tables } = await paginate(tablesDBListTables, {
|
|
378
384
|
databaseId,
|