monaco-editor-core 0.55.0-dev-20251022 → 0.55.0-dev-20251024
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +6 -0
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/browser/ui/iconLabel/iconlabel.css +2 -0
- package/esm/vs/base/browser/ui/list/listPaging.js +5 -1
- package/esm/vs/base/browser/ui/list/listPaging.js.map +1 -1
- package/esm/vs/base/browser/ui/list/listView.js +4 -3
- package/esm/vs/base/browser/ui/list/listView.js.map +1 -1
- package/esm/vs/base/browser/ui/toggle/toggle.js +2 -2
- package/esm/vs/base/browser/ui/toggle/toggle.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js +7 -0
- package/esm/vs/base/browser/ui/tree/compressedObjectTreeModel.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/objectTree.js +3 -0
- package/esm/vs/base/browser/ui/tree/objectTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/objectTreeModel.js +20 -0
- package/esm/vs/base/browser/ui/tree/objectTreeModel.js.map +1 -1
- package/esm/vs/base/common/arrays.js +10 -0
- package/esm/vs/base/common/arrays.js.map +1 -1
- package/esm/vs/base/common/codiconsLibrary.js +2 -0
- package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
- package/esm/vs/base/common/network.js +5 -1
- package/esm/vs/base/common/network.js.map +1 -1
- package/esm/vs/base/common/paging.js.map +1 -1
- package/esm/vs/base/common/validation.js +157 -0
- package/esm/vs/base/common/validation.js.map +1 -0
- package/esm/vs/editor/common/languages.js +10 -0
- package/esm/vs/editor/common/languages.js.map +1 -1
- package/esm/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/treeSitter/treeSitterSyntaxTokenBackend.js +1 -1
- package/esm/vs/editor/common/model/tokens/treeSitter/treeSitterSyntaxTokenBackend.js.map +1 -1
- package/esm/vs/editor/common/services/treeSitter/treeSitterLibraryService.js.map +1 -1
- package/esm/vs/editor/common/viewModel/viewModelLines.js.map +1 -1
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +64 -20
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +12 -12
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +11 -12
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +4 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/suggestWidgetAdapter.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js +3 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -20
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +31 -31
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
- package/esm/vs/editor/contrib/links/browser/links.js +10 -10
- package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +8 -8
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/esm/vs/editor/contrib/rename/browser/rename.js +11 -11
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +8 -8
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +10 -10
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +17 -17
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +24 -24
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +1 -1
- package/esm/vs/editor/standalone/browser/standaloneTreeSitterLibraryService.js +2 -12
- package/esm/vs/editor/standalone/browser/standaloneTreeSitterLibraryService.js.map +1 -1
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +5 -5
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/actions.js +1 -0
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/actions/common/menuService.js +2 -2
- package/esm/vs/platform/configuration/common/configurationRegistry.js +22 -10
- package/esm/vs/platform/configuration/common/configurationRegistry.js.map +1 -1
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
- package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/markers/common/markerService.js +2 -2
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +19 -9
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +12 -10
- package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputController.js +12 -6
- package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTree.js +9 -9
- package/esm/vs/platform/quickinput/browser/tree/quickInputTree.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +2 -2
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js +19 -26
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeSorter.js +46 -0
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeSorter.js.map +1 -0
- package/esm/vs/platform/quickinput/common/quickInput.js.map +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +17 -17
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +11 -11
- package/esm/vs/platform/theme/common/colors/miscColors.js +15 -15
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/common/network.ts","vs/base/common/network.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,WAAW,CAAC;AAEnC,MAAM,KAAW,OAAO,CA8IvB;AA9ID,WAAiB,OAAO;IAEvB;;;OAGG;IACU,gBAAQ,GAAG,UAAU,CAAC;IAEnC;;OAEG;IACU,cAAM,GAAG,QAAQ,CAAC;IAE/B;;OAEG;IACU,gBAAQ,GAAG,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AC,CAAC,CAAC,YAAY,CAAC;QACnD,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,EAAE,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAde,uBAAmB,sBAclC,CAAA;IAED;;;OAGG;IACH,SAAgB,cAAc,CAAC,WAAqD,EAAE,IAAa,EAAE,IAAa;QACjH,mDAAmD;QACnD,IAAI,CAAO,UAAW,CAAC,mBAAmB,EAAE,CAAC;YAC5C,2CAA2C;YAC3C,OAAO;QACR,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QACpD,IAAI,WAAW,YAAY,eAAe,EAAE,CAAC;YAC5C,WAAW,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACkB,WAAY,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC;QACnE,CAAC;IACF,CAAC;IAZe,kBAAc,iBAY7B,CAAA;AACF,CAAC,EAhDgB,GAAG,KAAH,GAAG,QAgDnB","file":"network.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as errors from './errors.js';\nimport * as platform from './platform.js';\nimport { equalsIgnoreCase, startsWithIgnoreCase } from './strings.js';\nimport { URI } from './uri.js';\nimport * as paths from './path.js';\n\nexport namespace Schemas {\n\n\t/**\n\t * A schema that is used for models that exist in memory\n\t * only and that have no correspondence on a server or such.\n\t */\n\texport const inMemory = 'inmemory';\n\n\t/**\n\t * A schema that is used for setting files\n\t */\n\texport const vscode = 'vscode';\n\n\t/**\n\t * A schema that is used for internal private files\n\t */\n\texport const internal = 'private';\n\n\t/**\n\t * A walk-through document.\n\t */\n\texport const walkThrough = 'walkThrough';\n\n\t/**\n\t * An embedded code snippet.\n\t */\n\texport const walkThroughSnippet = 'walkThroughSnippet';\n\n\texport const http = 'http';\n\n\texport const https = 'https';\n\n\texport const file = 'file';\n\n\texport const mailto = 'mailto';\n\n\texport const untitled = 'untitled';\n\n\texport const data = 'data';\n\n\texport const command = 'command';\n\n\texport const vscodeRemote = 'vscode-remote';\n\n\texport const vscodeRemoteResource = 'vscode-remote-resource';\n\n\texport const vscodeManagedRemoteResource = 'vscode-managed-remote-resource';\n\n\texport const vscodeUserData = 'vscode-userdata';\n\n\texport const vscodeCustomEditor = 'vscode-custom-editor';\n\n\texport const vscodeNotebookCell = 'vscode-notebook-cell';\n\texport const vscodeNotebookCellMetadata = 'vscode-notebook-cell-metadata';\n\texport const vscodeNotebookCellMetadataDiff = 'vscode-notebook-cell-metadata-diff';\n\texport const vscodeNotebookCellOutput = 'vscode-notebook-cell-output';\n\texport const vscodeNotebookCellOutputDiff = 'vscode-notebook-cell-output-diff';\n\texport const vscodeNotebookMetadata = 'vscode-notebook-metadata';\n\texport const vscodeInteractiveInput = 'vscode-interactive-input';\n\n\texport const vscodeSettings = 'vscode-settings';\n\n\texport const vscodeWorkspaceTrust = 'vscode-workspace-trust';\n\n\texport const vscodeTerminal = 'vscode-terminal';\n\n\t/** Scheme used for code blocks in chat. */\n\texport const vscodeChatCodeBlock = 'vscode-chat-code-block';\n\n\t/** Scheme used for LHS of code compare (aka diff) blocks in chat. */\n\texport const vscodeChatCodeCompareBlock = 'vscode-chat-code-compare-block';\n\n\t/** Scheme used for the chat input editor. */\n\texport const vscodeChatEditor = 'vscode-chat-editor';\n\n\t/** Scheme used for the chat input part */\n\texport const vscodeChatInput = 'chatSessionInput';\n\n\t/** Scheme for chat session content */\n\texport const vscodeChatSession = 'vscode-chat-session';\n\n\t/**\n\t * Scheme used internally for webviews that aren't linked to a resource (i.e. not custom editors)\n\t */\n\texport const webviewPanel = 'webview-panel';\n\n\t/**\n\t * Scheme used for loading the wrapper html and script in webviews.\n\t */\n\texport const vscodeWebview = 'vscode-webview';\n\n\t/**\n\t * Scheme used for extension pages\n\t */\n\texport const extension = 'extension';\n\n\t/**\n\t * Scheme used as a replacement of `file` scheme to load\n\t * files with our custom protocol handler (desktop only).\n\t */\n\texport const vscodeFileResource = 'vscode-file';\n\n\t/**\n\t * Scheme used for temporary resources\n\t */\n\texport const tmp = 'tmp';\n\n\t/**\n\t * Scheme used vs live share\n\t */\n\texport const vsls = 'vsls';\n\n\t/**\n\t * Scheme used for the Source Control commit input's text document\n\t */\n\texport const vscodeSourceControl = 'vscode-scm';\n\n\t/**\n\t * Scheme used for input box for creating comments.\n\t */\n\texport const commentsInput = 'comment';\n\n\t/**\n\t * Scheme used for special rendering of settings in the release notes\n\t */\n\texport const codeSetting = 'code-setting';\n\n\t/**\n\t * Scheme used for output panel resources\n\t */\n\texport const outputChannel = 'output';\n\n\t/**\n\t * Scheme used for the accessible view\n\t */\n\texport const accessibleView = 'accessible-view';\n\n\t/**\n\t * Used for snapshots of chat edits\n\t */\n\texport const chatEditingSnapshotScheme = 'chat-editing-snapshot-text-model';\n\texport const chatEditingModel = 'chat-editing-text-model';\n}\n\nexport function matchesScheme(target: URI | string, scheme: string): boolean {\n\tif (URI.isUri(target)) {\n\t\treturn equalsIgnoreCase(target.scheme, scheme);\n\t} else {\n\t\treturn startsWithIgnoreCase(target, scheme + ':');\n\t}\n}\n\nexport function matchesSomeScheme(target: URI | string, ...schemes: string[]): boolean {\n\treturn schemes.some(scheme => matchesScheme(target, scheme));\n}\nexport const connectionTokenQueryName = 'tkn';\n\nclass RemoteAuthoritiesImpl {\n\tprivate readonly _hosts: { [authority: string]: string | undefined } = Object.create(null);\n\tprivate readonly _ports: { [authority: string]: number | undefined } = Object.create(null);\n\tprivate readonly _connectionTokens: { [authority: string]: string | undefined } = Object.create(null);\n\tprivate _preferredWebSchema: 'http' | 'https' = 'http';\n\tprivate _delegate: ((uri: URI) => URI) | null = null;\n\tprivate _serverRootPath: string = '/';\n\n\tsetPreferredWebSchema(schema: 'http' | 'https') {\n\t\tthis._preferredWebSchema = schema;\n\t}\n\n\tprivate get _remoteResourcesPath(): string {\n\t\treturn paths.posix.join(this._serverRootPath, Schemas.vscodeRemoteResource);\n\t}\n\n\trewrite(uri: URI): URI {\n\t\tif (this._delegate) {\n\t\t\ttry {\n\t\t\t\treturn this._delegate(uri);\n\t\t\t} catch (err) {\n\t\t\t\terrors.onUnexpectedError(err);\n\t\t\t\treturn uri;\n\t\t\t}\n\t\t}\n\t\tconst authority = uri.authority;\n\t\tlet host = this._hosts[authority];\n\t\tif (host && host.indexOf(':') !== -1 && host.indexOf('[') === -1) {\n\t\t\thost = `[${host}]`;\n\t\t}\n\t\tconst port = this._ports[authority];\n\t\tconst connectionToken = this._connectionTokens[authority];\n\t\tlet query = `path=${encodeURIComponent(uri.path)}`;\n\t\tif (typeof connectionToken === 'string') {\n\t\t\tquery += `&${connectionTokenQueryName}=${encodeURIComponent(connectionToken)}`;\n\t\t}\n\t\treturn URI.from({\n\t\t\tscheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,\n\t\t\tauthority: `${host}:${port}`,\n\t\t\tpath: this._remoteResourcesPath,\n\t\t\tquery\n\t\t});\n\t}\n}\n\nexport const RemoteAuthorities = new RemoteAuthoritiesImpl();\n\nexport const VSCODE_AUTHORITY = 'vscode-app';\n\nclass FileAccessImpl {\n\n\tprivate static readonly FALLBACK_AUTHORITY = VSCODE_AUTHORITY;\n\n\t/**\n\t * Returns a URI to use in contexts where the browser is responsible\n\t * for loading (e.g. fetch()) or when used within the DOM.\n\t *\n\t * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.\n\t */\n\turiToBrowserUri(uri: URI): URI {\n\t\t// Handle remote URIs via `RemoteAuthorities`\n\t\tif (uri.scheme === Schemas.vscodeRemote) {\n\t\t\treturn RemoteAuthorities.rewrite(uri);\n\t\t}\n\n\t\t// Convert to `vscode-file` resource..\n\t\tif (\n\t\t\t// ...only ever for `file` resources\n\t\t\turi.scheme === Schemas.file &&\n\t\t\t(\n\t\t\t\t// ...and we run in native environments\n\t\t\t\tplatform.isNative ||\n\t\t\t\t// ...or web worker extensions on desktop\n\t\t\t\t(platform.webWorkerOrigin === `${Schemas.vscodeFileResource}://${FileAccessImpl.FALLBACK_AUTHORITY}`)\n\t\t\t)\n\t\t) {\n\t\t\treturn uri.with({\n\t\t\t\tscheme: Schemas.vscodeFileResource,\n\t\t\t\t// We need to provide an authority here so that it can serve\n\t\t\t\t// as origin for network and loading matters in chromium.\n\t\t\t\t// If the URI is not coming with an authority already, we\n\t\t\t\t// add our own\n\t\t\t\tauthority: uri.authority || FileAccessImpl.FALLBACK_AUTHORITY,\n\t\t\t\tquery: null,\n\t\t\t\tfragment: null\n\t\t\t});\n\t\t}\n\n\t\treturn uri;\n\t}\n}\n\nexport const FileAccess = new FileAccessImpl();\n\nexport const CacheControlheaders: Record<string, string> = Object.freeze({\n\t'Cache-Control': 'no-cache, no-store'\n});\n\nexport const DocumentPolicyheaders: Record<string, string> = Object.freeze({\n\t'Document-Policy': 'include-js-call-stacks-in-crash-reports'\n});\n\nexport namespace COI {\n\n\tconst coiHeaders = new Map<'3' | '2' | '1' | string, Record<string, string>>([\n\t\t['1', { 'Cross-Origin-Opener-Policy': 'same-origin' }],\n\t\t['2', { 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n\t\t['3', { 'Cross-Origin-Opener-Policy': 'same-origin', 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n\t]);\n\n\texport const CoopAndCoep = Object.freeze(coiHeaders.get('3'));\n\n\tconst coiSearchParamName = 'vscode-coi';\n\n\t/**\n\t * Extract desired headers from `vscode-coi` invocation\n\t */\n\texport function getHeadersFromQuery(url: string | URI | URL): Record<string, string> | undefined {\n\t\tlet params: URLSearchParams | undefined;\n\t\tif (typeof url === 'string') {\n\t\t\tparams = new URL(url).searchParams;\n\t\t} else if (url instanceof URL) {\n\t\t\tparams = url.searchParams;\n\t\t} else if (URI.isUri(url)) {\n\t\t\tparams = new URL(url.toString(true)).searchParams;\n\t\t}\n\t\tconst value = params?.get(coiSearchParamName);\n\t\tif (!value) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn coiHeaders.get(value);\n\t}\n\n\t/**\n\t * Add the `vscode-coi` query attribute based on wanting `COOP` and `COEP`. Will be a noop when `crossOriginIsolated`\n\t * isn't enabled the current context\n\t */\n\texport function addSearchParam(urlOrSearch: URLSearchParams | Record<string, string>, coop: boolean, coep: boolean): void {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tif (!(<any>globalThis).crossOriginIsolated) {\n\t\t\t// depends on the current context being COI\n\t\t\treturn;\n\t\t}\n\t\tconst value = coop && coep ? '3' : coep ? '2' : '1';\n\t\tif (urlOrSearch instanceof URLSearchParams) {\n\t\t\turlOrSearch.set(coiSearchParamName, value);\n\t\t} else {\n\t\t\t(<Record<string, string>>urlOrSearch)[coiSearchParamName] = value;\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as errors from './errors.js';\nimport * as platform from './platform.js';\nimport { equalsIgnoreCase, startsWithIgnoreCase } from './strings.js';\nimport { URI } from './uri.js';\nimport * as paths from './path.js';\n\nexport namespace Schemas {\n\n\t/**\n\t * A schema that is used for models that exist in memory\n\t * only and that have no correspondence on a server or such.\n\t */\n\texport const inMemory = 'inmemory';\n\n\t/**\n\t * A schema that is used for setting files\n\t */\n\texport const vscode = 'vscode';\n\n\t/**\n\t * A schema that is used for internal private files\n\t */\n\texport const internal = 'private';\n\n\t/**\n\t * A walk-through document.\n\t */\n\texport const walkThrough = 'walkThrough';\n\n\t/**\n\t * An embedded code snippet.\n\t */\n\texport const walkThroughSnippet = 'walkThroughSnippet';\n\n\texport const http = 'http';\n\n\texport const https = 'https';\n\n\texport const file = 'file';\n\n\texport const mailto = 'mailto';\n\n\texport const untitled = 'untitled';\n\n\texport const data = 'data';\n\n\texport const command = 'command';\n\n\texport const vscodeRemote = 'vscode-remote';\n\n\texport const vscodeRemoteResource = 'vscode-remote-resource';\n\n\texport const vscodeManagedRemoteResource = 'vscode-managed-remote-resource';\n\n\texport const vscodeUserData = 'vscode-userdata';\n\n\texport const vscodeCustomEditor = 'vscode-custom-editor';\n\n\texport const vscodeNotebookCell = 'vscode-notebook-cell';\n\texport const vscodeNotebookCellMetadata = 'vscode-notebook-cell-metadata';\n\texport const vscodeNotebookCellMetadataDiff = 'vscode-notebook-cell-metadata-diff';\n\texport const vscodeNotebookCellOutput = 'vscode-notebook-cell-output';\n\texport const vscodeNotebookCellOutputDiff = 'vscode-notebook-cell-output-diff';\n\texport const vscodeNotebookMetadata = 'vscode-notebook-metadata';\n\texport const vscodeInteractiveInput = 'vscode-interactive-input';\n\n\texport const vscodeSettings = 'vscode-settings';\n\n\texport const vscodeWorkspaceTrust = 'vscode-workspace-trust';\n\n\texport const vscodeTerminal = 'vscode-terminal';\n\n\t/** Scheme used for code blocks in chat. */\n\texport const vscodeChatCodeBlock = 'vscode-chat-code-block';\n\n\t/** Scheme used for LHS of code compare (aka diff) blocks in chat. */\n\texport const vscodeChatCodeCompareBlock = 'vscode-chat-code-compare-block';\n\n\t/** Scheme used for the chat input editor. */\n\texport const vscodeChatEditor = 'vscode-chat-editor';\n\n\t/** Scheme used for the chat input part */\n\texport const vscodeChatInput = 'chatSessionInput';\n\n\t/** Scheme for chat session content */\n\texport const vscodeChatSession = 'vscode-chat-session';\n\n\t/**\n\t * Scheme used internally for webviews that aren't linked to a resource (i.e. not custom editors)\n\t */\n\texport const webviewPanel = 'webview-panel';\n\n\t/**\n\t * Scheme used for loading the wrapper html and script in webviews.\n\t */\n\texport const vscodeWebview = 'vscode-webview';\n\n\t/**\n\t * Scheme used for extension pages\n\t */\n\texport const extension = 'extension';\n\n\t/**\n\t * Scheme used as a replacement of `file` scheme to load\n\t * files with our custom protocol handler (desktop only).\n\t */\n\texport const vscodeFileResource = 'vscode-file';\n\n\t/**\n\t * Scheme used for temporary resources\n\t */\n\texport const tmp = 'tmp';\n\n\t/**\n\t * Scheme used vs live share\n\t */\n\texport const vsls = 'vsls';\n\n\t/**\n\t * Scheme used for the Source Control commit input's text document\n\t */\n\texport const vscodeSourceControl = 'vscode-scm';\n\n\t/**\n\t * Scheme used for input box for creating comments.\n\t */\n\texport const commentsInput = 'comment';\n\n\t/**\n\t * Scheme used for special rendering of settings in the release notes\n\t */\n\texport const codeSetting = 'code-setting';\n\n\t/**\n\t * Scheme used for output panel resources\n\t */\n\texport const outputChannel = 'output';\n\n\t/**\n\t * Scheme used for the accessible view\n\t */\n\texport const accessibleView = 'accessible-view';\n\n\t/**\n\t * Used for snapshots of chat edits\n\t */\n\texport const chatEditingSnapshotScheme = 'chat-editing-snapshot-text-model';\n\texport const chatEditingModel = 'chat-editing-text-model';\n}\n\nexport function matchesScheme(target: URI | string, scheme: string): boolean {\n\tif (URI.isUri(target)) {\n\t\treturn equalsIgnoreCase(target.scheme, scheme);\n\t} else {\n\t\treturn startsWithIgnoreCase(target, scheme + ':');\n\t}\n}\n\nexport function matchesSomeScheme(target: URI | string, ...schemes: string[]): boolean {\n\treturn schemes.some(scheme => matchesScheme(target, scheme));\n}\nexport const connectionTokenQueryName = 'tkn';\n\nclass RemoteAuthoritiesImpl {\n\tprivate readonly _hosts: { [authority: string]: string | undefined } = Object.create(null);\n\tprivate readonly _ports: { [authority: string]: number | undefined } = Object.create(null);\n\tprivate readonly _connectionTokens: { [authority: string]: string | undefined } = Object.create(null);\n\tprivate _preferredWebSchema: 'http' | 'https' = 'http';\n\tprivate _delegate: ((uri: URI) => URI) | null = null;\n\tprivate _serverRootPath: string = '/';\n\n\tsetPreferredWebSchema(schema: 'http' | 'https') {\n\t\tthis._preferredWebSchema = schema;\n\t}\n\n\tprivate get _remoteResourcesPath(): string {\n\t\treturn paths.posix.join(this._serverRootPath, Schemas.vscodeRemoteResource);\n\t}\n\n\trewrite(uri: URI): URI {\n\t\tif (this._delegate) {\n\t\t\ttry {\n\t\t\t\treturn this._delegate(uri);\n\t\t\t} catch (err) {\n\t\t\t\terrors.onUnexpectedError(err);\n\t\t\t\treturn uri;\n\t\t\t}\n\t\t}\n\t\tconst authority = uri.authority;\n\t\tlet host = this._hosts[authority];\n\t\tif (host && host.indexOf(':') !== -1 && host.indexOf('[') === -1) {\n\t\t\thost = `[${host}]`;\n\t\t}\n\t\tconst port = this._ports[authority];\n\t\tconst connectionToken = this._connectionTokens[authority];\n\t\tlet query = `path=${encodeURIComponent(uri.path)}`;\n\t\tif (typeof connectionToken === 'string') {\n\t\t\tquery += `&${connectionTokenQueryName}=${encodeURIComponent(connectionToken)}`;\n\t\t}\n\t\treturn URI.from({\n\t\t\tscheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,\n\t\t\tauthority: `${host}:${port}`,\n\t\t\tpath: this._remoteResourcesPath,\n\t\t\tquery\n\t\t});\n\t}\n}\n\nexport const RemoteAuthorities = new RemoteAuthoritiesImpl();\n\nexport const VSCODE_AUTHORITY = 'vscode-app';\n\nclass FileAccessImpl {\n\n\tprivate static readonly FALLBACK_AUTHORITY = VSCODE_AUTHORITY;\n\n\t/**\n\t * Returns a URI to use in contexts where the browser is responsible\n\t * for loading (e.g. fetch()) or when used within the DOM.\n\t *\n\t * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.\n\t */\n\turiToBrowserUri(uri: URI): URI {\n\t\t// Handle remote URIs via `RemoteAuthorities`\n\t\tif (uri.scheme === Schemas.vscodeRemote) {\n\t\t\treturn RemoteAuthorities.rewrite(uri);\n\t\t}\n\n\t\t// Convert to `vscode-file` resource..\n\t\tif (\n\t\t\t// ...only ever for `file` resources\n\t\t\turi.scheme === Schemas.file &&\n\t\t\t(\n\t\t\t\t// ...and we run in native environments\n\t\t\t\tplatform.isNative ||\n\t\t\t\t// ...or web worker extensions on desktop\n\t\t\t\t(platform.webWorkerOrigin === `${Schemas.vscodeFileResource}://${FileAccessImpl.FALLBACK_AUTHORITY}`)\n\t\t\t)\n\t\t) {\n\t\t\treturn uri.with({\n\t\t\t\tscheme: Schemas.vscodeFileResource,\n\t\t\t\t// We need to provide an authority here so that it can serve\n\t\t\t\t// as origin for network and loading matters in chromium.\n\t\t\t\t// If the URI is not coming with an authority already, we\n\t\t\t\t// add our own\n\t\t\t\tauthority: uri.authority || FileAccessImpl.FALLBACK_AUTHORITY,\n\t\t\t\tquery: null,\n\t\t\t\tfragment: null\n\t\t\t});\n\t\t}\n\n\t\treturn uri;\n\t}\n}\n\nexport const FileAccess = new FileAccessImpl();\n\nexport const CacheControlheaders: Record<string, string> = Object.freeze({\n\t'Cache-Control': 'no-cache, no-store'\n});\n\nexport const DocumentPolicyheaders: Record<string, string> = Object.freeze({\n\t'Document-Policy': 'include-js-call-stacks-in-crash-reports'\n});\n\nexport namespace COI {\n\n\tconst coiHeaders = new Map<'3' | '2' | '1' | string, Record<string, string>>([\n\t\t['1', { 'Cross-Origin-Opener-Policy': 'same-origin' }],\n\t\t['2', { 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n\t\t['3', { 'Cross-Origin-Opener-Policy': 'same-origin', 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n\t]);\n\n\texport const CoopAndCoep = Object.freeze(coiHeaders.get('3'));\n\n\tconst coiSearchParamName = 'vscode-coi';\n\n\t/**\n\t * Extract desired headers from `vscode-coi` invocation\n\t */\n\texport function getHeadersFromQuery(url: string | URI | URL): Record<string, string> | undefined {\n\t\tlet params: URLSearchParams | undefined;\n\t\tif (typeof url === 'string') {\n\t\t\tparams = new URL(url).searchParams;\n\t\t} else if (url instanceof URL) {\n\t\t\tparams = url.searchParams;\n\t\t} else if (URI.isUri(url)) {\n\t\t\tparams = new URL(url.toString(true)).searchParams;\n\t\t}\n\t\tconst value = params?.get(coiSearchParamName);\n\t\tif (!value) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn coiHeaders.get(value);\n\t}\n\n\t/**\n\t * Add the `vscode-coi` query attribute based on wanting `COOP` and `COEP`. Will be a noop when `crossOriginIsolated`\n\t * isn't enabled the current context\n\t */\n\texport function addSearchParam(urlOrSearch: URLSearchParams | Record<string, string>, coop: boolean, coep: boolean): void {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tif (!(<any>globalThis).crossOriginIsolated) {\n\t\t\t// depends on the current context being COI\n\t\t\treturn;\n\t\t}\n\t\tconst value = coop && coep ? '3' : coep ? '2' : '1';\n\t\tif (urlOrSearch instanceof URLSearchParams) {\n\t\t\turlOrSearch.set(coiSearchParamName, value);\n\t\t} else {\n\t\t\t(<Record<string, string>>urlOrSearch)[coiSearchParamName] = value;\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/common/network.ts","vs/base/common/network.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,WAAW,CAAC;AAEnC,MAAM,KAAW,OAAO,CAkJvB;AAlJD,WAAiB,OAAO;IAEvB;;;OAGG;IACU,gBAAQ,GAAG,UAAU,CAAC;IAEnC;;OAEG;IACU,cAAM,GAAG,QAAQ,CAAC;IAE/B;;OAEG;IACU,gBAAQ,GAAG,SAAS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CAAC,CAAC,YAAY,CAAC;QACnD,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,EAAE,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAde,uBAAmB,sBAclC,CAAA;IAED;;;OAGG;IACH,SAAgB,cAAc,CAAC,WAAqD,EAAE,IAAa,EAAE,IAAa;QACjH,mDAAmD;QACnD,IAAI,CAAO,UAAW,CAAC,mBAAmB,EAAE,CAAC;YAC5C,2CAA2C;YAC3C,OAAO;QACR,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QACpD,IAAI,WAAW,YAAY,eAAe,EAAE,CAAC;YAC5C,WAAW,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACkB,WAAY,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC;QACnE,CAAC;IACF,CAAC;IAZe,kBAAc,iBAY7B,CAAA;AACF,CAAC,EAhDgB,GAAG,KAAH,GAAG,QAgDnB","file":"network.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as errors from './errors.js';\nimport * as platform from './platform.js';\nimport { equalsIgnoreCase, startsWithIgnoreCase } from './strings.js';\nimport { URI } from './uri.js';\nimport * as paths from './path.js';\n\nexport namespace Schemas {\n\n\t/**\n\t * A schema that is used for models that exist in memory\n\t * only and that have no correspondence on a server or such.\n\t */\n\texport const inMemory = 'inmemory';\n\n\t/**\n\t * A schema that is used for setting files\n\t */\n\texport const vscode = 'vscode';\n\n\t/**\n\t * A schema that is used for internal private files\n\t */\n\texport const internal = 'private';\n\n\t/**\n\t * A walk-through document.\n\t */\n\texport const walkThrough = 'walkThrough';\n\n\t/**\n\t * An embedded code snippet.\n\t */\n\texport const walkThroughSnippet = 'walkThroughSnippet';\n\n\texport const http = 'http';\n\n\texport const https = 'https';\n\n\texport const file = 'file';\n\n\texport const mailto = 'mailto';\n\n\texport const untitled = 'untitled';\n\n\texport const data = 'data';\n\n\texport const command = 'command';\n\n\texport const vscodeRemote = 'vscode-remote';\n\n\texport const vscodeRemoteResource = 'vscode-remote-resource';\n\n\texport const vscodeManagedRemoteResource = 'vscode-managed-remote-resource';\n\n\texport const vscodeUserData = 'vscode-userdata';\n\n\texport const vscodeCustomEditor = 'vscode-custom-editor';\n\n\texport const vscodeNotebookCell = 'vscode-notebook-cell';\n\texport const vscodeNotebookCellMetadata = 'vscode-notebook-cell-metadata';\n\texport const vscodeNotebookCellMetadataDiff = 'vscode-notebook-cell-metadata-diff';\n\texport const vscodeNotebookCellOutput = 'vscode-notebook-cell-output';\n\texport const vscodeNotebookCellOutputDiff = 'vscode-notebook-cell-output-diff';\n\texport const vscodeNotebookMetadata = 'vscode-notebook-metadata';\n\texport const vscodeInteractiveInput = 'vscode-interactive-input';\n\n\texport const vscodeSettings = 'vscode-settings';\n\n\texport const vscodeWorkspaceTrust = 'vscode-workspace-trust';\n\n\texport const vscodeTerminal = 'vscode-terminal';\n\n\t/** Scheme used for code blocks in chat. */\n\texport const vscodeChatCodeBlock = 'vscode-chat-code-block';\n\n\t/** Scheme used for LHS of code compare (aka diff) blocks in chat. */\n\texport const vscodeChatCodeCompareBlock = 'vscode-chat-code-compare-block';\n\n\t/** Scheme used for the chat input editor. */\n\texport const vscodeChatEditor = 'vscode-chat-editor';\n\n\t/** Scheme used for the chat input part */\n\texport const vscodeChatInput = 'chatSessionInput';\n\n\t/**\n\t * Scheme for chat session content\n\t *\n\t * @deprecated\n\t * */\n\texport const vscodeChatSession = 'vscode-chat-session';\n\n\t/**\n\t * Scheme used internally for webviews that aren't linked to a resource (i.e. not custom editors)\n\t */\n\texport const webviewPanel = 'webview-panel';\n\n\t/**\n\t * Scheme used for loading the wrapper html and script in webviews.\n\t */\n\texport const vscodeWebview = 'vscode-webview';\n\n\t/**\n\t * Scheme used for extension pages\n\t */\n\texport const extension = 'extension';\n\n\t/**\n\t * Scheme used as a replacement of `file` scheme to load\n\t * files with our custom protocol handler (desktop only).\n\t */\n\texport const vscodeFileResource = 'vscode-file';\n\n\t/**\n\t * Scheme used for temporary resources\n\t */\n\texport const tmp = 'tmp';\n\n\t/**\n\t * Scheme used vs live share\n\t */\n\texport const vsls = 'vsls';\n\n\t/**\n\t * Scheme used for the Source Control commit input's text document\n\t */\n\texport const vscodeSourceControl = 'vscode-scm';\n\n\t/**\n\t * Scheme used for input box for creating comments.\n\t */\n\texport const commentsInput = 'comment';\n\n\t/**\n\t * Scheme used for special rendering of settings in the release notes\n\t */\n\texport const codeSetting = 'code-setting';\n\n\t/**\n\t * Scheme used for output panel resources\n\t */\n\texport const outputChannel = 'output';\n\n\t/**\n\t * Scheme used for the accessible view\n\t */\n\texport const accessibleView = 'accessible-view';\n\n\t/**\n\t * Used for snapshots of chat edits\n\t */\n\texport const chatEditingSnapshotScheme = 'chat-editing-snapshot-text-model';\n\texport const chatEditingModel = 'chat-editing-text-model';\n}\n\nexport function matchesScheme(target: URI | string, scheme: string): boolean {\n\tif (URI.isUri(target)) {\n\t\treturn equalsIgnoreCase(target.scheme, scheme);\n\t} else {\n\t\treturn startsWithIgnoreCase(target, scheme + ':');\n\t}\n}\n\nexport function matchesSomeScheme(target: URI | string, ...schemes: string[]): boolean {\n\treturn schemes.some(scheme => matchesScheme(target, scheme));\n}\nexport const connectionTokenQueryName = 'tkn';\n\nclass RemoteAuthoritiesImpl {\n\tprivate readonly _hosts: { [authority: string]: string | undefined } = Object.create(null);\n\tprivate readonly _ports: { [authority: string]: number | undefined } = Object.create(null);\n\tprivate readonly _connectionTokens: { [authority: string]: string | undefined } = Object.create(null);\n\tprivate _preferredWebSchema: 'http' | 'https' = 'http';\n\tprivate _delegate: ((uri: URI) => URI) | null = null;\n\tprivate _serverRootPath: string = '/';\n\n\tsetPreferredWebSchema(schema: 'http' | 'https') {\n\t\tthis._preferredWebSchema = schema;\n\t}\n\n\tprivate get _remoteResourcesPath(): string {\n\t\treturn paths.posix.join(this._serverRootPath, Schemas.vscodeRemoteResource);\n\t}\n\n\trewrite(uri: URI): URI {\n\t\tif (this._delegate) {\n\t\t\ttry {\n\t\t\t\treturn this._delegate(uri);\n\t\t\t} catch (err) {\n\t\t\t\terrors.onUnexpectedError(err);\n\t\t\t\treturn uri;\n\t\t\t}\n\t\t}\n\t\tconst authority = uri.authority;\n\t\tlet host = this._hosts[authority];\n\t\tif (host && host.indexOf(':') !== -1 && host.indexOf('[') === -1) {\n\t\t\thost = `[${host}]`;\n\t\t}\n\t\tconst port = this._ports[authority];\n\t\tconst connectionToken = this._connectionTokens[authority];\n\t\tlet query = `path=${encodeURIComponent(uri.path)}`;\n\t\tif (typeof connectionToken === 'string') {\n\t\t\tquery += `&${connectionTokenQueryName}=${encodeURIComponent(connectionToken)}`;\n\t\t}\n\t\treturn URI.from({\n\t\t\tscheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,\n\t\t\tauthority: `${host}:${port}`,\n\t\t\tpath: this._remoteResourcesPath,\n\t\t\tquery\n\t\t});\n\t}\n}\n\nexport const RemoteAuthorities = new RemoteAuthoritiesImpl();\n\nexport const VSCODE_AUTHORITY = 'vscode-app';\n\nclass FileAccessImpl {\n\n\tprivate static readonly FALLBACK_AUTHORITY = VSCODE_AUTHORITY;\n\n\t/**\n\t * Returns a URI to use in contexts where the browser is responsible\n\t * for loading (e.g. fetch()) or when used within the DOM.\n\t *\n\t * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.\n\t */\n\turiToBrowserUri(uri: URI): URI {\n\t\t// Handle remote URIs via `RemoteAuthorities`\n\t\tif (uri.scheme === Schemas.vscodeRemote) {\n\t\t\treturn RemoteAuthorities.rewrite(uri);\n\t\t}\n\n\t\t// Convert to `vscode-file` resource..\n\t\tif (\n\t\t\t// ...only ever for `file` resources\n\t\t\turi.scheme === Schemas.file &&\n\t\t\t(\n\t\t\t\t// ...and we run in native environments\n\t\t\t\tplatform.isNative ||\n\t\t\t\t// ...or web worker extensions on desktop\n\t\t\t\t(platform.webWorkerOrigin === `${Schemas.vscodeFileResource}://${FileAccessImpl.FALLBACK_AUTHORITY}`)\n\t\t\t)\n\t\t) {\n\t\t\treturn uri.with({\n\t\t\t\tscheme: Schemas.vscodeFileResource,\n\t\t\t\t// We need to provide an authority here so that it can serve\n\t\t\t\t// as origin for network and loading matters in chromium.\n\t\t\t\t// If the URI is not coming with an authority already, we\n\t\t\t\t// add our own\n\t\t\t\tauthority: uri.authority || FileAccessImpl.FALLBACK_AUTHORITY,\n\t\t\t\tquery: null,\n\t\t\t\tfragment: null\n\t\t\t});\n\t\t}\n\n\t\treturn uri;\n\t}\n}\n\nexport const FileAccess = new FileAccessImpl();\n\nexport const CacheControlheaders: Record<string, string> = Object.freeze({\n\t'Cache-Control': 'no-cache, no-store'\n});\n\nexport const DocumentPolicyheaders: Record<string, string> = Object.freeze({\n\t'Document-Policy': 'include-js-call-stacks-in-crash-reports'\n});\n\nexport namespace COI {\n\n\tconst coiHeaders = new Map<'3' | '2' | '1' | string, Record<string, string>>([\n\t\t['1', { 'Cross-Origin-Opener-Policy': 'same-origin' }],\n\t\t['2', { 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n\t\t['3', { 'Cross-Origin-Opener-Policy': 'same-origin', 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n\t]);\n\n\texport const CoopAndCoep = Object.freeze(coiHeaders.get('3'));\n\n\tconst coiSearchParamName = 'vscode-coi';\n\n\t/**\n\t * Extract desired headers from `vscode-coi` invocation\n\t */\n\texport function getHeadersFromQuery(url: string | URI | URL): Record<string, string> | undefined {\n\t\tlet params: URLSearchParams | undefined;\n\t\tif (typeof url === 'string') {\n\t\t\tparams = new URL(url).searchParams;\n\t\t} else if (url instanceof URL) {\n\t\t\tparams = url.searchParams;\n\t\t} else if (URI.isUri(url)) {\n\t\t\tparams = new URL(url.toString(true)).searchParams;\n\t\t}\n\t\tconst value = params?.get(coiSearchParamName);\n\t\tif (!value) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn coiHeaders.get(value);\n\t}\n\n\t/**\n\t * Add the `vscode-coi` query attribute based on wanting `COOP` and `COEP`. Will be a noop when `crossOriginIsolated`\n\t * isn't enabled the current context\n\t */\n\texport function addSearchParam(urlOrSearch: URLSearchParams | Record<string, string>, coop: boolean, coep: boolean): void {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tif (!(<any>globalThis).crossOriginIsolated) {\n\t\t\t// depends on the current context being COI\n\t\t\treturn;\n\t\t}\n\t\tconst value = coop && coep ? '3' : coep ? '2' : '1';\n\t\tif (urlOrSearch instanceof URLSearchParams) {\n\t\t\turlOrSearch.set(coiSearchParamName, value);\n\t\t} else {\n\t\t\t(<Record<string, string>>urlOrSearch)[coiSearchParamName] = value;\n\t\t}\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as errors from './errors.js';\nimport * as platform from './platform.js';\nimport { equalsIgnoreCase, startsWithIgnoreCase } from './strings.js';\nimport { URI } from './uri.js';\nimport * as paths from './path.js';\n\nexport namespace Schemas {\n\n\t/**\n\t * A schema that is used for models that exist in memory\n\t * only and that have no correspondence on a server or such.\n\t */\n\texport const inMemory = 'inmemory';\n\n\t/**\n\t * A schema that is used for setting files\n\t */\n\texport const vscode = 'vscode';\n\n\t/**\n\t * A schema that is used for internal private files\n\t */\n\texport const internal = 'private';\n\n\t/**\n\t * A walk-through document.\n\t */\n\texport const walkThrough = 'walkThrough';\n\n\t/**\n\t * An embedded code snippet.\n\t */\n\texport const walkThroughSnippet = 'walkThroughSnippet';\n\n\texport const http = 'http';\n\n\texport const https = 'https';\n\n\texport const file = 'file';\n\n\texport const mailto = 'mailto';\n\n\texport const untitled = 'untitled';\n\n\texport const data = 'data';\n\n\texport const command = 'command';\n\n\texport const vscodeRemote = 'vscode-remote';\n\n\texport const vscodeRemoteResource = 'vscode-remote-resource';\n\n\texport const vscodeManagedRemoteResource = 'vscode-managed-remote-resource';\n\n\texport const vscodeUserData = 'vscode-userdata';\n\n\texport const vscodeCustomEditor = 'vscode-custom-editor';\n\n\texport const vscodeNotebookCell = 'vscode-notebook-cell';\n\texport const vscodeNotebookCellMetadata = 'vscode-notebook-cell-metadata';\n\texport const vscodeNotebookCellMetadataDiff = 'vscode-notebook-cell-metadata-diff';\n\texport const vscodeNotebookCellOutput = 'vscode-notebook-cell-output';\n\texport const vscodeNotebookCellOutputDiff = 'vscode-notebook-cell-output-diff';\n\texport const vscodeNotebookMetadata = 'vscode-notebook-metadata';\n\texport const vscodeInteractiveInput = 'vscode-interactive-input';\n\n\texport const vscodeSettings = 'vscode-settings';\n\n\texport const vscodeWorkspaceTrust = 'vscode-workspace-trust';\n\n\texport const vscodeTerminal = 'vscode-terminal';\n\n\t/** Scheme used for code blocks in chat. */\n\texport const vscodeChatCodeBlock = 'vscode-chat-code-block';\n\n\t/** Scheme used for LHS of code compare (aka diff) blocks in chat. */\n\texport const vscodeChatCodeCompareBlock = 'vscode-chat-code-compare-block';\n\n\t/** Scheme used for the chat input editor. */\n\texport const vscodeChatEditor = 'vscode-chat-editor';\n\n\t/** Scheme used for the chat input part */\n\texport const vscodeChatInput = 'chatSessionInput';\n\n\t/**\n\t * Scheme for chat session content\n\t *\n\t * @deprecated\n\t * */\n\texport const vscodeChatSession = 'vscode-chat-session';\n\n\t/**\n\t * Scheme used internally for webviews that aren't linked to a resource (i.e. not custom editors)\n\t */\n\texport const webviewPanel = 'webview-panel';\n\n\t/**\n\t * Scheme used for loading the wrapper html and script in webviews.\n\t */\n\texport const vscodeWebview = 'vscode-webview';\n\n\t/**\n\t * Scheme used for extension pages\n\t */\n\texport const extension = 'extension';\n\n\t/**\n\t * Scheme used as a replacement of `file` scheme to load\n\t * files with our custom protocol handler (desktop only).\n\t */\n\texport const vscodeFileResource = 'vscode-file';\n\n\t/**\n\t * Scheme used for temporary resources\n\t */\n\texport const tmp = 'tmp';\n\n\t/**\n\t * Scheme used vs live share\n\t */\n\texport const vsls = 'vsls';\n\n\t/**\n\t * Scheme used for the Source Control commit input's text document\n\t */\n\texport const vscodeSourceControl = 'vscode-scm';\n\n\t/**\n\t * Scheme used for input box for creating comments.\n\t */\n\texport const commentsInput = 'comment';\n\n\t/**\n\t * Scheme used for special rendering of settings in the release notes\n\t */\n\texport const codeSetting = 'code-setting';\n\n\t/**\n\t * Scheme used for output panel resources\n\t */\n\texport const outputChannel = 'output';\n\n\t/**\n\t * Scheme used for the accessible view\n\t */\n\texport const accessibleView = 'accessible-view';\n\n\t/**\n\t * Used for snapshots of chat edits\n\t */\n\texport const chatEditingSnapshotScheme = 'chat-editing-snapshot-text-model';\n\texport const chatEditingModel = 'chat-editing-text-model';\n}\n\nexport function matchesScheme(target: URI | string, scheme: string): boolean {\n\tif (URI.isUri(target)) {\n\t\treturn equalsIgnoreCase(target.scheme, scheme);\n\t} else {\n\t\treturn startsWithIgnoreCase(target, scheme + ':');\n\t}\n}\n\nexport function matchesSomeScheme(target: URI | string, ...schemes: string[]): boolean {\n\treturn schemes.some(scheme => matchesScheme(target, scheme));\n}\nexport const connectionTokenQueryName = 'tkn';\n\nclass RemoteAuthoritiesImpl {\n\tprivate readonly _hosts: { [authority: string]: string | undefined } = Object.create(null);\n\tprivate readonly _ports: { [authority: string]: number | undefined } = Object.create(null);\n\tprivate readonly _connectionTokens: { [authority: string]: string | undefined } = Object.create(null);\n\tprivate _preferredWebSchema: 'http' | 'https' = 'http';\n\tprivate _delegate: ((uri: URI) => URI) | null = null;\n\tprivate _serverRootPath: string = '/';\n\n\tsetPreferredWebSchema(schema: 'http' | 'https') {\n\t\tthis._preferredWebSchema = schema;\n\t}\n\n\tprivate get _remoteResourcesPath(): string {\n\t\treturn paths.posix.join(this._serverRootPath, Schemas.vscodeRemoteResource);\n\t}\n\n\trewrite(uri: URI): URI {\n\t\tif (this._delegate) {\n\t\t\ttry {\n\t\t\t\treturn this._delegate(uri);\n\t\t\t} catch (err) {\n\t\t\t\terrors.onUnexpectedError(err);\n\t\t\t\treturn uri;\n\t\t\t}\n\t\t}\n\t\tconst authority = uri.authority;\n\t\tlet host = this._hosts[authority];\n\t\tif (host && host.indexOf(':') !== -1 && host.indexOf('[') === -1) {\n\t\t\thost = `[${host}]`;\n\t\t}\n\t\tconst port = this._ports[authority];\n\t\tconst connectionToken = this._connectionTokens[authority];\n\t\tlet query = `path=${encodeURIComponent(uri.path)}`;\n\t\tif (typeof connectionToken === 'string') {\n\t\t\tquery += `&${connectionTokenQueryName}=${encodeURIComponent(connectionToken)}`;\n\t\t}\n\t\treturn URI.from({\n\t\t\tscheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,\n\t\t\tauthority: `${host}:${port}`,\n\t\t\tpath: this._remoteResourcesPath,\n\t\t\tquery\n\t\t});\n\t}\n}\n\nexport const RemoteAuthorities = new RemoteAuthoritiesImpl();\n\nexport const VSCODE_AUTHORITY = 'vscode-app';\n\nclass FileAccessImpl {\n\n\tprivate static readonly FALLBACK_AUTHORITY = VSCODE_AUTHORITY;\n\n\t/**\n\t * Returns a URI to use in contexts where the browser is responsible\n\t * for loading (e.g. fetch()) or when used within the DOM.\n\t *\n\t * **Note:** use `dom.ts#asCSSUrl` whenever the URL is to be used in CSS context.\n\t */\n\turiToBrowserUri(uri: URI): URI {\n\t\t// Handle remote URIs via `RemoteAuthorities`\n\t\tif (uri.scheme === Schemas.vscodeRemote) {\n\t\t\treturn RemoteAuthorities.rewrite(uri);\n\t\t}\n\n\t\t// Convert to `vscode-file` resource..\n\t\tif (\n\t\t\t// ...only ever for `file` resources\n\t\t\turi.scheme === Schemas.file &&\n\t\t\t(\n\t\t\t\t// ...and we run in native environments\n\t\t\t\tplatform.isNative ||\n\t\t\t\t// ...or web worker extensions on desktop\n\t\t\t\t(platform.webWorkerOrigin === `${Schemas.vscodeFileResource}://${FileAccessImpl.FALLBACK_AUTHORITY}`)\n\t\t\t)\n\t\t) {\n\t\t\treturn uri.with({\n\t\t\t\tscheme: Schemas.vscodeFileResource,\n\t\t\t\t// We need to provide an authority here so that it can serve\n\t\t\t\t// as origin for network and loading matters in chromium.\n\t\t\t\t// If the URI is not coming with an authority already, we\n\t\t\t\t// add our own\n\t\t\t\tauthority: uri.authority || FileAccessImpl.FALLBACK_AUTHORITY,\n\t\t\t\tquery: null,\n\t\t\t\tfragment: null\n\t\t\t});\n\t\t}\n\n\t\treturn uri;\n\t}\n}\n\nexport const FileAccess = new FileAccessImpl();\n\nexport const CacheControlheaders: Record<string, string> = Object.freeze({\n\t'Cache-Control': 'no-cache, no-store'\n});\n\nexport const DocumentPolicyheaders: Record<string, string> = Object.freeze({\n\t'Document-Policy': 'include-js-call-stacks-in-crash-reports'\n});\n\nexport namespace COI {\n\n\tconst coiHeaders = new Map<'3' | '2' | '1' | string, Record<string, string>>([\n\t\t['1', { 'Cross-Origin-Opener-Policy': 'same-origin' }],\n\t\t['2', { 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n\t\t['3', { 'Cross-Origin-Opener-Policy': 'same-origin', 'Cross-Origin-Embedder-Policy': 'require-corp' }],\n\t]);\n\n\texport const CoopAndCoep = Object.freeze(coiHeaders.get('3'));\n\n\tconst coiSearchParamName = 'vscode-coi';\n\n\t/**\n\t * Extract desired headers from `vscode-coi` invocation\n\t */\n\texport function getHeadersFromQuery(url: string | URI | URL): Record<string, string> | undefined {\n\t\tlet params: URLSearchParams | undefined;\n\t\tif (typeof url === 'string') {\n\t\t\tparams = new URL(url).searchParams;\n\t\t} else if (url instanceof URL) {\n\t\t\tparams = url.searchParams;\n\t\t} else if (URI.isUri(url)) {\n\t\t\tparams = new URL(url.toString(true)).searchParams;\n\t\t}\n\t\tconst value = params?.get(coiSearchParamName);\n\t\tif (!value) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn coiHeaders.get(value);\n\t}\n\n\t/**\n\t * Add the `vscode-coi` query attribute based on wanting `COOP` and `COEP`. Will be a noop when `crossOriginIsolated`\n\t * isn't enabled the current context\n\t */\n\texport function addSearchParam(urlOrSearch: URLSearchParams | Record<string, string>, coop: boolean, coep: boolean): void {\n\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\tif (!(<any>globalThis).crossOriginIsolated) {\n\t\t\t// depends on the current context being COI\n\t\t\treturn;\n\t\t}\n\t\tconst value = coop && coep ? '3' : coep ? '2' : '1';\n\t\tif (urlOrSearch instanceof URLSearchParams) {\n\t\t\turlOrSearch.set(coiSearchParamName, value);\n\t\t} else {\n\t\t\t(<Record<string, string>>urlOrSearch)[coiSearchParamName] = value;\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paging.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sources":["vs/base/common/paging.ts"],"names":[],"mappings":"","sourcesContent":["\nimport { CancellationToken } from './cancellation.js';\n\n/**\n * A PagedModel is a stateful model over an abstracted paged collection.\n */\nexport interface IPagedModel<T> {\n\
|
|
1
|
+
{"version":3,"file":"paging.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sources":["vs/base/common/paging.ts"],"names":[],"mappings":"","sourcesContent":["\nimport { CancellationToken } from './cancellation.js';\nimport { Event } from './event.js';\n\n/**\n * A PagedModel is a stateful model over an abstracted paged collection.\n */\nexport interface IPagedModel<T> {\n\treadonly length: number;\n\treadonly onDidIncrementLength: Event<number>;\n\tisResolved(index: number): boolean;\n\tget(index: number): T;\n\tresolve(index: number, cancellationToken: CancellationToken): Promise<T>;\n}\n"]}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { mapFilter } from './arrays.js';
|
|
6
|
+
export class ValidatorBase {
|
|
7
|
+
validateOrThrow(content) {
|
|
8
|
+
const result = this.validate(content);
|
|
9
|
+
if (result.error) {
|
|
10
|
+
throw new Error(result.error.message);
|
|
11
|
+
}
|
|
12
|
+
return result.content;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class TypeofValidator extends ValidatorBase {
|
|
16
|
+
constructor(type) {
|
|
17
|
+
super();
|
|
18
|
+
this.type = type;
|
|
19
|
+
}
|
|
20
|
+
validate(content) {
|
|
21
|
+
if (typeof content !== this.type) {
|
|
22
|
+
return { content: undefined, error: { message: `Expected ${this.type}, but got ${typeof content}` } };
|
|
23
|
+
}
|
|
24
|
+
return { content: content, error: undefined };
|
|
25
|
+
}
|
|
26
|
+
getJSONSchema() {
|
|
27
|
+
return { type: this.type };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const vStringValidator = new TypeofValidator('string');
|
|
31
|
+
export function vString() { return vStringValidator; }
|
|
32
|
+
const vNumberValidator = new TypeofValidator('number');
|
|
33
|
+
const vBooleanValidator = new TypeofValidator('boolean');
|
|
34
|
+
export function vBoolean() { return vBooleanValidator; }
|
|
35
|
+
const vObjAnyValidator = new TypeofValidator('object');
|
|
36
|
+
class UndefinedValidator extends ValidatorBase {
|
|
37
|
+
validate(content) {
|
|
38
|
+
if (content !== undefined) {
|
|
39
|
+
return { content: undefined, error: { message: `Expected undefined, but got ${typeof content}` } };
|
|
40
|
+
}
|
|
41
|
+
return { content: undefined, error: undefined };
|
|
42
|
+
}
|
|
43
|
+
getJSONSchema() {
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export function vUndefined() {
|
|
48
|
+
return new UndefinedValidator();
|
|
49
|
+
}
|
|
50
|
+
export class Optional {
|
|
51
|
+
constructor(validator) {
|
|
52
|
+
this.validator = validator;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function vOptionalProp(validator) {
|
|
56
|
+
return new Optional(validator);
|
|
57
|
+
}
|
|
58
|
+
class ObjValidator extends ValidatorBase {
|
|
59
|
+
constructor(properties) {
|
|
60
|
+
super();
|
|
61
|
+
this.properties = properties;
|
|
62
|
+
}
|
|
63
|
+
validate(content) {
|
|
64
|
+
if (typeof content !== 'object' || content === null) {
|
|
65
|
+
return { content: undefined, error: { message: 'Expected object' } };
|
|
66
|
+
}
|
|
67
|
+
// eslint-disable-next-line local/code-no-dangerous-type-assertions
|
|
68
|
+
const result = {};
|
|
69
|
+
for (const key in this.properties) {
|
|
70
|
+
const prop = this.properties[key];
|
|
71
|
+
// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any
|
|
72
|
+
const fieldValue = content[key];
|
|
73
|
+
const isOptional = prop instanceof Optional;
|
|
74
|
+
const validator = isOptional ? prop.validator : prop;
|
|
75
|
+
if (isOptional && fieldValue === undefined) {
|
|
76
|
+
// Optional field not provided, skip validation
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const { content: value, error } = validator.validate(fieldValue);
|
|
80
|
+
if (error) {
|
|
81
|
+
return { content: undefined, error: { message: `Error in property '${key}': ${error.message}` } };
|
|
82
|
+
}
|
|
83
|
+
// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any
|
|
84
|
+
result[key] = value;
|
|
85
|
+
}
|
|
86
|
+
return { content: result, error: undefined };
|
|
87
|
+
}
|
|
88
|
+
getJSONSchema() {
|
|
89
|
+
const requiredFields = [];
|
|
90
|
+
const schemaProperties = {};
|
|
91
|
+
for (const [key, prop] of Object.entries(this.properties)) {
|
|
92
|
+
const isOptional = prop instanceof Optional;
|
|
93
|
+
const validator = isOptional ? prop.validator : prop;
|
|
94
|
+
schemaProperties[key] = validator.getJSONSchema();
|
|
95
|
+
if (!isOptional) {
|
|
96
|
+
requiredFields.push(key);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const schema = {
|
|
100
|
+
type: 'object',
|
|
101
|
+
properties: schemaProperties,
|
|
102
|
+
...(requiredFields.length > 0 ? { required: requiredFields } : {})
|
|
103
|
+
};
|
|
104
|
+
return schema;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export function vObj(properties) {
|
|
108
|
+
return new ObjValidator(properties);
|
|
109
|
+
}
|
|
110
|
+
class UnionValidator extends ValidatorBase {
|
|
111
|
+
constructor(validators) {
|
|
112
|
+
super();
|
|
113
|
+
this.validators = validators;
|
|
114
|
+
}
|
|
115
|
+
validate(content) {
|
|
116
|
+
let lastError;
|
|
117
|
+
for (const validator of this.validators) {
|
|
118
|
+
const { content: value, error } = validator.validate(content);
|
|
119
|
+
if (!error) {
|
|
120
|
+
// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any
|
|
121
|
+
return { content: value, error: undefined };
|
|
122
|
+
}
|
|
123
|
+
lastError = error;
|
|
124
|
+
}
|
|
125
|
+
return { content: undefined, error: lastError };
|
|
126
|
+
}
|
|
127
|
+
getJSONSchema() {
|
|
128
|
+
return {
|
|
129
|
+
oneOf: mapFilter(this.validators, validator => {
|
|
130
|
+
if (validator instanceof UndefinedValidator) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
return validator.getJSONSchema();
|
|
134
|
+
}),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
export function vUnion(...validators) {
|
|
139
|
+
return new UnionValidator(validators);
|
|
140
|
+
}
|
|
141
|
+
class UseRefSchemaValidator extends ValidatorBase {
|
|
142
|
+
constructor(_ref, _validator) {
|
|
143
|
+
super();
|
|
144
|
+
this._ref = _ref;
|
|
145
|
+
this._validator = _validator;
|
|
146
|
+
}
|
|
147
|
+
validate(content) {
|
|
148
|
+
return this._validator.validate(content);
|
|
149
|
+
}
|
|
150
|
+
getJSONSchema() {
|
|
151
|
+
return { $ref: this._ref };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
export function vWithJsonSchemaRef(ref, validator) {
|
|
155
|
+
return new UseRefSchemaValidator(ref, validator);
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/base/common/validation.ts","vs/base/common/validation.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AASxC,MAAM,OAAgB,aAAa;IAKlC,eAAe,CAAC,OAAgB;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,MAAM,CAAC,OAAO,CAAC;IACvB,CAAC;CACD;AAgBD,MAAM,eAA8C,SAAQ,aAA8B;IACzF,YAA6B,IAAU;QACtC,KAAK,EAAE,CAAC;QADoB,SAAI,GAAJ,IAAI,CAAM;IAEvC,CAAC;IAED,QAAQ,CAAC,OAAgB;QACxB,IAAI,OAAO,OAAO,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YAClC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,YAAY,IAAI,CAAC,IAAI,aAAa,OAAO,OAAO,EAAE,EAAE,EAAE,CAAC;QACvG,CA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AAK,EAAE,CAAC;gBACZ,uFAAuF;gBACvF,OAAO,EAAE,OAAO,EAAE,KAAY,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;YACpD,CAAC;YAED,SAAS,GAAG,KAAK,CAAC;QACnB,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAU,EAAE,CAAC;IAClD,CAAC;IAED,aAAa;QACZ,OAAO;YACN,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE;gBAC7C,IAAI,SAAS,YAAY,kBAAkB,EAAE,CAAC;oBAC7C,OAAO,SAAS,CAAC;gBAClB,CAAC;gBACD,OAAO,SAAS,CAAC,aAAa,EAAE,CAAC;YAClC,CAAC,CAAC;SACF,CAAC;IACH,CAAC;CACD;AAED,MAAM,UAAU,MAAM,CAAkC,GAAG,UAAa;IACvE,OAAO,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,qBAAyB,SAAQ,aAAgB;IACtD,YACkB,IAAY,EACZ,UAAyB;QAE1C,KAAK,EAAE,CAAC;QAHS,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAe;IAG3C,CAAC;IAED,QAAQ,CAAC,OAAgB;QACxB,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,aAAa;QACZ,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,CAAC;CACD;AAED,MAAM,UAAU,kBAAkB,CAAI,GAAW,EAAE,SAAwB;IAC1E,OAAO,IAAI,qBAAqB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC","file":"validation.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { mapFilter } from './arrays.js';\nimport { IJSONSchema } from './jsonSchema.js';\n\nexport interface IValidator<T> {\n\tvalidate(content: unknown): { content: T; error: undefined } | { content: undefined; error: ValidationError };\n\n\tgetJSONSchema(): IJSONSchema;\n}\n\nexport abstract class ValidatorBase<T> implements IValidator<T> {\n\tabstract validate(content: unknown): { content: T; error: undefined } | { content: undefined; error: ValidationError };\n\n\tabstract getJSONSchema(): IJSONSchema;\n\n\tvalidateOrThrow(content: unknown): T {\n\t\tconst result = this.validate(content);\n\t\tif (result.error) {\n\t\t\tthrow new Error(result.error.message);\n\t\t}\n\t\treturn result.content;\n\t}\n}\n\nexport type ValidatorType<T> = T extends IValidator<infer U> ? U : never;\n\nexport interface ValidationError {\n\tmessage: string;\n}\n\ntype TypeOfMap = {\n\tstring: string;\n\tnumber: number;\n\tboolean: boolean;\n\tobject: object;\n\tnull: null;\n};\n\nclass TypeofValidator<TKey extends keyof TypeOfMap> extends ValidatorBase<TypeOfMap[TKey]> {\n\tconstructor(private readonly type: TKey) {\n\t\tsuper();\n\t}\n\n\tvalidate(content: unknown): { content: TypeOfMap[TKey]; error: undefined } | { content: undefined; error: ValidationError } {\n\t\tif (typeof content !== this.type) {\n\t\t\treturn { content: undefined, error: { message: `Expected ${this.type}, but got ${typeof content}` } };\n\t\t}\n\n\t\treturn { content: content as TypeOfMap[TKey], error: undefined };\n\t}\n\n\tgetJSONSchema(): IJSONSchema {\n\t\treturn { type: this.type };\n\t}\n}\n\nconst vStringValidator = new TypeofValidator('string');\nexport function vString(): ValidatorBase<string> { return vStringValidator; }\n\nconst vNumberValidator = new TypeofValidator('number');\n\nconst vBooleanValidator = new TypeofValidator('boolean');\nexport function vBoolean(): ValidatorBase<boolean> { return vBooleanValidator; }\n\nconst vObjAnyValidator = new TypeofValidator('object');\n\nclass UndefinedValidator extends ValidatorBase<undefined> {\n\tvalidate(content: unknown): { content: undefined; error: undefined } | { content: undefined; error: ValidationError } {\n\t\tif (content !== undefined) {\n\t\t\treturn { content: undefined, error: { message: `Expected undefined, but got ${typeof content}` } };\n\t\t}\n\n\t\treturn { content: undefined, error: undefined };\n\t}\n\n\tgetJSONSchema(): IJSONSchema {\n\t\treturn {};\n\t}\n}\n\nexport function vUndefined(): ValidatorBase<undefined> {\n\treturn new UndefinedValidator();\n}\n\nexport class Optional<T extends IValidator<unknown>> {\n\tconstructor(public readonly validator: T) { }\n}\n\nexport function vOptionalProp<T>(validator: IValidator<T>): Optional<IValidator<T>> {\n\treturn new Optional(validator);\n}\n\ntype ExtractOptionalKeys<T> = {\n\t[K in keyof T]: T[K] extends Optional<IValidator<unknown>> ? K : never;\n}[keyof T];\n\ntype ExtractRequiredKeys<T> = {\n\t[K in keyof T]: T[K] extends Optional<IValidator<unknown>> ? never : K;\n}[keyof T];\n\nexport type vObjType<T extends Record<string, IValidator<unknown> | Optional<IValidator<unknown>>>> = {\n\t[K in ExtractRequiredKeys<T>]: T[K] extends IValidator<infer U> ? U : never;\n} & {\n\t[K in ExtractOptionalKeys<T>]?: T[K] extends Optional<IValidator<infer U>> ? U : never;\n};\n\nclass ObjValidator<T extends Record<string, IValidator<unknown> | Optional<IValidator<unknown>>>> extends ValidatorBase<vObjType<T>> {\n\tconstructor(private readonly properties: T) {\n\t\tsuper();\n\t}\n\n\tvalidate(content: unknown): { content: vObjType<T>; error: undefined } | { content: undefined; error: ValidationError } {\n\t\tif (typeof content !== 'object' || content === null) {\n\t\t\treturn { content: undefined, error: { message: 'Expected object' } };\n\t\t}\n\n\t\t// eslint-disable-next-line local/code-no-dangerous-type-assertions\n\t\tconst result: vObjType<T> = {} as vObjType<T>;\n\n\t\tfor (const key in this.properties) {\n\t\t\tconst prop = this.properties[key];\n\t\t\t// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any\n\t\t\tconst fieldValue = (content as any)[key];\n\n\t\t\tconst isOptional = prop instanceof Optional;\n\t\t\tconst validator: IValidator<unknown> = isOptional ? prop.validator : prop;\n\n\t\t\tif (isOptional && fieldValue === undefined) {\n\t\t\t\t// Optional field not provided, skip validation\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst { content: value, error } = validator.validate(fieldValue);\n\t\t\tif (error) {\n\t\t\t\treturn { content: undefined, error: { message: `Error in property '${key}': ${error.message}` } };\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any\n\t\t\t(result as any)[key] = value;\n\t\t}\n\n\t\treturn { content: result, error: undefined };\n\t}\n\n\tgetJSONSchema(): IJSONSchema {\n\t\tconst requiredFields: string[] = [];\n\t\tconst schemaProperties: Record<string, IJSONSchema> = {};\n\n\t\tfor (const [key, prop] of Object.entries(this.properties)) {\n\t\t\tconst isOptional = prop instanceof Optional;\n\t\t\tconst validator: IValidator<unknown> = isOptional ? prop.validator : prop;\n\t\t\tschemaProperties[key] = validator.getJSONSchema();\n\t\t\tif (!isOptional) {\n\t\t\t\trequiredFields.push(key);\n\t\t\t}\n\t\t}\n\n\t\tconst schema: IJSONSchema = {\n\t\t\ttype: 'object',\n\t\t\tproperties: schemaProperties,\n\t\t\t...(requiredFields.length > 0 ? { required: requiredFields } : {})\n\t\t};\n\n\t\treturn schema;\n\t}\n}\n\nexport function vObj<T extends Record<string, IValidator<unknown> | Optional<IValidator<unknown>>>>(properties: T): ValidatorBase<vObjType<T>> {\n\treturn new ObjValidator(properties);\n}\n\nclass UnionValidator<T extends IValidator<unknown>[]> extends ValidatorBase<ValidatorType<T[number]>> {\n\tconstructor(private readonly validators: T) {\n\t\tsuper();\n\t}\n\n\tvalidate(content: unknown): { content: ValidatorType<T[number]>; error: undefined } | { content: undefined; error: ValidationError } {\n\t\tlet lastError: ValidationError | undefined;\n\t\tfor (const validator of this.validators) {\n\t\t\tconst { content: value, error } = validator.validate(content);\n\t\t\tif (!error) {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any\n\t\t\t\treturn { content: value as any, error: undefined };\n\t\t\t}\n\n\t\t\tlastError = error;\n\t\t}\n\n\t\treturn { content: undefined, error: lastError! };\n\t}\n\n\tgetJSONSchema(): IJSONSchema {\n\t\treturn {\n\t\t\toneOf: mapFilter(this.validators, validator => {\n\t\t\t\tif (validator instanceof UndefinedValidator) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn validator.getJSONSchema();\n\t\t\t}),\n\t\t};\n\t}\n}\n\nexport function vUnion<T extends IValidator<unknown>[]>(...validators: T): ValidatorBase<ValidatorType<T[number]>> {\n\treturn new UnionValidator(validators);\n}\n\nclass UseRefSchemaValidator<T> extends ValidatorBase<T> {\n\tconstructor(\n\t\tprivate readonly _ref: string,\n\t\tprivate readonly _validator: IValidator<T>\n\t) {\n\t\tsuper();\n\t}\n\n\tvalidate(content: unknown): { content: T; error: undefined } | { content: undefined; error: ValidationError } {\n\t\treturn this._validator.validate(content);\n\t}\n\n\tgetJSONSchema(): IJSONSchema {\n\t\treturn { $ref: this._ref };\n\t}\n}\n\nexport function vWithJsonSchemaRef<T>(ref: string, validator: IValidator<T>): ValidatorBase<T> {\n\treturn new UseRefSchemaValidator(ref, validator);\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { mapFilter } from './arrays.js';\nimport { IJSONSchema } from './jsonSchema.js';\n\nexport interface IValidator<T> {\n\tvalidate(content: unknown): { content: T; error: undefined } | { content: undefined; error: ValidationError };\n\n\tgetJSONSchema(): IJSONSchema;\n}\n\nexport abstract class ValidatorBase<T> implements IValidator<T> {\n\tabstract validate(content: unknown): { content: T; error: undefined } | { content: undefined; error: ValidationError };\n\n\tabstract getJSONSchema(): IJSONSchema;\n\n\tvalidateOrThrow(content: unknown): T {\n\t\tconst result = this.validate(content);\n\t\tif (result.error) {\n\t\t\tthrow new Error(result.error.message);\n\t\t}\n\t\treturn result.content;\n\t}\n}\n\nexport type ValidatorType<T> = T extends IValidator<infer U> ? U : never;\n\nexport interface ValidationError {\n\tmessage: string;\n}\n\ntype TypeOfMap = {\n\tstring: string;\n\tnumber: number;\n\tboolean: boolean;\n\tobject: object;\n\tnull: null;\n};\n\nclass TypeofValidator<TKey extends keyof TypeOfMap> extends ValidatorBase<TypeOfMap[TKey]> {\n\tconstructor(private readonly type: TKey) {\n\t\tsuper();\n\t}\n\n\tvalidate(content: unknown): { content: TypeOfMap[TKey]; error: undefined } | { content: undefined; error: ValidationError } {\n\t\tif (typeof content !== this.type) {\n\t\t\treturn { content: undefined, error: { message: `Expected ${this.type}, but got ${typeof content}` } };\n\t\t}\n\n\t\treturn { content: content as TypeOfMap[TKey], error: undefined };\n\t}\n\n\tgetJSONSchema(): IJSONSchema {\n\t\treturn { type: this.type };\n\t}\n}\n\nconst vStringValidator = new TypeofValidator('string');\nexport function vString(): ValidatorBase<string> { return vStringValidator; }\n\nconst vNumberValidator = new TypeofValidator('number');\n\nconst vBooleanValidator = new TypeofValidator('boolean');\nexport function vBoolean(): ValidatorBase<boolean> { return vBooleanValidator; }\n\nconst vObjAnyValidator = new TypeofValidator('object');\n\nclass UndefinedValidator extends ValidatorBase<undefined> {\n\tvalidate(content: unknown): { content: undefined; error: undefined } | { content: undefined; error: ValidationError } {\n\t\tif (content !== undefined) {\n\t\t\treturn { content: undefined, error: { message: `Expected undefined, but got ${typeof content}` } };\n\t\t}\n\n\t\treturn { content: undefined, error: undefined };\n\t}\n\n\tgetJSONSchema(): IJSONSchema {\n\t\treturn {};\n\t}\n}\n\nexport function vUndefined(): ValidatorBase<undefined> {\n\treturn new UndefinedValidator();\n}\n\nexport class Optional<T extends IValidator<unknown>> {\n\tconstructor(public readonly validator: T) { }\n}\n\nexport function vOptionalProp<T>(validator: IValidator<T>): Optional<IValidator<T>> {\n\treturn new Optional(validator);\n}\n\ntype ExtractOptionalKeys<T> = {\n\t[K in keyof T]: T[K] extends Optional<IValidator<unknown>> ? K : never;\n}[keyof T];\n\ntype ExtractRequiredKeys<T> = {\n\t[K in keyof T]: T[K] extends Optional<IValidator<unknown>> ? never : K;\n}[keyof T];\n\nexport type vObjType<T extends Record<string, IValidator<unknown> | Optional<IValidator<unknown>>>> = {\n\t[K in ExtractRequiredKeys<T>]: T[K] extends IValidator<infer U> ? U : never;\n} & {\n\t[K in ExtractOptionalKeys<T>]?: T[K] extends Optional<IValidator<infer U>> ? U : never;\n};\n\nclass ObjValidator<T extends Record<string, IValidator<unknown> | Optional<IValidator<unknown>>>> extends ValidatorBase<vObjType<T>> {\n\tconstructor(private readonly properties: T) {\n\t\tsuper();\n\t}\n\n\tvalidate(content: unknown): { content: vObjType<T>; error: undefined } | { content: undefined; error: ValidationError } {\n\t\tif (typeof content !== 'object' || content === null) {\n\t\t\treturn { content: undefined, error: { message: 'Expected object' } };\n\t\t}\n\n\t\t// eslint-disable-next-line local/code-no-dangerous-type-assertions\n\t\tconst result: vObjType<T> = {} as vObjType<T>;\n\n\t\tfor (const key in this.properties) {\n\t\t\tconst prop = this.properties[key];\n\t\t\t// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any\n\t\t\tconst fieldValue = (content as any)[key];\n\n\t\t\tconst isOptional = prop instanceof Optional;\n\t\t\tconst validator: IValidator<unknown> = isOptional ? prop.validator : prop;\n\n\t\t\tif (isOptional && fieldValue === undefined) {\n\t\t\t\t// Optional field not provided, skip validation\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst { content: value, error } = validator.validate(fieldValue);\n\t\t\tif (error) {\n\t\t\t\treturn { content: undefined, error: { message: `Error in property '${key}': ${error.message}` } };\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any\n\t\t\t(result as any)[key] = value;\n\t\t}\n\n\t\treturn { content: result, error: undefined };\n\t}\n\n\tgetJSONSchema(): IJSONSchema {\n\t\tconst requiredFields: string[] = [];\n\t\tconst schemaProperties: Record<string, IJSONSchema> = {};\n\n\t\tfor (const [key, prop] of Object.entries(this.properties)) {\n\t\t\tconst isOptional = prop instanceof Optional;\n\t\t\tconst validator: IValidator<unknown> = isOptional ? prop.validator : prop;\n\t\t\tschemaProperties[key] = validator.getJSONSchema();\n\t\t\tif (!isOptional) {\n\t\t\t\trequiredFields.push(key);\n\t\t\t}\n\t\t}\n\n\t\tconst schema: IJSONSchema = {\n\t\t\ttype: 'object',\n\t\t\tproperties: schemaProperties,\n\t\t\t...(requiredFields.length > 0 ? { required: requiredFields } : {})\n\t\t};\n\n\t\treturn schema;\n\t}\n}\n\nexport function vObj<T extends Record<string, IValidator<unknown> | Optional<IValidator<unknown>>>>(properties: T): ValidatorBase<vObjType<T>> {\n\treturn new ObjValidator(properties);\n}\n\nclass UnionValidator<T extends IValidator<unknown>[]> extends ValidatorBase<ValidatorType<T[number]>> {\n\tconstructor(private readonly validators: T) {\n\t\tsuper();\n\t}\n\n\tvalidate(content: unknown): { content: ValidatorType<T[number]>; error: undefined } | { content: undefined; error: ValidationError } {\n\t\tlet lastError: ValidationError | undefined;\n\t\tfor (const validator of this.validators) {\n\t\t\tconst { content: value, error } = validator.validate(content);\n\t\t\tif (!error) {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any\n\t\t\t\treturn { content: value as any, error: undefined };\n\t\t\t}\n\n\t\t\tlastError = error;\n\t\t}\n\n\t\treturn { content: undefined, error: lastError! };\n\t}\n\n\tgetJSONSchema(): IJSONSchema {\n\t\treturn {\n\t\t\toneOf: mapFilter(this.validators, validator => {\n\t\t\t\tif (validator instanceof UndefinedValidator) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\treturn validator.getJSONSchema();\n\t\t\t}),\n\t\t};\n\t}\n}\n\nexport function vUnion<T extends IValidator<unknown>[]>(...validators: T): ValidatorBase<ValidatorType<T[number]>> {\n\treturn new UnionValidator(validators);\n}\n\nclass UseRefSchemaValidator<T> extends ValidatorBase<T> {\n\tconstructor(\n\t\tprivate readonly _ref: string,\n\t\tprivate readonly _validator: IValidator<T>\n\t) {\n\t\tsuper();\n\t}\n\n\tvalidate(content: unknown): { content: T; error: undefined } | { content: undefined; error: ValidationError } {\n\t\treturn this._validator.validate(content);\n\t}\n\n\tgetJSONSchema(): IJSONSchema {\n\t\treturn { $ref: this._ref };\n\t}\n}\n\nexport function vWithJsonSchemaRef<T>(ref: string, validator: IValidator<T>): ValidatorBase<T> {\n\treturn new UseRefSchemaValidator(ref, validator);\n}\n"]}
|
|
@@ -243,6 +243,16 @@ export class ProviderId {
|
|
|
243
243
|
}
|
|
244
244
|
return result;
|
|
245
245
|
}
|
|
246
|
+
toStringWithoutVersion() {
|
|
247
|
+
let result = '';
|
|
248
|
+
if (this.extensionId) {
|
|
249
|
+
result += this.extensionId;
|
|
250
|
+
}
|
|
251
|
+
if (this.providerId) {
|
|
252
|
+
result += `:${this.providerId}`;
|
|
253
|
+
}
|
|
254
|
+
return result;
|
|
255
|
+
}
|
|
246
256
|
}
|
|
247
257
|
/** @internal */
|
|
248
258
|
export class VersionedExtensionId {
|