@tenonhq/sincronia-core 0.0.23 → 0.0.25

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.
@@ -81,12 +81,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
81
81
  Logger_1.logger.error("No update set selected");
82
82
  process.exit(1);
83
83
  }
84
+ // Extract the actual values from display_value objects
85
+ const sysId = typeof targetUpdateSet.sys_id === 'object' && targetUpdateSet.sys_id !== null ? targetUpdateSet.sys_id.value : targetUpdateSet.sys_id;
86
+ const name = typeof targetUpdateSet.name === 'object' && targetUpdateSet.name !== null ? targetUpdateSet.name.value : targetUpdateSet.name;
87
+ const applicationName = ((_a = targetUpdateSet.application) === null || _a === void 0 ? void 0 : _a.display_value) || (typeof targetUpdateSet.application === 'object' && targetUpdateSet.application !== null ? targetUpdateSet.application.value : targetUpdateSet.application);
84
88
  // Switch to the selected update set
85
- await switchToUpdateSet(targetUpdateSet.sys_id, targetUpdateSet.name);
86
- Logger_1.logger.info(chalk_1.default.green(`✓ Switched to update set: ${targetUpdateSet.name}`));
87
- Logger_1.logger.info(`Update Set ID: ${targetUpdateSet.sys_id}`);
88
- if ((_a = targetUpdateSet.application) === null || _a === void 0 ? void 0 : _a.display_value) {
89
- Logger_1.logger.info(`Scope: ${targetUpdateSet.application.display_value}`);
89
+ await switchToUpdateSet(sysId, name);
90
+ Logger_1.logger.info(chalk_1.default.green(`✓ Switched to update set: ${name}`));
91
+ Logger_1.logger.info(`Update Set ID: ${sysId}`);
92
+ if (applicationName) {
93
+ Logger_1.logger.info(`Scope: ${applicationName}`);
90
94
  }
91
95
  }
92
96
  catch (e) {
@@ -127,18 +131,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
127
131
  Logger_1.logger.info("─".repeat(80));
128
132
  updateSets.forEach((updateSet) => {
129
133
  var _a;
130
- const isCurrent = updateSet.sys_id === currentUpdateSetId;
134
+ // Handle both plain values and display_value objects
135
+ const sysId = typeof updateSet.sys_id === 'object' && updateSet.sys_id !== null ? updateSet.sys_id.value : updateSet.sys_id;
136
+ const name = typeof updateSet.name === 'object' && updateSet.name !== null ? updateSet.name.value : updateSet.name;
137
+ const description = typeof updateSet.description === 'object' && updateSet.description !== null ? updateSet.description.value : updateSet.description;
138
+ const createdBy = typeof updateSet.sys_created_by === 'object' && updateSet.sys_created_by !== null ? updateSet.sys_created_by.display_value || updateSet.sys_created_by.value : updateSet.sys_created_by;
139
+ const applicationName = ((_a = updateSet.application) === null || _a === void 0 ? void 0 : _a.display_value) || (typeof updateSet.application === 'object' && updateSet.application !== null ? updateSet.application.value : updateSet.application);
140
+ const isCurrent = sysId === currentUpdateSetId;
131
141
  const marker = isCurrent ? chalk_1.default.green("► ") : " ";
132
- const name = isCurrent ? chalk_1.default.green(updateSet.name) : updateSet.name;
133
- console.log(`${marker}${name}`);
134
- if (updateSet.description) {
135
- console.log(` Description: ${updateSet.description}`);
142
+ const displayName = isCurrent ? chalk_1.default.green(name) : name;
143
+ console.log(`${marker}${displayName}`);
144
+ if (description) {
145
+ console.log(` Description: ${description}`);
136
146
  }
137
- if ((_a = updateSet.application) === null || _a === void 0 ? void 0 : _a.display_value) {
138
- console.log(` Scope: ${updateSet.application.display_value}`);
147
+ if (applicationName) {
148
+ console.log(` Scope: ${applicationName}`);
139
149
  }
140
- console.log(` Created: ${formatDate(updateSet.sys_created_on)} by ${updateSet.sys_created_by}`);
141
- console.log(` ID: ${updateSet.sys_id}`);
150
+ console.log(` Created: ${formatDate(updateSet.sys_created_on)} by ${createdBy}`);
151
+ console.log(` ID: ${sysId}`);
142
152
  console.log("");
143
153
  });
144
154
  if (currentUpdateSetId) {
@@ -268,13 +278,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
268
278
  // Filter by name if provided
269
279
  let filteredSets = updateSets;
270
280
  if (nameFilter) {
271
- filteredSets = updateSets.filter(us => us.name.toLowerCase().includes(nameFilter.toLowerCase()));
281
+ filteredSets = updateSets.filter(us => {
282
+ const name = typeof us.name === 'object' && us.name !== null ? us.name.value : us.name;
283
+ return name.toLowerCase().includes(nameFilter.toLowerCase());
284
+ });
272
285
  if (filteredSets.length === 0) {
273
286
  Logger_1.logger.error(`No update sets found matching "${nameFilter}"`);
274
287
  return null;
275
288
  }
276
289
  // If exact match found, use it
277
- const exactMatch = filteredSets.find(us => us.name.toLowerCase() === nameFilter.toLowerCase());
290
+ const exactMatch = filteredSets.find(us => {
291
+ const name = typeof us.name === 'object' && us.name !== null ? us.name.value : us.name;
292
+ return name.toLowerCase() === nameFilter.toLowerCase();
293
+ });
278
294
  if (exactMatch) {
279
295
  return exactMatch;
280
296
  }
@@ -286,10 +302,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
286
302
  // Prompt user to select from list
287
303
  const choices = filteredSets.map(us => {
288
304
  var _a;
289
- return ({
290
- name: `${us.name}${((_a = us.application) === null || _a === void 0 ? void 0 : _a.display_value) ? ` (${us.application.display_value})` : ""} - ${us.description || "No description"}`,
305
+ const name = typeof us.name === 'object' && us.name !== null ? us.name.value : us.name;
306
+ const description = typeof us.description === 'object' && us.description !== null ? us.description.value : us.description;
307
+ const applicationName = ((_a = us.application) === null || _a === void 0 ? void 0 : _a.display_value) || (typeof us.application === 'object' && us.application !== null ? us.application.value : us.application);
308
+ return {
309
+ name: `${name}${applicationName ? ` (${applicationName})` : ""} - ${description || "No description"}`,
291
310
  value: us
292
- });
311
+ };
293
312
  });
294
313
  const { selectedUpdateSet } = await inquirer_1.default.prompt([
295
314
  {
@@ -306,7 +325,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
306
325
  * Helper function to format date
307
326
  */
308
327
  function formatDate(dateString) {
309
- const date = new Date(dateString);
310
- return date.toLocaleDateString() + " " + date.toLocaleTimeString();
328
+ try {
329
+ const actualDateString = typeof dateString === 'object' && dateString !== null ? dateString.display_value || dateString.value : dateString;
330
+ const date = new Date(actualDateString);
331
+ if (isNaN(date.getTime())) {
332
+ return actualDateString || "Unknown";
333
+ }
334
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
335
+ }
336
+ catch (e) {
337
+ return typeof dateString === 'string' ? dateString : "Unknown";
338
+ }
311
339
  }
312
340
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenonhq/sincronia-core",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "Next-gen file syncer",
5
5
  "license": "GPL-3.0",
6
6
  "main": "./dist/index.js",