appwrite-utils-cli 1.2.12 → 1.2.15
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.
@@ -11,5 +11,6 @@ export declare const deleteFunction: (client: Client, functionId: string) => Pro
|
|
11
11
|
export declare const createFunction: (client: Client, functionConfig: AppwriteFunction) => Promise<import("node-appwrite").Models.Function>;
|
12
12
|
export declare const updateFunctionSpecifications: (client: Client, functionId: string, specification: Specification) => Promise<import("node-appwrite").Models.Function | undefined>;
|
13
13
|
export declare const listSpecifications: (client: Client) => Promise<import("node-appwrite").Models.SpecificationList>;
|
14
|
+
export declare const listFunctionDeployments: (client: Client, functionId: string, queries?: string[]) => Promise<import("node-appwrite").Models.DeploymentList>;
|
14
15
|
export declare const updateFunction: (client: Client, functionConfig: AppwriteFunction) => Promise<import("node-appwrite").Models.Function>;
|
15
16
|
export declare const createFunctionTemplate: (templateType: "typescript-node" | "uv" | "count-docs-in-collection", functionName: string, basePath?: string) => Promise<string>;
|
@@ -94,6 +94,11 @@ export const listSpecifications = async (client) => {
|
|
94
94
|
const specifications = await functions.listSpecifications();
|
95
95
|
return specifications;
|
96
96
|
};
|
97
|
+
export const listFunctionDeployments = async (client, functionId, queries) => {
|
98
|
+
const functions = new Functions(client);
|
99
|
+
const deployments = await functions.listDeployments(functionId, queries);
|
100
|
+
return deployments;
|
101
|
+
};
|
97
102
|
export const updateFunction = async (client, functionConfig) => {
|
98
103
|
const functions = new Functions(client);
|
99
104
|
const functionResponse = await functions.update(functionConfig.$id, functionConfig.name, functionConfig.runtime, functionConfig.execute, functionConfig.events, functionConfig.schedule, functionConfig.timeout, functionConfig.enabled, functionConfig.logging, functionConfig.entrypoint, functionConfig.commands, functionConfig.scopes, functionConfig.installationId, functionConfig.providerRepositoryId, functionConfig.providerBranch, functionConfig.providerSilentMode, functionConfig.providerRootDirectory, functionConfig.specification);
|
@@ -6,7 +6,7 @@ import { fetchAllDatabases } from "../databases/methods.js";
|
|
6
6
|
import { CollectionSchema, attributeSchema, AppwriteConfigSchema, permissionsSchema, attributesSchema, indexesSchema, parseAttribute, } from "appwrite-utils";
|
7
7
|
import { getDatabaseFromConfig } from "./afterImportActions.js";
|
8
8
|
import { listBuckets } from "../storage/methods.js";
|
9
|
-
import { listFunctions } from "../functions/methods.js";
|
9
|
+
import { listFunctions, listFunctionDeployments } from "../functions/methods.js";
|
10
10
|
export class AppwriteToX {
|
11
11
|
config;
|
12
12
|
storage;
|
@@ -169,14 +169,7 @@ export class AppwriteToX {
|
|
169
169
|
const remoteFunctions = await listFunctions(this.config.appwriteClient, [
|
170
170
|
Query.limit(1000),
|
171
171
|
]);
|
172
|
-
|
173
|
-
const deployments = await this.config.appwriteClient.functions.listDeployments(func.$id, [Query.orderDesc("$createdAt"), Query.limit(1)]);
|
174
|
-
return {
|
175
|
-
function: func,
|
176
|
-
schemaStrings: deployments.deployments[0]?.schemaStrings || [],
|
177
|
-
};
|
178
|
-
}));
|
179
|
-
this.updatedConfig.functions = functionDeployments.map(({ function: func, schemaStrings }) => ({
|
172
|
+
this.updatedConfig.functions = remoteFunctions.functions.map((func) => ({
|
180
173
|
$id: func.$id,
|
181
174
|
name: func.name,
|
182
175
|
runtime: func.runtime,
|
@@ -190,7 +183,6 @@ export class AppwriteToX {
|
|
190
183
|
commands: func.commands || "npm install",
|
191
184
|
dirPath: `functions/${func.name}`,
|
192
185
|
specification: func.specification,
|
193
|
-
schemaStrings,
|
194
186
|
}));
|
195
187
|
// Make sure to update the config with all changes
|
196
188
|
this.updatedConfig = {
|
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.15",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
package/src/functions/methods.ts
CHANGED
@@ -161,6 +161,16 @@ export const listSpecifications = async (client: Client) => {
|
|
161
161
|
return specifications;
|
162
162
|
};
|
163
163
|
|
164
|
+
export const listFunctionDeployments = async (
|
165
|
+
client: Client,
|
166
|
+
functionId: string,
|
167
|
+
queries?: string[]
|
168
|
+
) => {
|
169
|
+
const functions = new Functions(client);
|
170
|
+
const deployments = await functions.listDeployments(functionId, queries);
|
171
|
+
return deployments;
|
172
|
+
};
|
173
|
+
|
164
174
|
export const updateFunction = async (
|
165
175
|
client: Client,
|
166
176
|
functionConfig: AppwriteFunction
|
@@ -27,7 +27,7 @@ import {
|
|
27
27
|
} from "appwrite-utils";
|
28
28
|
import { getDatabaseFromConfig } from "./afterImportActions.js";
|
29
29
|
import { listBuckets } from "../storage/methods.js";
|
30
|
-
import { listFunctions } from "../functions/methods.js";
|
30
|
+
import { listFunctions, listFunctionDeployments } from "../functions/methods.js";
|
31
31
|
|
32
32
|
export class AppwriteToX {
|
33
33
|
config: AppwriteConfig;
|
@@ -241,22 +241,9 @@ export class AppwriteToX {
|
|
241
241
|
const remoteFunctions = await listFunctions(this.config.appwriteClient!, [
|
242
242
|
Query.limit(1000),
|
243
243
|
]);
|
244
|
-
const functionDeployments = await Promise.all(
|
245
|
-
remoteFunctions.functions.map(async (func) => {
|
246
|
-
const deployments =
|
247
|
-
await this.config.appwriteClient!.functions.listDeployments(
|
248
|
-
func.$id,
|
249
|
-
[Query.orderDesc("$createdAt"), Query.limit(1)]
|
250
|
-
);
|
251
|
-
return {
|
252
|
-
function: func,
|
253
|
-
schemaStrings: deployments.deployments[0]?.schemaStrings || [],
|
254
|
-
};
|
255
|
-
})
|
256
|
-
);
|
257
244
|
|
258
|
-
this.updatedConfig.functions =
|
259
|
-
(
|
245
|
+
this.updatedConfig.functions = remoteFunctions.functions.map(
|
246
|
+
(func) => ({
|
260
247
|
$id: func.$id,
|
261
248
|
name: func.name,
|
262
249
|
runtime: func.runtime as Runtime,
|
@@ -270,7 +257,6 @@ export class AppwriteToX {
|
|
270
257
|
commands: func.commands || "npm install",
|
271
258
|
dirPath: `functions/${func.name}`,
|
272
259
|
specification: func.specification as Specification,
|
273
|
-
schemaStrings,
|
274
260
|
})
|
275
261
|
);
|
276
262
|
|