@azure-utils/storybooks
Version:
Utils to upload and manage Storybooks via Azure Functions and storage.
40 lines (39 loc) • 1.81 kB
JavaScript
//#region src/utils/constants.ts
const DEFAULT_SERVICE_NAME = "storybooks";
const DEFAULT_STORAGE_CONN_STR_ENV_VAR = "AzureWebJobsStorage";
const DEFAULT_PURGE_SCHEDULE_CRON = "0 0 0 * * *";
const CACHE_CONTROL_PUBLIC_YEAR = "public, max-age=31536000, immutable";
const CACHE_CONTROL_PUBLIC_WEEK = "public, max-age=604800, immutable";
const DEFAULT_PURGE_AFTER_DAYS = 30;
const DEFAULT_GITHUB_BRANCH = "main";
const ONE_DAY_IN_MS = 1440 * 60 * 1e3;
const CONTENT_TYPES = {
ANY: "*/*",
JSON: "application/json",
HTML: "text/html",
ZIP: "application/zip",
FORM_MULTIPART: "multipart/form-data",
FORM_ENCODED: "application/x-www-form-urlencoded"
};
const SUPPORTED_CONTENT_TYPES = Object.values(CONTENT_TYPES);
const SUPPORTED_CONTENT_TYPES_MSG = `Only following content-type supported: ${SUPPORTED_CONTENT_TYPES.join(", ")}.`;
const DEFAULT_CHECK_PERMISSIONS_CALLBACK = () => true;
const commonErrorResponses = {
400: { description: "Invalid request data" },
401: { description: "Unauthenticated access" },
403: { description: "Unauthorized access" },
500: { description: "An unexpected server-error occurred." }
};
const QUERY_PARAMS = {
mode: "mode",
newResource: "new",
editResource: "edit",
labelSlug: "labelSlug"
};
const PATTERNS = { projectId: {
pattern: "^[a-z0-9][a-z0-9-]{0,60}$",
message: "Should contain only lowercase alphabets, numbers and hyphen."
} };
//#endregion
export { CACHE_CONTROL_PUBLIC_WEEK, CACHE_CONTROL_PUBLIC_YEAR, CONTENT_TYPES, DEFAULT_CHECK_PERMISSIONS_CALLBACK, DEFAULT_GITHUB_BRANCH, DEFAULT_PURGE_AFTER_DAYS, DEFAULT_PURGE_SCHEDULE_CRON, DEFAULT_SERVICE_NAME, DEFAULT_STORAGE_CONN_STR_ENV_VAR, ONE_DAY_IN_MS, PATTERNS, QUERY_PARAMS, SUPPORTED_CONTENT_TYPES, SUPPORTED_CONTENT_TYPES_MSG, commonErrorResponses };
//# sourceMappingURL=constants-CsV1N9r4.mjs.map