diff --git a/.pnp.cjs b/.pnp.cjs index 97c085e37..c47d83b44 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -2942,6 +2942,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["@types/md5", [\ + ["npm:2.3.5", {\ + "packageLocation": "./.yarn/cache/@types-md5-npm-2.3.5-bd5c825c57-a86baf0521.zip/node_modules/@types/md5/",\ + "packageDependencies": [\ + ["@types/md5", "npm:2.3.5"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["@types/minimatch", [\ ["npm:5.1.2", {\ "packageLocation": "./.yarn/cache/@types-minimatch-npm-5.1.2-aab9c394d3-0391a28286.zip/node_modules/@types/minimatch/",\ @@ -4080,6 +4089,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["allure-js-commons", "workspace:packages/allure-js-commons"],\ ["@types/chai", "npm:4.3.6"],\ ["@types/eslint", "npm:8.44.2"],\ + ["@types/md5", "npm:2.3.5"],\ ["@types/mocha", "npm:10.0.1"],\ ["@types/node", "npm:20.6.3"],\ ["@types/sinon", "npm:17.0.3"],\ @@ -4096,6 +4106,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["eslint-plugin-prefer-arrow", "virtual:a59b12f7fe7bf3b80fc61d73eaaa33af60483f6ce31789d384fbe8ef169791f667d2559ec5f2fbae1a273a658ce021f1f5f1ea0718c56f81b30ad4e95a5668dd#npm:1.2.3"],\ ["expect", "npm:29.7.0"],\ ["glob", "npm:10.3.5"],\ + ["md5", "npm:2.3.0"],\ ["mocha", "npm:10.2.0"],\ ["mocha-multi-reporters", "virtual:3c6c31eedba60f6d4a0031098f0272720e7414162569ae8f58388d36f8e79683154a59f38a8e5aece9f0d5e45421fab86d5311a37a1c1aec338de3c79151496a#npm:1.5.1"],\ ["properties", "npm:1.2.1"],\ @@ -5716,6 +5727,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["charenc", [\ + ["npm:0.0.2", {\ + "packageLocation": "./.yarn/cache/charenc-npm-0.0.2-aca0c2f207-81dcadbe57.zip/node_modules/charenc/",\ + "packageDependencies": [\ + ["charenc", "npm:0.0.2"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["charset", [\ ["npm:1.0.1", {\ "packageLocation": "./.yarn/cache/charset-npm-1.0.1-56ffb0a667-adf747e7bc.zip/node_modules/charset/",\ @@ -6627,6 +6647,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["crypt", [\ + ["npm:0.0.2", {\ + "packageLocation": "./.yarn/cache/crypt-npm-0.0.2-033627d94f-baf4c7bbe0.zip/node_modules/crypt/",\ + "packageDependencies": [\ + ["crypt", "npm:0.0.2"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["crypto-browserify", [\ ["npm:3.12.0", {\ "packageLocation": "./.yarn/cache/crypto-browserify-npm-3.12.0-bed454fef0-c1609af826.zip/node_modules/crypto-browserify/",\ @@ -12291,6 +12320,18 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["md5", [\ + ["npm:2.3.0", {\ + "packageLocation": "./.yarn/cache/md5-npm-2.3.0-86c49d3915-a63cacf401.zip/node_modules/md5/",\ + "packageDependencies": [\ + ["md5", "npm:2.3.0"],\ + ["charenc", "npm:0.0.2"],\ + ["crypt", "npm:0.0.2"],\ + ["is-buffer", "npm:1.1.6"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["md5.js", [\ ["npm:1.3.5", {\ "packageLocation": "./.yarn/cache/md5.js-npm-1.3.5-130901125a-098494d885.zip/node_modules/md5.js/",\ diff --git a/.yarn/cache/@types-md5-npm-2.3.5-bd5c825c57-a86baf0521.zip b/.yarn/cache/@types-md5-npm-2.3.5-bd5c825c57-a86baf0521.zip new file mode 100644 index 000000000..bb83c3d13 Binary files /dev/null and b/.yarn/cache/@types-md5-npm-2.3.5-bd5c825c57-a86baf0521.zip differ diff --git a/.yarn/cache/charenc-npm-0.0.2-aca0c2f207-81dcadbe57.zip b/.yarn/cache/charenc-npm-0.0.2-aca0c2f207-81dcadbe57.zip new file mode 100644 index 000000000..a63e2ac86 Binary files /dev/null and b/.yarn/cache/charenc-npm-0.0.2-aca0c2f207-81dcadbe57.zip differ diff --git a/.yarn/cache/crypt-npm-0.0.2-033627d94f-baf4c7bbe0.zip b/.yarn/cache/crypt-npm-0.0.2-033627d94f-baf4c7bbe0.zip new file mode 100644 index 000000000..471817872 Binary files /dev/null and b/.yarn/cache/crypt-npm-0.0.2-033627d94f-baf4c7bbe0.zip differ diff --git a/.yarn/cache/md5-npm-2.3.0-86c49d3915-a63cacf401.zip b/.yarn/cache/md5-npm-2.3.0-86c49d3915-a63cacf401.zip new file mode 100644 index 000000000..fa1459f1c Binary files /dev/null and b/.yarn/cache/md5-npm-2.3.0-86c49d3915-a63cacf401.zip differ diff --git a/packages/allure-js-commons/browser.ts b/packages/allure-js-commons/browser.ts new file mode 100644 index 000000000..59f933725 --- /dev/null +++ b/packages/allure-js-commons/browser.ts @@ -0,0 +1,2 @@ +export { AllureBrowserRuntime as AllureRuntime } from "./src/browser/runtime"; +export { AllureInMemoryAllureWriter } from "./src/framework/writers/AllureInMemoryWriter"; diff --git a/packages/allure-js-commons/index.ts b/packages/allure-js-commons/index.ts index 401820b8a..d5b546606 100644 --- a/packages/allure-js-commons/index.ts +++ b/packages/allure-js-commons/index.ts @@ -1,68 +1,2 @@ -export { AllureRuntime } from "./src/AllureRuntime"; -export { - typeToExtension, - InMemoryAllureWriter, - FileSystemAllureWriter, - MessageAllureWriter, - AllureResults -} from "./src/writers"; -export { AllureConfig } from "./src/AllureConfig"; -export { AllureGroup } from "./src/AllureGroup"; -export { ExecutableItemWrapper } from "./src/ExecutableItemWrapper"; -export { AllureTest } from "./src/AllureTest"; -export { AllureStep } from "./src/ExecutableItemWrapper"; -export { isPromise } from "./src/isPromise"; -export { Allure, StepInterface } from "./src/Allure"; -export { - StepBodyFunction, - AllureCommandStep, - AllureCommandStepExecutable -} from "./src/AllureCommandStep"; -export { - AttachmentOptions, - MetadataMessage, - Attachment, - Category, - ExecutableItem, - StepResult, - Parameter, - StatusDetails, - Link, - Label, - ExecutorInfo, - TestResultContainer, - FixtureResult, - TestResult, - ContentType, - LabelName, - Severity, - Stage, - Status, - LinkType, - ParameterOptions, - StepMetadata, - AttachmentMetadata, - ImageDiffAttachment -} from "./src/model"; - -export { - allureIdRegexp, - allureIdRegexpGlobal, - allureLabelRegexp, - allureLabelRegexpGlobal, - allureReportFolder, - escapeRegExp, - getLabelsFromEnv, - getStatusFromError, - getSuitesLabels, - isAnyStepFailed, - md5, - readImageAsBase64, - serialize, - stripAscii, - extractMetadataFromString -} from "./src/utils"; - -export { AllureRuntimeApiInterface } from "./src/framework"; - -export { TestPlanV1, parseTestPlan } from "./src/testplan"; +export * from "./src/model"; +export * from "./src/utils"; diff --git a/packages/allure-js-commons/node.ts b/packages/allure-js-commons/node.ts new file mode 100644 index 000000000..842a843d8 --- /dev/null +++ b/packages/allure-js-commons/node.ts @@ -0,0 +1,2 @@ +export { AllureNodeRuntime as AllureRuntime } from "./src/node/runtime"; +export * from "./src/node/writers"; diff --git a/packages/allure-js-commons/package.json b/packages/allure-js-commons/package.json index 7e14d838b..2b38a5bea 100644 --- a/packages/allure-js-commons/package.json +++ b/packages/allure-js-commons/package.json @@ -20,6 +20,16 @@ "require": "./dist/index.js", "types": "./dist/index.d.ts" }, + "./node": { + "import": "./dist/node.js", + "require": "./dist/node.js", + "types": "./dist/node.d.ts" + }, + "./browser": { + "import": "./dist/browser.js", + "require": "./dist/browser.js", + "types": "./dist/browser.d.ts" + }, "./internal": { "import": "./dist/internal.js", "require": "./dist/internal.js", @@ -39,12 +49,14 @@ "test": "ts-node --project test/tsconfig.json test/runner.ts" }, "dependencies": { + "md5": "^2.3.0", "properties": "^1.2.1", "strip-ansi": "^5.2.0" }, "devDependencies": { "@types/chai": "^4.3.6", "@types/eslint": "^8", + "@types/md5": "^2.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.6.3", "@types/sinon": "^17.0.0", diff --git a/packages/allure-js-commons/src/AllureConfig.ts b/packages/allure-js-commons/src/AllureConfig.ts deleted file mode 100644 index 70b50ac3d..000000000 --- a/packages/allure-js-commons/src/AllureConfig.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { TestResult } from "./model"; -import { AllureWriter } from "./writers"; - -export interface AllureConfig { - readonly resultsDir: string; - readonly writer?: AllureWriter; - readonly testMapper?: (test: TestResult) => TestResult | null; -} diff --git a/packages/allure-js-commons/src/browser/runtime.ts b/packages/allure-js-commons/src/browser/runtime.ts new file mode 100644 index 000000000..a9c50d023 --- /dev/null +++ b/packages/allure-js-commons/src/browser/runtime.ts @@ -0,0 +1,18 @@ +import { AllureConfig } from "../framework/AllureConfig"; +import { AllureRuntime } from "../framework/AllureRuntime"; +import md5 from "md5"; + +export class AllureBrowserRuntime extends AllureRuntime { + constructor(config: AllureConfig) { + super(config, { + uuid: () => window.crypto.randomUUID(), + md5, + }); + } + + writeAttachmentFromPath() { + throw new Error( + "Browser Allure runtime doesn't support writting attachments from path! User AllureNodeRuntime instead or alternative methods to write attachments.", + ); + } +} diff --git a/packages/allure-js-commons/src/AllureCommandStep.ts b/packages/allure-js-commons/src/framework/AllureCommandStep.ts similarity index 99% rename from packages/allure-js-commons/src/AllureCommandStep.ts rename to packages/allure-js-commons/src/framework/AllureCommandStep.ts index 79f5ed888..5eaec6934 100644 --- a/packages/allure-js-commons/src/AllureCommandStep.ts +++ b/packages/allure-js-commons/src/framework/AllureCommandStep.ts @@ -11,7 +11,7 @@ import { Stage, Status, StepMetadata, -} from "./model"; +} from "../model"; export type StepBodyFunction = ( this: AllureCommandStepExecutable, diff --git a/packages/allure-js-commons/src/framework/AllureConfig.ts b/packages/allure-js-commons/src/framework/AllureConfig.ts new file mode 100644 index 000000000..15fa82e37 --- /dev/null +++ b/packages/allure-js-commons/src/framework/AllureConfig.ts @@ -0,0 +1,7 @@ +import { TestResult } from "../model"; +import { AllureWriter } from "./AllureWriter"; + +export interface AllureConfig { + readonly writer: AllureWriter; + readonly testMapper?: (test: TestResult) => TestResult | null; +} diff --git a/packages/allure-js-commons/src/ExecutableItemWrapper.ts b/packages/allure-js-commons/src/framework/AllureExecutable.ts similarity index 93% rename from packages/allure-js-commons/src/ExecutableItemWrapper.ts rename to packages/allure-js-commons/src/framework/AllureExecutable.ts index d6439204f..63e4fc3b7 100644 --- a/packages/allure-js-commons/src/ExecutableItemWrapper.ts +++ b/packages/allure-js-commons/src/framework/AllureExecutable.ts @@ -1,5 +1,5 @@ -import { stepResult } from "./constructors"; -import { isPromise } from "./isPromise"; +import { stepResult } from "./AllureResults"; +import { isPromise } from "../utils"; import { AttachmentOptions, ContentType, @@ -11,10 +11,11 @@ import { StatusDetails, StepResult, TestResult, -} from "./model"; -import { isAllStepsEnded, isAnyStepFailed, serialize } from "./utils"; +} from "../model"; +import { serialize } from "../utils"; +import { isAllStepsEnded, isAnyStepFailed } from "./utils"; -export class ExecutableItemWrapper { +export class AllureExecutable { constructor(private readonly info: FixtureResult | TestResult) {} get wrappedItem(): FixtureResult | TestResult { @@ -86,10 +87,13 @@ export class ExecutableItemWrapper { public startStep(name: string, start?: number): AllureStep { const result = stepResult(); + this.info.steps.push(result); const allureStep = new AllureStep(result, start); + allureStep.name = name; + return allureStep; } @@ -139,13 +143,14 @@ export class ExecutableItemWrapper { } // This class is here because of circular dependency with ExecutableItemWrapper -export class AllureStep extends ExecutableItemWrapper { +export class AllureStep extends AllureExecutable { constructor( // eslint-disable-next-line @typescript-eslint/no-shadow private readonly stepResult: StepResult, start: number = Date.now(), ) { super(stepResult); + this.stepResult.start = start; } diff --git a/packages/allure-js-commons/src/AllureGroup.ts b/packages/allure-js-commons/src/framework/AllureGroup.ts similarity index 67% rename from packages/allure-js-commons/src/AllureGroup.ts rename to packages/allure-js-commons/src/framework/AllureGroup.ts index 980ec667c..0a8128b13 100644 --- a/packages/allure-js-commons/src/AllureGroup.ts +++ b/packages/allure-js-commons/src/framework/AllureGroup.ts @@ -1,18 +1,22 @@ +import { TestResultContainer } from "../model"; +import { AllureExecutable } from "./AllureExecutable"; +import { fixtureResult, testResultContainer } from "./AllureResults"; import { AllureRuntime } from "./AllureRuntime"; import { AllureTest } from "./AllureTest"; -import { ExecutableItemWrapper } from "./ExecutableItemWrapper"; -import { fixtureResult, testResultContainer } from "./constructors"; -import { TestResultContainer } from "./model"; export class AllureGroup { - private testResultContainer: TestResultContainer = testResultContainer(); + private testResultContainer: TestResultContainer; - constructor(private readonly runtime: AllureRuntime) {} + constructor(private readonly runtime: AllureRuntime) { + this.testResultContainer = testResultContainer(runtime.crypto.uuid()); + } startGroup(name?: string): AllureGroup { const group = new AllureGroup(this.runtime); + this.testResultContainer.children.push(group.uuid); group.name = name || "Unnamed"; + return group; } @@ -42,15 +46,17 @@ export class AllureGroup { this.testResultContainer.name = name; } - addBefore(): ExecutableItemWrapper { + addBefore(): AllureExecutable { const result = fixtureResult(); + this.testResultContainer.befores.push(result); - return new ExecutableItemWrapper(result); + return new AllureExecutable(result); } - addAfter(): ExecutableItemWrapper { + addAfter(): AllureExecutable { const result = fixtureResult(); + this.testResultContainer.afters.push(result); - return new ExecutableItemWrapper(result); + return new AllureExecutable(result); } } diff --git a/packages/allure-js-commons/src/constructors.ts b/packages/allure-js-commons/src/framework/AllureResults.ts similarity index 71% rename from packages/allure-js-commons/src/constructors.ts rename to packages/allure-js-commons/src/framework/AllureResults.ts index 2b2ad3189..dc3e29dae 100644 --- a/packages/allure-js-commons/src/constructors.ts +++ b/packages/allure-js-commons/src/framework/AllureResults.ts @@ -1,9 +1,10 @@ -import { randomUUID } from "crypto"; -import { FixtureResult, Stage, Status, StepResult, TestResult, TestResultContainer } from "./model"; +import { FixtureResult, Stage, Status, StepResult, TestResult, TestResultContainer } from "../model"; -export const testResultContainer = (): TestResultContainer => { +export type UUIDGenerator = () => string; + +export const testResultContainer = (uuid: string): TestResultContainer => { return { - uuid: randomUUID(), + uuid, children: [], befores: [], afters: [], @@ -32,10 +33,10 @@ export const stepResult = (): StepResult => { }; }; -export const testResult = (): TestResult => { +export const testResult = (uuid: string, historyUuid: string): TestResult => { return { - uuid: randomUUID(), - historyId: randomUUID(), + uuid, + historyId: historyUuid, status: undefined, statusDetails: {}, stage: Stage.PENDING, diff --git a/packages/allure-js-commons/src/AllureRuntime.ts b/packages/allure-js-commons/src/framework/AllureRuntime.ts similarity index 51% rename from packages/allure-js-commons/src/AllureRuntime.ts rename to packages/allure-js-commons/src/framework/AllureRuntime.ts index 4adbb2b10..8b27548f8 100644 --- a/packages/allure-js-commons/src/AllureRuntime.ts +++ b/packages/allure-js-commons/src/framework/AllureRuntime.ts @@ -1,33 +1,42 @@ -import { randomUUID } from "crypto"; -import { PathLike } from "fs"; +// import { AllureConfig } from "./AllureConfig"; +// import { AllureGroup } from "./AllureGroup"; +import { AttachmentOptions, Category, ContentType, Crypto, TestResult, TestResultContainer } from "../model"; +import { typeToExtension } from "../utils"; import { AllureConfig } from "./AllureConfig"; -import { AllureGroup } from "./AllureGroup"; -import { AttachmentOptions, Category, ContentType, TestResult, TestResultContainer } from "./model"; -import { AllureWriter, FileSystemAllureWriter, typeToExtension } from "./writers"; +import { AllureWriter } from "./AllureWriter"; -const buildAttachmentFileName = (options: ContentType | string | AttachmentOptions): string => { - if (typeof options === "string") { - options = { contentType: options }; - } - const extension = typeToExtension(options); - return `${randomUUID()}-attachment${extension}`; -}; - -export class AllureRuntime { +export abstract class AllureRuntime { writer: AllureWriter; - constructor(private config: AllureConfig) { - this.writer = config.writer || new FileSystemAllureWriter(config); + crypto: Crypto; + + constructor( + private config: AllureConfig, + crypto: Crypto, + ) { + this.writer = config.writer; + this.crypto = crypto; } - startGroup(name?: string): AllureGroup { - const allureContainer = new AllureGroup(this); - allureContainer.name = name || "Unnamed"; - return allureContainer; + // startGroup(name?: string): AllureGroup { + // const allureContainer = new AllureGroup(this); + // allureContainer.name = name || "Unnamed"; + // return allureContainer; + // } + + buildAttachmentFileName(options: ContentType | string | AttachmentOptions): string { + if (typeof options === "string") { + options = { contentType: options }; + } + + const extension = typeToExtension(options); + + return `${this.crypto.uuid()}-attachment${extension}`; } writeResult(result: TestResult): void { const modifiedResult = this.config.testMapper !== undefined ? this.config.testMapper(result) : result; + if (modifiedResult != null) { this.writer.writeResult(modifiedResult); } @@ -42,14 +51,10 @@ export class AllureRuntime { options: ContentType | string | AttachmentOptions, encoding?: BufferEncoding, ): string { - const fileName = buildAttachmentFileName(options); + const fileName = this.buildAttachmentFileName(options); + this.writer.writeAttachment(fileName, content, encoding); - return fileName; - } - writeAttachmentFromPath(fromPath: PathLike, options: ContentType | string | AttachmentOptions): string { - const fileName = buildAttachmentFileName(options); - this.writer.writeAttachmentFromPath(fromPath, fileName); return fileName; } @@ -67,6 +72,7 @@ export class AllureRuntime { } return c; }); + this.writer.writeCategoriesDefinitions(serializedCategories); } } diff --git a/packages/allure-js-commons/src/Allure.ts b/packages/allure-js-commons/src/framework/AllureRuntimeAPI.ts similarity index 71% rename from packages/allure-js-commons/src/Allure.ts rename to packages/allure-js-commons/src/framework/AllureRuntimeAPI.ts index 372e1454d..53ad3f377 100644 --- a/packages/allure-js-commons/src/Allure.ts +++ b/packages/allure-js-commons/src/framework/AllureRuntimeAPI.ts @@ -1,13 +1,56 @@ +import { AllureExecutable } from "./AllureExecutable"; import { AllureRuntime } from "./AllureRuntime"; import { AllureTest } from "./AllureTest"; -import { ExecutableItemWrapper } from "./ExecutableItemWrapper"; -import { AllureRuntimeApiInterface } from "./framework"; -import { AttachmentOptions, Category, ContentType, LabelName, LinkType, ParameterOptions, Status } from "./model"; +import { AttachmentOptions, Category, ContentType, LabelName, LinkType, ParameterOptions, Status } from "../model"; + +// TODO: Allure abstract class contains all these methods, so don't need to duplicate anything +export interface AllureRuntimeApiInterface { + label(name: string, value: string): void; + + parameter(name: string, value: any, options?: ParameterOptions): void; + + link(url: string, name?: string, type?: string): void; + + attachment(content: string | Buffer, type: string): void; + + epic(epic: string): void; + + feature(feature: string): void; + + story(story: string): void; + + suite(name: string): void; + + parentSuite(name: string): void; + + subSuite(name: string): void; + + owner(owner: string): void; + + severity(severity: string): void; + + layer(layer: string): void; + + id(allureId: string): void; + + tag(tag: string): void; + + issue(name: string, url: string): void; + + tms(name: string, url: string): void; + + description(markdown: string): void; + + descriptionHtml(html: string): void; + + testCaseId(id: string): void; + + historyId(id: string): void; +} -// FIXME: step and attachment should be the same for each reporter implementation export abstract class Allure implements Omit { protected abstract get currentTest(): AllureTest; // test only - protected abstract get currentExecutable(): ExecutableItemWrapper; // step or test + protected abstract get currentExecutable(): AllureExecutable; // step or test protected constructor(protected runtime: AllureRuntime) {} @@ -112,5 +155,6 @@ export abstract class Allure implements Omit this.addLabel(label.name, label.value)); + // globalLabels.forEach((label) => this.addLabel(label.name, label.value)); } endTest(stop: number = Date.now()): void { @@ -74,7 +76,7 @@ export class AllureTest extends ExecutableItemWrapper { const tcId = this.testResult.testCaseId ? this.testResult.testCaseId : this.testResult.fullName - ? md5(this.testResult.fullName) + ? this.runtime.crypto.md5(this.testResult.fullName) : null; if (!tcId) { @@ -86,7 +88,7 @@ export class AllureTest extends ExecutableItemWrapper { .sort((a, b) => a.name?.localeCompare(b?.name) || a.value?.localeCompare(b?.value)) .map((p) => `${p.name ?? "null"}:${p.value ?? "null"}`) .join(","); - const paramsHash = md5(paramsString); + const paramsHash = this.runtime.crypto.md5(paramsString); this.historyId = `${tcId}:${paramsHash}`; } @@ -113,72 +115,73 @@ export class AllureTest extends ExecutableItemWrapper { * will be added to the test */ applyMetadata(metadata: Partial, stepApplyFn?: (step: ExecutableItem) => void) { - const { - attachments = [], - labels = [], - links = [], - parameter = [], - steps = [], - description, - descriptionHtml, - displayName, - historyId, - testCaseId, - } = metadata; - - labels.forEach((label) => { - this.addLabel(label.name, label.value); - }); - links.forEach((link) => { - this.addLink(link.url, link.name, link.type); - }); - parameter.forEach((param) => { - this.parameter(param.name, param.value, { - excluded: param.excluded, - mode: param.mode, - }); - }); - attachments.forEach((attachment) => { - const attachmentFilename = this.runtime.writeAttachment(attachment.content, attachment.type, attachment.encoding); - - this.addAttachment( - attachment.name, - { - contentType: attachment.type, - }, - attachmentFilename, - ); - }); - - if (description) { - this.description = description; - } - - if (descriptionHtml) { - this.descriptionHtml = descriptionHtml; - } - - if (displayName) { - this.name = displayName; - } - - if (testCaseId) { - this.testCaseId = testCaseId; - } - - if (historyId) { - this.historyId = historyId; - } - - steps.forEach((stepMetadata) => { - const step = AllureCommandStepExecutable.toExecutableItem(this.runtime, stepMetadata); - - if (stepApplyFn) { - stepApplyFn(step); - return; - } - - this.addStep(step); - }); + // TODO: + // const { + // attachments = [], + // labels = [], + // links = [], + // parameter = [], + // steps = [], + // description, + // descriptionHtml, + // displayName, + // historyId, + // testCaseId, + // } = metadata; + // + // labels.forEach((label) => { + // this.addLabel(label.name, label.value); + // }); + // links.forEach((link) => { + // this.addLink(link.url, link.name, link.type); + // }); + // parameter.forEach((param) => { + // this.parameter(param.name, param.value, { + // excluded: param.excluded, + // mode: param.mode, + // }); + // }); + // attachments.forEach((attachment) => { + // const attachmentFilename = this.runtime.writeAttachment(attachment.content, attachment.type, attachment.encoding); + // + // this.addAttachment( + // attachment.name, + // { + // contentType: attachment.type, + // }, + // attachmentFilename, + // ); + // }); + // + // if (description) { + // this.description = description; + // } + // + // if (descriptionHtml) { + // this.descriptionHtml = descriptionHtml; + // } + // + // if (displayName) { + // this.name = displayName; + // } + // + // if (testCaseId) { + // this.testCaseId = testCaseId; + // } + // + // if (historyId) { + // this.historyId = historyId; + // } + // + // steps.forEach((stepMetadata) => { + // const step = AllureCommandStepExecutable.toExecutableItem(this.runtime, stepMetadata); + // + // if (stepApplyFn) { + // stepApplyFn(step); + // return; + // } + // + // this.addStep(step); + // }); } } diff --git a/packages/allure-js-commons/src/writers/AllureWriter.ts b/packages/allure-js-commons/src/framework/AllureWriter.ts similarity index 80% rename from packages/allure-js-commons/src/writers/AllureWriter.ts rename to packages/allure-js-commons/src/framework/AllureWriter.ts index 46bb31907..f632f6b42 100644 --- a/packages/allure-js-commons/src/writers/AllureWriter.ts +++ b/packages/allure-js-commons/src/framework/AllureWriter.ts @@ -1,4 +1,3 @@ -import { PathLike } from "fs"; import { Category, TestResult, TestResultContainer } from "../model"; export interface AllureWriter { @@ -8,7 +7,7 @@ export interface AllureWriter { writeAttachment(name: string, content: Buffer | string, encoding?: BufferEncoding): void; - writeAttachmentFromPath(from: PathLike, distFileName: string): void; + writeAttachmentFromPath(from: string, distFileName: string): void; writeEnvironmentInfo(info: Record): void; diff --git a/packages/allure-js-commons/src/framework/index.ts b/packages/allure-js-commons/src/framework/index.ts deleted file mode 100644 index 4fac3ef90..000000000 --- a/packages/allure-js-commons/src/framework/index.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { StepBodyFunction } from "../AllureCommandStep"; -import { ParameterOptions } from "../model"; - -export interface AllureRuntimeApiInterface { - label(name: string, value: string): void; - - parameter(name: string, value: any, options?: ParameterOptions): void; - - link(url: string, name?: string, type?: string): void; - - attachment(content: string | Buffer, type: string): void; - - step(name: string, body: StepBodyFunction): void; - - epic(epic: string): void; - - feature(feature: string): void; - - story(story: string): void; - - suite(name: string): void; - - parentSuite(name: string): void; - - subSuite(name: string): void; - - owner(owner: string): void; - - severity(severity: string): void; - - layer(layer: string): void; - - id(allureId: string): void; - - tag(tag: string): void; - - issue(name: string, url: string): void; - - tms(name: string, url: string): void; - - description(markdown: string): void; - - descriptionHtml(html: string): void; - - testCaseId(id: string): void; - - historyId(id: string): void; -} diff --git a/packages/allure-js-commons/src/framework/utils.ts b/packages/allure-js-commons/src/framework/utils.ts new file mode 100644 index 000000000..6b033382a --- /dev/null +++ b/packages/allure-js-commons/src/framework/utils.ts @@ -0,0 +1,25 @@ +import { createHash, randomUUID } from "crypto"; +import { Crypto, ExecutableItem, Status } from "../model"; + +export const crypto: Crypto = { + uuid: () => { + return randomUUID(); + }, + md5: (str: string) => { + return createHash("md5").update(str).digest("hex"); + }, +}; + +export const isAnyStepFailed = (item: ExecutableItem): boolean => { + const isFailed = item.status === Status.FAILED; + + if (isFailed || item.steps.length === 0) { + return isFailed; + } + + return !!item.steps.find((step) => isAnyStepFailed(step)); +}; + +export const isAllStepsEnded = (item: ExecutableItem): boolean => { + return item.steps.every((val) => val.stop && isAllStepsEnded(val)); +}; diff --git a/packages/allure-js-commons/src/writers/InMemoryAllureWriter.ts b/packages/allure-js-commons/src/framework/writers/AllureInMemoryWriter.ts similarity index 75% rename from packages/allure-js-commons/src/writers/InMemoryAllureWriter.ts rename to packages/allure-js-commons/src/framework/writers/AllureInMemoryWriter.ts index c5c550661..9ddb15fcb 100644 --- a/packages/allure-js-commons/src/writers/InMemoryAllureWriter.ts +++ b/packages/allure-js-commons/src/framework/writers/AllureInMemoryWriter.ts @@ -1,16 +1,7 @@ -import { PathLike, readFileSync } from "fs"; -import { Category, TestResult, TestResultContainer } from "../model"; -import { AllureWriter } from "./AllureWriter"; +import { AllureResults, Category, TestResult, TestResultContainer } from "../../model"; +import { AllureWriter } from "../AllureWriter"; -export interface AllureResults { - tests: TestResult[]; - groups: TestResultContainer[]; - attachments: Record; - envInfo?: Record; - categories?: Category[]; -} - -export class InMemoryAllureWriter implements AllureWriter, AllureResults { +export class AllureInMemoryAllureWriter implements AllureWriter, AllureResults { public groups: TestResultContainer[] = []; public tests: TestResult[] = []; public attachments: Record = {}; @@ -29,8 +20,10 @@ export class InMemoryAllureWriter implements AllureWriter, AllureResults { this.attachments[name] = content; } - public writeAttachmentFromPath(from: PathLike, toFileName: string): void { - this.attachments[toFileName] = readFileSync(from); + public writeAttachmentFromPath(from: string, toFileName: string): void { + throw new Error( + "Can't write attachment from path because generic writer doesn't implement this logic! Use AllureInMemoryWriter for node.js.", + ); } public writeCategoriesDefinitions(categories: Category[]): void { diff --git a/packages/allure-js-commons/src/isPromise.ts b/packages/allure-js-commons/src/isPromise.ts deleted file mode 100644 index 47cd02b3b..000000000 --- a/packages/allure-js-commons/src/isPromise.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const isPromise = (obj: any): boolean => - !!obj && (typeof obj === "object" || typeof obj === "function") && typeof obj.then === "function"; diff --git a/packages/allure-js-commons/src/model.ts b/packages/allure-js-commons/src/model.ts index c99b7dd6a..b3a2b8f5c 100644 --- a/packages/allure-js-commons/src/model.ts +++ b/packages/allure-js-commons/src/model.ts @@ -2,6 +2,11 @@ export const ALLURE_METADATA_CONTENT_TYPE = "application/vnd.allure.metadata+jso export const ALLURE_IMAGEDIFF_CONTENT_TYPE = "application/vnd.allure.image.diff"; export const ALLURE_SKIPPED_BY_TEST_PLAN_LABEL = "allure-skipped-by-test-plan"; +export interface Crypto { + uuid: () => string; + md5: (str: string) => string; +} + export interface AttachmentMetadata { name: string; type: string; @@ -78,6 +83,7 @@ export interface ExecutableItem { } export type FixtureResult = ExecutableItem; + export type StepResult = ExecutableItem; export interface TestResult extends ExecutableItem { @@ -201,3 +207,11 @@ export interface ImageDiffAttachment { diff: string | undefined; // data:image;base64, name: string; } + +export interface AllureResults { + tests: TestResult[]; + groups: TestResultContainer[]; + attachments: Record; + envInfo?: Record; + categories?: Category[]; +} diff --git a/packages/allure-js-commons/src/node/runtime.ts b/packages/allure-js-commons/src/node/runtime.ts new file mode 100644 index 000000000..2030ca541 --- /dev/null +++ b/packages/allure-js-commons/src/node/runtime.ts @@ -0,0 +1,25 @@ +import { createHash, randomUUID } from "crypto"; +import { AllureConfig } from "../framework/AllureConfig"; +import { AllureRuntime } from "../framework/AllureRuntime"; +import { AttachmentOptions, ContentType } from "../model"; + +export class AllureNodeRuntime extends AllureRuntime { + constructor(config: AllureConfig & { resultsDir: string }) { + super(config, { + uuid: () => { + return randomUUID(); + }, + md5: (data: string) => { + return createHash("md5").update(data).digest("hex"); + }, + }); + } + + writeAttachmentFromPath(fromPath: string, options: ContentType | string | AttachmentOptions): string { + const fileName = this.buildAttachmentFileName(options); + + this.writer.writeAttachmentFromPath(fromPath, fileName); + + return fileName; + } +} diff --git a/packages/allure-js-commons/src/testplan.ts b/packages/allure-js-commons/src/node/testplan.ts similarity index 100% rename from packages/allure-js-commons/src/testplan.ts rename to packages/allure-js-commons/src/node/testplan.ts diff --git a/packages/allure-js-commons/src/node/utils.ts b/packages/allure-js-commons/src/node/utils.ts new file mode 100644 index 000000000..e6b24049d --- /dev/null +++ b/packages/allure-js-commons/src/node/utils.ts @@ -0,0 +1,169 @@ +import { readFile } from "fs/promises"; +import path from "path"; +import { env } from "process"; +import { ExecutableItem, Label, LabelName, Status } from "../model"; + +export const getLabelsFromEnv = (): Label[] => { + const envKeys = Object.keys(env); + const labels: Label[] = []; + + envKeys.forEach((key) => { + const labelRegexp = /^ALLURE_LABEL_(?.+)$/; + const match = key.match(labelRegexp); + if (match) { + const labelName = match.groups?.labelName; + const envValue = process.env[key]; + if (labelName && envValue) { + labels.push({ name: labelName.toLocaleLowerCase(), value: envValue }); + } + } + }); + + return labels; +}; + +const reRegExpChar = /[\\^$.*+?()[\]{}|]/g, + reHasRegExpChar = RegExp(reRegExpChar.source); + +export const escapeRegExp = (value: string): string => { + return reHasRegExpChar.test(value) ? value.replace(reRegExpChar, "\\$&") : value; +}; + +export const isAnyStepFailed = (item: ExecutableItem): boolean => { + const isFailed = item.status === Status.FAILED; + + if (isFailed || item.steps.length === 0) { + return isFailed; + } + + return !!item.steps.find((step) => isAnyStepFailed(step)); +}; + +export const isAllStepsEnded = (item: ExecutableItem): boolean => { + return item.steps.every((val) => val.stop && isAllStepsEnded(val)); +}; + +export const readImageAsBase64 = async (filePath: string): Promise => { + try { + const file = await readFile(filePath, { encoding: "base64" }); + return file ? `data:image/png;base64,${file}` : undefined; + } catch (e) { + return undefined; + } +}; + +const asciiRegex = new RegExp( + "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", // eslint-disable-line no-control-regex + "g", +); + +export const stripAscii = (str: string): string => { + return str.replace(asciiRegex, ""); +}; + +export const allureReportFolder = (outputFolder?: string): string => { + if (process.env.ALLURE_RESULTS_DIR) { + return path.resolve(process.cwd(), process.env.ALLURE_RESULTS_DIR); + } + if (outputFolder) { + return outputFolder; + } + return defaultReportFolder(); +}; + +export const defaultReportFolder = (): string => { + return path.resolve(process.cwd(), "allure-results"); +}; + +export const allureIdRegexp = /@?allure.id[:=](?[^\s]+)/; +export const allureIdRegexpGlobal = new RegExp(allureIdRegexp, "g"); + +export const allureLabelRegexp = /@?allure.label.(?[^\s]+?)[:=](?[^\s]+)/; +export const allureLabelRegexpGlobal = new RegExp(allureLabelRegexp, "g"); + +export const getStatusFromError = (error: Error): Status => { + switch (true) { + /** + * Native `node:assert` and `chai` (`vitest` uses it under the hood) throw `AssertionError` + * `jest` throws `JestAssertionError` instance + */ + case /assert/gi.test(error.constructor.name): + case /assert/gi.test(error.name): + case /assert/gi.test(error.message): + return Status.FAILED; + default: + return Status.BROKEN; + } +}; + +export const getSuitesLabels = (suites: string[]): Label[] => { + if (suites.length === 0) { + return []; + } + + const [parentSuite, suite, ...subSuites] = suites; + const labels: Label[] = []; + + if (parentSuite) { + labels.push({ + name: LabelName.PARENT_SUITE, + value: parentSuite, + }); + } + + if (suite) { + labels.push({ + name: LabelName.SUITE, + value: suite, + }); + } + + if (subSuites.length > 0) { + labels.push({ + name: LabelName.SUB_SUITE, + value: subSuites.join(" > "), + }); + } + + return labels; +}; + +export const serialize = (val: unknown): string => { + if (typeof val === "object" && !(val instanceof Map || val instanceof Set)) { + return JSON.stringify(val); + } + + if (val === undefined) { + return "undefined"; + } + + return (val as any).toString(); +}; + +export const extractMetadataFromString = ( + title: string, +): { + labels: Label[]; + cleanTitle: string; +} => { + const labels = [] as Label[]; + + title.split(" ").forEach((val) => { + const idValue = val.match(allureIdRegexp)?.groups?.id; + + if (idValue) { + labels.push({ name: LabelName.ALLURE_ID, value: idValue }); + } + + const labelMatch = val.match(allureLabelRegexp); + const { name, value } = labelMatch?.groups || {}; + + if (name && value) { + labels?.push({ name, value }); + } + }); + + const cleanTitle = title.replace(allureLabelRegexpGlobal, "").replace(allureIdRegexpGlobal, "").trim(); + + return { labels, cleanTitle }; +}; diff --git a/packages/allure-js-commons/src/writers/FileSystemAllureWriter.ts b/packages/allure-js-commons/src/node/writers/FileSystemAllureWriter.ts similarity index 77% rename from packages/allure-js-commons/src/writers/FileSystemAllureWriter.ts rename to packages/allure-js-commons/src/node/writers/FileSystemAllureWriter.ts index 93c8e70a9..447117e10 100644 --- a/packages/allure-js-commons/src/writers/FileSystemAllureWriter.ts +++ b/packages/allure-js-commons/src/node/writers/FileSystemAllureWriter.ts @@ -1,16 +1,17 @@ import { PathLike, copyFileSync, existsSync, mkdirSync, writeFileSync } from "fs"; import { join } from "path"; import { stringify } from "properties"; -import { AllureConfig } from "../AllureConfig"; -import { Category, TestResult, TestResultContainer } from "../model"; -import { AllureWriter } from "./AllureWriter"; +import { AllureConfig } from "../../framework/AllureConfig"; +import { AllureWriter } from "../../framework/AllureWriter"; +import { Category, TestResult, TestResultContainer } from "../../model"; const writeJson = (path: string, data: unknown): void => { - writeFileSync(path, JSON.stringify(data), { encoding: "utf-8" }); + writeFileSync(path, JSON.stringify(data), "utf8"); }; export class FileSystemAllureWriter implements AllureWriter { - constructor(private config: AllureConfig) { + constructor(private config: AllureConfig & { resultsDir: string }) { + // TODO: create results dir every time we write something if (!existsSync(this.config.resultsDir)) { mkdirSync(this.config.resultsDir, { recursive: true, @@ -20,7 +21,7 @@ export class FileSystemAllureWriter implements AllureWriter { writeAttachment(name: string, content: Buffer | string, encoding: BufferEncoding = "utf-8"): void { const path = this.buildPath(name); - writeFileSync(path, content, { encoding }); + writeFileSync(path, content, encoding); } writeAttachmentFromPath(from: PathLike, distFileName: string): void { diff --git a/packages/allure-js-commons/src/node/writers/InMemoryAllureWriter.ts b/packages/allure-js-commons/src/node/writers/InMemoryAllureWriter.ts new file mode 100644 index 000000000..2dc46f8ce --- /dev/null +++ b/packages/allure-js-commons/src/node/writers/InMemoryAllureWriter.ts @@ -0,0 +1,8 @@ +import { PathLike, readFileSync } from "fs"; +import { AllureInMemoryAllureWriter as CommonInMemoryWriter } from "../../framework/writers/AllureInMemoryWriter"; + +export class AllureInMemoryWriter extends CommonInMemoryWriter { + public writeAttachmentFromPath(from: PathLike, toFileName: string): void { + this.attachments[toFileName] = readFileSync(from); + } +} diff --git a/packages/allure-js-commons/src/writers/MessageAllureWriter.ts b/packages/allure-js-commons/src/node/writers/MessageAllureWriter.ts similarity index 92% rename from packages/allure-js-commons/src/writers/MessageAllureWriter.ts rename to packages/allure-js-commons/src/node/writers/MessageAllureWriter.ts index 45e2c28ed..729b9a308 100644 --- a/packages/allure-js-commons/src/writers/MessageAllureWriter.ts +++ b/packages/allure-js-commons/src/node/writers/MessageAllureWriter.ts @@ -1,7 +1,7 @@ import { PathLike, readFileSync } from "fs"; import { stringify } from "properties"; -import { Category, TestResult, TestResultContainer } from "../model"; -import { AllureWriter } from "./AllureWriter"; +import { Category, TestResult, TestResultContainer } from "../../model"; +import { AllureWriter } from "../../framework/AllureWriter"; type EventType = "result" | "container" | "attachment" | "misc"; type Event = { diff --git a/packages/allure-js-commons/src/node/writers/index.ts b/packages/allure-js-commons/src/node/writers/index.ts new file mode 100644 index 000000000..ec283ed7d --- /dev/null +++ b/packages/allure-js-commons/src/node/writers/index.ts @@ -0,0 +1,3 @@ +export { FileSystemAllureWriter } from "./FileSystemAllureWriter"; +export { AllureInMemoryWriter } from "./InMemoryAllureWriter"; +export { MessageAllureWriter } from "./MessageAllureWriter"; diff --git a/packages/allure-js-commons/src/utils.ts b/packages/allure-js-commons/src/utils.ts index 2f434dd6c..f42ab70a1 100644 --- a/packages/allure-js-commons/src/utils.ts +++ b/packages/allure-js-commons/src/utils.ts @@ -1,134 +1,912 @@ -import { createHash } from "crypto"; -import { readFile } from "fs/promises"; -import path from "path"; -import { env } from "process"; -import { ExecutableItem, Label, LabelName, Status } from "./model"; - -export const md5 = (data: string) => createHash("md5").update(data).digest("hex"); - -export const getLabelsFromEnv = (): Label[] => { - const envKeys = Object.keys(env); - const labels: Label[] = []; - - envKeys.forEach((key) => { - const labelRegexp = /^ALLURE_LABEL_(?.+)$/; - const match = key.match(labelRegexp); - if (match) { - const labelName = match.groups?.labelName; - const envValue = process.env[key]; - if (labelName && envValue) { - labels.push({ name: labelName.toLocaleLowerCase(), value: envValue }); - } - } - }); - - return labels; -}; - -const reRegExpChar = /[\\^$.*+?()[\]{}|]/g, - reHasRegExpChar = RegExp(reRegExpChar.source); - -export const escapeRegExp = (value: string): string => { - return reHasRegExpChar.test(value) ? value.replace(reRegExpChar, "\\$&") : value; -}; - -export const isAnyStepFailed = (item: ExecutableItem): boolean => { - const isFailed = item.status === Status.FAILED; - - if (isFailed || item.steps.length === 0) { - return isFailed; - } - - return !!item.steps.find((step) => isAnyStepFailed(step)); -}; - -export const isAllStepsEnded = (item: ExecutableItem): boolean => { - return item.steps.every((val) => val.stop && isAllStepsEnded(val)); -}; - -export const readImageAsBase64 = async (filePath: string): Promise => { - try { - const file = await readFile(filePath, { encoding: "base64" }); - return file ? `data:image/png;base64,${file}` : undefined; - } catch (e) { - return undefined; - } -}; - -const asciiRegex = new RegExp( - "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", // eslint-disable-line no-control-regex - "g", -); - -export const stripAscii = (str: string): string => { - return str.replace(asciiRegex, ""); -}; - -export const allureReportFolder = (outputFolder?: string): string => { - if (process.env.ALLURE_RESULTS_DIR) { - return path.resolve(process.cwd(), process.env.ALLURE_RESULTS_DIR); - } - if (outputFolder) { - return outputFolder; - } - return defaultReportFolder(); -}; - -export const defaultReportFolder = (): string => { - return path.resolve(process.cwd(), "allure-results"); -}; - -export const allureIdRegexp = /@?allure.id[:=](?[^\s]+)/; -export const allureIdRegexpGlobal = new RegExp(allureIdRegexp, "g"); - -export const allureLabelRegexp = /@?allure.label.(?[^\s]+?)[:=](?[^\s]+)/; -export const allureLabelRegexpGlobal = new RegExp(allureLabelRegexp, "g"); - -export const getStatusFromError = (error: Error): Status => { - switch (true) { - /** - * Native `node:assert` and `chai` (`vitest` uses it under the hood) throw `AssertionError` - * `jest` throws `JestAssertionError` instance - */ - case /assert/gi.test(error.constructor.name): - case /assert/gi.test(error.name): - case /assert/gi.test(error.message): - return Status.FAILED; - default: - return Status.BROKEN; - } -}; - -export const getSuitesLabels = (suites: string[]): Label[] => { - if (suites.length === 0) { - return []; - } - - const [parentSuite, suite, ...subSuites] = suites; - const labels: Label[] = []; - - if (parentSuite) { - labels.push({ - name: LabelName.PARENT_SUITE, - value: parentSuite, - }); +import { AttachmentOptions } from "./model"; + +const EXTENSIONS_BY_TYPE: Record = { + "application/andrew-inset": ".ez", + "application/applixware": ".aw", + "application/atom+xml": ".atom", + "application/atomcat+xml": ".atomcat", + "application/atomsvc+xml": ".atomsvc", + "application/bizagi-modeler": ".bpm", + "application/cbor": ".cbor", + "application/ccxml+xml": ".ccxml", + "application/coreldraw": ".cdr", + "application/cu-seeme": ".cu", + "application/dash+xml": ".mpd", + "application/davmount+xml": ".davmount", + "application/dif+xml": ".dif", + "application/dita+xml; format=map": ".ditamap", + "application/dita+xml; format=topic": ".dita", + "application/dita+xml; format=val": ".ditaval", + "application/ecmascript": ".ecma", + "application/emma+xml": ".emma", + "application/envi.hdr": ".hdr", + "application/epub+zip": ".epub", + "application/fits": ".fits", + "application/font-tdpfr": ".pfr", + "application/gzip": ".gz", + "application/hyperstudio": ".stk", + "application/illustrator": ".ai", + "application/java-archive": ".jar", + "application/java-serialized-object": ".ser", + "application/java-vm": ".class", + "application/javascript": ".js", + "application/json": ".json", + "application/lost+xml": ".lostxml", + "application/mac-binhex40": ".hqx", + "application/mac-compactpro": ".cpt", + "application/manifest+json": ".webmanifest", + "application/marc": ".mrc", + "application/mathematica": ".ma", + "application/mathml+xml": ".mathml", + "application/mbox": ".mbox", + "application/mediaservercontrol+xml": ".mscml", + "application/mp4": ".mp4s", + "application/msword": ".doc", + "application/mxf": ".mxf", + "application/octet-stream": ".bin", + "application/oda": ".oda", + "application/oebps-package+xml": ".opf", + "application/ogg": ".ogx", + "application/onenote": ".onetmp", + "application/onenote; format=one": ".one", + "application/onenote; format=onetoc2": ".onetoc", + "application/onenote; format=package": ".onepkg", + "application/patch-ops-error+xml": ".xer", + "application/pdf": ".pdf", + "application/pgp-encrypted": ".pgp", + "application/pgp-signature": ".asc", + "application/pics-rules": ".prf", + "application/pkcs7-mime": ".p7m", + "application/pkcs7-signature": ".p7s", + "application/pkcs10": ".p10", + "application/pkix-cert": ".cer", + "application/pkix-crl": ".crl", + "application/pkix-pkipath": ".pkipath", + "application/pkixcmp": ".pki", + "application/pls+xml": ".pls", + "application/postscript": ".ps", + "application/prs.cww": ".cww", + "application/rdf+xml": ".rdf", + "application/reginfo+xml": ".rif", + "application/relax-ng-compact-syntax": ".rnc", + "application/resource-lists+xml": ".rl", + "application/resource-lists-diff+xml": ".rld", + "application/rls-services+xml": ".rs", + "application/rsd+xml": ".rsd", + "application/rss+xml": ".rss", + "application/rtf": ".rtf", + "application/sbml+xml": ".sbml", + "application/scvp-cv-request": ".scq", + "application/scvp-cv-response": ".scs", + "application/scvp-vp-request": ".spq", + "application/scvp-vp-response": ".spp", + "application/sdp": ".sdp", + "application/sereal": ".srl", + "application/set-payment-initiation": ".setpay", + "application/set-registration-initiation": ".setreg", + "application/shf+xml": ".shf", + "application/sldworks": ".sldprt", + "application/smil+xml": ".smi", + "application/sparql-query": ".rq", + "application/sparql-results+xml": ".srx", + "application/srgs": ".gram", + "application/srgs+xml": ".grxml", + "application/ssml+xml": ".ssml", + "application/timestamped-data": ".tsd", + "application/vnd.3gpp.pic-bw-large": ".plb", + "application/vnd.3gpp.pic-bw-small": ".psb", + "application/vnd.3gpp.pic-bw-var": ".pvb", + "application/vnd.3gpp2.tcap": ".tcap", + "application/vnd.3m.post-it-notes": ".pwn", + "application/vnd.accpac.simply.aso": ".aso", + "application/vnd.accpac.simply.imp": ".imp", + "application/vnd.acucobol": ".acu", + "application/vnd.acucorp": ".atc", + "application/vnd.adobe.aftereffects.project": ".aep", + "application/vnd.adobe.aftereffects.template": ".aet", + "application/vnd.adobe.air-application-installer-package+zip": ".air", + "application/vnd.adobe.indesign-idml-package": ".idml", + "application/vnd.adobe.xdp+xml": ".xdp", + "application/vnd.adobe.xfdf": ".xfdf", + "application/vnd.airzip.filesecure.azf": ".azf", + "application/vnd.airzip.filesecure.azs": ".azs", + "application/vnd.allure.image.diff": ".imagediff", + "application/vnd.allure.metadata+json": ".metadata", + "application/vnd.amazon.ebook": ".azw", + "application/vnd.americandynamics.acc": ".acc", + "application/vnd.amiga.ami": ".ami", + "application/vnd.android.package-archive": ".apk", + "application/vnd.anser-web-certificate-issue-initiation": ".cii", + "application/vnd.anser-web-funds-transfer-initiation": ".fti", + "application/vnd.antix.game-component": ".atx", + "application/vnd.apple.installer+xml": ".mpkg", + "application/vnd.apple.keynote": ".key", + "application/vnd.apple.mpegurl": ".m3u8", + "application/vnd.apple.numbers": ".numbers", + "application/vnd.apple.pages": ".pages", + "application/vnd.arastra.swi": ".swi", + "application/vnd.blueice.multipass": ".mpm", + "application/vnd.bmi": ".bmi", + "application/vnd.businessobjects": ".rep", + "application/vnd.chemdraw+xml": ".cdxml", + "application/vnd.chipnuts.karaoke-mmd": ".mmd", + "application/vnd.cinderella": ".cdy", + "application/vnd.claymore": ".cla", + "application/vnd.clonk.c4group": ".c4g", + "application/vnd.commonspace": ".csp", + "application/vnd.contact.cmsg": ".cdbcmsg", + "application/vnd.cosmocaller": ".cmc", + "application/vnd.crick.clicker": ".clkx", + "application/vnd.crick.clicker.keyboard": ".clkk", + "application/vnd.crick.clicker.palette": ".clkp", + "application/vnd.crick.clicker.template": ".clkt", + "application/vnd.crick.clicker.wordbank": ".clkw", + "application/vnd.criticaltools.wbs+xml": ".wbs", + "application/vnd.ctc-posml": ".pml", + "application/vnd.cups-ppd": ".ppd", + "application/vnd.curl.car": ".car", + "application/vnd.curl.pcurl": ".pcurl", + "application/vnd.data-vision.rdz": ".rdz", + "application/vnd.denovo.fcselayout-link": ".fe_launch", + "application/vnd.dna": ".dna", + "application/vnd.dolby.mlp": ".mlp", + "application/vnd.dpgraph": ".dpg", + "application/vnd.dreamfactory": ".dfac", + "application/vnd.dynageo": ".geo", + "application/vnd.ecowin.chart": ".mag", + "application/vnd.enliven": ".nml", + "application/vnd.epson.esf": ".esf", + "application/vnd.epson.msf": ".msf", + "application/vnd.epson.quickanime": ".qam", + "application/vnd.epson.salt": ".slt", + "application/vnd.epson.ssf": ".ssf", + "application/vnd.eszigno3+xml": ".es3", + "application/vnd.etsi.asic-e+zip": ".asice", + "application/vnd.etsi.asic-s+zip": ".asics", + "application/vnd.ezpix-album": ".ez2", + "application/vnd.ezpix-package": ".ez3", + "application/vnd.fdf": ".fdf", + "application/vnd.fdsn.mseed": ".mseed", + "application/vnd.fdsn.seed": ".seed", + "application/vnd.flographit": ".gph", + "application/vnd.fluxtime.clip": ".ftc", + "application/vnd.framemaker": ".fm", + "application/vnd.frogans.fnc": ".fnc", + "application/vnd.frogans.ltf": ".ltf", + "application/vnd.fsc.weblaunch": ".fsc", + "application/vnd.fujitsu.oasys": ".oas", + "application/vnd.fujitsu.oasys2": ".oa2", + "application/vnd.fujitsu.oasys3": ".oa3", + "application/vnd.fujitsu.oasysgp": ".fg5", + "application/vnd.fujitsu.oasysprs": ".bh2", + "application/vnd.fujixerox.ddd": ".ddd", + "application/vnd.fujixerox.docuworks": ".xdw", + "application/vnd.fujixerox.docuworks.binder": ".xbd", + "application/vnd.fuzzysheet": ".fzs", + "application/vnd.genomatix.tuxedo": ".txd", + "application/vnd.geogebra.file": ".ggb", + "application/vnd.geogebra.tool": ".ggt", + "application/vnd.geometry-explorer": ".gex", + "application/vnd.gmx": ".gmx", + "application/vnd.google-earth.kml+xml": ".kml", + "application/vnd.google-earth.kmz": ".kmz", + "application/vnd.grafeq": ".gqf", + "application/vnd.groove-account": ".gac", + "application/vnd.groove-help": ".ghf", + "application/vnd.groove-identity-message": ".gim", + "application/vnd.groove-injector": ".grv", + "application/vnd.groove-tool-message": ".gtm", + "application/vnd.groove-tool-template": ".tpl", + "application/vnd.groove-vcard": ".vcg", + "application/vnd.handheld-entertainment+xml": ".zmm", + "application/vnd.hbci": ".hbci", + "application/vnd.hhe.lesson-player": ".les", + "application/vnd.hp-hpgl": ".hpgl", + "application/vnd.hp-hpid": ".hpid", + "application/vnd.hp-hps": ".hps", + "application/vnd.hp-jlyt": ".jlt", + "application/vnd.hp-pcl": ".pcl", + "application/vnd.hp-pclxl": ".pclxl", + "application/vnd.hydrostatix.sof-data": ".sfd-hdstx", + "application/vnd.hzn-3d-crossword": ".x3d", + "application/vnd.ibm.minipay": ".mpy", + "application/vnd.ibm.modcap": ".afp", + "application/vnd.ibm.rights-management": ".irm", + "application/vnd.ibm.secure-container": ".sc", + "application/vnd.iccprofile": ".icc", + "application/vnd.igloader": ".igl", + "application/vnd.immervision-ivp": ".ivp", + "application/vnd.immervision-ivu": ".ivu", + "application/vnd.intercon.formnet": ".xpw", + "application/vnd.intu.qbo": ".qbo", + "application/vnd.intu.qfx": ".qfx", + "application/vnd.iptc.g2.newsmessage+xml": ".nar", + "application/vnd.ipunplugged.rcprofile": ".rcprofile", + "application/vnd.irepository.package+xml": ".irp", + "application/vnd.is-xpr": ".xpr", + "application/vnd.jam": ".jam", + "application/vnd.java.hprof": ".hprof", + "application/vnd.java.hprof.text": ".hprof.txt", + "application/vnd.jcp.javame.midlet-rms": ".rms", + "application/vnd.jisp": ".jisp", + "application/vnd.joost.joda-archive": ".joda", + "application/vnd.kahootz": ".ktz", + "application/vnd.kde.karbon": ".karbon", + "application/vnd.kde.kchart": ".chrt", + "application/vnd.kde.kformula": ".kfo", + "application/vnd.kde.kivio": ".flw", + "application/vnd.kde.kontour": ".kon", + "application/vnd.kde.kpresenter": ".kpr", + "application/vnd.kde.kspread": ".ksp", + "application/vnd.kde.kword": ".kwd", + "application/vnd.kenameaapp": ".htke", + "application/vnd.kidspiration": ".kia", + "application/vnd.kinar": ".kne", + "application/vnd.koan": ".skp", + "application/vnd.kodak-descriptor": ".sse", + "application/vnd.llamagraphics.life-balance.desktop": ".lbd", + "application/vnd.llamagraphics.life-balance.exchange+xml": ".lbe", + "application/vnd.lotus-1-2-3": ".wk1", + "application/vnd.lotus-1-2-3; version=2": ".wk1", + "application/vnd.lotus-1-2-3; version=3": ".wk3", + "application/vnd.lotus-1-2-3; version=4": ".wk4", + "application/vnd.lotus-1-2-3; version=97+9.x": ".123", + "application/vnd.lotus-approach": ".apr", + "application/vnd.lotus-freelance": ".pre", + "application/vnd.lotus-notes": ".nsf", + "application/vnd.lotus-organizer": ".org", + "application/vnd.lotus-wordpro": ".lwp", + "application/vnd.macports.portpkg": ".portpkg", + "application/vnd.mcd": ".mcd", + "application/vnd.medcalcdata": ".mc1", + "application/vnd.mediastation.cdkey": ".cdkey", + "application/vnd.mfer": ".mwf", + "application/vnd.mfmp": ".mfm", + "application/vnd.micrografx.flo": ".flo", + "application/vnd.micrografx.igx": ".igx", + "application/vnd.mif": ".mif", + "application/vnd.mindjet.mindmanager": ".mmp", + "application/vnd.mobius.daf": ".daf", + "application/vnd.mobius.dis": ".dis", + "application/vnd.mobius.mbk": ".mbk", + "application/vnd.mobius.mqy": ".mqy", + "application/vnd.mobius.msl": ".msl", + "application/vnd.mobius.plc": ".plc", + "application/vnd.mobius.txf": ".txf", + "application/vnd.mophun.application": ".mpn", + "application/vnd.mophun.certificate": ".mpc", + "application/vnd.mozilla.xul+xml": ".xul", + "application/vnd.ms-artgalry": ".cil", + "application/vnd.ms-cab-compressed": ".cab", + "application/vnd.ms-excel": ".xls", + "application/vnd.ms-excel.addin.macroenabled.12": ".xlam", + "application/vnd.ms-excel.sheet.binary.macroenabled.12": ".xlsb", + "application/vnd.ms-excel.sheet.macroenabled.12": ".xlsm", + "application/vnd.ms-excel.template.macroenabled.12": ".xltm", + "application/vnd.ms-fontobject": ".eot", + "application/vnd.ms-htmlhelp": ".chm", + "application/vnd.ms-ims": ".ims", + "application/vnd.ms-lrm": ".lrm", + "application/vnd.ms-outlook": ".msg", + "application/vnd.ms-outlook-pst": ".pst", + "application/vnd.ms-pki.seccat": ".cat", + "application/vnd.ms-pki.stl": ".stl", + "application/vnd.ms-powerpoint": ".ppt", + "application/vnd.ms-powerpoint.addin.macroenabled.12": ".ppam", + "application/vnd.ms-powerpoint.presentation.macroenabled.12": ".pptm", + "application/vnd.ms-powerpoint.slide.macroenabled.12": ".sldm", + "application/vnd.ms-powerpoint.slideshow.macroenabled.12": ".ppsm", + "application/vnd.ms-powerpoint.template.macroenabled.12": ".potm", + "application/vnd.ms-project": ".mpp", + "application/vnd.ms-visio.drawing": ".vsdx", + "application/vnd.ms-visio.drawing.macroenabled.12": ".vsdm", + "application/vnd.ms-visio.stencil": ".vssx", + "application/vnd.ms-visio.stencil.macroenabled.12": ".vssm", + "application/vnd.ms-visio.template": ".vstx", + "application/vnd.ms-visio.template.macroenabled.12": ".vstm", + "application/vnd.ms-word.document.macroenabled.12": ".docm", + "application/vnd.ms-word.template.macroenabled.12": ".dotm", + "application/vnd.ms-works": ".wps", + "application/vnd.ms-wpl": ".wpl", + "application/vnd.ms-xpsdocument": ".xps", + "application/vnd.mseq": ".mseq", + "application/vnd.musician": ".mus", + "application/vnd.muvee.style": ".msty", + "application/vnd.neurolanguage.nlu": ".nlu", + "application/vnd.noblenet-directory": ".nnd", + "application/vnd.noblenet-sealer": ".nns", + "application/vnd.noblenet-web": ".nnw", + "application/vnd.nokia.n-gage.data": ".ngdat", + "application/vnd.nokia.n-gage.symbian.install": ".n-gage", + "application/vnd.nokia.radio-preset": ".rpst", + "application/vnd.nokia.radio-presets": ".rpss", + "application/vnd.novadigm.edm": ".edm", + "application/vnd.novadigm.edx": ".edx", + "application/vnd.novadigm.ext": ".ext", + "application/vnd.oasis.opendocument.base": ".odb", + "application/vnd.oasis.opendocument.chart": ".odc", + "application/vnd.oasis.opendocument.chart-template": ".otc", + "application/vnd.oasis.opendocument.flat.presentation": ".fodp", + "application/vnd.oasis.opendocument.flat.spreadsheet": ".fods", + "application/vnd.oasis.opendocument.flat.text": ".fodt", + "application/vnd.oasis.opendocument.formula": ".odf", + "application/vnd.oasis.opendocument.formula-template": ".odft", + "application/vnd.oasis.opendocument.graphics": ".odg", + "application/vnd.oasis.opendocument.graphics-template": ".otg", + "application/vnd.oasis.opendocument.image": ".odi", + "application/vnd.oasis.opendocument.image-template": ".oti", + "application/vnd.oasis.opendocument.presentation": ".odp", + "application/vnd.oasis.opendocument.presentation-template": ".otp", + "application/vnd.oasis.opendocument.spreadsheet": ".ods", + "application/vnd.oasis.opendocument.spreadsheet-template": ".ots", + "application/vnd.oasis.opendocument.text": ".odt", + "application/vnd.oasis.opendocument.text-master": ".otm", + "application/vnd.oasis.opendocument.text-template": ".ott", + "application/vnd.oasis.opendocument.text-web": ".oth", + "application/vnd.olpc-sugar": ".xo", + "application/vnd.oma.dd2+xml": ".dd2", + "application/vnd.openofficeorg.autotext": ".bau", + "application/vnd.openofficeorg.extension": ".oxt", + "application/vnd.openxmlformats-officedocument.presentationml.presentation": ".pptx", + "application/vnd.openxmlformats-officedocument.presentationml.slide": ".sldx", + "application/vnd.openxmlformats-officedocument.presentationml.slideshow": ".ppsx", + "application/vnd.openxmlformats-officedocument.presentationml.template": ".potx", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ".xlsx", + "application/vnd.openxmlformats-officedocument.spreadsheetml.template": ".xltx", + "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx", + "application/vnd.openxmlformats-officedocument.wordprocessingml.template": ".dotx", + "application/vnd.osgi.dp": ".dp", + "application/vnd.palm": ".pqa", + "application/vnd.pg.format": ".str", + "application/vnd.pg.osasli": ".ei6", + "application/vnd.picsel": ".efif", + "application/vnd.pocketlearn": ".plf", + "application/vnd.powerbuilder6": ".pbd", + "application/vnd.previewsystems.box": ".box", + "application/vnd.proteus.magazine": ".mgz", + "application/vnd.publishare-delta-tree": ".qps", + "application/vnd.pvi.ptid1": ".ptid", + "application/vnd.quark.quarkxpress": ".qxd", + "application/vnd.recordare.musicxml": ".mxl", + "application/vnd.recordare.musicxml+xml": ".musicxml", + "application/vnd.rim.cod": ".cod", + "application/vnd.rn-realmedia": ".rm", + "application/vnd.route66.link66+xml": ".link66", + "application/vnd.seemail": ".see", + "application/vnd.sema": ".sema", + "application/vnd.semd": ".semd", + "application/vnd.semf": ".semf", + "application/vnd.shana.informed.formdata": ".ifm", + "application/vnd.shana.informed.formtemplate": ".itp", + "application/vnd.shana.informed.interchange": ".iif", + "application/vnd.shana.informed.package": ".ipk", + "application/vnd.simtech-mindmapper": ".twd", + "application/vnd.smaf": ".mmf", + "application/vnd.smart.teacher": ".teacher", + "application/vnd.solent.sdkm+xml": ".sdkm", + "application/vnd.spotfire.dxp": ".dxp", + "application/vnd.spotfire.sfs": ".sfs", + "application/vnd.stardivision.calc": ".sdc", + "application/vnd.stardivision.draw": ".sda", + "application/vnd.stardivision.impress": ".sdd", + "application/vnd.stardivision.math": ".smf", + "application/vnd.stardivision.writer": ".sdw", + "application/vnd.stardivision.writer-global": ".sgl", + "application/vnd.sun.xml.calc": ".sxc", + "application/vnd.sun.xml.calc.template": ".stc", + "application/vnd.sun.xml.draw": ".sxd", + "application/vnd.sun.xml.draw.template": ".std", + "application/vnd.sun.xml.impress": ".sxi", + "application/vnd.sun.xml.impress.template": ".sti", + "application/vnd.sun.xml.math": ".sxm", + "application/vnd.sun.xml.writer": ".sxw", + "application/vnd.sun.xml.writer.global": ".sxg", + "application/vnd.sun.xml.writer.template": ".stw", + "application/vnd.sus-calendar": ".sus", + "application/vnd.svd": ".svd", + "application/vnd.symbian.install": ".sis", + "application/vnd.syncml+xml": ".xsm", + "application/vnd.syncml.dm+wbxml": ".bdm", + "application/vnd.syncml.dm+xml": ".xdm", + "application/vnd.tao.intent-module-archive": ".tao", + "application/vnd.tcpdump.pcap": ".pcap", + "application/vnd.tmobile-livetv": ".tmo", + "application/vnd.trid.tpt": ".tpt", + "application/vnd.triscape.mxs": ".mxs", + "application/vnd.trueapp": ".tra", + "application/vnd.ufdl": ".ufd", + "application/vnd.uiq.theme": ".utz", + "application/vnd.umajin": ".umj", + "application/vnd.unity": ".unityweb", + "application/vnd.uoml+xml": ".uoml", + "application/vnd.vcx": ".vcx", + "application/vnd.visio": ".vsd", + "application/vnd.visionary": ".vis", + "application/vnd.vsf": ".vsf", + "application/vnd.wap.wbxml": ".wbxml", + "application/vnd.wap.wmlc": ".wmlc", + "application/vnd.wap.wmlscriptc": ".wmlsc", + "application/vnd.webturbo": ".wtb", + "application/vnd.wolfram.wl": ".wl", + "application/vnd.wordperfect": ".wpd", + "application/vnd.wqd": ".wqd", + "application/vnd.wt.stf": ".stf", + "application/vnd.xara": ".xar", + "application/vnd.xfdl": ".xfdl", + "application/vnd.yamaha.hv-dic": ".hvd", + "application/vnd.yamaha.hv-script": ".hvs", + "application/vnd.yamaha.hv-voice": ".hvp", + "application/vnd.yamaha.openscoreformat": ".osf", + "application/vnd.yamaha.openscoreformat.osfpvg+xml": ".osfpvg", + "application/vnd.yamaha.smaf-audio": ".saf", + "application/vnd.yamaha.smaf-phrase": ".spf", + "application/vnd.yellowriver-custom-menu": ".cmp", + "application/vnd.zul": ".zir", + "application/vnd.zzazz.deck+xml": ".zaz", + "application/voicexml+xml": ".vxml", + "application/warc": ".warc", + "application/wasm": ".wasm", + "application/winhlp": ".hlp", + "application/wsdl+xml": ".wsdl", + "application/wspolicy+xml": ".wspolicy", + "application/x-7z-compressed": ".7z", + "application/x-abiword": ".abw", + "application/x-ace-compressed": ".ace", + "application/x-adobe-indesign": ".indd", + "application/x-adobe-indesign-interchange": ".inx", + "application/x-apple-diskimage": ".dmg", + "application/x-appleworks": ".cwk", + "application/x-archive": ".ar", + "application/x-arj": ".arj", + "application/x-authorware-bin": ".aab", + "application/x-authorware-map": ".aam", + "application/x-authorware-seg": ".aas", + "application/x-axcrypt": ".axx", + "application/x-bat": ".bat", + "application/x-bcpio": ".bcpio", + "application/x-bibtex-text-file": ".bib", + "application/x-bittorrent": ".torrent", + "application/x-brotli": ".br", + "application/x-bzip": ".bz", + "application/x-bzip2": ".bz2", + "application/x-cdlink": ".vcd", + "application/x-chat": ".chat", + "application/x-chess-pgn": ".pgn", + "application/x-chrome-package": ".crx", + "application/x-compress": ".z", + "application/x-corelpresentations": ".shw", + "application/x-cpio": ".cpio", + "application/x-csh": ".csh", + "application/x-dbf": ".dbf", + "application/x-debian-package": ".deb", + "application/x-dex": ".dex", + "application/x-director": ".dir", + "application/x-doom": ".wad", + "application/x-dosexec": ".exe", + "application/x-dtbncx+xml": ".ncx", + "application/x-dtbook+xml": ".dtb", + "application/x-dtbresource+xml": ".res", + "application/x-dvi": ".dvi", + "application/x-elc": ".elc", + "application/x-endnote-refer": ".enw", + "application/x-erdas-hfa": ".hfa", + "application/x-esri-layer": ".lyr", + "application/x-fictionbook+xml": ".fb2", + "application/x-filemaker": ".fp7", + "application/x-font-adobe-metric": ".afm", + "application/x-font-bdf": ".bdf", + "application/x-font-ghostscript": ".gsf", + "application/x-font-linux-psf": ".psf", + "application/x-font-otf": ".otf", + "application/x-font-pcf": ".pcf", + "application/x-font-printer-metric": ".pfm", + "application/x-font-snf": ".snf", + "application/x-font-ttf": ".ttf", + "application/x-font-type1": ".pfa", + "application/x-futuresplash": ".spl", + "application/x-gnucash": ".gnucash", + "application/x-gnumeric": ".gnumeric", + "application/x-grib": ".grb", + "application/x-gtar": ".gtar", + "application/x-hdf": ".hdf", + "application/x-ibooks+zip": ".ibooks", + "application/x-internet-archive": ".arc", + "application/x-iso9660-image": ".iso", + "application/x-itunes-ipa": ".ipa", + "application/x-java-jnilib": ".jnilib", + "application/x-java-jnlp-file": ".jnlp", + "application/x-java-pack200": ".pack", + "application/x-killustrator": ".kil", + "application/x-latex": ".latex", + "application/x-lz4": ".lz4", + "application/x-lzip": ".lz", + "application/x-lzma": ".lzma", + "application/x-matlab-data": ".mat", + "application/x-memgraph": ".memgraph", + "application/x-mobipocket-ebook": ".prc", + "application/x-ms-application": ".application", + "application/x-ms-asx": ".asx", + "application/x-ms-installer": ".msi", + "application/x-ms-wmd": ".wmd", + "application/x-ms-wmz": ".wmz", + "application/x-ms-xbap": ".xbap", + "application/x-msaccess": ".mdb", + "application/x-msbinder": ".obd", + "application/x-mscardfile": ".crd", + "application/x-msclip": ".clp", + "application/x-msdownload": ".dll", + "application/x-msmediaview": ".mvb", + "application/x-msmoney": ".mny", + "application/x-mspublisher": ".pub", + "application/x-msschedule": ".scd", + "application/x-msterminal": ".trm", + "application/x-mswrite": ".wri", + "application/x-mysql-misam-compressed-index": ".MYI", + "application/x-mysql-misam-data": ".MYD", + "application/x-nesrom": ".nes", + "application/x-netcdf": ".nc", + "application/x-parquet": ".parquet", + "application/x-pkcs7-certificates": ".p7b", + "application/x-pkcs7-certreqresp": ".p7r", + "application/x-pkcs12": ".p12", + "application/x-project": ".mpx", + "application/x-prt": ".prt", + "application/x-quattro-pro": ".wq1", + "application/x-quattro-pro; version=1+5": ".wb1", + "application/x-quattro-pro; version=1-4": ".wq1", + "application/x-quattro-pro; version=5": ".wq2", + "application/x-quattro-pro; version=6": ".wb2", + "application/x-rar-compressed": ".rar", + "application/x-roxio-toast": ".toast", + "application/x-rpm": ".rpm", + "application/x-sas": ".sas", + "application/x-sas-access": ".sa7", + "application/x-sas-audit": ".st7", + "application/x-sas-backup": ".sas7bbak", + "application/x-sas-catalog": ".sc7", + "application/x-sas-data": ".sd7", + "application/x-sas-data-index": ".si7", + "application/x-sas-data-v6": ".sd2", + "application/x-sas-dmdb": ".s7m", + "application/x-sas-fdb": ".sf7", + "application/x-sas-itemstor": ".sr7", + "application/x-sas-mddb": ".sm7", + "application/x-sas-program-data": ".ss7", + "application/x-sas-putility": ".sp7", + "application/x-sas-transport": ".stx", + "application/x-sas-utility": ".su7", + "application/x-sas-view": ".sv7", + "application/x-sas-xport": ".xpt", + "application/x-sfdu": ".sfdu", + "application/x-sh": ".sh", + "application/x-shapefile": ".shp", + "application/x-shar": ".shar", + "application/x-shockwave-flash": ".swf", + "application/x-silverlight-app": ".xap", + "application/x-snappy-framed": ".sz", + "application/x-staroffice-template": ".vor", + "application/x-stata-do": ".do", + "application/x-stata-dta": ".dta", + "application/x-stuffit": ".sit", + "application/x-stuffitx": ".sitx", + "application/x-sv4cpio": ".sv4cpio", + "application/x-sv4crc": ".sv4crc", + "application/x-tar": ".tar", + "application/x-tex": ".tex", + "application/x-tex-tfm": ".tfm", + "application/x-texinfo": ".texinfo", + "application/x-tika-java-enterprise-archive": ".ear", + "application/x-tika-java-web-archive": ".war", + "application/x-tika-msworks-spreadsheet": ".xlr", + "application/x-tmx": ".tmx", + "application/x-uc2-compressed": ".uc2", + "application/x-ustar": ".ustar", + "application/x-vmdk": ".vmdk", + "application/x-wais-source": ".src", + "application/x-webarchive": ".webarchive", + "application/x-x509-cert": ".crt", + "application/x-x509-cert; format=der": ".der", + "application/x-x509-cert; format=pem": ".pem", + "application/x-xfig": ".fig", + "application/x-xliff+xml": ".xlf", + "application/x-xliff+zip": ".xlz", + "application/x-xmind": ".xmind", + "application/x-xpinstall": ".xpi", + "application/x-xz": ".xz", + "application/x-zoo": ".zoo", + "application/xenc+xml": ".xenc", + "application/xhtml+xml": ".xhtml", + "application/xml": ".xml", + "application/xml-dtd": ".dtd", + "application/xop+xml": ".xop", + "application/xquery": ".xq", + "application/xslfo+xml": ".xslfo", + "application/xslt+xml": ".xslt", + "application/xspf+xml": ".xspf", + "application/xv+xml": ".mxml", + "application/zip": ".zip", + "application/zstd": ".zst", + "audio/ac3": ".ac3", + "audio/adpcm": ".adp", + "audio/amr": ".amr", + "audio/basic": ".au", + "audio/midi": ".mid", + "audio/mp4": ".mp4a", + "audio/mpeg": ".mpga", + "audio/ogg": ".oga", + "audio/opus": ".opus", + "audio/speex": ".spx", + "audio/vnd.adobe.soundbooth": ".asnd", + "audio/vnd.digital-winds": ".eol", + "audio/vnd.dts": ".dts", + "audio/vnd.dts.hd": ".dtshd", + "audio/vnd.lucent.voice": ".lvp", + "audio/vnd.ms-playready.media.pya": ".pya", + "audio/vnd.nuera.ecelp4800": ".ecelp4800", + "audio/vnd.nuera.ecelp7470": ".ecelp7470", + "audio/vnd.nuera.ecelp9600": ".ecelp9600", + "audio/vnd.wave": ".wav", + "audio/vorbis": ".ogg", + "audio/x-aac": ".aac", + "audio/x-aiff": ".aif", + "audio/x-caf": ".caf", + "audio/x-flac": ".flac", + "audio/x-matroska": ".mka", + "audio/x-mod": ".mod", + "audio/x-mpegurl": ".m3u", + "audio/x-ms-wax": ".wax", + "audio/x-ms-wma": ".wma", + "audio/x-pn-realaudio": ".ram", + "audio/x-pn-realaudio-plugin": ".rmp", + "chemical/x-cdx": ".cdx", + "chemical/x-cif": ".cif", + "chemical/x-cmdf": ".cmdf", + "chemical/x-cml": ".cml", + "chemical/x-csml": ".csml", + "chemical/x-pdb": ".pdb", + "chemical/x-xyz": ".xyz", + "image/aces": ".exr", + "image/avif": ".avif", + "image/bmp": ".bmp", + "image/cgm": ".cgm", + "image/emf": ".emf", + "image/g3fax": ".g3", + "image/gif": ".gif", + "image/heic": ".heic", + "image/heif": ".heif", + "image/icns": ".icns", + "image/ief": ".ief", + "image/jp2": ".jp2", + "image/jpeg": ".jpg", + "image/jpm": ".jpm", + "image/jpx": ".jpf", + "image/jxl": ".jxl", + "image/nitf": ".ntf", + "image/png": ".png", + "image/prs.btif": ".btif", + "image/svg+xml": ".svg", + "image/tiff": ".tiff", + "image/vnd.adobe.photoshop": ".psd", + "image/vnd.adobe.premiere": ".ppj", + "image/vnd.dgn": ".dgn", + "image/vnd.djvu": ".djvu", + "image/vnd.dwg": ".dwg", + "image/vnd.dxb": ".dxb", + "image/vnd.dxf": ".dxf", + "image/vnd.fastbidsheet": ".fbs", + "image/vnd.fpx": ".fpx", + "image/vnd.fst": ".fst", + "image/vnd.fujixerox.edmics-mmr": ".mmr", + "image/vnd.fujixerox.edmics-rlc": ".rlc", + "image/vnd.microsoft.icon": ".ico", + "image/vnd.ms-modi": ".mdi", + "image/vnd.net-fpx": ".npx", + "image/vnd.wap.wbmp": ".wbmp", + "image/vnd.xiff": ".xif", + "image/vnd.zbrush.dcx": ".dcx", + "image/vnd.zbrush.pcx": ".pcx", + "image/webp": ".webp", + "image/wmf": ".wmf", + "image/x-bpg": ".bpg", + "image/x-cmu-raster": ".ras", + "image/x-cmx": ".cmx", + "image/x-dpx": ".dpx", + "image/x-emf-compressed": ".emz", + "image/x-freehand": ".fh", + "image/x-jbig2": ".jb2", + "image/x-jp2-codestream": ".j2c", + "image/x-pict": ".pic", + "image/x-portable-anymap": ".pnm", + "image/x-portable-bitmap": ".pbm", + "image/x-portable-graymap": ".pgm", + "image/x-portable-pixmap": ".ppm", + "image/x-raw-adobe": ".dng", + "image/x-raw-canon": ".crw", + "image/x-raw-casio": ".bay", + "image/x-raw-epson": ".erf", + "image/x-raw-fuji": ".raf", + "image/x-raw-hasselblad": ".3fr", + "image/x-raw-imacon": ".fff", + "image/x-raw-kodak": ".k25", + "image/x-raw-leaf": ".mos", + "image/x-raw-logitech": ".pxn", + "image/x-raw-mamiya": ".mef", + "image/x-raw-minolta": ".mrw", + "image/x-raw-nikon": ".nef", + "image/x-raw-olympus": ".orf", + "image/x-raw-panasonic": ".raw", + "image/x-raw-pentax": ".ptx", + "image/x-raw-phaseone": ".iiq", + "image/x-raw-rawzor": ".rwz", + "image/x-raw-red": ".r3d", + "image/x-raw-sigma": ".x3f", + "image/x-raw-sony": ".arw", + "image/x-rgb": ".rgb", + "image/x-tga": ".tga", + "image/x-xbitmap": ".xbm", + "image/x-xcf": ".xcf", + "image/x-xpixmap": ".xpm", + "image/x-xwindowdump": ".xwd", + "message/rfc822": ".eml", + "message/x-emlx": ".emlx", + "model/e57": ".e57", + "model/iges": ".igs", + "model/mesh": ".msh", + "model/vnd.dwf": ".dwf", + "model/vnd.dwfx+xps": ".dwfx", + "model/vnd.gdl": ".gdl", + "model/vnd.gtw": ".gtw", + "model/vnd.mts": ".mts", + "model/vnd.vtu": ".vtu", + "model/vrml": ".wrl", + "multipart/related": ".mht", + "text/asp": ".asp", + "text/aspdotnet": ".aspx", + "text/calendar": ".ics", + "text/css": ".css", + "text/csv": ".csv", + "text/html": ".html", + "text/iso19139+xml": ".iso19139", + "text/plain": ".txt", + "text/prs.lines.tag": ".dsc", + "text/richtext": ".rtx", + "text/sgml": ".sgml", + "text/tab-separated-values": ".tsv", + "text/troff": ".t", + "text/uri-list": ".uri", + "text/vnd.curl": ".curl", + "text/vnd.curl.dcurl": ".dcurl", + "text/vnd.curl.mcurl": ".mcurl", + "text/vnd.curl.scurl": ".scurl", + "text/vnd.fly": ".fly", + "text/vnd.fmi.flexstor": ".flx", + "text/vnd.graphviz": ".gv", + "text/vnd.in3d.3dml": ".3dml", + "text/vnd.in3d.spot": ".spot", + "text/vnd.iptc.anpa": ".anpa", + "text/vnd.sun.j2me.app-descriptor": ".jad", + "text/vnd.wap.wml": ".wml", + "text/vnd.wap.wmlscript": ".wmls", + "text/vtt": ".vtt", + "text/x-actionscript": ".as", + "text/x-ada": ".ada", + "text/x-applescript": ".applescript", + "text/x-asciidoc": ".asciidoc", + "text/x-aspectj": ".aj", + "text/x-assembly": ".s", + "text/x-awk": ".awk", + "text/x-basic": ".bas", + "text/x-c++hdr": ".hpp", + "text/x-c++src": ".cpp", + "text/x-cgi": ".cgi", + "text/x-chdr": ".h", + "text/x-clojure": ".clj", + "text/x-cobol": ".cbl", + "text/x-coffeescript": ".coffee", + "text/x-coldfusion": ".cfm", + "text/x-common-lisp": ".cl", + "text/x-config": ".config", + "text/x-csharp": ".cs", + "text/x-csrc": ".c", + "text/x-d": ".d", + "text/x-diff": ".diff", + "text/x-eiffel": ".e", + "text/x-emacs-lisp": ".el", + "text/x-erlang": ".erl", + "text/x-expect": ".exp", + "text/x-forth": ".4th", + "text/x-fortran": ".f", + "text/x-go": ".go", + "text/x-groovy": ".groovy", + "text/x-haml": ".haml", + "text/x-haskell": ".hs", + "text/x-haxe": ".hx", + "text/x-idl": ".idl", + "text/x-ini": ".ini", + "text/x-java-properties": ".properties", + "text/x-java-source": ".java", + "text/x-jsp": ".jsp", + "text/x-less": ".less", + "text/x-lex": ".l", + "text/x-log": ".log", + "text/x-lua": ".lua", + "text/x-ml": ".ml", + "text/x-modula": ".m3", + "text/x-objcsrc": ".m", + "text/x-ocaml": ".ocaml", + "text/x-pascal": ".p", + "text/x-perl": ".pl", + "text/x-php": ".php", + "text/x-prolog": ".pro", + "text/x-python": ".py", + "text/x-rexx": ".rexx", + "text/x-rsrc": ".r", + "text/x-rst": ".rest", + "text/x-ruby": ".rb", + "text/x-scala": ".scala", + "text/x-scheme": ".scm", + "text/x-sed": ".sed", + "text/x-setext": ".etx", + "text/x-sql": ".sql", + "text/x-stsrc": ".st", + "text/x-tcl": ".itk", + "text/x-uuencode": ".uu", + "text/x-vbasic": ".cls", + "text/x-vbdotnet": ".vb", + "text/x-vbscript": ".vbs", + "text/x-vcalendar": ".vcs", + "text/x-vcard": ".vcf", + "text/x-verilog": ".v", + "text/x-vhdl": ".vhd", + "text/x-web-markdown": ".md", + "text/x-yacc": ".y", + "text/x-yaml": ".yaml", + "video/3gpp": ".3gp", + "video/3gpp2": ".3g2", + "video/h261": ".h261", + "video/h263": ".h263", + "video/h264": ".h264", + "video/iso.segment": ".m4s", + "video/jpeg": ".jpgv", + "video/mj2": ".mj2", + "video/mp4": ".mp4", + "video/mpeg": ".mpeg", + "video/ogg": ".ogv", + "video/quicktime": ".qt", + "video/vnd.fvt": ".fvt", + "video/vnd.mpegurl": ".mxu", + "video/vnd.ms-playready.media.pyv": ".pyv", + "video/vnd.vivo": ".viv", + "video/webm": ".webm", + "video/x-dirac": ".drc", + "video/x-f4v": ".f4v", + "video/x-flc": ".flc", + "video/x-fli": ".fli", + "video/x-flv": ".flv", + "video/x-jng": ".jng", + "video/x-m4v": ".m4v", + "video/x-matroska": ".mkv", + "video/x-mng": ".mng", + "video/x-ms-asf": ".asf", + "video/x-ms-wm": ".wm", + "video/x-ms-wmv": ".wmv", + "video/x-ms-wmx": ".wmx", + "video/x-ms-wvx": ".wvx", + "video/x-msvideo": ".avi", + "video/x-ogm": ".ogm", + "video/x-sgi-movie": ".movie", + "x-conference/x-cooltalk": ".ice", +} as const; + +export const isPromise = (obj: any): boolean => + !!obj && (typeof obj === "object" || typeof obj === "function") && typeof obj.then === "function"; + +export const typeToExtension = (options: AttachmentOptions): string => { + if (options.fileExtension) { + return options.fileExtension.startsWith(".") ? options.fileExtension : `.${options.fileExtension}`; } - if (suite) { - labels.push({ - name: LabelName.SUITE, - value: suite, - }); - } - - if (subSuites.length > 0) { - labels.push({ - name: LabelName.SUB_SUITE, - value: subSuites.join(" > "), - }); - } - - return labels; + return EXTENSIONS_BY_TYPE[options.contentType] || ""; }; export const serialize = (val: unknown): string => { @@ -142,26 +920,3 @@ export const serialize = (val: unknown): string => { return (val as any).toString(); }; - -export const extractMetadataFromString = (title: string): { labels: Label[]; cleanTitle: string } => { - const labels = [] as Label[]; - - title.split(" ").forEach((val) => { - const idValue = val.match(allureIdRegexp)?.groups?.id; - - if (idValue) { - labels.push({ name: LabelName.ALLURE_ID, value: idValue }); - } - - const labelMatch = val.match(allureLabelRegexp); - const { name, value } = labelMatch?.groups || {}; - - if (name && value) { - labels?.push({ name, value }); - } - }); - - const cleanTitle = title.replace(allureLabelRegexpGlobal, "").replace(allureIdRegexpGlobal, "").trim(); - - return { labels, cleanTitle }; -}; diff --git a/packages/allure-js-commons/src/writers/index.ts b/packages/allure-js-commons/src/writers/index.ts deleted file mode 100644 index c77e307cb..000000000 --- a/packages/allure-js-commons/src/writers/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { AllureWriter } from "./AllureWriter"; -export { FileSystemAllureWriter } from "./FileSystemAllureWriter"; -export { InMemoryAllureWriter } from "./InMemoryAllureWriter"; -export { MessageAllureWriter } from "./MessageAllureWriter"; -export { AllureResults } from "./InMemoryAllureWriter"; -export * from "./utils"; diff --git a/packages/allure-js-commons/src/writers/utils.ts b/packages/allure-js-commons/src/writers/utils.ts deleted file mode 100644 index 39bfa6722..000000000 --- a/packages/allure-js-commons/src/writers/utils.ts +++ /dev/null @@ -1,907 +0,0 @@ -/* eslint-disable max-lines */ -import { AttachmentOptions } from "../model"; - -const extensionsByType: Record = { - "application/andrew-inset": ".ez", - "application/applixware": ".aw", - "application/atom+xml": ".atom", - "application/atomcat+xml": ".atomcat", - "application/atomsvc+xml": ".atomsvc", - "application/bizagi-modeler": ".bpm", - "application/cbor": ".cbor", - "application/ccxml+xml": ".ccxml", - "application/coreldraw": ".cdr", - "application/cu-seeme": ".cu", - "application/dash+xml": ".mpd", - "application/davmount+xml": ".davmount", - "application/dif+xml": ".dif", - "application/dita+xml; format=map": ".ditamap", - "application/dita+xml; format=topic": ".dita", - "application/dita+xml; format=val": ".ditaval", - "application/ecmascript": ".ecma", - "application/emma+xml": ".emma", - "application/envi.hdr": ".hdr", - "application/epub+zip": ".epub", - "application/fits": ".fits", - "application/font-tdpfr": ".pfr", - "application/gzip": ".gz", - "application/hyperstudio": ".stk", - "application/illustrator": ".ai", - "application/java-archive": ".jar", - "application/java-serialized-object": ".ser", - "application/java-vm": ".class", - "application/javascript": ".js", - "application/json": ".json", - "application/lost+xml": ".lostxml", - "application/mac-binhex40": ".hqx", - "application/mac-compactpro": ".cpt", - "application/manifest+json": ".webmanifest", - "application/marc": ".mrc", - "application/mathematica": ".ma", - "application/mathml+xml": ".mathml", - "application/mbox": ".mbox", - "application/mediaservercontrol+xml": ".mscml", - "application/mp4": ".mp4s", - "application/msword": ".doc", - "application/mxf": ".mxf", - "application/octet-stream": ".bin", - "application/oda": ".oda", - "application/oebps-package+xml": ".opf", - "application/ogg": ".ogx", - "application/onenote": ".onetmp", - "application/onenote; format=one": ".one", - "application/onenote; format=onetoc2": ".onetoc", - "application/onenote; format=package": ".onepkg", - "application/patch-ops-error+xml": ".xer", - "application/pdf": ".pdf", - "application/pgp-encrypted": ".pgp", - "application/pgp-signature": ".asc", - "application/pics-rules": ".prf", - "application/pkcs7-mime": ".p7m", - "application/pkcs7-signature": ".p7s", - "application/pkcs10": ".p10", - "application/pkix-cert": ".cer", - "application/pkix-crl": ".crl", - "application/pkix-pkipath": ".pkipath", - "application/pkixcmp": ".pki", - "application/pls+xml": ".pls", - "application/postscript": ".ps", - "application/prs.cww": ".cww", - "application/rdf+xml": ".rdf", - "application/reginfo+xml": ".rif", - "application/relax-ng-compact-syntax": ".rnc", - "application/resource-lists+xml": ".rl", - "application/resource-lists-diff+xml": ".rld", - "application/rls-services+xml": ".rs", - "application/rsd+xml": ".rsd", - "application/rss+xml": ".rss", - "application/rtf": ".rtf", - "application/sbml+xml": ".sbml", - "application/scvp-cv-request": ".scq", - "application/scvp-cv-response": ".scs", - "application/scvp-vp-request": ".spq", - "application/scvp-vp-response": ".spp", - "application/sdp": ".sdp", - "application/sereal": ".srl", - "application/set-payment-initiation": ".setpay", - "application/set-registration-initiation": ".setreg", - "application/shf+xml": ".shf", - "application/sldworks": ".sldprt", - "application/smil+xml": ".smi", - "application/sparql-query": ".rq", - "application/sparql-results+xml": ".srx", - "application/srgs": ".gram", - "application/srgs+xml": ".grxml", - "application/ssml+xml": ".ssml", - "application/timestamped-data": ".tsd", - "application/vnd.3gpp.pic-bw-large": ".plb", - "application/vnd.3gpp.pic-bw-small": ".psb", - "application/vnd.3gpp.pic-bw-var": ".pvb", - "application/vnd.3gpp2.tcap": ".tcap", - "application/vnd.3m.post-it-notes": ".pwn", - "application/vnd.accpac.simply.aso": ".aso", - "application/vnd.accpac.simply.imp": ".imp", - "application/vnd.acucobol": ".acu", - "application/vnd.acucorp": ".atc", - "application/vnd.adobe.aftereffects.project": ".aep", - "application/vnd.adobe.aftereffects.template": ".aet", - "application/vnd.adobe.air-application-installer-package+zip": ".air", - "application/vnd.adobe.indesign-idml-package": ".idml", - "application/vnd.adobe.xdp+xml": ".xdp", - "application/vnd.adobe.xfdf": ".xfdf", - "application/vnd.airzip.filesecure.azf": ".azf", - "application/vnd.airzip.filesecure.azs": ".azs", - "application/vnd.allure.image.diff": ".imagediff", - "application/vnd.allure.metadata+json": ".metadata", - "application/vnd.amazon.ebook": ".azw", - "application/vnd.americandynamics.acc": ".acc", - "application/vnd.amiga.ami": ".ami", - "application/vnd.android.package-archive": ".apk", - "application/vnd.anser-web-certificate-issue-initiation": ".cii", - "application/vnd.anser-web-funds-transfer-initiation": ".fti", - "application/vnd.antix.game-component": ".atx", - "application/vnd.apple.installer+xml": ".mpkg", - "application/vnd.apple.keynote": ".key", - "application/vnd.apple.mpegurl": ".m3u8", - "application/vnd.apple.numbers": ".numbers", - "application/vnd.apple.pages": ".pages", - "application/vnd.arastra.swi": ".swi", - "application/vnd.blueice.multipass": ".mpm", - "application/vnd.bmi": ".bmi", - "application/vnd.businessobjects": ".rep", - "application/vnd.chemdraw+xml": ".cdxml", - "application/vnd.chipnuts.karaoke-mmd": ".mmd", - "application/vnd.cinderella": ".cdy", - "application/vnd.claymore": ".cla", - "application/vnd.clonk.c4group": ".c4g", - "application/vnd.commonspace": ".csp", - "application/vnd.contact.cmsg": ".cdbcmsg", - "application/vnd.cosmocaller": ".cmc", - "application/vnd.crick.clicker": ".clkx", - "application/vnd.crick.clicker.keyboard": ".clkk", - "application/vnd.crick.clicker.palette": ".clkp", - "application/vnd.crick.clicker.template": ".clkt", - "application/vnd.crick.clicker.wordbank": ".clkw", - "application/vnd.criticaltools.wbs+xml": ".wbs", - "application/vnd.ctc-posml": ".pml", - "application/vnd.cups-ppd": ".ppd", - "application/vnd.curl.car": ".car", - "application/vnd.curl.pcurl": ".pcurl", - "application/vnd.data-vision.rdz": ".rdz", - "application/vnd.denovo.fcselayout-link": ".fe_launch", - "application/vnd.dna": ".dna", - "application/vnd.dolby.mlp": ".mlp", - "application/vnd.dpgraph": ".dpg", - "application/vnd.dreamfactory": ".dfac", - "application/vnd.dynageo": ".geo", - "application/vnd.ecowin.chart": ".mag", - "application/vnd.enliven": ".nml", - "application/vnd.epson.esf": ".esf", - "application/vnd.epson.msf": ".msf", - "application/vnd.epson.quickanime": ".qam", - "application/vnd.epson.salt": ".slt", - "application/vnd.epson.ssf": ".ssf", - "application/vnd.eszigno3+xml": ".es3", - "application/vnd.etsi.asic-e+zip": ".asice", - "application/vnd.etsi.asic-s+zip": ".asics", - "application/vnd.ezpix-album": ".ez2", - "application/vnd.ezpix-package": ".ez3", - "application/vnd.fdf": ".fdf", - "application/vnd.fdsn.mseed": ".mseed", - "application/vnd.fdsn.seed": ".seed", - "application/vnd.flographit": ".gph", - "application/vnd.fluxtime.clip": ".ftc", - "application/vnd.framemaker": ".fm", - "application/vnd.frogans.fnc": ".fnc", - "application/vnd.frogans.ltf": ".ltf", - "application/vnd.fsc.weblaunch": ".fsc", - "application/vnd.fujitsu.oasys": ".oas", - "application/vnd.fujitsu.oasys2": ".oa2", - "application/vnd.fujitsu.oasys3": ".oa3", - "application/vnd.fujitsu.oasysgp": ".fg5", - "application/vnd.fujitsu.oasysprs": ".bh2", - "application/vnd.fujixerox.ddd": ".ddd", - "application/vnd.fujixerox.docuworks": ".xdw", - "application/vnd.fujixerox.docuworks.binder": ".xbd", - "application/vnd.fuzzysheet": ".fzs", - "application/vnd.genomatix.tuxedo": ".txd", - "application/vnd.geogebra.file": ".ggb", - "application/vnd.geogebra.tool": ".ggt", - "application/vnd.geometry-explorer": ".gex", - "application/vnd.gmx": ".gmx", - "application/vnd.google-earth.kml+xml": ".kml", - "application/vnd.google-earth.kmz": ".kmz", - "application/vnd.grafeq": ".gqf", - "application/vnd.groove-account": ".gac", - "application/vnd.groove-help": ".ghf", - "application/vnd.groove-identity-message": ".gim", - "application/vnd.groove-injector": ".grv", - "application/vnd.groove-tool-message": ".gtm", - "application/vnd.groove-tool-template": ".tpl", - "application/vnd.groove-vcard": ".vcg", - "application/vnd.handheld-entertainment+xml": ".zmm", - "application/vnd.hbci": ".hbci", - "application/vnd.hhe.lesson-player": ".les", - "application/vnd.hp-hpgl": ".hpgl", - "application/vnd.hp-hpid": ".hpid", - "application/vnd.hp-hps": ".hps", - "application/vnd.hp-jlyt": ".jlt", - "application/vnd.hp-pcl": ".pcl", - "application/vnd.hp-pclxl": ".pclxl", - "application/vnd.hydrostatix.sof-data": ".sfd-hdstx", - "application/vnd.hzn-3d-crossword": ".x3d", - "application/vnd.ibm.minipay": ".mpy", - "application/vnd.ibm.modcap": ".afp", - "application/vnd.ibm.rights-management": ".irm", - "application/vnd.ibm.secure-container": ".sc", - "application/vnd.iccprofile": ".icc", - "application/vnd.igloader": ".igl", - "application/vnd.immervision-ivp": ".ivp", - "application/vnd.immervision-ivu": ".ivu", - "application/vnd.intercon.formnet": ".xpw", - "application/vnd.intu.qbo": ".qbo", - "application/vnd.intu.qfx": ".qfx", - "application/vnd.iptc.g2.newsmessage+xml": ".nar", - "application/vnd.ipunplugged.rcprofile": ".rcprofile", - "application/vnd.irepository.package+xml": ".irp", - "application/vnd.is-xpr": ".xpr", - "application/vnd.jam": ".jam", - "application/vnd.java.hprof": ".hprof", - "application/vnd.java.hprof.text": ".hprof.txt", - "application/vnd.jcp.javame.midlet-rms": ".rms", - "application/vnd.jisp": ".jisp", - "application/vnd.joost.joda-archive": ".joda", - "application/vnd.kahootz": ".ktz", - "application/vnd.kde.karbon": ".karbon", - "application/vnd.kde.kchart": ".chrt", - "application/vnd.kde.kformula": ".kfo", - "application/vnd.kde.kivio": ".flw", - "application/vnd.kde.kontour": ".kon", - "application/vnd.kde.kpresenter": ".kpr", - "application/vnd.kde.kspread": ".ksp", - "application/vnd.kde.kword": ".kwd", - "application/vnd.kenameaapp": ".htke", - "application/vnd.kidspiration": ".kia", - "application/vnd.kinar": ".kne", - "application/vnd.koan": ".skp", - "application/vnd.kodak-descriptor": ".sse", - "application/vnd.llamagraphics.life-balance.desktop": ".lbd", - "application/vnd.llamagraphics.life-balance.exchange+xml": ".lbe", - "application/vnd.lotus-1-2-3": ".wk1", - "application/vnd.lotus-1-2-3; version=2": ".wk1", - "application/vnd.lotus-1-2-3; version=3": ".wk3", - "application/vnd.lotus-1-2-3; version=4": ".wk4", - "application/vnd.lotus-1-2-3; version=97+9.x": ".123", - "application/vnd.lotus-approach": ".apr", - "application/vnd.lotus-freelance": ".pre", - "application/vnd.lotus-notes": ".nsf", - "application/vnd.lotus-organizer": ".org", - "application/vnd.lotus-wordpro": ".lwp", - "application/vnd.macports.portpkg": ".portpkg", - "application/vnd.mcd": ".mcd", - "application/vnd.medcalcdata": ".mc1", - "application/vnd.mediastation.cdkey": ".cdkey", - "application/vnd.mfer": ".mwf", - "application/vnd.mfmp": ".mfm", - "application/vnd.micrografx.flo": ".flo", - "application/vnd.micrografx.igx": ".igx", - "application/vnd.mif": ".mif", - "application/vnd.mindjet.mindmanager": ".mmp", - "application/vnd.mobius.daf": ".daf", - "application/vnd.mobius.dis": ".dis", - "application/vnd.mobius.mbk": ".mbk", - "application/vnd.mobius.mqy": ".mqy", - "application/vnd.mobius.msl": ".msl", - "application/vnd.mobius.plc": ".plc", - "application/vnd.mobius.txf": ".txf", - "application/vnd.mophun.application": ".mpn", - "application/vnd.mophun.certificate": ".mpc", - "application/vnd.mozilla.xul+xml": ".xul", - "application/vnd.ms-artgalry": ".cil", - "application/vnd.ms-cab-compressed": ".cab", - "application/vnd.ms-excel": ".xls", - "application/vnd.ms-excel.addin.macroenabled.12": ".xlam", - "application/vnd.ms-excel.sheet.binary.macroenabled.12": ".xlsb", - "application/vnd.ms-excel.sheet.macroenabled.12": ".xlsm", - "application/vnd.ms-excel.template.macroenabled.12": ".xltm", - "application/vnd.ms-fontobject": ".eot", - "application/vnd.ms-htmlhelp": ".chm", - "application/vnd.ms-ims": ".ims", - "application/vnd.ms-lrm": ".lrm", - "application/vnd.ms-outlook": ".msg", - "application/vnd.ms-outlook-pst": ".pst", - "application/vnd.ms-pki.seccat": ".cat", - "application/vnd.ms-pki.stl": ".stl", - "application/vnd.ms-powerpoint": ".ppt", - "application/vnd.ms-powerpoint.addin.macroenabled.12": ".ppam", - "application/vnd.ms-powerpoint.presentation.macroenabled.12": ".pptm", - "application/vnd.ms-powerpoint.slide.macroenabled.12": ".sldm", - "application/vnd.ms-powerpoint.slideshow.macroenabled.12": ".ppsm", - "application/vnd.ms-powerpoint.template.macroenabled.12": ".potm", - "application/vnd.ms-project": ".mpp", - "application/vnd.ms-visio.drawing": ".vsdx", - "application/vnd.ms-visio.drawing.macroenabled.12": ".vsdm", - "application/vnd.ms-visio.stencil": ".vssx", - "application/vnd.ms-visio.stencil.macroenabled.12": ".vssm", - "application/vnd.ms-visio.template": ".vstx", - "application/vnd.ms-visio.template.macroenabled.12": ".vstm", - "application/vnd.ms-word.document.macroenabled.12": ".docm", - "application/vnd.ms-word.template.macroenabled.12": ".dotm", - "application/vnd.ms-works": ".wps", - "application/vnd.ms-wpl": ".wpl", - "application/vnd.ms-xpsdocument": ".xps", - "application/vnd.mseq": ".mseq", - "application/vnd.musician": ".mus", - "application/vnd.muvee.style": ".msty", - "application/vnd.neurolanguage.nlu": ".nlu", - "application/vnd.noblenet-directory": ".nnd", - "application/vnd.noblenet-sealer": ".nns", - "application/vnd.noblenet-web": ".nnw", - "application/vnd.nokia.n-gage.data": ".ngdat", - "application/vnd.nokia.n-gage.symbian.install": ".n-gage", - "application/vnd.nokia.radio-preset": ".rpst", - "application/vnd.nokia.radio-presets": ".rpss", - "application/vnd.novadigm.edm": ".edm", - "application/vnd.novadigm.edx": ".edx", - "application/vnd.novadigm.ext": ".ext", - "application/vnd.oasis.opendocument.base": ".odb", - "application/vnd.oasis.opendocument.chart": ".odc", - "application/vnd.oasis.opendocument.chart-template": ".otc", - "application/vnd.oasis.opendocument.flat.presentation": ".fodp", - "application/vnd.oasis.opendocument.flat.spreadsheet": ".fods", - "application/vnd.oasis.opendocument.flat.text": ".fodt", - "application/vnd.oasis.opendocument.formula": ".odf", - "application/vnd.oasis.opendocument.formula-template": ".odft", - "application/vnd.oasis.opendocument.graphics": ".odg", - "application/vnd.oasis.opendocument.graphics-template": ".otg", - "application/vnd.oasis.opendocument.image": ".odi", - "application/vnd.oasis.opendocument.image-template": ".oti", - "application/vnd.oasis.opendocument.presentation": ".odp", - "application/vnd.oasis.opendocument.presentation-template": ".otp", - "application/vnd.oasis.opendocument.spreadsheet": ".ods", - "application/vnd.oasis.opendocument.spreadsheet-template": ".ots", - "application/vnd.oasis.opendocument.text": ".odt", - "application/vnd.oasis.opendocument.text-master": ".otm", - "application/vnd.oasis.opendocument.text-template": ".ott", - "application/vnd.oasis.opendocument.text-web": ".oth", - "application/vnd.olpc-sugar": ".xo", - "application/vnd.oma.dd2+xml": ".dd2", - "application/vnd.openofficeorg.autotext": ".bau", - "application/vnd.openofficeorg.extension": ".oxt", - "application/vnd.openxmlformats-officedocument.presentationml.presentation": ".pptx", - "application/vnd.openxmlformats-officedocument.presentationml.slide": ".sldx", - "application/vnd.openxmlformats-officedocument.presentationml.slideshow": ".ppsx", - "application/vnd.openxmlformats-officedocument.presentationml.template": ".potx", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ".xlsx", - "application/vnd.openxmlformats-officedocument.spreadsheetml.template": ".xltx", - "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx", - "application/vnd.openxmlformats-officedocument.wordprocessingml.template": ".dotx", - "application/vnd.osgi.dp": ".dp", - "application/vnd.palm": ".pqa", - "application/vnd.pg.format": ".str", - "application/vnd.pg.osasli": ".ei6", - "application/vnd.picsel": ".efif", - "application/vnd.pocketlearn": ".plf", - "application/vnd.powerbuilder6": ".pbd", - "application/vnd.previewsystems.box": ".box", - "application/vnd.proteus.magazine": ".mgz", - "application/vnd.publishare-delta-tree": ".qps", - "application/vnd.pvi.ptid1": ".ptid", - "application/vnd.quark.quarkxpress": ".qxd", - "application/vnd.recordare.musicxml": ".mxl", - "application/vnd.recordare.musicxml+xml": ".musicxml", - "application/vnd.rim.cod": ".cod", - "application/vnd.rn-realmedia": ".rm", - "application/vnd.route66.link66+xml": ".link66", - "application/vnd.seemail": ".see", - "application/vnd.sema": ".sema", - "application/vnd.semd": ".semd", - "application/vnd.semf": ".semf", - "application/vnd.shana.informed.formdata": ".ifm", - "application/vnd.shana.informed.formtemplate": ".itp", - "application/vnd.shana.informed.interchange": ".iif", - "application/vnd.shana.informed.package": ".ipk", - "application/vnd.simtech-mindmapper": ".twd", - "application/vnd.smaf": ".mmf", - "application/vnd.smart.teacher": ".teacher", - "application/vnd.solent.sdkm+xml": ".sdkm", - "application/vnd.spotfire.dxp": ".dxp", - "application/vnd.spotfire.sfs": ".sfs", - "application/vnd.stardivision.calc": ".sdc", - "application/vnd.stardivision.draw": ".sda", - "application/vnd.stardivision.impress": ".sdd", - "application/vnd.stardivision.math": ".smf", - "application/vnd.stardivision.writer": ".sdw", - "application/vnd.stardivision.writer-global": ".sgl", - "application/vnd.sun.xml.calc": ".sxc", - "application/vnd.sun.xml.calc.template": ".stc", - "application/vnd.sun.xml.draw": ".sxd", - "application/vnd.sun.xml.draw.template": ".std", - "application/vnd.sun.xml.impress": ".sxi", - "application/vnd.sun.xml.impress.template": ".sti", - "application/vnd.sun.xml.math": ".sxm", - "application/vnd.sun.xml.writer": ".sxw", - "application/vnd.sun.xml.writer.global": ".sxg", - "application/vnd.sun.xml.writer.template": ".stw", - "application/vnd.sus-calendar": ".sus", - "application/vnd.svd": ".svd", - "application/vnd.symbian.install": ".sis", - "application/vnd.syncml+xml": ".xsm", - "application/vnd.syncml.dm+wbxml": ".bdm", - "application/vnd.syncml.dm+xml": ".xdm", - "application/vnd.tao.intent-module-archive": ".tao", - "application/vnd.tcpdump.pcap": ".pcap", - "application/vnd.tmobile-livetv": ".tmo", - "application/vnd.trid.tpt": ".tpt", - "application/vnd.triscape.mxs": ".mxs", - "application/vnd.trueapp": ".tra", - "application/vnd.ufdl": ".ufd", - "application/vnd.uiq.theme": ".utz", - "application/vnd.umajin": ".umj", - "application/vnd.unity": ".unityweb", - "application/vnd.uoml+xml": ".uoml", - "application/vnd.vcx": ".vcx", - "application/vnd.visio": ".vsd", - "application/vnd.visionary": ".vis", - "application/vnd.vsf": ".vsf", - "application/vnd.wap.wbxml": ".wbxml", - "application/vnd.wap.wmlc": ".wmlc", - "application/vnd.wap.wmlscriptc": ".wmlsc", - "application/vnd.webturbo": ".wtb", - "application/vnd.wolfram.wl": ".wl", - "application/vnd.wordperfect": ".wpd", - "application/vnd.wqd": ".wqd", - "application/vnd.wt.stf": ".stf", - "application/vnd.xara": ".xar", - "application/vnd.xfdl": ".xfdl", - "application/vnd.yamaha.hv-dic": ".hvd", - "application/vnd.yamaha.hv-script": ".hvs", - "application/vnd.yamaha.hv-voice": ".hvp", - "application/vnd.yamaha.openscoreformat": ".osf", - "application/vnd.yamaha.openscoreformat.osfpvg+xml": ".osfpvg", - "application/vnd.yamaha.smaf-audio": ".saf", - "application/vnd.yamaha.smaf-phrase": ".spf", - "application/vnd.yellowriver-custom-menu": ".cmp", - "application/vnd.zul": ".zir", - "application/vnd.zzazz.deck+xml": ".zaz", - "application/voicexml+xml": ".vxml", - "application/warc": ".warc", - "application/wasm": ".wasm", - "application/winhlp": ".hlp", - "application/wsdl+xml": ".wsdl", - "application/wspolicy+xml": ".wspolicy", - "application/x-7z-compressed": ".7z", - "application/x-abiword": ".abw", - "application/x-ace-compressed": ".ace", - "application/x-adobe-indesign": ".indd", - "application/x-adobe-indesign-interchange": ".inx", - "application/x-apple-diskimage": ".dmg", - "application/x-appleworks": ".cwk", - "application/x-archive": ".ar", - "application/x-arj": ".arj", - "application/x-authorware-bin": ".aab", - "application/x-authorware-map": ".aam", - "application/x-authorware-seg": ".aas", - "application/x-axcrypt": ".axx", - "application/x-bat": ".bat", - "application/x-bcpio": ".bcpio", - "application/x-bibtex-text-file": ".bib", - "application/x-bittorrent": ".torrent", - "application/x-brotli": ".br", - "application/x-bzip": ".bz", - "application/x-bzip2": ".bz2", - "application/x-cdlink": ".vcd", - "application/x-chat": ".chat", - "application/x-chess-pgn": ".pgn", - "application/x-chrome-package": ".crx", - "application/x-compress": ".z", - "application/x-corelpresentations": ".shw", - "application/x-cpio": ".cpio", - "application/x-csh": ".csh", - "application/x-dbf": ".dbf", - "application/x-debian-package": ".deb", - "application/x-dex": ".dex", - "application/x-director": ".dir", - "application/x-doom": ".wad", - "application/x-dosexec": ".exe", - "application/x-dtbncx+xml": ".ncx", - "application/x-dtbook+xml": ".dtb", - "application/x-dtbresource+xml": ".res", - "application/x-dvi": ".dvi", - "application/x-elc": ".elc", - "application/x-endnote-refer": ".enw", - "application/x-erdas-hfa": ".hfa", - "application/x-esri-layer": ".lyr", - "application/x-fictionbook+xml": ".fb2", - "application/x-filemaker": ".fp7", - "application/x-font-adobe-metric": ".afm", - "application/x-font-bdf": ".bdf", - "application/x-font-ghostscript": ".gsf", - "application/x-font-linux-psf": ".psf", - "application/x-font-otf": ".otf", - "application/x-font-pcf": ".pcf", - "application/x-font-printer-metric": ".pfm", - "application/x-font-snf": ".snf", - "application/x-font-ttf": ".ttf", - "application/x-font-type1": ".pfa", - "application/x-futuresplash": ".spl", - "application/x-gnucash": ".gnucash", - "application/x-gnumeric": ".gnumeric", - "application/x-grib": ".grb", - "application/x-gtar": ".gtar", - "application/x-hdf": ".hdf", - "application/x-ibooks+zip": ".ibooks", - "application/x-internet-archive": ".arc", - "application/x-iso9660-image": ".iso", - "application/x-itunes-ipa": ".ipa", - "application/x-java-jnilib": ".jnilib", - "application/x-java-jnlp-file": ".jnlp", - "application/x-java-pack200": ".pack", - "application/x-killustrator": ".kil", - "application/x-latex": ".latex", - "application/x-lz4": ".lz4", - "application/x-lzip": ".lz", - "application/x-lzma": ".lzma", - "application/x-matlab-data": ".mat", - "application/x-memgraph": ".memgraph", - "application/x-mobipocket-ebook": ".prc", - "application/x-ms-application": ".application", - "application/x-ms-asx": ".asx", - "application/x-ms-installer": ".msi", - "application/x-ms-wmd": ".wmd", - "application/x-ms-wmz": ".wmz", - "application/x-ms-xbap": ".xbap", - "application/x-msaccess": ".mdb", - "application/x-msbinder": ".obd", - "application/x-mscardfile": ".crd", - "application/x-msclip": ".clp", - "application/x-msdownload": ".dll", - "application/x-msmediaview": ".mvb", - "application/x-msmoney": ".mny", - "application/x-mspublisher": ".pub", - "application/x-msschedule": ".scd", - "application/x-msterminal": ".trm", - "application/x-mswrite": ".wri", - "application/x-mysql-misam-compressed-index": ".MYI", - "application/x-mysql-misam-data": ".MYD", - "application/x-nesrom": ".nes", - "application/x-netcdf": ".nc", - "application/x-parquet": ".parquet", - "application/x-pkcs7-certificates": ".p7b", - "application/x-pkcs7-certreqresp": ".p7r", - "application/x-pkcs12": ".p12", - "application/x-project": ".mpx", - "application/x-prt": ".prt", - "application/x-quattro-pro": ".wq1", - "application/x-quattro-pro; version=1+5": ".wb1", - "application/x-quattro-pro; version=1-4": ".wq1", - "application/x-quattro-pro; version=5": ".wq2", - "application/x-quattro-pro; version=6": ".wb2", - "application/x-rar-compressed": ".rar", - "application/x-roxio-toast": ".toast", - "application/x-rpm": ".rpm", - "application/x-sas": ".sas", - "application/x-sas-access": ".sa7", - "application/x-sas-audit": ".st7", - "application/x-sas-backup": ".sas7bbak", - "application/x-sas-catalog": ".sc7", - "application/x-sas-data": ".sd7", - "application/x-sas-data-index": ".si7", - "application/x-sas-data-v6": ".sd2", - "application/x-sas-dmdb": ".s7m", - "application/x-sas-fdb": ".sf7", - "application/x-sas-itemstor": ".sr7", - "application/x-sas-mddb": ".sm7", - "application/x-sas-program-data": ".ss7", - "application/x-sas-putility": ".sp7", - "application/x-sas-transport": ".stx", - "application/x-sas-utility": ".su7", - "application/x-sas-view": ".sv7", - "application/x-sas-xport": ".xpt", - "application/x-sfdu": ".sfdu", - "application/x-sh": ".sh", - "application/x-shapefile": ".shp", - "application/x-shar": ".shar", - "application/x-shockwave-flash": ".swf", - "application/x-silverlight-app": ".xap", - "application/x-snappy-framed": ".sz", - "application/x-staroffice-template": ".vor", - "application/x-stata-do": ".do", - "application/x-stata-dta": ".dta", - "application/x-stuffit": ".sit", - "application/x-stuffitx": ".sitx", - "application/x-sv4cpio": ".sv4cpio", - "application/x-sv4crc": ".sv4crc", - "application/x-tar": ".tar", - "application/x-tex": ".tex", - "application/x-tex-tfm": ".tfm", - "application/x-texinfo": ".texinfo", - "application/x-tika-java-enterprise-archive": ".ear", - "application/x-tika-java-web-archive": ".war", - "application/x-tika-msworks-spreadsheet": ".xlr", - "application/x-tmx": ".tmx", - "application/x-uc2-compressed": ".uc2", - "application/x-ustar": ".ustar", - "application/x-vmdk": ".vmdk", - "application/x-wais-source": ".src", - "application/x-webarchive": ".webarchive", - "application/x-x509-cert": ".crt", - "application/x-x509-cert; format=der": ".der", - "application/x-x509-cert; format=pem": ".pem", - "application/x-xfig": ".fig", - "application/x-xliff+xml": ".xlf", - "application/x-xliff+zip": ".xlz", - "application/x-xmind": ".xmind", - "application/x-xpinstall": ".xpi", - "application/x-xz": ".xz", - "application/x-zoo": ".zoo", - "application/xenc+xml": ".xenc", - "application/xhtml+xml": ".xhtml", - "application/xml": ".xml", - "application/xml-dtd": ".dtd", - "application/xop+xml": ".xop", - "application/xquery": ".xq", - "application/xslfo+xml": ".xslfo", - "application/xslt+xml": ".xslt", - "application/xspf+xml": ".xspf", - "application/xv+xml": ".mxml", - "application/zip": ".zip", - "application/zstd": ".zst", - "audio/ac3": ".ac3", - "audio/adpcm": ".adp", - "audio/amr": ".amr", - "audio/basic": ".au", - "audio/midi": ".mid", - "audio/mp4": ".mp4a", - "audio/mpeg": ".mpga", - "audio/ogg": ".oga", - "audio/opus": ".opus", - "audio/speex": ".spx", - "audio/vnd.adobe.soundbooth": ".asnd", - "audio/vnd.digital-winds": ".eol", - "audio/vnd.dts": ".dts", - "audio/vnd.dts.hd": ".dtshd", - "audio/vnd.lucent.voice": ".lvp", - "audio/vnd.ms-playready.media.pya": ".pya", - "audio/vnd.nuera.ecelp4800": ".ecelp4800", - "audio/vnd.nuera.ecelp7470": ".ecelp7470", - "audio/vnd.nuera.ecelp9600": ".ecelp9600", - "audio/vnd.wave": ".wav", - "audio/vorbis": ".ogg", - "audio/x-aac": ".aac", - "audio/x-aiff": ".aif", - "audio/x-caf": ".caf", - "audio/x-flac": ".flac", - "audio/x-matroska": ".mka", - "audio/x-mod": ".mod", - "audio/x-mpegurl": ".m3u", - "audio/x-ms-wax": ".wax", - "audio/x-ms-wma": ".wma", - "audio/x-pn-realaudio": ".ram", - "audio/x-pn-realaudio-plugin": ".rmp", - "chemical/x-cdx": ".cdx", - "chemical/x-cif": ".cif", - "chemical/x-cmdf": ".cmdf", - "chemical/x-cml": ".cml", - "chemical/x-csml": ".csml", - "chemical/x-pdb": ".pdb", - "chemical/x-xyz": ".xyz", - "image/aces": ".exr", - "image/avif": ".avif", - "image/bmp": ".bmp", - "image/cgm": ".cgm", - "image/emf": ".emf", - "image/g3fax": ".g3", - "image/gif": ".gif", - "image/heic": ".heic", - "image/heif": ".heif", - "image/icns": ".icns", - "image/ief": ".ief", - "image/jp2": ".jp2", - "image/jpeg": ".jpg", - "image/jpm": ".jpm", - "image/jpx": ".jpf", - "image/jxl": ".jxl", - "image/nitf": ".ntf", - "image/png": ".png", - "image/prs.btif": ".btif", - "image/svg+xml": ".svg", - "image/tiff": ".tiff", - "image/vnd.adobe.photoshop": ".psd", - "image/vnd.adobe.premiere": ".ppj", - "image/vnd.dgn": ".dgn", - "image/vnd.djvu": ".djvu", - "image/vnd.dwg": ".dwg", - "image/vnd.dxb": ".dxb", - "image/vnd.dxf": ".dxf", - "image/vnd.fastbidsheet": ".fbs", - "image/vnd.fpx": ".fpx", - "image/vnd.fst": ".fst", - "image/vnd.fujixerox.edmics-mmr": ".mmr", - "image/vnd.fujixerox.edmics-rlc": ".rlc", - "image/vnd.microsoft.icon": ".ico", - "image/vnd.ms-modi": ".mdi", - "image/vnd.net-fpx": ".npx", - "image/vnd.wap.wbmp": ".wbmp", - "image/vnd.xiff": ".xif", - "image/vnd.zbrush.dcx": ".dcx", - "image/vnd.zbrush.pcx": ".pcx", - "image/webp": ".webp", - "image/wmf": ".wmf", - "image/x-bpg": ".bpg", - "image/x-cmu-raster": ".ras", - "image/x-cmx": ".cmx", - "image/x-dpx": ".dpx", - "image/x-emf-compressed": ".emz", - "image/x-freehand": ".fh", - "image/x-jbig2": ".jb2", - "image/x-jp2-codestream": ".j2c", - "image/x-pict": ".pic", - "image/x-portable-anymap": ".pnm", - "image/x-portable-bitmap": ".pbm", - "image/x-portable-graymap": ".pgm", - "image/x-portable-pixmap": ".ppm", - "image/x-raw-adobe": ".dng", - "image/x-raw-canon": ".crw", - "image/x-raw-casio": ".bay", - "image/x-raw-epson": ".erf", - "image/x-raw-fuji": ".raf", - "image/x-raw-hasselblad": ".3fr", - "image/x-raw-imacon": ".fff", - "image/x-raw-kodak": ".k25", - "image/x-raw-leaf": ".mos", - "image/x-raw-logitech": ".pxn", - "image/x-raw-mamiya": ".mef", - "image/x-raw-minolta": ".mrw", - "image/x-raw-nikon": ".nef", - "image/x-raw-olympus": ".orf", - "image/x-raw-panasonic": ".raw", - "image/x-raw-pentax": ".ptx", - "image/x-raw-phaseone": ".iiq", - "image/x-raw-rawzor": ".rwz", - "image/x-raw-red": ".r3d", - "image/x-raw-sigma": ".x3f", - "image/x-raw-sony": ".arw", - "image/x-rgb": ".rgb", - "image/x-tga": ".tga", - "image/x-xbitmap": ".xbm", - "image/x-xcf": ".xcf", - "image/x-xpixmap": ".xpm", - "image/x-xwindowdump": ".xwd", - "message/rfc822": ".eml", - "message/x-emlx": ".emlx", - "model/e57": ".e57", - "model/iges": ".igs", - "model/mesh": ".msh", - "model/vnd.dwf": ".dwf", - "model/vnd.dwfx+xps": ".dwfx", - "model/vnd.gdl": ".gdl", - "model/vnd.gtw": ".gtw", - "model/vnd.mts": ".mts", - "model/vnd.vtu": ".vtu", - "model/vrml": ".wrl", - "multipart/related": ".mht", - "text/asp": ".asp", - "text/aspdotnet": ".aspx", - "text/calendar": ".ics", - "text/css": ".css", - "text/csv": ".csv", - "text/html": ".html", - "text/iso19139+xml": ".iso19139", - "text/plain": ".txt", - "text/prs.lines.tag": ".dsc", - "text/richtext": ".rtx", - "text/sgml": ".sgml", - "text/tab-separated-values": ".tsv", - "text/troff": ".t", - "text/uri-list": ".uri", - "text/vnd.curl": ".curl", - "text/vnd.curl.dcurl": ".dcurl", - "text/vnd.curl.mcurl": ".mcurl", - "text/vnd.curl.scurl": ".scurl", - "text/vnd.fly": ".fly", - "text/vnd.fmi.flexstor": ".flx", - "text/vnd.graphviz": ".gv", - "text/vnd.in3d.3dml": ".3dml", - "text/vnd.in3d.spot": ".spot", - "text/vnd.iptc.anpa": ".anpa", - "text/vnd.sun.j2me.app-descriptor": ".jad", - "text/vnd.wap.wml": ".wml", - "text/vnd.wap.wmlscript": ".wmls", - "text/vtt": ".vtt", - "text/x-actionscript": ".as", - "text/x-ada": ".ada", - "text/x-applescript": ".applescript", - "text/x-asciidoc": ".asciidoc", - "text/x-aspectj": ".aj", - "text/x-assembly": ".s", - "text/x-awk": ".awk", - "text/x-basic": ".bas", - "text/x-c++hdr": ".hpp", - "text/x-c++src": ".cpp", - "text/x-cgi": ".cgi", - "text/x-chdr": ".h", - "text/x-clojure": ".clj", - "text/x-cobol": ".cbl", - "text/x-coffeescript": ".coffee", - "text/x-coldfusion": ".cfm", - "text/x-common-lisp": ".cl", - "text/x-config": ".config", - "text/x-csharp": ".cs", - "text/x-csrc": ".c", - "text/x-d": ".d", - "text/x-diff": ".diff", - "text/x-eiffel": ".e", - "text/x-emacs-lisp": ".el", - "text/x-erlang": ".erl", - "text/x-expect": ".exp", - "text/x-forth": ".4th", - "text/x-fortran": ".f", - "text/x-go": ".go", - "text/x-groovy": ".groovy", - "text/x-haml": ".haml", - "text/x-haskell": ".hs", - "text/x-haxe": ".hx", - "text/x-idl": ".idl", - "text/x-ini": ".ini", - "text/x-java-properties": ".properties", - "text/x-java-source": ".java", - "text/x-jsp": ".jsp", - "text/x-less": ".less", - "text/x-lex": ".l", - "text/x-log": ".log", - "text/x-lua": ".lua", - "text/x-ml": ".ml", - "text/x-modula": ".m3", - "text/x-objcsrc": ".m", - "text/x-ocaml": ".ocaml", - "text/x-pascal": ".p", - "text/x-perl": ".pl", - "text/x-php": ".php", - "text/x-prolog": ".pro", - "text/x-python": ".py", - "text/x-rexx": ".rexx", - "text/x-rsrc": ".r", - "text/x-rst": ".rest", - "text/x-ruby": ".rb", - "text/x-scala": ".scala", - "text/x-scheme": ".scm", - "text/x-sed": ".sed", - "text/x-setext": ".etx", - "text/x-sql": ".sql", - "text/x-stsrc": ".st", - "text/x-tcl": ".itk", - "text/x-uuencode": ".uu", - "text/x-vbasic": ".cls", - "text/x-vbdotnet": ".vb", - "text/x-vbscript": ".vbs", - "text/x-vcalendar": ".vcs", - "text/x-vcard": ".vcf", - "text/x-verilog": ".v", - "text/x-vhdl": ".vhd", - "text/x-web-markdown": ".md", - "text/x-yacc": ".y", - "text/x-yaml": ".yaml", - "video/3gpp": ".3gp", - "video/3gpp2": ".3g2", - "video/h261": ".h261", - "video/h263": ".h263", - "video/h264": ".h264", - "video/iso.segment": ".m4s", - "video/jpeg": ".jpgv", - "video/mj2": ".mj2", - "video/mp4": ".mp4", - "video/mpeg": ".mpeg", - "video/ogg": ".ogv", - "video/quicktime": ".qt", - "video/vnd.fvt": ".fvt", - "video/vnd.mpegurl": ".mxu", - "video/vnd.ms-playready.media.pyv": ".pyv", - "video/vnd.vivo": ".viv", - "video/webm": ".webm", - "video/x-dirac": ".drc", - "video/x-f4v": ".f4v", - "video/x-flc": ".flc", - "video/x-fli": ".fli", - "video/x-flv": ".flv", - "video/x-jng": ".jng", - "video/x-m4v": ".m4v", - "video/x-matroska": ".mkv", - "video/x-mng": ".mng", - "video/x-ms-asf": ".asf", - "video/x-ms-wm": ".wm", - "video/x-ms-wmv": ".wmv", - "video/x-ms-wmx": ".wmx", - "video/x-ms-wvx": ".wvx", - "video/x-msvideo": ".avi", - "video/x-ogm": ".ogm", - "video/x-sgi-movie": ".movie", - "x-conference/x-cooltalk": ".ice", -}; - -export const typeToExtension = (options: AttachmentOptions): string => { - if (options.fileExtension) { - return options.fileExtension.startsWith(".") ? options.fileExtension : `.${options.fileExtension}`; - } - return extensionsByType[options.contentType] || ""; -}; diff --git a/packages/allure-js-commons/tsconfig.json b/packages/allure-js-commons/tsconfig.json index 31ba6e7cb..427e6f552 100644 --- a/packages/allure-js-commons/tsconfig.json +++ b/packages/allure-js-commons/tsconfig.json @@ -3,9 +3,12 @@ "include": [ "./src/**/*", "index.ts", + "node.ts", + "browser.ts", "internal.ts", ], "compilerOptions": { + "lib": ["dom", "es2017"], "types": [ "node" ], diff --git a/yarn.lock b/yarn.lock index 71da1184a..2303a0cd2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2129,6 +2129,13 @@ __metadata: languageName: node linkType: hard +"@types/md5@npm:^2.3.5": + version: 2.3.5 + resolution: "@types/md5@npm:2.3.5" + checksum: a86baf0521006e3072488bd79089b84831780866102e5e4b4f7afabfab17e0270a3791f3331776b73efb2cc9317efd56a334fd3d2698c7929e9b18593ca3fd39 + languageName: node + linkType: hard + "@types/minimatch@npm:^5.1.2": version: 5.1.2 resolution: "@types/minimatch@npm:5.1.2" @@ -3084,6 +3091,7 @@ __metadata: dependencies: "@types/chai": ^4.3.6 "@types/eslint": ^8 + "@types/md5": ^2.3.5 "@types/mocha": ^10.0.1 "@types/node": ^20.6.3 "@types/sinon": ^17.0.0 @@ -3100,6 +3108,7 @@ __metadata: eslint-plugin-prefer-arrow: ^1.2.3 expect: ^29.5.0 glob: ^10.3.5 + md5: ^2.3.0 mocha: ^10.2.0 mocha-multi-reporters: ^1.5.1 properties: ^1.2.1 @@ -4489,6 +4498,13 @@ __metadata: languageName: node linkType: hard +"charenc@npm:0.0.2": + version: 0.0.2 + resolution: "charenc@npm:0.0.2" + checksum: 81dcadbe57e861d527faf6dd3855dc857395a1c4d6781f4847288ab23cffb7b3ee80d57c15bba7252ffe3e5e8019db767757ee7975663ad2ca0939bb8fcaf2e5 + languageName: node + linkType: hard + "charset@npm:^1.0.0": version: 1.0.1 resolution: "charset@npm:1.0.1" @@ -5327,6 +5343,13 @@ __metadata: languageName: node linkType: hard +"crypt@npm:0.0.2": + version: 0.0.2 + resolution: "crypt@npm:0.0.2" + checksum: baf4c7bbe05df656ec230018af8cf7dbe8c14b36b98726939cef008d473f6fe7a4fad906cfea4062c93af516f1550a3f43ceb4d6615329612c6511378ed9fe34 + languageName: node + linkType: hard + "crypto-browserify@npm:^3.0.0": version: 3.12.0 resolution: "crypto-browserify@npm:3.12.0" @@ -8588,7 +8611,7 @@ __metadata: languageName: node linkType: hard -"is-buffer@npm:^1.1.0, is-buffer@npm:^1.1.5": +"is-buffer@npm:^1.1.0, is-buffer@npm:^1.1.5, is-buffer@npm:~1.1.6": version: 1.1.6 resolution: "is-buffer@npm:1.1.6" checksum: 4a186d995d8bbf9153b4bd9ff9fd04ae75068fe695d29025d25e592d9488911eeece84eefbd8fa41b8ddcc0711058a71d4c466dcf6f1f6e1d83830052d8ca707 @@ -10396,6 +10419,17 @@ __metadata: languageName: node linkType: hard +"md5@npm:^2.3.0": + version: 2.3.0 + resolution: "md5@npm:2.3.0" + dependencies: + charenc: 0.0.2 + crypt: 0.0.2 + is-buffer: ~1.1.6 + checksum: a63cacf4018dc9dee08c36e6f924a64ced735b37826116c905717c41cebeb41a522f7a526ba6ad578f9c80f02cb365033ccd67fe186ffbcc1a1faeb75daa9b6e + languageName: node + linkType: hard + "memorystream@npm:^0.3.1": version: 0.3.1 resolution: "memorystream@npm:0.3.1"