@camunda8/sdk
Version:
[](https://www.npmjs.com/package/@camunda8/sdk)
26 lines • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseSearchResults = void 0;
const lossless_json_1 = require("lossless-json");
const lib_1 = require("../../lib");
function parseSearchResults(json,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
dto) {
const parsedResult = (0, lossless_json_1.parse)(json);
// Assuming `parsedResult` matches the structure of `SearchResults<T>`
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const items = parsedResult.items.map((item) => (0, lib_1.losslessParse)((0, lossless_json_1.stringify)(item), dto));
// Apply additional parsing or annotations if necessary
// For each item in the array, you could potentially apply the same or similar logic
// as in `losslessParse` if your items have properties that need special handling.
const total = parsedResult.total.toString(); // Or convert based on your needs
// Construct the final object, assuming `SearchResults` is a simple interface without methods
const result = {
items: items,
sortValues: parsedResult.sortValues, // Handle according to your needs
total,
};
return result;
}
exports.parseSearchResults = parseSearchResults;
//# sourceMappingURL=parseSearchResults.js.map