appwrite-utils-cli 1.2.26 → 1.2.28
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.
@@ -335,12 +335,12 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
|
|
335
335
|
case "double":
|
336
336
|
case "float": // Backward compatibility
|
337
337
|
if (action === "create") {
|
338
|
-
await tryAwaitWithRetry(async () => await db.createFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min
|
338
|
+
await tryAwaitWithRetry(async () => await db.createFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min !== undefined ? finalAttribute.min : -2147483647, finalAttribute.max !== undefined ? finalAttribute.max : 2147483647, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
339
339
|
? finalAttribute.xdefault
|
340
340
|
: null, finalAttribute.array || false));
|
341
341
|
}
|
342
342
|
else {
|
343
|
-
await tryAwaitWithRetry(async () => await db.updateFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min
|
343
|
+
await tryAwaitWithRetry(async () => await db.updateFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min !== undefined ? finalAttribute.min : -2147483647, finalAttribute.max !== undefined ? finalAttribute.max : 2147483647, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
344
344
|
? finalAttribute.xdefault
|
345
345
|
: null));
|
346
346
|
}
|
package/dist/interactiveCLI.js
CHANGED
@@ -16,6 +16,7 @@ import { deployLocalFunction } from "./functions/deployments.js";
|
|
16
16
|
import { join } from "node:path";
|
17
17
|
import path from "path";
|
18
18
|
import fs from "node:fs";
|
19
|
+
import os from "node:os";
|
19
20
|
import { SchemaGenerator } from "./shared/schemaGenerator.js";
|
20
21
|
import { ConfirmationDialogs } from "./shared/confirmationDialogs.js";
|
21
22
|
import { MessageFormatter } from "./shared/messageFormatter.js";
|
@@ -478,12 +479,25 @@ export class InteractiveCLI {
|
|
478
479
|
console.log(chalk.gray(` Function name: ${functionConfig.name}`));
|
479
480
|
console.log(chalk.gray(` Function ID: ${functionConfig.$id}`));
|
480
481
|
console.log(chalk.gray(` Config dirPath: ${functionConfig.dirPath || 'undefined'}`));
|
482
|
+
if (functionConfig.dirPath) {
|
483
|
+
const expandedPath = functionConfig.dirPath.startsWith('~/')
|
484
|
+
? functionConfig.dirPath.replace('~', os.homedir())
|
485
|
+
: functionConfig.dirPath;
|
486
|
+
console.log(chalk.gray(` Expanded dirPath: ${expandedPath}`));
|
487
|
+
}
|
481
488
|
console.log(chalk.gray(` Appwrite folder: ${this.controller.getAppwriteFolderPath()}`));
|
482
489
|
console.log(chalk.gray(` Current working dir: ${process.cwd()}`));
|
490
|
+
// Helper function to expand tilde in paths
|
491
|
+
const expandTildePath = (path) => {
|
492
|
+
if (path.startsWith('~/')) {
|
493
|
+
return path.replace('~', os.homedir());
|
494
|
+
}
|
495
|
+
return path;
|
496
|
+
};
|
483
497
|
// Check locations in priority order:
|
484
498
|
const priorityLocations = [
|
485
|
-
// 1. Config dirPath if specified
|
486
|
-
functionConfig.dirPath,
|
499
|
+
// 1. Config dirPath if specified (with tilde expansion)
|
500
|
+
functionConfig.dirPath ? expandTildePath(functionConfig.dirPath) : undefined,
|
487
501
|
// 2. Appwrite config folder/functions/name
|
488
502
|
join(this.controller.getAppwriteFolderPath(), "functions", functionNameLower),
|
489
503
|
// 3. Current working directory/functions/name
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "appwrite-utils-cli",
|
3
3
|
"description": "Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.",
|
4
|
-
"version": "1.2.
|
4
|
+
"version": "1.2.28",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
@@ -552,8 +552,8 @@ export const createOrUpdateAttribute = async (
|
|
552
552
|
collection.$id,
|
553
553
|
finalAttribute.key,
|
554
554
|
finalAttribute.required || false,
|
555
|
-
finalAttribute.min
|
556
|
-
finalAttribute.max
|
555
|
+
finalAttribute.min !== undefined ? finalAttribute.min : -2147483647,
|
556
|
+
finalAttribute.max !== undefined ? finalAttribute.max : 2147483647,
|
557
557
|
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
558
558
|
? finalAttribute.xdefault
|
559
559
|
: null,
|
@@ -568,8 +568,8 @@ export const createOrUpdateAttribute = async (
|
|
568
568
|
collection.$id,
|
569
569
|
finalAttribute.key,
|
570
570
|
finalAttribute.required || false,
|
571
|
-
finalAttribute.min
|
572
|
-
finalAttribute.max
|
571
|
+
finalAttribute.min !== undefined ? finalAttribute.min : -2147483647,
|
572
|
+
finalAttribute.max !== undefined ? finalAttribute.max : 2147483647,
|
573
573
|
finalAttribute.xdefault !== undefined && !finalAttribute.required
|
574
574
|
? finalAttribute.xdefault
|
575
575
|
: null
|
package/src/interactiveCLI.ts
CHANGED
@@ -44,6 +44,7 @@ import { deployLocalFunction } from "./functions/deployments.js";
|
|
44
44
|
import { join } from "node:path";
|
45
45
|
import path from "path";
|
46
46
|
import fs from "node:fs";
|
47
|
+
import os from "node:os";
|
47
48
|
import { SchemaGenerator } from "./shared/schemaGenerator.js";
|
48
49
|
import { ConfirmationDialogs } from "./shared/confirmationDialogs.js";
|
49
50
|
import { MessageFormatter } from "./shared/messageFormatter.js";
|
@@ -625,13 +626,27 @@ export class InteractiveCLI {
|
|
625
626
|
console.log(chalk.gray(` Function name: ${functionConfig.name}`));
|
626
627
|
console.log(chalk.gray(` Function ID: ${functionConfig.$id}`));
|
627
628
|
console.log(chalk.gray(` Config dirPath: ${functionConfig.dirPath || 'undefined'}`));
|
629
|
+
if (functionConfig.dirPath) {
|
630
|
+
const expandedPath = functionConfig.dirPath.startsWith('~/')
|
631
|
+
? functionConfig.dirPath.replace('~', os.homedir())
|
632
|
+
: functionConfig.dirPath;
|
633
|
+
console.log(chalk.gray(` Expanded dirPath: ${expandedPath}`));
|
634
|
+
}
|
628
635
|
console.log(chalk.gray(` Appwrite folder: ${this.controller.getAppwriteFolderPath()}`));
|
629
636
|
console.log(chalk.gray(` Current working dir: ${process.cwd()}`));
|
630
637
|
|
638
|
+
// Helper function to expand tilde in paths
|
639
|
+
const expandTildePath = (path: string): string => {
|
640
|
+
if (path.startsWith('~/')) {
|
641
|
+
return path.replace('~', os.homedir());
|
642
|
+
}
|
643
|
+
return path;
|
644
|
+
};
|
645
|
+
|
631
646
|
// Check locations in priority order:
|
632
647
|
const priorityLocations = [
|
633
|
-
// 1. Config dirPath if specified
|
634
|
-
functionConfig.dirPath,
|
648
|
+
// 1. Config dirPath if specified (with tilde expansion)
|
649
|
+
functionConfig.dirPath ? expandTildePath(functionConfig.dirPath) : undefined,
|
635
650
|
// 2. Appwrite config folder/functions/name
|
636
651
|
join(
|
637
652
|
this.controller.getAppwriteFolderPath()!,
|