appwrite-utils-cli 1.2.21 → 1.2.23
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.
@@ -185,10 +185,8 @@ export class AppwriteToX {
|
|
185
185
|
specification: func.specification,
|
186
186
|
}));
|
187
187
|
// Make sure to update the config with all changes
|
188
|
-
|
189
|
-
|
190
|
-
functions: this.updatedConfig.functions,
|
191
|
-
};
|
188
|
+
updatedConfig.functions = this.updatedConfig.functions;
|
189
|
+
this.updatedConfig = updatedConfig;
|
192
190
|
}
|
193
191
|
async toSchemas(databases) {
|
194
192
|
await this.appwriteSync(this.config, databases);
|
@@ -199,10 +197,12 @@ export class AppwriteToX {
|
|
199
197
|
if (isYamlProject) {
|
200
198
|
console.log("📄 Detected YAML configuration - generating YAML collection definitions");
|
201
199
|
generator.updateYamlCollections();
|
200
|
+
await generator.updateConfig(this.updatedConfig, true);
|
202
201
|
}
|
203
202
|
else {
|
204
203
|
console.log("📝 Generating TypeScript collection definitions");
|
205
204
|
generator.updateTsSchemas();
|
205
|
+
await generator.updateConfig(this.updatedConfig, false);
|
206
206
|
}
|
207
207
|
generator.generateSchemas();
|
208
208
|
}
|
package/dist/utilsController.js
CHANGED
@@ -20,6 +20,8 @@ import { deployLocalFunction } from "./functions/deployments.js";
|
|
20
20
|
import fs from "node:fs";
|
21
21
|
import { configureLogging, updateLogger } from "./shared/logging.js";
|
22
22
|
import { MessageFormatter, Messages } from "./shared/messageFormatter.js";
|
23
|
+
import { SchemaGenerator } from "./shared/schemaGenerator.js";
|
24
|
+
import { findYamlConfig } from "./config/yamlConfig.js";
|
23
25
|
export class UtilsController {
|
24
26
|
appwriteFolderPath;
|
25
27
|
appwriteConfigPath;
|
@@ -398,6 +400,11 @@ export class UtilsController {
|
|
398
400
|
await appwriteToX.toSchemas(databases);
|
399
401
|
// Update the controller's config with the synchronized collections
|
400
402
|
this.config = appwriteToX.updatedConfig;
|
403
|
+
// Write the updated config back to disk
|
404
|
+
const generator = new SchemaGenerator(this.config, this.appwriteFolderPath);
|
405
|
+
const yamlConfigPath = findYamlConfig(this.appwriteFolderPath);
|
406
|
+
const isYamlProject = !!yamlConfigPath;
|
407
|
+
await generator.updateConfig(this.config, isYamlProject);
|
401
408
|
}
|
402
409
|
async syncDb(databases = [], collections = []) {
|
403
410
|
await this.init();
|
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.23",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
@@ -261,10 +261,8 @@ export class AppwriteToX {
|
|
261
261
|
);
|
262
262
|
|
263
263
|
// Make sure to update the config with all changes
|
264
|
-
|
265
|
-
|
266
|
-
functions: this.updatedConfig.functions,
|
267
|
-
};
|
264
|
+
updatedConfig.functions = this.updatedConfig.functions;
|
265
|
+
this.updatedConfig = updatedConfig;
|
268
266
|
}
|
269
267
|
|
270
268
|
async toSchemas(databases?: Models.Database[]) {
|
@@ -281,9 +279,11 @@ export class AppwriteToX {
|
|
281
279
|
if (isYamlProject) {
|
282
280
|
console.log("📄 Detected YAML configuration - generating YAML collection definitions");
|
283
281
|
generator.updateYamlCollections();
|
282
|
+
await generator.updateConfig(this.updatedConfig, true);
|
284
283
|
} else {
|
285
284
|
console.log("📝 Generating TypeScript collection definitions");
|
286
285
|
generator.updateTsSchemas();
|
286
|
+
await generator.updateConfig(this.updatedConfig, false);
|
287
287
|
}
|
288
288
|
|
289
289
|
generator.generateSchemas();
|
package/src/utilsController.ts
CHANGED
@@ -68,6 +68,8 @@ import { deployLocalFunction } from "./functions/deployments.js";
|
|
68
68
|
import fs from "node:fs";
|
69
69
|
import { configureLogging, updateLogger } from "./shared/logging.js";
|
70
70
|
import { MessageFormatter, Messages } from "./shared/messageFormatter.js";
|
71
|
+
import { SchemaGenerator } from "./shared/schemaGenerator.js";
|
72
|
+
import { findYamlConfig } from "./config/yamlConfig.js";
|
71
73
|
|
72
74
|
export interface SetupOptions {
|
73
75
|
databases?: Models.Database[];
|
@@ -569,6 +571,12 @@ export class UtilsController {
|
|
569
571
|
|
570
572
|
// Update the controller's config with the synchronized collections
|
571
573
|
this.config = appwriteToX.updatedConfig;
|
574
|
+
|
575
|
+
// Write the updated config back to disk
|
576
|
+
const generator = new SchemaGenerator(this.config, this.appwriteFolderPath);
|
577
|
+
const yamlConfigPath = findYamlConfig(this.appwriteFolderPath);
|
578
|
+
const isYamlProject = !!yamlConfigPath;
|
579
|
+
await generator.updateConfig(this.config, isYamlProject);
|
572
580
|
}
|
573
581
|
|
574
582
|
async syncDb(
|