@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.
- package/dist/updateSetCommands.js +49 -21
- package/package.json +1 -1
|
@@ -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(
|
|
86
|
-
Logger_1.logger.info(chalk_1.default.green(`✓ Switched to update set: ${
|
|
87
|
-
Logger_1.logger.info(`Update Set ID: ${
|
|
88
|
-
if (
|
|
89
|
-
Logger_1.logger.info(`Scope: ${
|
|
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
|
-
|
|
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
|
|
133
|
-
console.log(`${marker}${
|
|
134
|
-
if (
|
|
135
|
-
console.log(` 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 (
|
|
138
|
-
console.log(` Scope: ${
|
|
147
|
+
if (applicationName) {
|
|
148
|
+
console.log(` Scope: ${applicationName}`);
|
|
139
149
|
}
|
|
140
|
-
console.log(` Created: ${formatDate(updateSet.sys_created_on)} by ${
|
|
141
|
-
console.log(` 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 =>
|
|
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 =>
|
|
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
|
-
|
|
290
|
-
|
|
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
|
-
|
|
310
|
-
|
|
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
|
});
|