Skip to content

Commit 9e3e9ed

Browse files
committed
use query clas
1 parent 0f8f833 commit 9e3e9ed

File tree

1 file changed

+17
-38
lines changed

1 file changed

+17
-38
lines changed

lib/commands/push.ts

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import {
6262
AuthMethod,
6363
AppwriteException,
6464
Client,
65+
Query,
6566
} from "@appwrite.io/console";
6667
import { checkDeployConditions } from "../utils.js";
6768
import { Pools } from "./utils/pools.js";
@@ -766,24 +767,14 @@ export class Push {
766767
const proxyServiceUrl = await getProxyService(
767768
this.projectClient,
768769
);
769-
const res = await proxyServiceUrl.listRules([
770-
JSON.stringify({ method: "limit", values: [1] }),
771-
JSON.stringify({
772-
method: "equal",
773-
attribute: "deploymentResourceType",
774-
values: ["function"],
775-
}),
776-
JSON.stringify({
777-
method: "equal",
778-
attribute: "deploymentResourceId",
779-
values: [func["$id"]],
780-
}),
781-
JSON.stringify({
782-
method: "equal",
783-
attribute: "trigger",
784-
values: ["manual"],
785-
}),
786-
]);
770+
const res = await proxyServiceUrl.listRules({
771+
queries: [
772+
Query.limit(1),
773+
Query.equal("deploymentResourceType", "function"),
774+
Query.equal("deploymentResourceId", func["$id"]),
775+
Query.equal("trigger", "manual"),
776+
],
777+
});
787778

788779
if (Number(res.total) === 1) {
789780
url = `https://${res.rules[0].domain}`;
@@ -1099,22 +1090,10 @@ export class Push {
10991090
this.projectClient,
11001091
);
11011092
const res = await proxyServiceUrl.listRules([
1102-
JSON.stringify({ method: "limit", values: [1] }),
1103-
JSON.stringify({
1104-
method: "equal",
1105-
attribute: "deploymentResourceType",
1106-
values: ["site"],
1107-
}),
1108-
JSON.stringify({
1109-
method: "equal",
1110-
attribute: "deploymentResourceId",
1111-
values: [site["$id"]],
1112-
}),
1113-
JSON.stringify({
1114-
method: "equal",
1115-
attribute: "trigger",
1116-
values: ["manual"],
1117-
}),
1093+
Query.limit(1),
1094+
Query.equal("deploymentResourceType", "site"),
1095+
Query.equal("deploymentResourceId", site["$id"]),
1096+
Query.equal("trigger", "manual"),
11181097
]);
11191098

11201099
if (Number(res.total) === 1) {
@@ -1186,10 +1165,10 @@ export class Push {
11861165
tables.map(async (table: any) => {
11871166
try {
11881167
const tablesDBService = await getTablesDBService(this.projectClient);
1189-
const remoteTable = await tablesDBService.getTable(
1190-
table["databaseId"],
1191-
table["$id"],
1192-
);
1168+
const remoteTable = await tablesDBService.getTable({
1169+
databaseId: table["databaseId"],
1170+
tableId: table["$id"],
1171+
});
11931172

11941173
const changes: string[] = [];
11951174
if (remoteTable.name !== table.name) changes.push("name");

0 commit comments

Comments
 (0)