appwrite-cli 9.1.0 → 10.0.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.0.1
4
+
5
+ * Fix CLI Dart model generation issues
6
+ * Fix row permissions and security sync
7
+ * Fix error when pushing columns with relationships
8
+ * Fix resource name from attributes to columns for TablesDB indexes
9
+
10
+ ## 10.0.0
11
+
12
+ * **Breaking:** Removed Avatars CLI command and all related subcommands; corresponding examples deleted
13
+ * **Feat:** Geo defaults now accept coordinate arrays for Databases and Tables DB, with automatic normalization
14
+ * **Feat:** Pull command skips deprecated resources by default and shows clearer totals/messages
15
+ * **Feat:** Updated CLI descriptions: Databases marked legacy; added tables-db, projects, and project
16
+ * Fix TypeScript type generation now quotes invalid property names to produce valid typings
17
+ * Update documentation: Removed Avatars CLI examples and updated help text to reflect new geo defaults and terminology
18
+
3
19
  ## 8.3.0
4
20
 
5
21
  * **Feat:** Add support for `appwrite.config.json` file
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.1.0
32
+ 10.0.1
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.1.0
63
+ 10.0.1
64
64
  ```
65
65
 
66
66
  ## Getting Started
package/index.js CHANGED
@@ -20,7 +20,6 @@ const { run } = require("./lib/commands/run");
20
20
  const { push, deploy } = require("./lib/commands/push");
21
21
  const { update } = require("./lib/commands/update");
22
22
  const { account } = require("./lib/commands/account");
23
- const { avatars } = require("./lib/commands/avatars");
24
23
  const { console } = require("./lib/commands/console");
25
24
  const { databases } = require("./lib/commands/databases");
26
25
  const { functions } = require("./lib/commands/functions");
@@ -124,7 +123,6 @@ program
124
123
  .addCommand(update)
125
124
  .addCommand(logout)
126
125
  .addCommand(account)
127
- .addCommand(avatars)
128
126
  .addCommand(console)
129
127
  .addCommand(databases)
130
128
  .addCommand(functions)
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.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"
16
+ $GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.1/appwrite-cli-win-x64.exe"
17
+ $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/10.0.1/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.1.0"
100
+ GITHUB_LATEST_VERSION="10.0.1"
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.1.0',
20
- 'user-agent' : `AppwriteCLI/9.1.0 (${os.type()} ${os.version()}; ${os.arch()})`,
19
+ 'x-sdk-version': '10.0.1',
20
+ 'user-agent' : `AppwriteCLI/10.0.1 (${os.type()} ${os.version()}; ${os.arch()})`,
21
21
  'X-Appwrite-Response-Format' : '1.8.0',
22
22
  };
23
23
  }
@@ -1185,7 +1185,7 @@ const databasesUpdateIpAttribute = async ({databaseId,collectionId,key,required,
1185
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
1186
  * @property {string} key Attribute Key.
1187
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.
1188
+ * @property {any[]} xdefault Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required.
1189
1189
  * @property {boolean} overrideForCli
1190
1190
  * @property {boolean} parseOutput
1191
1191
  * @property {libClient | undefined} sdk
@@ -1205,6 +1205,7 @@ const databasesCreateLineAttribute = async ({databaseId,collectionId,key,require
1205
1205
  if (typeof required !== 'undefined') {
1206
1206
  payload['required'] = required;
1207
1207
  }
1208
+ xdefault = xdefault === true ? [] : xdefault;
1208
1209
  if (typeof xdefault !== 'undefined') {
1209
1210
  payload['default'] = xdefault;
1210
1211
  }
@@ -1228,7 +1229,7 @@ const databasesCreateLineAttribute = async ({databaseId,collectionId,key,require
1228
1229
  * @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
1230
  * @property {string} key Attribute Key.
1230
1231
  * @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 {any[]} xdefault Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required.
1232
1233
  * @property {string} newKey New attribute key.
1233
1234
  * @property {boolean} overrideForCli
1234
1235
  * @property {boolean} parseOutput
@@ -1246,6 +1247,7 @@ const databasesUpdateLineAttribute = async ({databaseId,collectionId,key,require
1246
1247
  if (typeof required !== 'undefined') {
1247
1248
  payload['required'] = required;
1248
1249
  }
1250
+ xdefault = xdefault === true ? [] : xdefault;
1249
1251
  if (typeof xdefault !== 'undefined') {
1250
1252
  payload['default'] = xdefault;
1251
1253
  }
@@ -1272,7 +1274,7 @@ const databasesUpdateLineAttribute = async ({databaseId,collectionId,key,require
1272
1274
  * @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
1275
  * @property {string} key Attribute Key.
1274
1276
  * @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.
1277
+ * @property {any[]} xdefault Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required.
1276
1278
  * @property {boolean} overrideForCli
1277
1279
  * @property {boolean} parseOutput
1278
1280
  * @property {libClient | undefined} sdk
@@ -1292,6 +1294,7 @@ const databasesCreatePointAttribute = async ({databaseId,collectionId,key,requir
1292
1294
  if (typeof required !== 'undefined') {
1293
1295
  payload['required'] = required;
1294
1296
  }
1297
+ xdefault = xdefault === true ? [] : xdefault;
1295
1298
  if (typeof xdefault !== 'undefined') {
1296
1299
  payload['default'] = xdefault;
1297
1300
  }
@@ -1315,7 +1318,7 @@ const databasesCreatePointAttribute = async ({databaseId,collectionId,key,requir
1315
1318
  * @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
1319
  * @property {string} key Attribute Key.
1317
1320
  * @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.
1321
+ * @property {any[]} xdefault Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required.
1319
1322
  * @property {string} newKey New attribute key.
1320
1323
  * @property {boolean} overrideForCli
1321
1324
  * @property {boolean} parseOutput
@@ -1333,6 +1336,7 @@ const databasesUpdatePointAttribute = async ({databaseId,collectionId,key,requir
1333
1336
  if (typeof required !== 'undefined') {
1334
1337
  payload['required'] = required;
1335
1338
  }
1339
+ xdefault = xdefault === true ? [] : xdefault;
1336
1340
  if (typeof xdefault !== 'undefined') {
1337
1341
  payload['default'] = xdefault;
1338
1342
  }
@@ -1359,7 +1363,7 @@ const databasesUpdatePointAttribute = async ({databaseId,collectionId,key,requir
1359
1363
  * @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
1364
  * @property {string} key Attribute Key.
1361
1365
  * @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.
1366
+ * @property {any[]} xdefault Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.
1363
1367
  * @property {boolean} overrideForCli
1364
1368
  * @property {boolean} parseOutput
1365
1369
  * @property {libClient | undefined} sdk
@@ -1379,6 +1383,7 @@ const databasesCreatePolygonAttribute = async ({databaseId,collectionId,key,requ
1379
1383
  if (typeof required !== 'undefined') {
1380
1384
  payload['required'] = required;
1381
1385
  }
1386
+ xdefault = xdefault === true ? [] : xdefault;
1382
1387
  if (typeof xdefault !== 'undefined') {
1383
1388
  payload['default'] = xdefault;
1384
1389
  }
@@ -1402,7 +1407,7 @@ const databasesCreatePolygonAttribute = async ({databaseId,collectionId,key,requ
1402
1407
  * @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
1408
  * @property {string} key Attribute Key.
1404
1409
  * @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.
1410
+ * @property {any[]} xdefault Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.
1406
1411
  * @property {string} newKey New attribute key.
1407
1412
  * @property {boolean} overrideForCli
1408
1413
  * @property {boolean} parseOutput
@@ -1420,6 +1425,7 @@ const databasesUpdatePolygonAttribute = async ({databaseId,collectionId,key,requ
1420
1425
  if (typeof required !== 'undefined') {
1421
1426
  payload['required'] = required;
1422
1427
  }
1428
+ xdefault = xdefault === true ? [] : xdefault;
1423
1429
  if (typeof xdefault !== 'undefined') {
1424
1430
  payload['default'] = xdefault;
1425
1431
  }
@@ -2851,7 +2857,7 @@ databases
2851
2857
  .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
2858
  .requiredOption(`--key <key>`, `Attribute Key.`)
2853
2859
  .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.`)
2860
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required.`)
2855
2861
  .action(actionRunner(databasesCreateLineAttribute))
2856
2862
 
2857
2863
  databases
@@ -2861,18 +2867,18 @@ databases
2861
2867
  .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
2868
  .requiredOption(`--key <key>`, `Attribute Key.`)
2863
2869
  .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.`)
2870
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required.`)
2865
2871
  .option(`--new-key <new-key>`, `New attribute key.`)
2866
2872
  .action(actionRunner(databasesUpdateLineAttribute))
2867
2873
 
2868
2874
  databases
2869
2875
  .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.`)
2876
+ .description(`[**DEPRECATED** - This command is deprecated. Please use 'tables-db create-point-column' instead] Create a geometric point attribute.`)
2871
2877
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2872
2878
  .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
2879
  .requiredOption(`--key <key>`, `Attribute Key.`)
2874
2880
  .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.`)
2881
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required.`)
2876
2882
  .action(actionRunner(databasesCreatePointAttribute))
2877
2883
 
2878
2884
  databases
@@ -2882,7 +2888,7 @@ databases
2882
2888
  .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
2889
  .requiredOption(`--key <key>`, `Attribute Key.`)
2884
2890
  .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.`)
2891
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required.`)
2886
2892
  .option(`--new-key <new-key>`, `New attribute key.`)
2887
2893
  .action(actionRunner(databasesUpdatePointAttribute))
2888
2894
 
@@ -2893,7 +2899,7 @@ databases
2893
2899
  .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
2900
  .requiredOption(`--key <key>`, `Attribute Key.`)
2895
2901
  .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.`)
2902
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.`)
2897
2903
  .action(actionRunner(databasesCreatePolygonAttribute))
2898
2904
 
2899
2905
  databases
@@ -2903,7 +2909,7 @@ databases
2903
2909
  .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
2910
  .requiredOption(`--key <key>`, `Attribute Key.`)
2905
2911
  .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.`)
2912
+ .option(`--xdefault <xdefault>`, `Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required.`)
2907
2913
  .option(`--new-key <new-key>`, `New attribute key.`)
2908
2914
  .action(actionRunner(databasesUpdatePolygonAttribute))
2909
2915
 
@@ -1234,7 +1234,7 @@ const projectsListPlatforms = async ({projectId,parseOutput = true, overrideForC
1234
1234
  /**
1235
1235
  * @typedef {Object} ProjectsCreatePlatformRequestParams
1236
1236
  * @property {string} projectId Project unique ID.
1237
- * @property {PlatformType} type Platform type.
1237
+ * @property {PlatformType} type Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.
1238
1238
  * @property {string} name Platform name. Max length: 128 chars.
1239
1239
  * @property {string} key Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars.
1240
1240
  * @property {string} store App store or Google Play store ID. Max length: 256 chars.
@@ -2354,7 +2354,7 @@ projects
2354
2354
  .command(`create-platform`)
2355
2355
  .description(`Create a new platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API.`)
2356
2356
  .requiredOption(`--project-id <project-id>`, `Project unique ID.`)
2357
- .requiredOption(`--type <type>`, `Platform type.`)
2357
+ .requiredOption(`--type <type>`, `Platform type. Possible values are: web, flutter-web, flutter-ios, flutter-android, flutter-linux, flutter-macos, flutter-windows, apple-ios, apple-macos, apple-watchos, apple-tvos, android, unity, react-native-ios, react-native-android.`)
2358
2358
  .requiredOption(`--name <name>`, `Platform name. Max length: 128 chars.`)
2359
2359
  .option(`--key <key>`, `Package name for Android or bundle ID for iOS or macOS. Max length: 256 chars.`)
2360
2360
  .option(`--store <store>`, `App store or Google Play store ID. Max length: 256 chars.`)
@@ -295,7 +295,8 @@ const pullSites = async ({ code, withVariables }) => {
295
295
  const pullCollection = async () => {
296
296
  warn("appwrite pull collection has been deprecated. Please consider using 'appwrite pull tables' instead");
297
297
  log("Fetching collections ...");
298
- let total = 0;
298
+ let totalDatabases = 0;
299
+ let totalCollections = 0;
299
300
 
300
301
  const fetchResponse = await databasesList({
301
302
  queries: [JSON.stringify({ method: 'limit', values: [1] })],
@@ -303,7 +304,7 @@ const pullCollection = async () => {
303
304
  });
304
305
  if (fetchResponse["databases"].length <= 0) {
305
306
  log("No collections found.");
306
- success(`Successfully pulled ${chalk.bold(total)} collections.`);
307
+ success(`Successfully pulled ${chalk.bold(totalCollections)} collections from ${chalk.bold(totalDatabases)} databases.`);
307
308
  return;
308
309
  }
309
310
 
@@ -323,7 +324,7 @@ const pullCollection = async () => {
323
324
  parseOutput: false
324
325
  });
325
326
 
326
- total++;
327
+ totalDatabases++;
327
328
  log(`Pulling all collections from ${chalk.bold(database['name'])} database ...`);
328
329
 
329
330
  localConfig.addDatabase(database);
@@ -334,6 +335,7 @@ const pullCollection = async () => {
334
335
  }, 100, 'collections');
335
336
 
336
337
  for (const collection of collections) {
338
+ totalCollections++;
337
339
  localConfig.addCollection({
338
340
  ...collection,
339
341
  '$createdAt': undefined,
@@ -342,12 +344,13 @@ const pullCollection = async () => {
342
344
  }
343
345
  }
344
346
 
345
- success(`Successfully pulled ${chalk.bold(total)} collections.`);
347
+ success(`Successfully pulled ${chalk.bold(totalCollections)} collections from ${chalk.bold(totalDatabases)} databases.`);
346
348
  }
347
349
 
348
350
  const pullTable = async () => {
349
351
  log("Fetching tables ...");
350
- let total = 0;
352
+ let totalTablesDBs = 0;
353
+ let totalTables = 0;
351
354
 
352
355
  const fetchResponse = await tablesDBList({
353
356
  queries: [JSON.stringify({ method: 'limit', values: [1] })],
@@ -355,7 +358,7 @@ const pullTable = async () => {
355
358
  });
356
359
  if (fetchResponse["databases"].length <= 0) {
357
360
  log("No tables found.");
358
- success(`Successfully pulled ${chalk.bold(total)} tables.`);
361
+ success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} tableDBs.`);
359
362
  return;
360
363
  }
361
364
 
@@ -375,7 +378,7 @@ const pullTable = async () => {
375
378
  parseOutput: false
376
379
  });
377
380
 
378
- total++;
381
+ totalTablesDBs++;
379
382
  log(`Pulling all tables from ${chalk.bold(database['name'])} database ...`);
380
383
 
381
384
  localConfig.addTablesDB(database);
@@ -386,6 +389,7 @@ const pullTable = async () => {
386
389
  }, 100, 'tables');
387
390
 
388
391
  for (const table of tables) {
392
+ totalTables++;
389
393
  localConfig.addTable({
390
394
  ...table,
391
395
  '$createdAt': undefined,
@@ -394,7 +398,7 @@ const pullTable = async () => {
394
398
  }
395
399
  }
396
400
 
397
- success(`Successfully pulled ${chalk.bold(total)} tables.`);
401
+ success(`Successfully pulled ${chalk.bold(totalTables)} tables from ${chalk.bold(totalTablesDBs)} tableDBs.`);
398
402
  }
399
403
 
400
404
  const pullBucket = async () => {
@@ -474,14 +478,16 @@ const pullMessagingTopic = async () => {
474
478
 
475
479
  const pull = new Command("pull")
476
480
  .description(commandDescriptions['pull'])
477
- .action(actionRunner(pullResources));
481
+ .action(actionRunner(() => pullResources({ skipDeprecated: true })));
478
482
 
479
483
  pull
480
484
  .command("all")
481
485
  .description("Pull all resource.")
482
486
  .action(actionRunner(() => {
483
487
  cliConfig.all = true;
484
- return pullResources();
488
+ return pullResources({
489
+ skipDeprecated: true
490
+ });
485
491
  }));
486
492
 
487
493
  pull
@@ -50,10 +50,12 @@ const {
50
50
  databasesUpdateCollection
51
51
  } = require("./databases");
52
52
  const {
53
+ tablesDBCreate,
53
54
  tablesDBGet,
55
+ tablesDBUpdate,
56
+ tablesDBCreateTable,
54
57
  tablesDBGetTable,
55
- tablesDBUpdateTable,
56
- tablesDBCreateTable
58
+ tablesDBUpdateTable
57
59
  } = require("./tables-db");
58
60
  const {
59
61
  storageGetBucket, storageUpdateBucket, storageCreateBucket
@@ -548,7 +550,7 @@ const createAttribute = (databaseId, collectionId, attribute) => {
548
550
  return databasesCreateRelationshipAttribute({
549
551
  databaseId,
550
552
  collectionId,
551
- relatedCollectionId: attribute.relatedCollection,
553
+ relatedCollectionId: attribute.relatedTable ?? attribute.relatedCollection,
552
554
  type: attribute.relationType,
553
555
  twoWay: attribute.twoWay,
554
556
  key: attribute.key,
@@ -667,7 +669,7 @@ const updateAttribute = (databaseId, collectionId, attribute) => {
667
669
  return databasesUpdateRelationshipAttribute({
668
670
  databaseId,
669
671
  collectionId,
670
- relatedCollectionId: attribute.relatedCollection,
672
+ relatedCollectionId: attribute.relatedTable ?? attribute.relatedCollection,
671
673
  type: attribute.relationType,
672
674
  twoWay: attribute.twoWay,
673
675
  key: attribute.key,
@@ -881,7 +883,7 @@ const createIndexes = async (indexes, collection) => {
881
883
  collectionId: collection['$id'],
882
884
  key: index.key,
883
885
  type: index.type,
884
- attributes: index.attributes,
886
+ attributes: index.columns ?? index.attributes,
885
887
  orders: index.orders,
886
888
  parseOutput: false
887
889
  });
@@ -1730,7 +1732,7 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1730
1732
 
1731
1733
  const databases = Array.from(new Set(tables.map(table => table['databaseId'])));
1732
1734
 
1733
- // Parallel db actions
1735
+ // Parallel tablesDB actions
1734
1736
  await Promise.all(databases.map(async (databaseId) => {
1735
1737
  const localDatabase = localConfig.getTablesDB(databaseId);
1736
1738
 
@@ -1741,7 +1743,7 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1741
1743
  });
1742
1744
 
1743
1745
  if (database.name !== (localDatabase.name ?? databaseId)) {
1744
- await databasesUpdate({
1746
+ await tablesDBUpdate({
1745
1747
  databaseId: databaseId,
1746
1748
  name: localDatabase.name ?? databaseId,
1747
1749
  parseOutput: false
@@ -1752,7 +1754,7 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1752
1754
  } catch (err) {
1753
1755
  log(`Database ${databaseId} not found. Creating it now ...`);
1754
1756
 
1755
- await databasesCreate({
1757
+ await tablesDBCreate({
1756
1758
  databaseId: databaseId,
1757
1759
  name: localDatabase.name ?? databaseId,
1758
1760
  parseOutput: false,
@@ -1761,10 +1763,12 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1761
1763
  }));
1762
1764
 
1763
1765
 
1764
- if (!(await approveChanges(tables, tablesDBGetTable, KeysTable, 'tableId', 'tables', ['columns', 'indexes'], 'databaseId', 'databaseId',))) {
1766
+ if (!(await approveChanges(tables, tablesDBGetTable, KeysTable, 'tableId', 'tables', ['columns', 'indexes'], 'databaseId', 'databaseId'))) {
1765
1767
  return;
1766
1768
  }
1767
- // Parallel collection actions
1769
+ let tablesChanged = new Set();
1770
+
1771
+ // Parallel tables actions
1768
1772
  await Promise.all(tables.map(async (table) => {
1769
1773
  try {
1770
1774
  const remoteTable = await tablesDBGetTable({
@@ -1773,15 +1777,23 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1773
1777
  parseOutput: false,
1774
1778
  });
1775
1779
 
1776
- if (remoteTable.name !== table.name) {
1780
+ const changes = [];
1781
+ if (remoteTable.name !== table.name) changes.push('name');
1782
+ if (remoteTable.rowSecurity !== table.rowSecurity) changes.push('rowSecurity');
1783
+ if (JSON.stringify(remoteTable['$permissions']) !== JSON.stringify(table['$permissions'])) changes.push('permissions');
1784
+
1785
+ if (changes.length > 0) {
1777
1786
  await tablesDBUpdateTable({
1778
1787
  databaseId: table['databaseId'],
1779
1788
  tableId: table['$id'],
1780
1789
  name: table.name,
1781
- parseOutput: false
1790
+ parseOutput: false,
1791
+ rowSecurity: table.rowSecurity,
1792
+ permissions: table['$permissions']
1782
1793
  })
1783
1794
 
1784
- success(`Updated ${table.name} ( ${table['$id']} ) name`);
1795
+ success(`Updated ${table.name} ( ${table['$id']} ) - ${changes.join(', ')}`);
1796
+ tablesChanged.add(table['$id']);
1785
1797
  }
1786
1798
  table.remoteVersion = remoteTable;
1787
1799
 
@@ -1794,16 +1806,19 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1794
1806
  databaseId: table['databaseId'],
1795
1807
  tableId: table['$id'],
1796
1808
  name: table.name,
1797
- documentSecurity: table.documentSecurity,
1809
+ rowSecurity: table.rowSecurity,
1798
1810
  permissions: table['$permissions'],
1799
1811
  parseOutput: false
1800
1812
  })
1813
+
1814
+ success(`Created ${table.name} ( ${table['$id']} )`);
1815
+ tablesChanged.add(table['$id']);
1801
1816
  } else {
1802
1817
  throw e;
1803
1818
  }
1804
1819
  }
1805
1820
  }))
1806
- let numberOfTables = 0;
1821
+
1807
1822
  // Serialize attribute actions
1808
1823
  for (let table of tables) {
1809
1824
  let columns = table.columns;
@@ -1831,11 +1846,11 @@ const pushTable = async ({ returnOnZero, attempts } = { returnOnZero: false }) =
1831
1846
  } catch (e) {
1832
1847
  throw e;
1833
1848
  }
1834
- numberOfTables++;
1849
+ tablesChanged.add(table['$id']);
1835
1850
  success(`Successfully pushed ${table.name} ( ${table['$id']} )`);
1836
1851
  }
1837
1852
 
1838
- success(`Successfully pushed ${numberOfTables} tables`);
1853
+ success(`Successfully pushed ${tablesChanged.size} tables`);
1839
1854
  }
1840
1855
 
1841
1856
  const pushCollection = async ({ returnOnZero, attempts } = { returnOnZero: false }) => {