UNPKG

@azure-utils/storybooks

Version:

Utils to upload and manage Storybooks via Azure Functions and storage.

129 lines (127 loc) 3.53 kB
//#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 Object.defineProperty(exports, 'CACHE_CONTROL_PUBLIC_WEEK', { enumerable: true, get: function () { return CACHE_CONTROL_PUBLIC_WEEK; } }); Object.defineProperty(exports, 'CACHE_CONTROL_PUBLIC_YEAR', { enumerable: true, get: function () { return CACHE_CONTROL_PUBLIC_YEAR; } }); Object.defineProperty(exports, 'CONTENT_TYPES', { enumerable: true, get: function () { return CONTENT_TYPES; } }); Object.defineProperty(exports, 'DEFAULT_CHECK_PERMISSIONS_CALLBACK', { enumerable: true, get: function () { return DEFAULT_CHECK_PERMISSIONS_CALLBACK; } }); Object.defineProperty(exports, 'DEFAULT_GITHUB_BRANCH', { enumerable: true, get: function () { return DEFAULT_GITHUB_BRANCH; } }); Object.defineProperty(exports, 'DEFAULT_PURGE_AFTER_DAYS', { enumerable: true, get: function () { return DEFAULT_PURGE_AFTER_DAYS; } }); Object.defineProperty(exports, 'DEFAULT_PURGE_SCHEDULE_CRON', { enumerable: true, get: function () { return DEFAULT_PURGE_SCHEDULE_CRON; } }); Object.defineProperty(exports, 'DEFAULT_SERVICE_NAME', { enumerable: true, get: function () { return DEFAULT_SERVICE_NAME; } }); Object.defineProperty(exports, 'DEFAULT_STORAGE_CONN_STR_ENV_VAR', { enumerable: true, get: function () { return DEFAULT_STORAGE_CONN_STR_ENV_VAR; } }); Object.defineProperty(exports, 'ONE_DAY_IN_MS', { enumerable: true, get: function () { return ONE_DAY_IN_MS; } }); Object.defineProperty(exports, 'PATTERNS', { enumerable: true, get: function () { return PATTERNS; } }); Object.defineProperty(exports, 'QUERY_PARAMS', { enumerable: true, get: function () { return QUERY_PARAMS; } }); Object.defineProperty(exports, 'SUPPORTED_CONTENT_TYPES', { enumerable: true, get: function () { return SUPPORTED_CONTENT_TYPES; } }); Object.defineProperty(exports, 'SUPPORTED_CONTENT_TYPES_MSG', { enumerable: true, get: function () { return SUPPORTED_CONTENT_TYPES_MSG; } }); Object.defineProperty(exports, 'commonErrorResponses', { enumerable: true, get: function () { return commonErrorResponses; } });