intlayer-editor
Version:
Integrate the Intlayer visual editor into your Intlayer projects, enabling CMS-like content management with multilingual support.
74 lines • 2.86 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var responseData_exports = {};
__export(responseData_exports, {
formatPaginatedResponse: () => formatPaginatedResponse,
formatResponse: () => formatResponse
});
module.exports = __toCommonJS(responseData_exports);
var import_httpStatusCodes = require('./httpStatusCodes.cjs');
const isSuccessStatus = (status) => status === import_httpStatusCodes.HttpStatusCodes.OK_200 || status === import_httpStatusCodes.HttpStatusCodes.CREATED_201 || status === import_httpStatusCodes.HttpStatusCodes.ACCEPTED_202 || status === import_httpStatusCodes.HttpStatusCodes.NON_AUTHORITATIVE_INFORMATION_203 || status === import_httpStatusCodes.HttpStatusCodes.NO_CONTENT_204 || status === import_httpStatusCodes.HttpStatusCodes.RESET_CONTENT_205 || status === import_httpStatusCodes.HttpStatusCodes.PARTIAL_CONTENT_206 || status === import_httpStatusCodes.HttpStatusCodes.MULTI_STATUS_207 || status === import_httpStatusCodes.HttpStatusCodes.ALREADY_REPORTED_208 || status === import_httpStatusCodes.HttpStatusCodes.IM_USED_226;
function formatResponse({
message,
description,
data,
error,
status = import_httpStatusCodes.HttpStatusCodes.OK_200
}) {
const success = isSuccessStatus(status);
return {
success,
message: message ?? void 0,
description: description ?? void 0,
data: data ?? null,
error: error ?? void 0,
status
};
}
function formatPaginatedResponse({
status = import_httpStatusCodes.HttpStatusCodes.OK_200,
message,
description,
data,
error,
page,
pageSize,
totalPages,
totalItems
}) {
const success = isSuccessStatus(status);
return {
success,
message: message ?? void 0,
description: description ?? void 0,
data: data ?? null,
error: error ?? void 0,
status,
page: page ?? null,
page_size: pageSize ?? null,
total_pages: totalPages ?? null,
total_items: totalItems ?? null
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
formatPaginatedResponse,
formatResponse
});
//# sourceMappingURL=responseData.cjs.map