All files / ext.wikilambda.app/utils metadataUtils.js

100% Statements 110/110
100% Branches 2/2
100% Functions 1/1
100% Lines 110/110

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 11125x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x 25x  
/**
 * WikiLambda Vue editor: Metadata dialog configuration utilities
 *
 * @copyright 2020– Abstract Wikipedia team; see AUTHORS.txt
 * @license MIT
 */
'use strict';
 
const metadataUtils = {
	/**
	 * Metadata keys configuration for the Metadata Dialog component.
	 * Defines how the information should be structured and transformed.
	 */
	metadataKeys: {
		errors: {
			title: 'wikilambda-functioncall-metadata-errors',
			description: 'getErrorSummary',
			open: true,
			keys: [
				{ key: 'errors', title: 'wikilambda-functioncall-metadata-errors-summary', transform: 'getErrorType' },
				{ key: 'errors', title: 'wikilambda-functioncall-metadata-errors-args', transform: 'getErrorStringArgs' },
				{ key: 'errors', title: 'wikilambda-functioncall-metadata-errors-children', transform: 'getErrorChildren' },
				{ key: 'validateErrors', title: 'wikilambda-functioncall-metadata-validator-errors-summary', transform: 'getErrorType' },
				{ key: 'expectedTestResult', title: 'wikilambda-functioncall-metadata-expected-result', transform: 'getTestResultValue' },
				{ key: 'actualTestResult', title: 'wikilambda-functioncall-metadata-actual-result', transform: 'getTestResultValue' },
				{ key: 'executorDebugLogs', title: 'wikilambda-functioncall-metadata-execution-debug-logs', transform: 'getDebugLogs' }
			]
		},
		warnings: {
			title: 'wikilambda-functioncall-metadata-warnings',
			description: 'getWarningsSummary',
			open: true,
			keys: [
				{ key: 'warnings', title: 'wikilambda-functioncall-metadata-warnings-list', transform: 'getWarningsList' }
			]
		},
		implementation: {
			title: 'wikilambda-functioncall-metadata-implementation',
			description: 'getImplementationSummary',
			keys: [
				{ key: 'implementationId', title: 'wikilambda-functioncall-metadata-implementation-name', transform: 'getImplementationLink' },
				{ key: 'implementationId', title: 'wikilambda-functioncall-metadata-implementation-id', transform: 'getStringValue' },
				{ key: 'implementationType', title: 'wikilambda-functioncall-metadata-implementation-type' }
			]
		},
		caching: {
			title: 'wikilambda-functioncall-metadata-caching',
			description: 'getCachingSummary',
			keys: [
				{ key: 'functionCallCachedOn', title: 'wikilambda-functioncall-metadata-cache-stored', transform: 'toRelativeTime' },
				{ key: 'testCallCachedOn', title: 'wikilambda-functioncall-metadata-cache-test-call-stored', transform: 'toRelativeTime' },
				{ key: 'validationCallCachedOn', title: 'wikilambda-functioncall-metadata-cache-test-validation-stored', transform: 'toRelativeTime' },
				{ key: 'testResultCachedOn', title: 'wikilambda-functioncall-metadata-cache-test-result-stored', transform: 'toRelativeTime' },
				{ key: 'testResultCacheKey', title: 'wikilambda-functioncall-metadata-cache-test-result-key', transform: 'getLinksOfTestKey' }
			]
		},
		duration: {
			title: 'wikilambda-functioncall-metadata-duration',
			description: 'getDurationSummary',
			sections: [ {
				title: 'wikilambda-functioncall-metadata-orchestration',
				keys: [
					{ key: 'orchestrationDuration', title: 'wikilambda-functioncall-metadata-duration' },
					{ key: 'orchestrationStartTime', title: 'wikilambda-functioncall-metadata-start-time', transform: 'toRelativeTime' },
					{ key: 'orchestrationEndTime', title: 'wikilambda-functioncall-metadata-end-time', transform: 'toRelativeTime' }
				]
			}, {
				title: 'wikilambda-functioncall-metadata-evaluation',
				keys: [
					{ key: 'evaluationDuration', title: 'wikilambda-functioncall-metadata-duration' },
					{ key: 'evaluationStartTime', title: 'wikilambda-functioncall-metadata-start-time', transform: 'toRelativeTime' },
					{ key: 'evaluationEndTime', title: 'wikilambda-functioncall-metadata-end-time', transform: 'toRelativeTime' }
				]
			} ]
		},
		cpu: {
			title: 'wikilambda-functioncall-metadata-cpu-usage',
			description: 'getCpuUsageSummary',
			keys: [
				{ key: 'orchestrationCpuUsage', title: 'wikilambda-functioncall-metadata-orchestration' },
				{ key: 'evaluationCpuUsage', title: 'wikilambda-functioncall-metadata-evaluation' },
				{ key: 'executionCpuUsage', title: 'wikilambda-functioncall-metadata-execution' }
			]
		},
		memory: {
			title: 'wikilambda-functioncall-metadata-memory-usage',
			description: 'getMemoryUsageSummary',
			keys: [
				{ key: 'orchestrationMemoryUsage', title: 'wikilambda-functioncall-metadata-orchestration' },
				{ key: 'evaluationMemoryUsage', title: 'wikilambda-functioncall-metadata-evaluation' },
				{ key: 'executionMemoryUsage', title: 'wikilambda-functioncall-metadata-execution' }
			]
		},
		server: {
			title: 'wikilambda-functioncall-metadata-hostname',
			keys: [
				{ key: 'orchestrationHostname', title: 'wikilambda-functioncall-metadata-orchestration' },
				{ key: 'evaluationHostname', title: 'wikilambda-functioncall-metadata-evaluation' }
			]
		},
		programmingLanguage: {
			title: 'wikilambda-functioncall-metadata-programming-language',
			keys: [
				{ key: 'programmingLanguageVersion', title: 'wikilambda-functioncall-metadata-programming-language-version' }
			]
		}
	}
};
 
module.exports = metadataUtils;