appwrite-utils-cli 1.6.8 → 1.6.9

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.
@@ -1,4 +1,6 @@
1
1
  import { logger } from "../../shared/logging.js";
2
+ import fs from "fs";
3
+ import path from "path";
2
4
  /**
3
5
  * Service responsible for validation during import operations.
4
6
  * Provides centralized validation logic extracted from ImportDataActions and DataLoader.
@@ -203,8 +205,6 @@ export class ValidationService {
203
205
  errors.push(...importDefErrors.map(err => `${collection.name}.importDefs[${i}]: ${err}`));
204
206
  // Check if import file exists
205
207
  try {
206
- const fs = require("fs");
207
- const path = require("path");
208
208
  const filePath = path.resolve(appwriteFolderPath, importDef.filePath);
209
209
  if (!fs.existsSync(filePath)) {
210
210
  errors.push(`${collection.name}.importDefs[${i}]: Import file not found: ${filePath}`);
@@ -4,6 +4,7 @@ import { logger } from "../../shared/logging.js";
4
4
  import { normalizeYamlData, usesTableTerminology, convertTerminology } from "../../utils/yamlConverter.js";
5
5
  import path from "path";
6
6
  import fs from "fs";
7
+ import yaml from "js-yaml";
7
8
  /**
8
9
  * Integration service that bridges YAML import configurations with the existing import system.
9
10
  * Provides seamless integration between new YAML configs and legacy TypeScript collection definitions.
@@ -225,7 +226,6 @@ export class YamlImportIntegration {
225
226
  updateMapping: importDef.updateMapping,
226
227
  },
227
228
  };
228
- const yaml = require("js-yaml");
229
229
  const yamlContent = yaml.dump(yamlConfig, {
230
230
  indent: 2,
231
231
  lineWidth: 120,
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.6.8",
4
+ "version": "1.6.9",
5
5
  "main": "src/main.ts",
6
6
  "type": "module",
7
7
  "repository": {
@@ -1,10 +1,12 @@
1
- import type {
2
- AttributeMappings,
3
- ImportDef,
4
- CollectionCreate,
5
- } from "appwrite-utils";
6
- import type { ImportDataActions } from "../importDataActions.js";
7
- import { logger } from "../../shared/logging.js";
1
+ import type {
2
+ AttributeMappings,
3
+ ImportDef,
4
+ CollectionCreate,
5
+ } from "appwrite-utils";
6
+ import type { ImportDataActions } from "../importDataActions.js";
7
+ import { logger } from "../../shared/logging.js";
8
+ import fs from "fs";
9
+ import path from "path";
8
10
 
9
11
  /**
10
12
  * Service responsible for validation during import operations.
@@ -274,15 +276,13 @@ export class ValidationService {
274
276
  );
275
277
 
276
278
  // Check if import file exists
277
- try {
278
- const fs = require("fs");
279
- const path = require("path");
280
- const filePath = path.resolve(appwriteFolderPath, importDef.filePath);
281
- if (!fs.existsSync(filePath)) {
282
- errors.push(
283
- `${collection.name}.importDefs[${i}]: Import file not found: ${filePath}`
284
- );
285
- }
279
+ try {
280
+ const filePath = path.resolve(appwriteFolderPath, importDef.filePath);
281
+ if (!fs.existsSync(filePath)) {
282
+ errors.push(
283
+ `${collection.name}.importDefs[${i}]: Import file not found: ${filePath}`
284
+ );
285
+ }
286
286
  } catch (error) {
287
287
  warnings.push(
288
288
  `${collection.name}.importDefs[${i}]: Could not validate file existence: ${error}`
@@ -346,4 +346,4 @@ export class ValidationService {
346
346
  shouldContinue: true,
347
347
  };
348
348
  }
349
- }
349
+ }
@@ -1,10 +1,11 @@
1
- import type { CollectionCreate, ImportDef } from "appwrite-utils";
2
- import { YamlImportConfigLoader, type YamlImportConfig } from "./YamlImportConfigLoader.js";
3
- import { createImportSchemas, createImportExamples } from "./generateImportSchemas.js";
4
- import { logger } from "../../shared/logging.js";
5
- import { normalizeYamlData, usesTableTerminology, convertTerminology, type YamlCollectionData } from "../../utils/yamlConverter.js";
6
- import path from "path";
7
- import fs from "fs";
1
+ import type { CollectionCreate, ImportDef } from "appwrite-utils";
2
+ import { YamlImportConfigLoader, type YamlImportConfig } from "./YamlImportConfigLoader.js";
3
+ import { createImportSchemas, createImportExamples } from "./generateImportSchemas.js";
4
+ import { logger } from "../../shared/logging.js";
5
+ import { normalizeYamlData, usesTableTerminology, convertTerminology, type YamlCollectionData } from "../../utils/yamlConverter.js";
6
+ import path from "path";
7
+ import fs from "fs";
8
+ import yaml from "js-yaml";
8
9
 
9
10
  /**
10
11
  * Integration service that bridges YAML import configurations with the existing import system.
@@ -284,8 +285,7 @@ export class YamlImportIntegration {
284
285
  },
285
286
  };
286
287
 
287
- const yaml = require("js-yaml");
288
- const yamlContent = yaml.dump(yamlConfig, {
288
+ const yamlContent = yaml.dump(yamlConfig, {
289
289
  indent: 2,
290
290
  lineWidth: 120,
291
291
  sortKeys: false,
@@ -443,4 +443,4 @@ export class YamlImportIntegration {
443
443
  missingComponents,
444
444
  };
445
445
  }
446
- }
446
+ }