@tenonhq/sincronia-core 0.0.47 → 0.0.48

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.
@@ -37,7 +37,7 @@ var __importStar = (this && this.__importStar) || (function () {
37
37
  if (v !== undefined) module.exports = v;
38
38
  }
39
39
  else if (typeof define === "function" && define.amd) {
40
- define(["require", "exports", "./Logger", "./config", "./wizard", "./snClient", "./commands", "path", "fs"], factory);
40
+ define(["require", "exports", "./Logger", "./FileLogger", "./config", "./wizard", "./snClient", "./commands", "path", "fs"], factory);
41
41
  }
42
42
  })(function (require, exports) {
43
43
  "use strict";
@@ -46,6 +46,7 @@ var __importStar = (this && this.__importStar) || (function () {
46
46
  exports.initScopesCommand = initScopesCommand;
47
47
  exports.watchAllScopesCommand = watchAllScopesCommand;
48
48
  const Logger_1 = require("./Logger");
49
+ const FileLogger_1 = require("./FileLogger");
49
50
  const ConfigManager = __importStar(require("./config"));
50
51
  const wizard_1 = require("./wizard");
51
52
  const snClient_1 = require("./snClient");
@@ -83,9 +84,23 @@ var __importStar = (this && this.__importStar) || (function () {
83
84
  // Use the record's name property instead of the key for the directory name
84
85
  const recordDirName = record.name || recordName;
85
86
  const recordPath = path.join(tablePath, recordDirName);
86
- Logger_1.logger.debug(`Processing record: ${recordDirName} with ${((_a = record.files) === null || _a === void 0 ? void 0 : _a.length) || 0} files`);
87
+ FileLogger_1.fileLogger.debug(`Processing record: ${recordDirName} with ${((_a = record.files) === null || _a === void 0 ? void 0 : _a.length) || 0} files`);
87
88
  // Ensure the record directory exists
88
89
  await fsp.mkdir(recordPath, { recursive: true });
90
+ // Create metadata file for this record
91
+ const metadataFilePath = path.join(recordPath, "metaData.json");
92
+ const metadataContent = {
93
+ _generatedAt: new Date().toISOString(),
94
+ };
95
+ FileLogger_1.fileLogger.debug(`*** CREATING METADATA FILE: ${metadataFilePath}`);
96
+ FileLogger_1.fileLogger.debug(`Metadata content: ${JSON.stringify(metadataContent)}`);
97
+ try {
98
+ await fsp.writeFile(metadataFilePath, JSON.stringify(metadataContent, null, 2), "utf8");
99
+ FileLogger_1.fileLogger.debug(`*** SUCCESSFULLY CREATED METADATA FILE for ${recordDirName}`);
100
+ }
101
+ catch (metaError) {
102
+ Logger_1.logger.error(`Failed to write metadata file ${metadataFilePath}: ${metaError}`);
103
+ }
89
104
  // Process each file in the record
90
105
  for (const file of record.files || []) {
91
106
  const filePath = path.join(recordPath, `${file.name}.${file.type}`);
@@ -155,7 +170,7 @@ var __importStar = (this && this.__importStar) || (function () {
155
170
  const record = table.records[recordName];
156
171
  missingFiles[tableName][record.sys_id] = record.files.map((f) => ({
157
172
  name: f.name,
158
- type: f.type
173
+ type: f.type,
159
174
  }));
160
175
  }
161
176
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenonhq/sincronia-core",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "description": "Next-gen file syncer",
5
5
  "license": "GPL-3.0",
6
6
  "main": "./dist/index.js",