appwrite-utils-cli 0.10.72 → 0.10.73
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 +1 -0
- package/dist/main.js +4 -0
- package/dist/migrations/transfer.js +13 -3
- package/package.json +1 -1
- package/src/main.ts +5 -0
- package/src/migrations/transfer.ts +25 -9
package/README.md
CHANGED
@@ -148,6 +148,7 @@ This updated CLI ensures that developers have robust tools at their fingertips t
|
|
148
148
|
|
149
149
|
## Changelog
|
150
150
|
|
151
|
+
- 0.10.73: Fix moving users, passwords should work now (from Appwrite, Argon2)
|
151
152
|
- 0.10.71: Fix create template function `__dirname`
|
152
153
|
- 0.10.70: Fixed `--transfer-users` phones
|
153
154
|
- 0.10.67: Added `--transfer-users` boolean flag to also transfer users between projects
|
package/dist/main.js
CHANGED
@@ -12,6 +12,10 @@ import { fetchAllCollections } from "./collections/methods.js";
|
|
12
12
|
import chalk from "chalk";
|
13
13
|
import { listSpecifications } from "./functions/methods.js";
|
14
14
|
const argv = yargs(hideBin(process.argv))
|
15
|
+
.option("config", {
|
16
|
+
type: "string",
|
17
|
+
description: "Appwrite Config file name",
|
18
|
+
})
|
15
19
|
.option("it", {
|
16
20
|
alias: ["interactive", "i"],
|
17
21
|
type: "boolean",
|
@@ -407,9 +407,19 @@ export const transferUsersLocalToRemote = async (localUsers, endpoint, projectId
|
|
407
407
|
const phone = user.phone
|
408
408
|
? converterFunctions.convertPhoneStringToUSInternational(user.phone)
|
409
409
|
: undefined;
|
410
|
-
|
411
|
-
|
412
|
-
|
410
|
+
if (user.hash) {
|
411
|
+
await tryAwaitWithRetry(async () => remoteUsers.createArgon2User(user.$id, user.email, user.password, // password - cannot transfer hashed passwords
|
412
|
+
user.name // phone - optional
|
413
|
+
));
|
414
|
+
if (phone) {
|
415
|
+
await tryAwaitWithRetry(async () => remoteUsers.updatePhone(user.$id, phone));
|
416
|
+
}
|
417
|
+
}
|
418
|
+
else {
|
419
|
+
await tryAwaitWithRetry(async () => remoteUsers.create(user.$id, user.email, phone, // phone - optional
|
420
|
+
user.password, // password - cannot transfer hashed passwords
|
421
|
+
user.name));
|
422
|
+
}
|
413
423
|
// Update user preferences and status
|
414
424
|
await tryAwaitWithRetry(async () => remoteUsers.updatePrefs(user.$id, user.prefs));
|
415
425
|
if (!user.emailVerification) {
|
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": "0.10.
|
4
|
+
"version": "0.10.73",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
package/src/main.ts
CHANGED
@@ -15,6 +15,7 @@ import chalk from "chalk";
|
|
15
15
|
import { listSpecifications } from "./functions/methods.js";
|
16
16
|
|
17
17
|
interface CliOptions {
|
18
|
+
config?: string;
|
18
19
|
it?: boolean;
|
19
20
|
dbIds?: string;
|
20
21
|
collectionIds?: string;
|
@@ -50,6 +51,10 @@ interface CliOptions {
|
|
50
51
|
type ParsedArgv = ArgumentsCamelCase<CliOptions>;
|
51
52
|
|
52
53
|
const argv = yargs(hideBin(process.argv))
|
54
|
+
.option("config", {
|
55
|
+
type: "string",
|
56
|
+
description: "Appwrite Config file name",
|
57
|
+
})
|
53
58
|
.option("it", {
|
54
59
|
alias: ["interactive", "i"],
|
55
60
|
type: "boolean",
|
@@ -815,15 +815,31 @@ export const transferUsersLocalToRemote = async (
|
|
815
815
|
? converterFunctions.convertPhoneStringToUSInternational(user.phone)
|
816
816
|
: undefined;
|
817
817
|
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
818
|
+
if (user.hash) {
|
819
|
+
await tryAwaitWithRetry(async () =>
|
820
|
+
remoteUsers.createArgon2User(
|
821
|
+
user.$id,
|
822
|
+
user.email,
|
823
|
+
user.password!, // password - cannot transfer hashed passwords
|
824
|
+
user.name // phone - optional
|
825
|
+
)
|
826
|
+
);
|
827
|
+
if (phone) {
|
828
|
+
await tryAwaitWithRetry(async () =>
|
829
|
+
remoteUsers.updatePhone(user.$id, phone)
|
830
|
+
);
|
831
|
+
}
|
832
|
+
} else {
|
833
|
+
await tryAwaitWithRetry(async () =>
|
834
|
+
remoteUsers.create(
|
835
|
+
user.$id,
|
836
|
+
user.email,
|
837
|
+
phone, // phone - optional
|
838
|
+
user.password, // password - cannot transfer hashed passwords
|
839
|
+
user.name
|
840
|
+
)
|
841
|
+
);
|
842
|
+
}
|
827
843
|
|
828
844
|
// Update user preferences and status
|
829
845
|
await tryAwaitWithRetry(async () =>
|