appwrite-utils-cli 0.10.69 → 0.10.71

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 CHANGED
@@ -148,6 +148,8 @@ This updated CLI ensures that developers have robust tools at their fingertips t
148
148
 
149
149
  ## Changelog
150
150
 
151
+ - 0.10.71: Fix create template function `__dirname`
152
+ - 0.10.70: Fixed `--transfer-users` phones
151
153
  - 0.10.67: Added `--transfer-users` boolean flag to also transfer users between projects
152
154
  - 0.10.66: Fixed `ignore` always being an empty array, if not set, so it properly ignores the defaults
153
155
  - 0.10.65: Fixed the stupid local functions not caring about the ignore string, and added `__pycache__` and `.venv` to default ignores
@@ -1,9 +1,12 @@
1
1
  import { AppwriteException, Client, Functions, Query, Runtime, } from "node-appwrite";
2
- import { join } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { join, dirname } from "node:path";
3
4
  import fs from "node:fs";
4
5
  import {} from "appwrite-utils";
5
6
  import chalk from "chalk";
6
7
  import { extract as extractTar } from "tar";
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = dirname(__filename);
7
10
  export const listFunctions = async (client, queries, search) => {
8
11
  const functions = new Functions(client);
9
12
  const functionsList = await functions.list(queries, search);
@@ -1,4 +1,4 @@
1
- import { tryAwaitWithRetry } from "appwrite-utils";
1
+ import { converterFunctions, tryAwaitWithRetry } from "appwrite-utils";
2
2
  import { Client, Databases, IndexType, Query, Storage, Users, } from "node-appwrite";
3
3
  import { InputFile } from "node-appwrite/file";
4
4
  import { getAppwriteClient } from "../utils/helperFunctions.js";
@@ -404,7 +404,10 @@ export const transferUsersLocalToRemote = async (localUsers, endpoint, projectId
404
404
  catch (error) {
405
405
  // User doesn't exist, proceed with creation
406
406
  }
407
- await tryAwaitWithRetry(async () => remoteUsers.create(user.$id, user.email, user.phone, // phone - optional
407
+ const phone = user.phone
408
+ ? converterFunctions.convertPhoneStringToUSInternational(user.phone)
409
+ : undefined;
410
+ await tryAwaitWithRetry(async () => remoteUsers.create(user.$id, user.email, phone, // phone - optional
408
411
  user.password, // password - cannot transfer hashed passwords
409
412
  user.name));
410
413
  // Update user preferences and status
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.69",
4
+ "version": "0.10.71",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -5,7 +5,8 @@ import {
5
5
  Query,
6
6
  Runtime,
7
7
  } from "node-appwrite";
8
- import { join } from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ import { join, dirname } from "node:path";
9
10
  import fs from "node:fs";
10
11
  import {
11
12
  type AppwriteFunction,
@@ -15,6 +16,9 @@ import {
15
16
  import chalk from "chalk";
16
17
  import { extract as extractTar } from "tar";
17
18
 
19
+ const __filename = fileURLToPath(import.meta.url);
20
+ const __dirname = dirname(__filename);
21
+
18
22
  export const listFunctions = async (
19
23
  client: Client,
20
24
  queries?: string[],
@@ -1,4 +1,4 @@
1
- import { tryAwaitWithRetry } from "appwrite-utils";
1
+ import { converterFunctions, tryAwaitWithRetry } from "appwrite-utils";
2
2
  import {
3
3
  Client,
4
4
  Databases,
@@ -811,11 +811,15 @@ export const transferUsersLocalToRemote = async (
811
811
  // User doesn't exist, proceed with creation
812
812
  }
813
813
 
814
+ const phone = user.phone
815
+ ? converterFunctions.convertPhoneStringToUSInternational(user.phone)
816
+ : undefined;
817
+
814
818
  await tryAwaitWithRetry(async () =>
815
819
  remoteUsers.create(
816
820
  user.$id,
817
821
  user.email,
818
- user.phone, // phone - optional
822
+ phone, // phone - optional
819
823
  user.password, // password - cannot transfer hashed passwords
820
824
  user.name
821
825
  )