<commit_before>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

// @ts-check

/**
 * ```
 * --------------------------------
 * |    UI SIDE    |  AGENT SIDE  |
 * |---------------|--------------|
 * | vscode-remote | file         |
 * | file          | vscode-local |
 * --------------------------------
 * ```
 */
module.exports = function(remoteAuthority) {
	return {
		transformIncoming: (uri) => {
			if (uri.scheme === 'vscode-remote') {
				return { scheme: 'file', path: uri.path };
			}
			if (uri.scheme === 'file') {
				return { scheme: 'vscode-local', path: uri.path };
			}
			return uri;
		},

		transformOutgoing: (uri) => {
			if (uri.scheme === 'file') {
				return { scheme: 'vscode-remote', authority: remoteAuthority, path: uri.path };
			}
			if (uri.scheme === 'vscode-local') {
				return { scheme: 'file', path: uri.path };
			}
			return uri;
		},

		transformOutgoingScheme: (scheme) => {
			if (scheme === 'file') {
				return 'vscode-remote';
			} else if (scheme === 'vscode-local') {
				return 'file';
			}
			return scheme;
		}
	};
};<commit_msg>Improve TS checking in `uriTransformer.js`<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

// @ts-check

/**
 * ```
 * --------------------------------
 * |    UI SIDE    |  AGENT SIDE  |
 * |---------------|--------------|
 * | vscode-remote | file         |
 * | file          | vscode-local |
 * --------------------------------
 * ```
 * @typedef { import('../base/common/uriIpc').IRawURITransformer } IRawURITransformer
 * @typedef { import('../base/common/uriIpc').UriParts } UriParts
 * @typedef { import('../base/common/uri').UriComponents } UriComponents
 * @param {string} remoteAuthority
 * @returns {IRawURITransformer}
 */
module.exports = function(remoteAuthority) {
	return {
		/**
		 * @param {UriParts} uri
		 * @returns {UriParts}
		 */
		transformIncoming: (uri) => {
			if (uri.scheme === 'vscode-remote') {
				return { scheme: 'file', path: uri.path };
			}
			if (uri.scheme === 'file') {
				return { scheme: 'vscode-local', path: uri.path };
			}
			return uri;
		},
		/**
		 * @param {UriParts} uri
		 * @returns {UriParts}
		 */
		transformOutgoing: (uri) => {
			if (uri.scheme === 'file') {
				return { scheme: 'vscode-remote', authority: remoteAuthority, path: uri.path };
			}
			if (uri.scheme === 'vscode-local') {
				return { scheme: 'file', path: uri.path };
			}
			return uri;
		},
		/**
		 * @param {string} scheme
		 * @returns {string}
		 */
		transformOutgoingScheme: (scheme) => {
			if (scheme === 'file') {
				return 'vscode-remote';
			} else if (scheme === 'vscode-local') {
				return 'file';
			}
			return scheme;
		}
	};
};
{'fraction_non_alphanumeric': 0.3185840707964602, 'fraction_numerical': 0.0, 'mean_word_length': 1.5332302936630602, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4205328', 'n_tokens_mistral': 1079, 'n_tokens_neox': 942, 'n_words': 215}