@microsoft/windows-admin-center-sdk 2.541.0 → 2.552.0
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/angular/assets/strings/cs-CZ/strings.json +1 -1
- package/angular/assets/strings/de-DE/strings.json +1 -1
- package/angular/assets/strings/es-ES/strings.json +1 -1
- package/angular/assets/strings/fr-FR/strings.json +1 -1
- package/angular/assets/strings/hu-HU/strings.json +1 -1
- package/angular/assets/strings/id-ID/strings.json +1 -1
- package/angular/assets/strings/it-IT/strings.json +1 -1
- package/angular/assets/strings/ja-JP/strings.json +1 -1
- package/angular/assets/strings/ko-KR/strings.json +1 -1
- package/angular/assets/strings/nl-NL/strings.json +1 -1
- package/angular/assets/strings/pl-PL/strings.json +1 -1
- package/angular/assets/strings/pt-BR/strings.json +1 -1
- package/angular/assets/strings/pt-PT/strings.json +1 -1
- package/angular/assets/strings/ru-RU/strings.json +1 -1
- package/angular/assets/strings/strings.json +1 -1
- package/angular/assets/strings/sv-SE/strings.json +1 -1
- package/angular/assets/strings/tr-TR/strings.json +1 -1
- package/angular/assets/strings/zh-CN/strings.json +1 -1
- package/angular/assets/strings/zh-TW/strings.json +1 -1
- package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.js +1385 -301
- package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.js.map +1 -1
- package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.min.js +2 -2
- package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.min.js.map +1 -1
- package/angular/esm2015/src/controls/details/details.component.js +13 -5
- package/angular/esm2015/src/controls/index.js +7 -2
- package/angular/esm2015/src/controls/layout/layout.component.js +10 -2
- package/angular/esm2015/src/controls/pivot/pivot.component.js +58 -4
- package/angular/esm2015/src/controls/property-grid/property-grid.component.js +2 -2
- package/angular/esm2015/src/controls/ux/sme-ux-content/index.js +3 -0
- package/angular/esm2015/src/controls/ux/sme-ux-content/sme-ux-content.component.js +25 -0
- package/angular/esm2015/src/controls/ux/sme-ux-content/sme-ux-content.module.js +23 -0
- package/angular/esm2015/src/controls/ux/sme-ux-footer/index.js +4 -0
- package/angular/esm2015/src/controls/ux/sme-ux-footer/sme-ux-footer-template/sme-wizard-lite-footer-template/index.js +3 -0
- package/angular/esm2015/src/controls/ux/sme-ux-footer/sme-ux-footer-template/sme-wizard-lite-footer-template/sme-wizard-lite-footer-template.component.js +184 -0
- package/angular/esm2015/src/controls/ux/sme-ux-footer/sme-ux-footer-template/sme-wizard-lite-footer-template/sme-wizard-lite-footer-template.module.js +31 -0
- package/angular/esm2015/src/controls/ux/sme-ux-footer/sme-ux-footer.component.js +25 -0
- package/angular/esm2015/src/controls/ux/sme-ux-footer/sme-ux-footer.module.js +23 -0
- package/angular/esm2015/src/controls/ux/sme-ux-page/index.js +3 -0
- package/angular/esm2015/src/controls/ux/sme-ux-page/sme-ux-page.component.js +25 -0
- package/angular/esm2015/src/controls/ux/sme-ux-page/sme-ux-page.module.js +31 -0
- package/angular/esm2015/src/controls/wizard-lite/index.js +3 -0
- package/angular/esm2015/src/controls/wizard-lite/wizard-lite.component.js +109 -0
- package/angular/esm2015/src/controls/wizard-lite/wizard-lite.module.js +57 -0
- package/angular/esm2015/src/controls/wizard-lite/wizard-lite.service.js +109 -0
- package/angular/esm2015/src/controls/wizard-lite/wizard-navigation-button/index.js +3 -0
- package/angular/esm2015/src/controls/wizard-lite/wizard-navigation-button/wizard-navigation-button.component.js +241 -0
- package/angular/esm2015/src/controls/wizard-lite/wizard-navigation-button/wizard-navigation-button.module.js +31 -0
- package/angular/esm2015/src/generated/strings.js +1 -1
- package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.js +1192 -282
- package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.js.map +1 -1
- package/angular/src/controls/details/details.component.d.ts +2 -1
- package/angular/src/controls/index.d.ts +6 -1
- package/angular/src/controls/pivot/pivot.component.d.ts +27 -1
- package/angular/src/controls/ux/sme-ux-content/index.d.ts +2 -0
- package/angular/src/controls/ux/sme-ux-content/sme-ux-content.component.d.ts +9 -0
- package/angular/src/controls/ux/sme-ux-content/sme-ux-content.module.d.ts +8 -0
- package/angular/src/controls/ux/sme-ux-footer/index.d.ts +3 -0
- package/angular/src/controls/ux/sme-ux-footer/sme-ux-footer-template/sme-wizard-lite-footer-template/index.d.ts +2 -0
- package/angular/src/controls/ux/sme-ux-footer/sme-ux-footer-template/sme-wizard-lite-footer-template/sme-wizard-lite-footer-template.component.d.ts +36 -0
- package/angular/src/controls/ux/sme-ux-footer/sme-ux-footer-template/sme-wizard-lite-footer-template/sme-wizard-lite-footer-template.module.d.ts +10 -0
- package/angular/src/controls/ux/sme-ux-footer/sme-ux-footer.component.d.ts +9 -0
- package/angular/src/controls/ux/sme-ux-footer/sme-ux-footer.module.d.ts +8 -0
- package/angular/src/controls/ux/sme-ux-page/index.d.ts +2 -0
- package/angular/src/controls/ux/sme-ux-page/sme-ux-page.component.d.ts +9 -0
- package/angular/src/controls/ux/sme-ux-page/sme-ux-page.module.d.ts +10 -0
- package/angular/src/controls/wizard-lite/index.d.ts +2 -0
- package/angular/src/controls/wizard-lite/wizard-lite.component.d.ts +38 -0
- package/angular/src/controls/wizard-lite/wizard-lite.module.d.ts +14 -0
- package/angular/src/controls/wizard-lite/wizard-lite.service.d.ts +30 -0
- package/angular/src/controls/wizard-lite/wizard-navigation-button/index.d.ts +2 -0
- package/angular/src/controls/wizard-lite/wizard-navigation-button/wizard-navigation-button.component.d.ts +108 -0
- package/angular/src/controls/wizard-lite/wizard-navigation-button/wizard-navigation-button.module.d.ts +9 -0
- package/angular/src/generated/strings.d.ts +10 -0
- package/core/assets/strings/cs-CZ/strings.json +1 -1
- package/core/assets/strings/de-DE/strings.json +1 -1
- package/core/assets/strings/es-ES/strings.json +1 -1
- package/core/assets/strings/fr-FR/strings.json +1 -1
- package/core/assets/strings/hu-HU/strings.json +1 -1
- package/core/assets/strings/id-ID/strings.json +1 -1
- package/core/assets/strings/it-IT/strings.json +1 -1
- package/core/assets/strings/ja-JP/strings.json +1 -1
- package/core/assets/strings/ko-KR/strings.json +1 -1
- package/core/assets/strings/nl-NL/strings.json +1 -1
- package/core/assets/strings/pl-PL/strings.json +1 -1
- package/core/assets/strings/pt-BR/strings.json +1 -1
- package/core/assets/strings/pt-PT/strings.json +1 -1
- package/core/assets/strings/ru-RU/strings.json +1 -1
- package/core/assets/strings/strings.json +1 -1
- package/core/assets/strings/sv-SE/strings.json +1 -1
- package/core/assets/strings/tr-TR/strings.json +1 -1
- package/core/assets/strings/zh-CN/strings.json +1 -1
- package/core/assets/strings/zh-TW/strings.json +1 -1
- package/core/data/file-transfer.js +5 -5
- package/core/data/file-transfer.js.map +1 -1
- package/core/data/wdac-operations.d.ts +10 -0
- package/core/data/wdac-operations.js +14 -1
- package/core/data/wdac-operations.js.map +1 -1
- package/core/diagnostics/sme-web-telemetry-models.d.ts +2 -1
- package/core/diagnostics/sme-web-telemetry-models.js +1 -0
- package/core/diagnostics/sme-web-telemetry-models.js.map +1 -1
- package/core/diagnostics/sme-web-telemetry.d.ts +20 -0
- package/core/diagnostics/sme-web-telemetry.js +59 -0
- package/core/diagnostics/sme-web-telemetry.js.map +1 -1
- package/core/generated/powershell-scripts.js +1 -1
- package/core/generated/powershell-scripts.js.map +1 -1
- package/core/generated/strings.d.ts +1 -0
- package/core/generated/strings.js.map +1 -1
- package/core/resources/scripts/public/inventory/Get-ServerInventory.ps1 +11 -3
- package/core/shared/server-inventory/server-inventory-cache.js +3 -0
- package/core/shared/server-inventory/server-inventory-cache.js.map +1 -1
- package/core/shared/server-inventory/server-inventory.d.ts +24 -0
- package/core/shared/server-inventory/server-inventory.js.map +1 -1
- package/package.json +1 -1
- package/styles/css/main-v2.css +1 -1
- package/tools/wac-cli/templates/wac-template/angular.json +2 -2
- package/tools/wac-cli/templates/wac-template/src/main.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/data/file-transfer.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ACJ;AAED,MAAM,kBAAkB;IACpB,YACoB,KAAa,EACb,UAAkB,EAClB,KAAmB;QAFnB,UAAK,GAAL,KAAK,CAAQ;QACb,eAAU,GAAV,UAAU,CAAQ;QAClB,UAAK,GAAL,KAAK,CAAc;IAEvC,CAAC;CACJ","file":"file-transfer.js","sourcesContent":["import { from, Observable } from 'rxjs';\r\nimport { AjaxError, AjaxRequest } from 'rxjs/ajax';\r\nimport { map } from 'rxjs/operators';\r\nimport { CancellationToken } from '../async/cancellation';\r\nimport { Progress } from '../async/progress';\r\nimport { ErrorMonitor } from '../diagnostics/error-monitor';\r\nimport { Strings } from '../generated/strings';\r\nimport { EnvironmentModule } from '../manifest/environment-modules';\r\nimport { AuthorizationManager } from '../security/authorization-manager';\r\nimport { Cookie } from './cookie';\r\nimport { GatewayConnection } from './gateway-connection';\r\nimport { ApiVersion } from './gateway-url-builder';\r\nimport { headerConstants, HttpStatusCode } from './http-constants';\r\nimport { NativeQ } from './native-q';\r\nimport { NodeConnection, NodeRequest } from './node-connection';\r\nimport { UriBuilder } from './uri-builder';\r\n\r\nexport interface FileOptions {\r\n /**\r\n * Indicates that audit logging for this request should be made. Default is false.\r\n */\r\n logAudit?: boolean;\r\n\r\n /**\r\n * Indicates that telemetry logging for this request should be made. Default is false.\r\n */\r\n logTelemetry?: boolean;\r\n}\r\n\r\n/** Represents a object that transfers files */\r\nexport class FileTransfer {\r\n\r\n private moduleName = null;\r\n\r\n /**\r\n * Downloads a blob of data\r\n *\r\n * @param blob the blob of data to download\r\n * @param fileName the name of the file for the user to download.\r\n */\r\n public static downloadBlob(blob: Blob, fileName: string) {\r\n let useAnchorTagForDownload = true;\r\n\r\n if (window.navigator.msSaveOrOpenBlob) {\r\n // This is for IE and Microsoft Edge < 16\r\n // for those cases the download anchor tag doesn't generate the right name so we use the MS download system instead\r\n // \"5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393\"\r\n const ua = navigator.userAgent;\r\n const edgeIndex = ua.indexOf('Edge');\r\n if (edgeIndex > 0) {\r\n const dotIndex = ua.indexOf('.', edgeIndex);\r\n let versionNumber = 0;\r\n if (dotIndex > 0) {\r\n const versionString = ua.substring(edgeIndex + 'Edge'.length + 1, dotIndex);\r\n versionNumber = Number(versionString);\r\n }\r\n\r\n useAnchorTagForDownload = versionNumber > 15;\r\n } else {\r\n useAnchorTagForDownload = false;\r\n }\r\n }\r\n\r\n if (useAnchorTagForDownload) {\r\n const downloadLink = document.createElement('a');\r\n downloadLink.style.display = 'none';\r\n\r\n const url = URL.createObjectURL(blob);\r\n downloadLink.setAttribute('href', url);\r\n downloadLink.setAttribute('download', fileName);\r\n downloadLink.click();\r\n downloadLink.remove();\r\n } else {\r\n window.navigator.msSaveOrOpenBlob(blob, fileName);\r\n }\r\n }\r\n\r\n /**\r\n * Navigates to a file.\r\n *\r\n * @param filePath the file path we are navigating to.\r\n */\r\n public static navigateToFile(filePath: string): void {\r\n const downloadLink = document.createElement('a');\r\n downloadLink.style.display = 'none';\r\n downloadLink.setAttribute('href', filePath);\r\n downloadLink.click();\r\n downloadLink.remove();\r\n }\r\n\r\n /**\r\n * Initializes a new instance of the FileTransfer class.\r\n *\r\n * @param nodeConnection the NodeConnection class instance.\r\n * @param gatewayConnection the GatewayConnection class instance.\r\n * @param authorizationManager the AuthorizationManager class instance.\r\n */\r\n constructor(\r\n private nodeConnection: NodeConnection,\r\n private gatewayConnection: GatewayConnection,\r\n private authorizationManager: AuthorizationManager) {\r\n }\r\n\r\n private static generateRanges(ranges: ContentRange[], segmentSize: number, totalSize: number): void {\r\n const offset = segmentSize - 1;\r\n const max = totalSize - 1;\r\n\r\n for (let first = 0, last = offset; first < max; first += offset + 1, last = Math.min(++last + offset, max)) {\r\n ranges.push(new ContentRange(first, last, totalSize));\r\n }\r\n }\r\n\r\n private static extractNode(input: string) {\r\n const url = new URL(input);\r\n const segments = url.pathname.split('/');\r\n return segments[3];\r\n }\r\n\r\n /**\r\n * The GET call to file transfer endpoint and return a Blob of the requested file\r\n *\r\n * @param nodeName the node to transfer the file from.\r\n * @param sourcePath the path of the remote file to transfer.\r\n * @param fileOptions the file options for the action.\r\n * @return Observable<Blob> the observable Blob object.\r\n */\r\n public transferBlob(\r\n nodeName: string,\r\n sourcePath: string,\r\n fileOptions?: FileOptions): Observable<Blob> {\r\n const relativeUrl = this.gatewayConnection.url().node(nodeName).makeRelative().fileTransfer().file(sourcePath).build();\r\n const headers = {\r\n Accept: 'application/octet-stream'\r\n };\r\n const token = Cookie.getCrossSiteRequestForgeryToken();\r\n\r\n if (token) {\r\n headers[headerConstants.CROSS_SITE_REQUEST_FORGERY_TOKEN] = token;\r\n }\r\n\r\n const request = <NodeRequest>{ headers: headers, responseType: 'blob' };\r\n\r\n if (fileOptions) {\r\n request.logAudit = fileOptions.logAudit;\r\n request.logTelemetry = fileOptions.logTelemetry;\r\n }\r\n\r\n return this.nodeConnection.get(nodeName, relativeUrl, request);\r\n }\r\n\r\n /**\r\n * The GET call to file transfer endpoint and manual download of stream\r\n *\r\n * @param nodeName the node to transfer the file from.\r\n * @param sourcePath the path of the remote file to transfer.\r\n * @param targetName the desired name for the downloaded file.\r\n * @param fileOptions the file options for the action.\r\n * @return Observable<Blob> the observable Blob object.\r\n */\r\n public transferFile(\r\n nodeName: string,\r\n sourcePath: string,\r\n targetName: string,\r\n fileOptions?: FileOptions\r\n ): Observable<Blob> {\r\n\r\n return this.transferBlob(nodeName, sourcePath, fileOptions)\r\n .pipe(map((responseBlob: Blob) => {\r\n FileTransfer.downloadBlob(responseBlob, targetName);\r\n return responseBlob;\r\n }));\r\n }\r\n\r\n /**\r\n * Upload a file from fileObject.\r\n *\r\n * @deprecated Use upload instead.\r\n * @param nodeName the node to upload the file to.\r\n * @param path the file path to store on the target node.\r\n * @param fileObject the file object created on the UI.\r\n * @param fileOptions the file options for the action.\r\n * @return Observable<any> the observable object.\r\n */\r\n public uploadFile(nodeName: string, path: string, fileObject: File, fileOptions?: FileOptions): Observable<any> {\r\n const deferred = NativeQ.defer<any>();\r\n const formData = new FormData();\r\n formData.append('file-0', fileObject);\r\n const request = new XMLHttpRequest();\r\n const url = this.gatewayConnection.url().node(nodeName).fileTransfer().file(path).build();\r\n const handler = () => {\r\n if (request.readyState === 4 /* complete */) {\r\n if (request.status === HttpStatusCode.Ok || request.status === HttpStatusCode.Created) {\r\n deferred.resolve(request.responseText);\r\n } else {\r\n ErrorMonitor.current.reportErrorFromAjax(\r\n <AjaxError>{\r\n status: request.status,\r\n xhr: request,\r\n request: { url, method: 'POST'}\r\n });\r\n\r\n const uploadError = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error;\r\n const message = request.status === HttpStatusCode.CorsRequestFailed ? uploadError.FileNotFound\r\n : (request.status === HttpStatusCode.BadRequest ? uploadError.OperationBlocked\r\n : uploadError.Unknown.format(request.status));\r\n deferred.reject({ xhr: request, message: message });\r\n }\r\n }\r\n };\r\n\r\n let tokenValue: string;\r\n const ajaxRequest = <AjaxRequest>{ headers: {} };\r\n this.authorizationManager.addAuthorizationRequestHeader(ajaxRequest, nodeName);\r\n request.open('PUT', url);\r\n request.withCredentials = true;\r\n\r\n tokenValue = ajaxRequest.headers[headerConstants.SME_AUTHORIZATION];\r\n if (tokenValue) {\r\n request.setRequestHeader(headerConstants.SME_AUTHORIZATION, tokenValue);\r\n }\r\n\r\n tokenValue = ajaxRequest.headers[headerConstants.USE_LAPS];\r\n if (tokenValue) {\r\n request.setRequestHeader(headerConstants.USE_LAPS, tokenValue);\r\n\r\n // If ajaxRequest.headers[LAPS_LOCALADMINNAME] will always have default of 'administrator',\r\n // so no need to check if it exists and not null\r\n request.setRequestHeader(headerConstants.LAPS_LOCALADMINNAME, ajaxRequest.headers[headerConstants.LAPS_LOCALADMINNAME]);\r\n }\r\n\r\n if (fileOptions) {\r\n if (fileOptions.logAudit === true || fileOptions.logAudit === false) {\r\n request.setRequestHeader(headerConstants.LOG_AUDIT, fileOptions.logAudit ? 'true' : 'false');\r\n }\r\n\r\n if (fileOptions.logTelemetry === true || fileOptions.logTelemetry === false) {\r\n request.setRequestHeader(headerConstants.LOG_TELEMETRY, fileOptions.logTelemetry ? 'true' : 'false');\r\n }\r\n }\r\n\r\n const token = Cookie.getCrossSiteRequestForgeryToken();\r\n if (token) {\r\n request.setRequestHeader(headerConstants.CROSS_SITE_REQUEST_FORGERY_TOKEN, token);\r\n }\r\n\r\n request.setRequestHeader(headerConstants.MODULE_NAME, this.nameOfModule);\r\n request.onreadystatechange = handler;\r\n request.send(formData);\r\n return from(deferred.promise);\r\n }\r\n\r\n /**\r\n * Uploads the specified file.\r\n * @param node The target computer to upload the file to.\r\n * @param path The path on the target computer to upload the file to.\r\n * @param file The file to upload.\r\n * @param options The file upload options.\r\n * @param cancellationToken The token that can be used to cancel the operation.\r\n * @returns An observable object that contains the result of the file transfer.\r\n */\r\n public upload(\r\n node: string,\r\n path: string,\r\n file: File,\r\n options: FileUploadOptions = new FileUploadOptions(),\r\n cancellationToken: CancellationToken = CancellationToken.NONE\r\n ): Observable<FileTransferResult> {\r\n\r\n return from(this.uploadAsync(node, path, file, options, cancellationToken));\r\n }\r\n\r\n private uploadAsync(\r\n node: string,\r\n path: string,\r\n file: File,\r\n options: FileUploadOptions,\r\n cancellationToken: CancellationToken): Promise<FileTransferResult> {\r\n\r\n // if the file size <= transfer size, then just transfer the file all at once,\r\n // which will be much faster than the multi - request flow for a single transfer\r\n if (file.size <= options.transferSize) {\r\n return this.uploadAllAtOnce(node, path, file, options, cancellationToken);\r\n }\r\n\r\n return this.uploadInParts(node, path, file, options, cancellationToken);\r\n }\r\n\r\n private async uploadAllAtOnce(\r\n node: string,\r\n path: string,\r\n file: File,\r\n options: FileUploadOptions,\r\n cancellationToken: CancellationToken): Promise<FileTransferResult> {\r\n\r\n const url = this.gatewayConnection.url().node(node).fileTransfer().file(path).build();\r\n const headers = this.newRequestHeaders(node, options);\r\n const transfer = new FileTransferInfo(file.size, 1);\r\n const result = new FileTransferResult(new FileTransferContinuation(null, null, file, transfer));\r\n\r\n do {\r\n const response = await fetch(url, { method: 'PUT', credentials: 'include', headers: headers, body: file });\r\n\r\n switch (response.status) {\r\n case HttpStatusCode.Ok:\r\n case HttpStatusCode.Created:\r\n case HttpStatusCode.NoContent:\r\n transfer.incrementCompleted();\r\n return result;\r\n case HttpStatusCode.Forbidden:\r\n case HttpStatusCode.Conflict:\r\n const blockedMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.OperationBlocked;\r\n throw new Error(blockedMessage);\r\n default:\r\n if (cancellationToken.isCancellationRequested) {\r\n break;\r\n }\r\n const unknownMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.Unknown;\r\n throw new Error(unknownMessage.format(response.status));\r\n }\r\n }\r\n while (!cancellationToken.isCancellationRequested);\r\n\r\n cancellationToken.throwIfCancellationRequested();\r\n }\r\n\r\n private async uploadInParts(\r\n node: string,\r\n path: string,\r\n file: File,\r\n options: FileUploadOptions,\r\n cancellationToken: CancellationToken = CancellationToken.NONE): Promise<FileTransferResult> {\r\n\r\n const continuation = await this.newUpload(node, path, file, options, cancellationToken);\r\n let canceled = cancellationToken.isCancellationRequested;\r\n let error: Error = null;\r\n\r\n if (!canceled) {\r\n error = await this.uploadRanges(continuation, options, cancellationToken);\r\n canceled = error !== null || cancellationToken.isCancellationRequested;\r\n }\r\n\r\n if (canceled && options.cancellationBehavior === FileTransferCancellationBehavior.Cancel) {\r\n try {\r\n // cancel the file transfer if an error occurred or the caller requested cancellation\r\n await this.cancelUpload(continuation);\r\n } catch (e) {\r\n // unable to cancel (e.g. clean up) the file transfer\r\n // if cancellation occurred from an error, rethrow it now\r\n if (error !== null) {\r\n throw error;\r\n }\r\n\r\n throw e;\r\n }\r\n\r\n return new FileTransferResult();\r\n }\r\n\r\n return new FileTransferResult(continuation);\r\n }\r\n\r\n /**\r\n * Resumes a previously started file upload.\r\n * @param continuation The information required to continue the file transfer.\r\n * @param progress The object used to report the progress of the upload.\r\n * @param cancellationToken The token that can be used to cancel the operation.\r\n */\r\n public resumeUpload(\r\n continuation: FileTransferContinuation,\r\n progress: Progress<number> = new NoProgress(),\r\n cancellationToken: CancellationToken = CancellationToken.NONE): Observable<void> {\r\n\r\n return from(this.resumeUploadAsync(continuation, progress, cancellationToken));\r\n }\r\n\r\n private async resumeUploadAsync(\r\n continuation: FileTransferContinuation,\r\n progress: Progress<number> = new NoProgress(),\r\n cancellationToken: CancellationToken = CancellationToken.NONE): Promise<void> {\r\n\r\n const transferSize = continuation.transfer.size;\r\n const options = new FileUploadOptions(transferSize, FileTransferCancellationBehavior.Pause, progress);\r\n const error = await this.uploadRanges(continuation, options, cancellationToken);\r\n\r\n if (error !== null) {\r\n throw error;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Cancels a previously started file upload.\r\n * @param continuation The information required to cancel the file transfer.\r\n */\r\n public cancelUpload(continuation: FileTransferContinuation): Observable<void> {\r\n return from(this.cancelUploadAsync(continuation));\r\n }\r\n\r\n private async cancelUploadAsync(continuation: FileTransferContinuation): Promise<void> {\r\n const url = continuation.location;\r\n const node = FileTransfer.extractNode(url);\r\n const headers = this.newRequestHeaders(node, new FileUploadOptions());\r\n let attempts = 0;\r\n\r\n headers.append(headerConstants.IF_MATCH, continuation.token);\r\n\r\n do {\r\n const response = await fetch(url, { method: 'DELETE', credentials: 'include', headers: headers });\r\n const statusCode = response.status;\r\n\r\n // canceled or a new transfer was started\r\n if (statusCode === HttpStatusCode.NoContent || statusCode === HttpStatusCode.PreconditionFailed) {\r\n break;\r\n }\r\n\r\n switch (statusCode) {\r\n case HttpStatusCode.Conflict:\r\n break;\r\n case HttpStatusCode.BadGateway:\r\n case HttpStatusCode.ServiceUnavailable:\r\n if (++attempts > 3) {\r\n const giveUpMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.Unknown;\r\n throw new Error(giveUpMessage.format(statusCode));\r\n }\r\n break;\r\n default:\r\n const unknownMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.Unknown;\r\n throw new Error(unknownMessage.format(statusCode));\r\n }\r\n\r\n } while (true);\r\n\r\n return null;\r\n }\r\n\r\n private newRequestHeaders(node: string, options: FileUploadOptions): Headers {\r\n const request = this.gatewayConnection.defaultHttpSecureOptions;\r\n\r\n this.authorizationManager.addAuthorizationRequestHeader(request, node);\r\n\r\n const headers = new Headers();\r\n const authAadToken = request.headers[headerConstants.SME_AAD_AUTHORIZATION];\r\n const authToken = request.headers[headerConstants.SME_AUTHORIZATION];\r\n const useLaps = request.headers[headerConstants.USE_LAPS];\r\n const xsfrToken = Cookie.getCrossSiteRequestForgeryToken();\r\n const { logAudit, logTelemetry } = options.logging;\r\n\r\n headers.append(headerConstants.MODULE_NAME, this.nameOfModule);\r\n\r\n if (authAadToken) {\r\n headers.append(headerConstants.SME_AAD_AUTHORIZATION, authAadToken);\r\n }\r\n\r\n if (authToken) {\r\n headers.append(headerConstants.SME_AUTHORIZATION, authToken);\r\n }\r\n\r\n if (useLaps) {\r\n headers.append(headerConstants.USE_LAPS, useLaps);\r\n headers.append(headerConstants.LAPS_LOCALADMINNAME, request.headers[headerConstants.LAPS_LOCALADMINNAME]);\r\n }\r\n\r\n if (xsfrToken) {\r\n headers.append(headerConstants.CROSS_SITE_REQUEST_FORGERY_TOKEN, xsfrToken);\r\n }\r\n\r\n if (logAudit !== undefined) {\r\n headers.append(headerConstants.LOG_AUDIT, logAudit.toString());\r\n }\r\n\r\n if (logTelemetry !== undefined) {\r\n headers.append(headerConstants.LOG_TELEMETRY, logTelemetry.toString());\r\n }\r\n\r\n return headers;\r\n }\r\n\r\n private async newUpload(\r\n node: string,\r\n path: string,\r\n file: File,\r\n options: FileUploadOptions,\r\n cancellationToken: CancellationToken = CancellationToken.NONE): Promise<FileTransferContinuation> {\r\n\r\n const url = this.gatewayConnection.url().node(node).fileTransfer().file(path).build();\r\n const lastModified = new Date(file.lastModified).toISOString();\r\n const headers = this.newRequestHeaders(node, options);\r\n let response: Response;\r\n let retry = false;\r\n\r\n headers.append(headerConstants.CONTENT_DISPOSITION, `create; size=${file.size}; modification-date=\"${lastModified}\"`);\r\n\r\n do {\r\n response = await fetch(url, { method: 'POST', credentials: 'include', headers: headers });\r\n retry = response.status === HttpStatusCode.Conflict;\r\n } while (retry && !cancellationToken.isCancellationRequested);\r\n\r\n switch (response.status) {\r\n case HttpStatusCode.Created:\r\n const builder = new UriBuilder(response.headers.get(headerConstants.LOCATION));\r\n\r\n // it's the client's job to tell the server which api version they want to use;\r\n // the location header will not contain the query parameter\r\n builder.setQueryParameter('api-version', ApiVersion.Latest);\r\n\r\n const location = builder.toString();\r\n const etag = response.headers.get(headerConstants.ETAG);\r\n const ranges = new Array<ContentRange>();\r\n\r\n FileTransfer.generateRanges(ranges, options.transferSize, file.size);\r\n\r\n const transfer = new FileTransferInfo(options.transferSize, ranges.length);\r\n const continuation = new FileTransferContinuation(location, etag, file, transfer, ranges);\r\n\r\n return continuation;\r\n case HttpStatusCode.Forbidden:\r\n case HttpStatusCode.Conflict:\r\n const blockedMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.OperationBlocked;\r\n throw new Error(blockedMessage);\r\n default:\r\n const unknownMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.Unknown;\r\n throw new Error(unknownMessage.format(response.status));\r\n }\r\n }\r\n\r\n private async uploadRanges(\r\n continuation: FileTransferContinuation,\r\n options: FileUploadOptions,\r\n cancellationToken: CancellationToken): Promise<Error> {\r\n\r\n const node = FileTransfer.extractNode(continuation.location);\r\n const progress = options.progress;\r\n const ranges = continuation.ranges;\r\n const transfer = continuation.transfer;\r\n const remaining = continuation.ranges.length;\r\n const promises = new Map<number, Promise<HttpTransferResult>>();\r\n\r\n // start up to 3 uploads in parallel\r\n for (let i = 0; i < remaining && i < 3; i++) {\r\n promises.set(i, this.uploadPartialFile(i, node, continuation, ranges.shift(), options));\r\n }\r\n\r\n while (promises.size > 0 && !cancellationToken.isCancellationRequested) {\r\n // wait for first completed upload\r\n const result = await Promise.race(promises.values());\r\n\r\n switch (result.statusCode) {\r\n case HttpStatusCode.NoContent:\r\n if (ranges.length > 0) {\r\n if (!cancellationToken.isCancellationRequested) {\r\n // start next upload\r\n promises.set(result.index, this.uploadPartialFile(result.index, node, continuation, ranges.shift(), options));\r\n }\r\n } else {\r\n promises.delete(result.index);\r\n }\r\n\r\n transfer.incrementCompleted();\r\n progress.report(transfer.percentComplete);\r\n break;\r\n case HttpStatusCode.Unauthorized:\r\n case HttpStatusCode.Conflict:\r\n case HttpStatusCode.BadGateway:\r\n case HttpStatusCode.ServiceUnavailable:\r\n if (!cancellationToken.isCancellationRequested) {\r\n // retry upload\r\n promises.set(result.index, this.uploadPartialFile(result.index, node, continuation, result.range, options));\r\n }\r\n break;\r\n case HttpStatusCode.Gone:\r\n case HttpStatusCode.PreconditionFailed:\r\n\r\n // burn down promises\r\n promises.delete(result.index);\r\n await Promise.all(promises.values());\r\n promises.clear();\r\n\r\n // clear remaining ranges; the transfer cannot be completed\r\n if (ranges.length > 0) {\r\n ranges.splice(0, ranges.length);\r\n }\r\n break;\r\n default:\r\n const unknownMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.Unknown;\r\n return new Error(unknownMessage.format(result.statusCode));\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private async uploadPartialFile(\r\n index: number,\r\n node: string,\r\n continuation: FileTransferContinuation,\r\n range: ContentRange,\r\n options: FileUploadOptions): Promise<HttpTransferResult> {\r\n\r\n const blob = continuation.file.slice(range.from, range.to + 1);\r\n const headers = this.newRequestHeaders(node, options);\r\n\r\n headers.append(headerConstants.CONTENT_TYPE, 'application/octet-stream');\r\n headers.append(headerConstants.CONTENT_RANGE, range.toString());\r\n headers.append(headerConstants.IF_MATCH, continuation.token);\r\n\r\n const response = await fetch(continuation.location, {\r\n method: 'PATCH',\r\n credentials: 'include',\r\n headers: headers,\r\n body: blob\r\n });\r\n\r\n return new HttpTransferResult(index, response.status, range);\r\n }\r\n\r\n /**\r\n * Gets the name of current shell or module.\r\n */\r\n private get nameOfModule(): string {\r\n if (!this.moduleName) {\r\n this.moduleName = EnvironmentModule.getModuleName();\r\n }\r\n\r\n return this.moduleName;\r\n }\r\n}\r\n\r\n/** Represents the possible cancellation behaviors */\r\nexport enum FileTransferCancellationBehavior {\r\n /** Indicates the file transfer is cancelled or aborted on cancellation */\r\n Cancel,\r\n\r\n /** Indicates the file transfer is paused on cancellation */\r\n Pause,\r\n}\r\n\r\n/** Represents file upload options. */\r\nexport class FileUploadOptions {\r\n constructor(\r\n /** Gets the size of transfer content. The default value is 10MB. */\r\n public readonly transferSize: number = 10485760,\r\n\r\n /** Indicates the behavior to perform if the operation is canceled. */\r\n public readonly cancellationBehavior: FileTransferCancellationBehavior = FileTransferCancellationBehavior.Cancel,\r\n\r\n /** A token that can be used to cancel the operation. */\r\n public readonly progress: Progress<number> = new NoProgress(),\r\n\r\n /** Gets the associated logging options. */\r\n public readonly logging: FileOptions = { logAudit: false, logTelemetry: false }) {\r\n\r\n }\r\n}\r\n\r\n/** Represents the size and progress of a file transfer. */\r\nexport class FileTransferInfo {\r\n private completed = 0;\r\n\r\n constructor(\r\n /** Gets the size used in the file transfer. */\r\n public readonly size: number,\r\n\r\n /** Gets the total number of items in the file transfer. */\r\n public readonly count: number) {\r\n }\r\n\r\n /** Gets the percentage of the file transfer completed. */\r\n public get percentComplete(): number {\r\n return (this.completed / this.count) * 100;\r\n }\r\n\r\n /** Increments the number of completed items in the file transfer. */\r\n public incrementCompleted(): void {\r\n this.completed = Math.min(this.completed + 1, this.count);\r\n }\r\n}\r\n\r\n/** Represents a continuation for a file transfer */\r\nexport class FileTransferContinuation {\r\n constructor(\r\n /** Gets the URl representing the location of the file transfer */\r\n public readonly location: string,\r\n\r\n /** Gets the continuation token for the file transfer */\r\n public readonly token: string,\r\n\r\n /** Gets the file being transferred */\r\n public readonly file: File,\r\n\r\n /** Gets the file transfer information. */\r\n public readonly transfer: FileTransferInfo,\r\n\r\n /** Gets the remaining ranges in the file transfer */\r\n public readonly ranges: ContentRange[] = new Array<ContentRange>()) {\r\n }\r\n}\r\n\r\n/** Represents the result of a file transfer */\r\nexport class FileTransferResult {\r\n constructor(\r\n /** Gets the continuation token associated with the file transfer */\r\n public readonly continuation: FileTransferContinuation =\r\n new FileTransferContinuation(null, null, null, new FileTransferInfo(0, 0))) {\r\n\r\n }\r\n\r\n /** Gets a value indicating whether the file transfer is complete */\r\n public get completed(): boolean {\r\n return this.continuation.ranges.length === 0;\r\n }\r\n\r\n /** Gets a value indicating whether the file transfer is resumable */\r\n public get resumable() {\r\n return !this.completed &&\r\n this.continuation.token !== null &&\r\n this.continuation.location !== null &&\r\n this.continuation.file !== null;\r\n }\r\n}\r\n\r\n/** Represent a range of content in a file transfer */\r\nexport class ContentRange {\r\n constructor(\r\n /** Gets the zero-based start of the content, in bytes */\r\n // tslint:disable-next-line:no-shadowed-variable\r\n public readonly from: number,\r\n\r\n /** Gets the zero-based end of the content, in bytes */\r\n public readonly to: number,\r\n\r\n /** Gets the total size of the content in bytes */\r\n public readonly totalSize: number) {\r\n\r\n }\r\n\r\n /** Returns the string representation of the object */\r\n public toString(): string {\r\n return `bytes ${this.from}-${this.to}/${this.totalSize}`;\r\n }\r\n}\r\n\r\nclass NoProgress implements Progress<number> {\r\n public report(value: number): void {\r\n\r\n }\r\n}\r\n\r\nclass HttpTransferResult {\r\n constructor(\r\n public readonly index: number,\r\n public readonly statusCode: number,\r\n public readonly range: ContentRange) {\r\n\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/data/file-transfer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,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ACJ;AAED,MAAM,kBAAkB;IACpB,YACoB,KAAa,EACb,UAAkB,EAClB,KAAmB;QAFnB,UAAK,GAAL,KAAK,CAAQ;QACb,eAAU,GAAV,UAAU,CAAQ;QAClB,UAAK,GAAL,KAAK,CAAc;IAEvC,CAAC;CACJ","file":"file-transfer.js","sourcesContent":["import { from, Observable } from 'rxjs';\r\nimport { AjaxError, AjaxRequest } from 'rxjs/ajax';\r\nimport { map } from 'rxjs/operators';\r\nimport { CancellationToken } from '../async/cancellation';\r\nimport { Progress } from '../async/progress';\r\nimport { ErrorMonitor } from '../diagnostics/error-monitor';\r\nimport { Strings } from '../generated/strings';\r\nimport { EnvironmentModule } from '../manifest/environment-modules';\r\nimport { AuthorizationManager } from '../security/authorization-manager';\r\nimport { Cookie } from './cookie';\r\nimport { GatewayConnection } from './gateway-connection';\r\nimport { ApiVersion } from './gateway-url-builder';\r\nimport { headerConstants, HttpStatusCode } from './http-constants';\r\nimport { NativeQ } from './native-q';\r\nimport { NodeConnection, NodeRequest } from './node-connection';\r\nimport { UriBuilder } from './uri-builder';\r\n\r\nexport interface FileOptions {\r\n /**\r\n * Indicates that audit logging for this request should be made. Default is false.\r\n */\r\n logAudit?: boolean;\r\n\r\n /**\r\n * Indicates that telemetry logging for this request should be made. Default is false.\r\n */\r\n logTelemetry?: boolean;\r\n}\r\n\r\n/** Represents a object that transfers files */\r\nexport class FileTransfer {\r\n\r\n private moduleName = null;\r\n\r\n /**\r\n * Downloads a blob of data\r\n *\r\n * @param blob the blob of data to download\r\n * @param fileName the name of the file for the user to download.\r\n */\r\n public static downloadBlob(blob: Blob, fileName: string) {\r\n let useAnchorTagForDownload = true;\r\n\r\n if (window.navigator.msSaveOrOpenBlob) {\r\n // This is for IE and Microsoft Edge < 16\r\n // for those cases the download anchor tag doesn't generate the right name so we use the MS download system instead\r\n // \"5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393\"\r\n const ua = navigator.userAgent;\r\n const edgeIndex = ua.indexOf('Edge');\r\n if (edgeIndex > 0) {\r\n const dotIndex = ua.indexOf('.', edgeIndex);\r\n let versionNumber = 0;\r\n if (dotIndex > 0) {\r\n const versionString = ua.substring(edgeIndex + 'Edge'.length + 1, dotIndex);\r\n versionNumber = Number(versionString);\r\n }\r\n\r\n useAnchorTagForDownload = versionNumber > 15;\r\n } else {\r\n useAnchorTagForDownload = false;\r\n }\r\n }\r\n\r\n if (useAnchorTagForDownload) {\r\n const downloadLink = document.createElement('a');\r\n downloadLink.style.display = 'none';\r\n\r\n const url = URL.createObjectURL(blob);\r\n downloadLink.setAttribute('href', url);\r\n downloadLink.setAttribute('download', fileName);\r\n downloadLink.click();\r\n downloadLink.remove();\r\n } else {\r\n window.navigator.msSaveOrOpenBlob(blob, fileName);\r\n }\r\n }\r\n\r\n /**\r\n * Navigates to a file.\r\n *\r\n * @param filePath the file path we are navigating to.\r\n */\r\n public static navigateToFile(filePath: string): void {\r\n const downloadLink = document.createElement('a');\r\n downloadLink.style.display = 'none';\r\n downloadLink.setAttribute('href', filePath);\r\n downloadLink.click();\r\n downloadLink.remove();\r\n }\r\n\r\n /**\r\n * Initializes a new instance of the FileTransfer class.\r\n *\r\n * @param nodeConnection the NodeConnection class instance.\r\n * @param gatewayConnection the GatewayConnection class instance.\r\n * @param authorizationManager the AuthorizationManager class instance.\r\n */\r\n constructor(\r\n private nodeConnection: NodeConnection,\r\n private gatewayConnection: GatewayConnection,\r\n private authorizationManager: AuthorizationManager) {\r\n }\r\n\r\n private static generateRanges(ranges: ContentRange[], segmentSize: number, totalSize: number): void {\r\n const offset = segmentSize - 1;\r\n const max = totalSize - 1;\r\n\r\n for (let first = 0, last = offset; first < max; first += offset + 1, last = Math.min(++last + offset, max)) {\r\n ranges.push(new ContentRange(first, last, totalSize));\r\n }\r\n }\r\n\r\n private static extractNode(input: string) {\r\n const url = new URL(input);\r\n const segments = url.pathname.split('/');\r\n return segments[3];\r\n }\r\n\r\n /**\r\n * The GET call to file transfer endpoint and return a Blob of the requested file\r\n *\r\n * @param nodeName the node to transfer the file from.\r\n * @param sourcePath the path of the remote file to transfer.\r\n * @param fileOptions the file options for the action.\r\n * @return Observable<Blob> the observable Blob object.\r\n */\r\n public transferBlob(\r\n nodeName: string,\r\n sourcePath: string,\r\n fileOptions?: FileOptions): Observable<Blob> {\r\n const relativeUrl = this.gatewayConnection.url().node(nodeName).makeRelative().fileTransfer().file(sourcePath).build();\r\n const headers = {\r\n Accept: 'application/octet-stream'\r\n };\r\n const token = Cookie.getCrossSiteRequestForgeryToken();\r\n\r\n if (token) {\r\n headers[headerConstants.CROSS_SITE_REQUEST_FORGERY_TOKEN] = token;\r\n }\r\n\r\n const request = <NodeRequest>{ headers: headers, responseType: 'blob' };\r\n\r\n if (fileOptions) {\r\n request.logAudit = fileOptions.logAudit;\r\n request.logTelemetry = fileOptions.logTelemetry;\r\n }\r\n\r\n return this.nodeConnection.get(nodeName, relativeUrl, request);\r\n }\r\n\r\n /**\r\n * The GET call to file transfer endpoint and manual download of stream\r\n *\r\n * @param nodeName the node to transfer the file from.\r\n * @param sourcePath the path of the remote file to transfer.\r\n * @param targetName the desired name for the downloaded file.\r\n * @param fileOptions the file options for the action.\r\n * @return Observable<Blob> the observable Blob object.\r\n */\r\n public transferFile(\r\n nodeName: string,\r\n sourcePath: string,\r\n targetName: string,\r\n fileOptions?: FileOptions\r\n ): Observable<Blob> {\r\n\r\n return this.transferBlob(nodeName, sourcePath, fileOptions)\r\n .pipe(map((responseBlob: Blob) => {\r\n FileTransfer.downloadBlob(responseBlob, targetName);\r\n return responseBlob;\r\n }));\r\n }\r\n\r\n /**\r\n * Upload a file from fileObject.\r\n *\r\n * @deprecated Use upload instead.\r\n * @param nodeName the node to upload the file to.\r\n * @param path the file path to store on the target node.\r\n * @param fileObject the file object created on the UI.\r\n * @param fileOptions the file options for the action.\r\n * @return Observable<any> the observable object.\r\n */\r\n public uploadFile(nodeName: string, path: string, fileObject: File, fileOptions?: FileOptions): Observable<any> {\r\n const deferred = NativeQ.defer<any>();\r\n const formData = new FormData();\r\n formData.append('file-0', fileObject);\r\n const request = new XMLHttpRequest();\r\n const url = this.gatewayConnection.url().node(nodeName).fileTransfer().file(path).build();\r\n const handler = () => {\r\n if (request.readyState === 4 /* complete */) {\r\n if (request.status === HttpStatusCode.Ok || request.status === HttpStatusCode.Created) {\r\n deferred.resolve(request.responseText);\r\n } else {\r\n ErrorMonitor.current.reportErrorFromAjax(\r\n <AjaxError>{\r\n status: request.status,\r\n xhr: request,\r\n request: { url, method: 'POST'}\r\n });\r\n\r\n const uploadError = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error;\r\n const message = request.status === HttpStatusCode.CorsRequestFailed ? uploadError.FileNotFound\r\n : (request.status === HttpStatusCode.BadRequest ? uploadError.OperationBlocked\r\n : uploadError.Unknown.format(request.status));\r\n deferred.reject({ xhr: request, message: message });\r\n }\r\n }\r\n };\r\n\r\n let tokenValue: string;\r\n const ajaxRequest = <AjaxRequest>{ headers: {} };\r\n this.authorizationManager.addAuthorizationRequestHeader(ajaxRequest, nodeName);\r\n request.open('PUT', url);\r\n request.withCredentials = true;\r\n\r\n tokenValue = ajaxRequest.headers[headerConstants.SME_AUTHORIZATION];\r\n if (tokenValue) {\r\n request.setRequestHeader(headerConstants.SME_AUTHORIZATION, tokenValue);\r\n }\r\n\r\n tokenValue = ajaxRequest.headers[headerConstants.USE_LAPS];\r\n if (tokenValue) {\r\n request.setRequestHeader(headerConstants.USE_LAPS, tokenValue);\r\n\r\n // If ajaxRequest.headers[LAPS_LOCALADMINNAME] will always have default of 'administrator',\r\n // so no need to check if it exists and not null\r\n request.setRequestHeader(headerConstants.LAPS_LOCALADMINNAME, ajaxRequest.headers[headerConstants.LAPS_LOCALADMINNAME]);\r\n }\r\n\r\n if (fileOptions) {\r\n if (fileOptions.logAudit === true || fileOptions.logAudit === false) {\r\n request.setRequestHeader(headerConstants.LOG_AUDIT, fileOptions.logAudit ? 'true' : 'false');\r\n }\r\n\r\n if (fileOptions.logTelemetry === true || fileOptions.logTelemetry === false) {\r\n request.setRequestHeader(headerConstants.LOG_TELEMETRY, fileOptions.logTelemetry ? 'true' : 'false');\r\n }\r\n }\r\n\r\n const token = Cookie.getCrossSiteRequestForgeryToken();\r\n if (token) {\r\n request.setRequestHeader(headerConstants.CROSS_SITE_REQUEST_FORGERY_TOKEN, token);\r\n }\r\n\r\n request.setRequestHeader(headerConstants.MODULE_NAME, this.nameOfModule);\r\n request.onreadystatechange = handler;\r\n request.send(formData);\r\n return from(deferred.promise);\r\n }\r\n\r\n /**\r\n * Uploads the specified file.\r\n * @param node The target computer to upload the file to.\r\n * @param path The path on the target computer to upload the file to.\r\n * @param file The file to upload.\r\n * @param options The file upload options.\r\n * @param cancellationToken The token that can be used to cancel the operation.\r\n * @returns An observable object that contains the result of the file transfer.\r\n */\r\n public upload(\r\n node: string,\r\n path: string,\r\n file: File,\r\n options: FileUploadOptions = new FileUploadOptions(),\r\n cancellationToken: CancellationToken = CancellationToken.NONE\r\n ): Observable<FileTransferResult> {\r\n\r\n return from(this.uploadAsync(node, path, file, options, cancellationToken));\r\n }\r\n\r\n private uploadAsync(\r\n node: string,\r\n path: string,\r\n file: File,\r\n options: FileUploadOptions,\r\n cancellationToken: CancellationToken): Promise<FileTransferResult> {\r\n\r\n // if the file size <= transfer size, then just transfer the file all at once,\r\n // which will be much faster than the multi - request flow for a single transfer\r\n if (file.size <= options.transferSize) {\r\n return this.uploadAllAtOnce(node, path, file, options, cancellationToken);\r\n }\r\n\r\n return this.uploadInParts(node, path, file, options, cancellationToken);\r\n }\r\n\r\n private async uploadAllAtOnce(\r\n node: string,\r\n path: string,\r\n file: File,\r\n options: FileUploadOptions,\r\n cancellationToken: CancellationToken): Promise<FileTransferResult> {\r\n\r\n const url = this.gatewayConnection.url().node(node).fileTransfer().file(path).build();\r\n const headers = this.newRequestHeaders(node, options);\r\n const transfer = new FileTransferInfo(file.size, 1);\r\n const result = new FileTransferResult(new FileTransferContinuation(null, null, file, transfer));\r\n\r\n do {\r\n const response = await fetch(url, { method: 'PUT', credentials: 'include', headers: headers, body: file });\r\n switch (response.status) {\r\n case HttpStatusCode.Ok:\r\n case HttpStatusCode.Created:\r\n case HttpStatusCode.NoContent:\r\n transfer.incrementCompleted();\r\n return result;\r\n case HttpStatusCode.Forbidden:\r\n case HttpStatusCode.Conflict:\r\n const blockedMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.OperationBlocked;\r\n throw new Error(blockedMessage);\r\n default:\r\n if (cancellationToken.isCancellationRequested) {\r\n break;\r\n }\r\n const unknownMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.Unknown;\r\n throw new Error(unknownMessage.format(response.status, response.statusText));\r\n }\r\n }\r\n while (!cancellationToken.isCancellationRequested);\r\n\r\n cancellationToken.throwIfCancellationRequested();\r\n }\r\n\r\n private async uploadInParts(\r\n node: string,\r\n path: string,\r\n file: File,\r\n options: FileUploadOptions,\r\n cancellationToken: CancellationToken = CancellationToken.NONE): Promise<FileTransferResult> {\r\n\r\n const continuation = await this.newUpload(node, path, file, options, cancellationToken);\r\n let canceled = cancellationToken.isCancellationRequested;\r\n let error: Error = null;\r\n\r\n if (!canceled) {\r\n error = await this.uploadRanges(continuation, options, cancellationToken);\r\n canceled = error !== null || cancellationToken.isCancellationRequested;\r\n }\r\n\r\n if (canceled && options.cancellationBehavior === FileTransferCancellationBehavior.Cancel) {\r\n try {\r\n // cancel the file transfer if an error occurred or the caller requested cancellation\r\n await this.cancelUpload(continuation);\r\n } catch (e) {\r\n // unable to cancel (e.g. clean up) the file transfer\r\n // if cancellation occurred from an error, rethrow it now\r\n if (error !== null) {\r\n throw error;\r\n }\r\n\r\n throw e;\r\n }\r\n\r\n return new FileTransferResult();\r\n }\r\n\r\n return new FileTransferResult(continuation);\r\n }\r\n\r\n /**\r\n * Resumes a previously started file upload.\r\n * @param continuation The information required to continue the file transfer.\r\n * @param progress The object used to report the progress of the upload.\r\n * @param cancellationToken The token that can be used to cancel the operation.\r\n */\r\n public resumeUpload(\r\n continuation: FileTransferContinuation,\r\n progress: Progress<number> = new NoProgress(),\r\n cancellationToken: CancellationToken = CancellationToken.NONE): Observable<void> {\r\n\r\n return from(this.resumeUploadAsync(continuation, progress, cancellationToken));\r\n }\r\n\r\n private async resumeUploadAsync(\r\n continuation: FileTransferContinuation,\r\n progress: Progress<number> = new NoProgress(),\r\n cancellationToken: CancellationToken = CancellationToken.NONE): Promise<void> {\r\n\r\n const transferSize = continuation.transfer.size;\r\n const options = new FileUploadOptions(transferSize, FileTransferCancellationBehavior.Pause, progress);\r\n const error = await this.uploadRanges(continuation, options, cancellationToken);\r\n\r\n if (error !== null) {\r\n throw error;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Cancels a previously started file upload.\r\n * @param continuation The information required to cancel the file transfer.\r\n */\r\n public cancelUpload(continuation: FileTransferContinuation): Observable<void> {\r\n return from(this.cancelUploadAsync(continuation));\r\n }\r\n\r\n private async cancelUploadAsync(continuation: FileTransferContinuation): Promise<void> {\r\n const url = continuation.location;\r\n const node = FileTransfer.extractNode(url);\r\n const headers = this.newRequestHeaders(node, new FileUploadOptions());\r\n let attempts = 0;\r\n\r\n headers.append(headerConstants.IF_MATCH, continuation.token);\r\n\r\n do {\r\n const response = await fetch(url, { method: 'DELETE', credentials: 'include', headers: headers });\r\n const statusCode = response.status;\r\n\r\n // canceled or a new transfer was started\r\n if (statusCode === HttpStatusCode.NoContent || statusCode === HttpStatusCode.PreconditionFailed) {\r\n break;\r\n }\r\n switch (statusCode) {\r\n case HttpStatusCode.Conflict:\r\n break;\r\n case HttpStatusCode.BadGateway:\r\n case HttpStatusCode.ServiceUnavailable:\r\n if (++attempts > 3) {\r\n const giveUpMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.Unknown;\r\n throw new Error(giveUpMessage.format(statusCode, response.statusText));\r\n }\r\n break;\r\n default:\r\n const unknownMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.Unknown;\r\n throw new Error(unknownMessage.format(statusCode, response.statusText));\r\n }\r\n\r\n } while (true);\r\n\r\n return null;\r\n }\r\n\r\n private newRequestHeaders(node: string, options: FileUploadOptions): Headers {\r\n const request = this.gatewayConnection.defaultHttpSecureOptions;\r\n\r\n this.authorizationManager.addAuthorizationRequestHeader(request, node);\r\n\r\n const headers = new Headers();\r\n const authAadToken = request.headers[headerConstants.SME_AAD_AUTHORIZATION];\r\n const authToken = request.headers[headerConstants.SME_AUTHORIZATION];\r\n const useLaps = request.headers[headerConstants.USE_LAPS];\r\n const xsfrToken = Cookie.getCrossSiteRequestForgeryToken();\r\n const { logAudit, logTelemetry } = options.logging;\r\n\r\n headers.append(headerConstants.MODULE_NAME, this.nameOfModule);\r\n\r\n if (authAadToken) {\r\n headers.append(headerConstants.SME_AAD_AUTHORIZATION, authAadToken);\r\n }\r\n\r\n if (authToken) {\r\n headers.append(headerConstants.SME_AUTHORIZATION, authToken);\r\n }\r\n\r\n if (useLaps) {\r\n headers.append(headerConstants.USE_LAPS, useLaps);\r\n headers.append(headerConstants.LAPS_LOCALADMINNAME, request.headers[headerConstants.LAPS_LOCALADMINNAME]);\r\n }\r\n\r\n if (xsfrToken) {\r\n headers.append(headerConstants.CROSS_SITE_REQUEST_FORGERY_TOKEN, xsfrToken);\r\n }\r\n\r\n if (logAudit !== undefined) {\r\n headers.append(headerConstants.LOG_AUDIT, logAudit.toString());\r\n }\r\n\r\n if (logTelemetry !== undefined) {\r\n headers.append(headerConstants.LOG_TELEMETRY, logTelemetry.toString());\r\n }\r\n\r\n return headers;\r\n }\r\n\r\n private async newUpload(\r\n node: string,\r\n path: string,\r\n file: File,\r\n options: FileUploadOptions,\r\n cancellationToken: CancellationToken = CancellationToken.NONE): Promise<FileTransferContinuation> {\r\n\r\n const url = this.gatewayConnection.url().node(node).fileTransfer().file(path).build();\r\n const lastModified = new Date(file.lastModified).toISOString();\r\n const headers = this.newRequestHeaders(node, options);\r\n let response: Response;\r\n let retry = false;\r\n\r\n headers.append(headerConstants.CONTENT_DISPOSITION, `create; size=${file.size}; modification-date=\"${lastModified}\"`);\r\n\r\n do {\r\n response = await fetch(url, { method: 'POST', credentials: 'include', headers: headers });\r\n retry = response.status === HttpStatusCode.Conflict;\r\n } while (retry && !cancellationToken.isCancellationRequested);\r\n\r\n switch (response.status) {\r\n case HttpStatusCode.Created:\r\n const builder = new UriBuilder(response.headers.get(headerConstants.LOCATION));\r\n\r\n // it's the client's job to tell the server which api version they want to use;\r\n // the location header will not contain the query parameter\r\n builder.setQueryParameter('api-version', ApiVersion.Latest);\r\n\r\n const location = builder.toString();\r\n const etag = response.headers.get(headerConstants.ETAG);\r\n const ranges = new Array<ContentRange>();\r\n\r\n FileTransfer.generateRanges(ranges, options.transferSize, file.size);\r\n\r\n const transfer = new FileTransferInfo(options.transferSize, ranges.length);\r\n const continuation = new FileTransferContinuation(location, etag, file, transfer, ranges);\r\n\r\n return continuation;\r\n case HttpStatusCode.Forbidden:\r\n case HttpStatusCode.Conflict:\r\n const blockedMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.OperationBlocked;\r\n throw new Error(blockedMessage);\r\n default:\r\n const unknownMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.Unknown;\r\n throw new Error(unknownMessage.format(response.status, response.statusText));\r\n }\r\n }\r\n\r\n private async uploadRanges(\r\n continuation: FileTransferContinuation,\r\n options: FileUploadOptions,\r\n cancellationToken: CancellationToken): Promise<Error> {\r\n\r\n const node = FileTransfer.extractNode(continuation.location);\r\n const progress = options.progress;\r\n const ranges = continuation.ranges;\r\n const transfer = continuation.transfer;\r\n const remaining = continuation.ranges.length;\r\n const promises = new Map<number, Promise<HttpTransferResult>>();\r\n\r\n // start up to 3 uploads in parallel\r\n for (let i = 0; i < remaining && i < 3; i++) {\r\n promises.set(i, this.uploadPartialFile(i, node, continuation, ranges.shift(), options));\r\n }\r\n\r\n while (promises.size > 0 && !cancellationToken.isCancellationRequested) {\r\n // wait for first completed upload\r\n const result = await Promise.race(promises.values());\r\n switch (result.statusCode) {\r\n case HttpStatusCode.NoContent:\r\n if (ranges.length > 0) {\r\n if (!cancellationToken.isCancellationRequested) {\r\n // start next upload\r\n promises.set(result.index, this.uploadPartialFile(result.index, node, continuation, ranges.shift(), options));\r\n }\r\n } else {\r\n promises.delete(result.index);\r\n }\r\n\r\n transfer.incrementCompleted();\r\n progress.report(transfer.percentComplete);\r\n break;\r\n case HttpStatusCode.Unauthorized:\r\n case HttpStatusCode.Conflict:\r\n case HttpStatusCode.BadGateway:\r\n case HttpStatusCode.ServiceUnavailable:\r\n if (!cancellationToken.isCancellationRequested) {\r\n // retry upload\r\n promises.set(result.index, this.uploadPartialFile(result.index, node, continuation, result.range, options));\r\n }\r\n break;\r\n case HttpStatusCode.Gone:\r\n case HttpStatusCode.PreconditionFailed:\r\n\r\n // burn down promises\r\n promises.delete(result.index);\r\n await Promise.all(promises.values());\r\n promises.clear();\r\n\r\n // clear remaining ranges; the transfer cannot be completed\r\n if (ranges.length > 0) {\r\n ranges.splice(0, ranges.length);\r\n }\r\n break;\r\n default:\r\n const unknownMessage = MsftSme.getStrings<Strings>().MsftSmeShell.Core.DirectoryList.Upload.Error.UnknownNoMessage;\r\n return new Error(unknownMessage.format(result.statusCode));\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private async uploadPartialFile(\r\n index: number,\r\n node: string,\r\n continuation: FileTransferContinuation,\r\n range: ContentRange,\r\n options: FileUploadOptions): Promise<HttpTransferResult> {\r\n\r\n const blob = continuation.file.slice(range.from, range.to + 1);\r\n const headers = this.newRequestHeaders(node, options);\r\n\r\n headers.append(headerConstants.CONTENT_TYPE, 'application/octet-stream');\r\n headers.append(headerConstants.CONTENT_RANGE, range.toString());\r\n headers.append(headerConstants.IF_MATCH, continuation.token);\r\n\r\n const response = await fetch(continuation.location, {\r\n method: 'PATCH',\r\n credentials: 'include',\r\n headers: headers,\r\n body: blob\r\n });\r\n\r\n return new HttpTransferResult(index, response.status, range);\r\n }\r\n\r\n /**\r\n * Gets the name of current shell or module.\r\n */\r\n private get nameOfModule(): string {\r\n if (!this.moduleName) {\r\n this.moduleName = EnvironmentModule.getModuleName();\r\n }\r\n\r\n return this.moduleName;\r\n }\r\n}\r\n\r\n/** Represents the possible cancellation behaviors */\r\nexport enum FileTransferCancellationBehavior {\r\n /** Indicates the file transfer is cancelled or aborted on cancellation */\r\n Cancel,\r\n\r\n /** Indicates the file transfer is paused on cancellation */\r\n Pause,\r\n}\r\n\r\n/** Represents file upload options. */\r\nexport class FileUploadOptions {\r\n constructor(\r\n /** Gets the size of transfer content. The default value is 10MB. */\r\n public readonly transferSize: number = 10485760,\r\n\r\n /** Indicates the behavior to perform if the operation is canceled. */\r\n public readonly cancellationBehavior: FileTransferCancellationBehavior = FileTransferCancellationBehavior.Cancel,\r\n\r\n /** A token that can be used to cancel the operation. */\r\n public readonly progress: Progress<number> = new NoProgress(),\r\n\r\n /** Gets the associated logging options. */\r\n public readonly logging: FileOptions = { logAudit: false, logTelemetry: false }) {\r\n\r\n }\r\n}\r\n\r\n/** Represents the size and progress of a file transfer. */\r\nexport class FileTransferInfo {\r\n private completed = 0;\r\n\r\n constructor(\r\n /** Gets the size used in the file transfer. */\r\n public readonly size: number,\r\n\r\n /** Gets the total number of items in the file transfer. */\r\n public readonly count: number) {\r\n }\r\n\r\n /** Gets the percentage of the file transfer completed. */\r\n public get percentComplete(): number {\r\n return (this.completed / this.count) * 100;\r\n }\r\n\r\n /** Increments the number of completed items in the file transfer. */\r\n public incrementCompleted(): void {\r\n this.completed = Math.min(this.completed + 1, this.count);\r\n }\r\n}\r\n\r\n/** Represents a continuation for a file transfer */\r\nexport class FileTransferContinuation {\r\n constructor(\r\n /** Gets the URl representing the location of the file transfer */\r\n public readonly location: string,\r\n\r\n /** Gets the continuation token for the file transfer */\r\n public readonly token: string,\r\n\r\n /** Gets the file being transferred */\r\n public readonly file: File,\r\n\r\n /** Gets the file transfer information. */\r\n public readonly transfer: FileTransferInfo,\r\n\r\n /** Gets the remaining ranges in the file transfer */\r\n public readonly ranges: ContentRange[] = new Array<ContentRange>()) {\r\n }\r\n}\r\n\r\n/** Represents the result of a file transfer */\r\nexport class FileTransferResult {\r\n constructor(\r\n /** Gets the continuation token associated with the file transfer */\r\n public readonly continuation: FileTransferContinuation =\r\n new FileTransferContinuation(null, null, null, new FileTransferInfo(0, 0))) {\r\n\r\n }\r\n\r\n /** Gets a value indicating whether the file transfer is complete */\r\n public get completed(): boolean {\r\n return this.continuation.ranges.length === 0;\r\n }\r\n\r\n /** Gets a value indicating whether the file transfer is resumable */\r\n public get resumable() {\r\n return !this.completed &&\r\n this.continuation.token !== null &&\r\n this.continuation.location !== null &&\r\n this.continuation.file !== null;\r\n }\r\n}\r\n\r\n/** Represent a range of content in a file transfer */\r\nexport class ContentRange {\r\n constructor(\r\n /** Gets the zero-based start of the content, in bytes */\r\n // tslint:disable-next-line:no-shadowed-variable\r\n public readonly from: number,\r\n\r\n /** Gets the zero-based end of the content, in bytes */\r\n public readonly to: number,\r\n\r\n /** Gets the total size of the content in bytes */\r\n public readonly totalSize: number) {\r\n\r\n }\r\n\r\n /** Returns the string representation of the object */\r\n public toString(): string {\r\n return `bytes ${this.from}-${this.to}/${this.totalSize}`;\r\n }\r\n}\r\n\r\nclass NoProgress implements Progress<number> {\r\n public report(value: number): void {\r\n\r\n }\r\n}\r\n\r\nclass HttpTransferResult {\r\n constructor(\r\n public readonly index: number,\r\n public readonly statusCode: number,\r\n public readonly range: ContentRange) {\r\n\r\n }\r\n}\r\n"]}
|
|
@@ -59,6 +59,10 @@ export declare class WdacConstants {
|
|
|
59
59
|
* PowerShell Language mode API endpoint.
|
|
60
60
|
*/
|
|
61
61
|
static psLanguageModeUrl: string;
|
|
62
|
+
/**
|
|
63
|
+
* Wdac cache reset API endpoint.
|
|
64
|
+
*/
|
|
65
|
+
static resetWdacCacheUrl: string;
|
|
62
66
|
}
|
|
63
67
|
/**
|
|
64
68
|
* Windows Defender Application Control (WDAC) operations class.
|
|
@@ -83,4 +87,10 @@ export declare class WdacOperations {
|
|
|
83
87
|
* @param options the NodeRequestOptions for this API call.
|
|
84
88
|
*/
|
|
85
89
|
getPsLanguageMode(targetNodeName: string, options?: NodeRequestOptions): Observable<PsLanguageModeResult>;
|
|
90
|
+
/**
|
|
91
|
+
* Resets the WDAC cache of a specified targetNodeName.
|
|
92
|
+
* @param targetNodeName the machine name to reset the WDAC cache for.
|
|
93
|
+
* @param options the NodeRequestOptions for this API call.
|
|
94
|
+
*/
|
|
95
|
+
resetWdacCache(targetNodeName: string, options?: NodeRequestOptions): Observable<void>;
|
|
86
96
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { throwError } from 'rxjs';
|
|
2
|
-
import { catchError, switchMap } from 'rxjs/operators';
|
|
2
|
+
import { catchError, map, switchMap } from 'rxjs/operators';
|
|
3
3
|
/**
|
|
4
4
|
* Windows Defender Application Control (WDAC) mode values.
|
|
5
5
|
* https://learn.microsoft.com/lv-lv/dotnet/api/microsoft.powershell.commands.deviceguardconfigcodeintegritystatus?view=powershellsdk-1.1.0
|
|
@@ -34,6 +34,10 @@ WdacConstants.wdacModeUrl = 'features/wdac/operations/wdacMode';
|
|
|
34
34
|
* PowerShell Language mode API endpoint.
|
|
35
35
|
*/
|
|
36
36
|
WdacConstants.psLanguageModeUrl = 'features/wdac/operations/psLanguageMode';
|
|
37
|
+
/**
|
|
38
|
+
* Wdac cache reset API endpoint.
|
|
39
|
+
*/
|
|
40
|
+
WdacConstants.resetWdacCacheUrl = 'features/wdac/operations/resetWdacCache';
|
|
37
41
|
/**
|
|
38
42
|
* Windows Defender Application Control (WDAC) operations class.
|
|
39
43
|
*/
|
|
@@ -78,6 +82,15 @@ export class WdacOperations {
|
|
|
78
82
|
return throwError(error);
|
|
79
83
|
}));
|
|
80
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Resets the WDAC cache of a specified targetNodeName.
|
|
87
|
+
* @param targetNodeName the machine name to reset the WDAC cache for.
|
|
88
|
+
* @param options the NodeRequestOptions for this API call.
|
|
89
|
+
*/
|
|
90
|
+
resetWdacCache(targetNodeName, options) {
|
|
91
|
+
return this.appContext.node.post(targetNodeName, WdacConstants.resetWdacCacheUrl, null, options)
|
|
92
|
+
.pipe(map(() => null));
|
|
93
|
+
}
|
|
81
94
|
}
|
|
82
95
|
|
|
83
96
|
//# sourceMappingURL=wdac-operations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/data/wdac-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/data/wdac-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK5D;;;GAGG;AACH,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAChB,qCAAO,CAAA;IACP,iDAAa,CAAA;IACb,6DAAmB,CAAA;AACvB,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACtB,mEAAgB,CAAA;IAChB,+EAAsB,CAAA;IACtB,+DAAc,CAAA;IACd,iFAAuB,CAAA;AAC3B,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAgCD;;GAEG;AACH,MAAM,OAAO,aAAa;;AACtB;;GAEG;AACW,yBAAW,GAAG,mCAAmC,CAAC;AAEhE;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AAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aAC3E;YACD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC,CAAC,CACL,CAAC;IACV,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,cAAsB,EAAE,OAA4B;QACtE,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,iBAAiB,EAAE,IAAI,EAAE,OAAO,CAAC;aAC3F,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,CAAC;CACJ","file":"wdac-operations.js","sourcesContent":["import { Observable, throwError } from 'rxjs';\r\nimport { catchError, map, switchMap } from 'rxjs/operators';\r\nimport { AppContext } from './app-context';\r\nimport { HttpStatusCode } from './http-constants';\r\nimport { NodeRequestOptions } from './node-connection';\r\n\r\n/**\r\n * Windows Defender Application Control (WDAC) mode values.\r\n * https://learn.microsoft.com/lv-lv/dotnet/api/microsoft.powershell.commands.deviceguardconfigcodeintegritystatus?view=powershellsdk-1.1.0\r\n */\r\nexport enum WdacMode {\r\n Off = 0,\r\n AuditMode = 1,\r\n EnforcementMode = 2\r\n}\r\n\r\n/**\r\n * PowerShell Language mode values.\r\n * https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.pslanguagemode?view=powershellsdk-7.0.0\r\n */\r\nexport enum PSLanguageMode {\r\n FullLanguage = 0,\r\n RestrictedLanguage = 1,\r\n NoLanguage = 2,\r\n ConstrainedLanguage = 3\r\n}\r\n\r\n/**\r\n * Represents the data returned from the wdacMode endpoint - /api/nodes/<node>/features/wdac/operations/wdacMode\r\n */\r\nexport interface WdacModeResult {\r\n /**\r\n * Status of the request/response.\r\n */\r\n status: HttpStatusCode;\r\n\r\n /**\r\n * WdacMode of the target node.\r\n */\r\n wdacMode: WdacMode;\r\n}\r\n\r\n/**\r\n * Represents the data returned from the psLanguageMode endpoint - /api/nodes/<node>/features/wdac/operations/psLanguageMode\r\n */\r\nexport interface PsLanguageModeResult {\r\n /**\r\n * Status of the request/response.\r\n */\r\n status: HttpStatusCode;\r\n\r\n /**\r\n * PowerShell Language Mode of the target node.\r\n */\r\n psLanguageMode: PSLanguageMode;\r\n}\r\n\r\n/**\r\n * Windows Defender Application Control (WDAC) Constants.\r\n */\r\nexport class WdacConstants {\r\n /**\r\n * Wdac mode API endpoint.\r\n */\r\n public static wdacModeUrl = 'features/wdac/operations/wdacMode';\r\n\r\n /**\r\n * PowerShell Language mode API endpoint.\r\n */\r\n public static psLanguageModeUrl = 'features/wdac/operations/psLanguageMode';\r\n\r\n /**\r\n * Wdac cache reset API endpoint.\r\n */\r\n public static resetWdacCacheUrl = 'features/wdac/operations/resetWdacCache';\r\n}\r\n\r\n/**\r\n * Windows Defender Application Control (WDAC) operations class.\r\n */\r\nexport class WdacOperations {\r\n /**\r\n * Initializes a new instance of the WdacOperations class.\r\n *\r\n * @param appContext the application context.\r\n */\r\n constructor(private appContext: AppContext) { }\r\n\r\n /**\r\n * Gets the WdacMode of a specified targetNodeName.\r\n * @param targetNodeName the machine name to get the WdacMode for.\r\n * @param options the NodeRequestOptions for this API call.\r\n */\r\n public getWdacMode(targetNodeName: string, options?: NodeRequestOptions): Observable<WdacModeResult> {\r\n return this.appContext.node.get(targetNodeName, WdacConstants.wdacModeUrl, options)\r\n .pipe(\r\n catchError((error, caught) => {\r\n // catch elevation error and retry after elevated.\r\n if (this.appContext.gateway.isElevationRequired(error)) {\r\n return this.appContext.gateway.pollingGatewayElevated()\r\n .pipe(switchMap(elevated => elevated ? caught : throwError(error)));\r\n }\r\n return throwError(error);\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Gets the PowerShell Language Mode of a specified targetNodeName.\r\n * @param targetNodeName the machine name to get the WdacMode for.\r\n * @param options the NodeRequestOptions for this API call.\r\n */\r\n public getPsLanguageMode(targetNodeName: string, options?: NodeRequestOptions): Observable<PsLanguageModeResult> {\r\n return this.appContext.node.get(targetNodeName, WdacConstants.psLanguageModeUrl, options)\r\n .pipe(\r\n catchError((error, caught) => {\r\n // catch elevation error and retry after elevated.\r\n if (this.appContext.gateway.isElevationRequired(error)) {\r\n return this.appContext.gateway.pollingGatewayElevated()\r\n .pipe(switchMap(elevated => elevated ? caught : throwError(error)));\r\n }\r\n return throwError(error);\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Resets the WDAC cache of a specified targetNodeName.\r\n * @param targetNodeName the machine name to reset the WDAC cache for.\r\n * @param options the NodeRequestOptions for this API call.\r\n */\r\n public resetWdacCache(targetNodeName: string, options?: NodeRequestOptions): Observable<void> {\r\n return this.appContext.node.post(targetNodeName, WdacConstants.resetWdacCacheUrl, null, options)\r\n .pipe(map(() => null));\r\n }\r\n}\r\n"]}
|
|
@@ -87,7 +87,8 @@ export declare enum TelemetryEventTypes {
|
|
|
87
87
|
Performance = "performance",
|
|
88
88
|
Lighthouse = "lighthouse",
|
|
89
89
|
Notification = "notification",
|
|
90
|
-
Powershell = "powershell"
|
|
90
|
+
Powershell = "powershell",
|
|
91
|
+
StatusUpdate = "statusUpdate"
|
|
91
92
|
}
|
|
92
93
|
/**
|
|
93
94
|
* Labels for WAC metadata tags
|
|
@@ -32,6 +32,7 @@ export var TelemetryEventTypes;
|
|
|
32
32
|
TelemetryEventTypes["Lighthouse"] = "lighthouse";
|
|
33
33
|
TelemetryEventTypes["Notification"] = "notification";
|
|
34
34
|
TelemetryEventTypes["Powershell"] = "powershell";
|
|
35
|
+
TelemetryEventTypes["StatusUpdate"] = "statusUpdate";
|
|
35
36
|
})(TelemetryEventTypes || (TelemetryEventTypes = {}));
|
|
36
37
|
/**
|
|
37
38
|
* Labels for WAC metadata tags
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/diagnostics/sme-web-telemetry-models.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,oFAAoF;AAqEpF;;GAEG;AACH,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACvB,yDAAM,CAAA;IACN,6DAAQ,CAAA;IACR,uEAAa,CAAA;IACb,mEAAW,CAAA;IACX,iEAAU,CAAA;IACV,uFAAqB,CAAA;IACrB,qEAAY,CAAA;AAChB,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B;AAED;;GAEG;AACF,MAAM,CAAN,IAAY,oBAGZ;AAHA,WAAY,oBAAoB;IAC7B,uCAAe,CAAA;IACf,oCAAY,CAAA;AAChB,CAAC,EAHY,oBAAoB,KAApB,oBAAoB,QAGhC;AAED;;GAEG;AACF,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/diagnostics/sme-web-telemetry-models.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,oFAAoF;AAqEpF;;GAEG;AACH,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACvB,yDAAM,CAAA;IACN,6DAAQ,CAAA;IACR,uEAAa,CAAA;IACb,mEAAW,CAAA;IACX,iEAAU,CAAA;IACV,uFAAqB,CAAA;IACrB,qEAAY,CAAA;AAChB,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B;AAED;;GAEG;AACF,MAAM,CAAN,IAAY,oBAGZ;AAHA,WAAY,oBAAoB;IAC7B,uCAAe,CAAA;IACf,oCAAY,CAAA;AAChB,CAAC,EAHY,oBAAoB,KAApB,oBAAoB,QAGhC;AAED;;GAEG;AACF,MAAM,CAAN,IAAY,mBAQZ;AARA,WAAY,mBAAmB;IAC5B,6CAAsB,CAAA;IACtB,sCAAe,CAAA;IACf,kDAA2B,CAAA;IAC3B,gDAAyB,CAAA;IACzB,oDAA6B,CAAA;IAC7B,gDAAyB,CAAA;IACzB,oDAA6B,CAAA;AACjC,CAAC,EARY,mBAAmB,KAAnB,mBAAmB,QAQ/B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,aAWX;AAXD,WAAY,aAAa;IACrB,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,2DAA0C,CAAA;IAC1C,6CAA4B,CAAA;IAC5B,2DAA0C,CAAA;IAC1C,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;IACnB,iDAAgC,CAAA;IAChC,wEAAuD,CAAA;AAC3D,CAAC,EAXW,aAAa,KAAb,aAAa,QAWxB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC5B,2CAAmB,CAAA;IACnB,+CAAuB,CAAA;IACvB,uCAAe,CAAA;IACf,yCAAiB,CAAA;AACrB,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B","file":"sme-web-telemetry-models.js","sourcesContent":["// 1DS documentation found at\r\n// https://1dsdocs.azurewebsites.net/getting-started/javascript-getting_started.html\r\n\r\n/**\r\n * This file contains override value interfaces from 1DS - we redefine these locally because we cannot take the npm package due to\r\n * it being from a private feed. Instead, we load the CDN and use our redefined interfaces to help everything mesh together.\r\n * Disable tslint interface prefix rule b/c these are 1DS libraries, avoid renaming to keep consistent.\r\n */\r\n\r\nimport { RpcNotification } from '../rpc/notification/rpc-notification-model';\r\n\r\n// tslint:disable:interface-name\r\n/************************************\r\n * WAC models\r\n ************************************/\r\n\r\n/**\r\n * Exposed class to hold sme performance data.\r\n */\r\nexport interface SmePerformanceData {\r\n label?: string;\r\n sme?: any;\r\n resources?: any;\r\n navigation?: any;\r\n totalLoadTime: number;\r\n}\r\n\r\n/**\r\n * Holds lighthouse metrics to send via telemetry. See more details at https://web.dev/vitals/\r\n */\r\n export interface LighthousePerformanceMetrics {\r\n CumulativeLayoutShift?: number;\r\n LargestContentfulPaint?: number;\r\n FirstContentfulPaint?: number;\r\n FirstInputDelay?: number;\r\n TimeToFirstByte?: number;\r\n TotalBlockingTime?: number;\r\n TimeToInteractive?: number;\r\n}\r\n\r\n/**\r\n * Class w/ all SME performance data to be sent via telemetry. Internal to SmeWebTelemetry.\r\n * Numbers are converted to strings because we use toFixed to truncate numbers to avoid triggering MSCOM scrubbed\r\n * stream personal data removal (eg with phone numbers)\r\n */\r\nexport interface CompleteSmePerformanceData {\r\n extension: string;\r\n entryPointName: string;\r\n url: string;\r\n moduleOpened: boolean;\r\n label?: string;\r\n sme?: any;\r\n resources?: any;\r\n navigation?: any;\r\n totalLoadTime: string;\r\n}\r\n\r\n/**\r\n * Class to hold any kind of telemetry event parameters needed to fire an event.\r\n */\r\nexport interface TelemetryEventBody {\r\n overrideValues?: IOverrideValues;\r\n element?: Element;\r\n performance?: SmePerformanceData;\r\n lighthouse?: LighthousePerformanceMetrics;\r\n notification?: RpcNotification;\r\n custom?: any;\r\n customProperties?: { [name: string]: any };\r\n}\r\n\r\n/**\r\n * Telemetry events supported.\r\n */\r\nexport enum TelemetryEvents {\r\n Action,\r\n PageView,\r\n ContentUpdate,\r\n Performance,\r\n Lighthouse,\r\n ModuleOpenPerformance,\r\n Notification\r\n}\r\n\r\n/**\r\n * Telemetry action types supported - corresponds to awa jsll action type dictionary.\r\n */\r\n export enum TelemetryActionTypes {\r\n Automatic = 'A',\r\n Click = 'CL'\r\n}\r\n\r\n/**\r\n * Telemetry event types supported - labels type field in data dictionary within events.\r\n */\r\n export enum TelemetryEventTypes {\r\n Informational = 'info',\r\n Error = 'error',\r\n Performance = 'performance',\r\n Lighthouse = 'lighthouse',\r\n Notification = 'notification',\r\n Powershell = 'powershell',\r\n StatusUpdate = 'statusUpdate'\r\n}\r\n\r\n/**\r\n * Labels for WAC metadata tags\r\n */\r\nexport enum SmeMetaLabels {\r\n Language = 'wac-lang',\r\n IsProduction = 'wac-prod',\r\n ExtensionVersion = 'wac-extension-version',\r\n SessionId = 'wac-session-id',\r\n InstallationType = 'wac-installation-type',\r\n Build = 'wac-build',\r\n Market = 'market',\r\n Environment = 'env',\r\n GatewayMode = 'wac-gateway-mode',\r\n GatewayOperationalMode = 'wac-gateway-operational-mode'\r\n}\r\n\r\n/**\r\n * Standard telemetry tracking event states\r\n */\r\nexport enum TelemetryEventStates {\r\n Started = 'started',\r\n Completed = 'completed',\r\n Error = 'error',\r\n Exited = 'exited'\r\n}\r\n\r\n/**\r\n * Include powershell details that may be helpful in telemetry, including response and psSessionId.\r\n * Data is kept as an optional any-helpful field kind of thing.\r\n */\r\nexport interface PowershellDetails {\r\n /**\r\n * Response object - this should be the response within the error if result is an AjaxError\r\n */\r\n response?: any;\r\n\r\n /**\r\n * Powershell session ID - used to map to PS command in telemetry\r\n */\r\n id?: string;\r\n\r\n /**\r\n * Any other miscellaneous data that would like to be sent.\r\n */\r\n otherData?: any;\r\n}\r\n\r\n/************************************\r\n * Override values interfaces\r\n ************************************/\r\n export interface IOverrideValues {\r\n /**\r\n * One of the awa.behavior values.\r\n */\r\n behavior?: number;\r\n /**\r\n * Page name\r\n */\r\n pageName?: string;\r\n /**\r\n * Page type\r\n */\r\n pageType?: string;\r\n /**\r\n * KVP to be added to the page tags collected\r\n */\r\n pageTags?: any;\r\n /**\r\n * Indicates if the event was fired automatically\r\n */\r\n isAuto?: boolean;\r\n}\r\n\r\n/**\r\n * Overrides for Page View event\r\n */\r\n export interface IPageViewOverrideValues extends IOverrideValues {\r\n /**\r\n * Uri of the referrer page\r\n */\r\n referrerUri?: string;\r\n}\r\n\r\n/**\r\n * Overrides for Page Action event\r\n */\r\nexport interface IPageActionOverrideValues extends IOverrideValues {\r\n /**\r\n * Uri of the referrer page\r\n */\r\n refUri?: string;\r\n /**\r\n * One of the awa.actionType values\r\n */\r\n actionType?: string;\r\n /**\r\n * Target uri for PageAction events\r\n */\r\n targetUri?: string;\r\n /**\r\n * Click coordinates relative to the top left of the fully rendered content area in the browser\r\n */\r\n clickCoordinateX?: number;\r\n /**\r\n * Click coordinates relative to the top left of the fully rendered content area in the browser\r\n */\r\n clickCoordinateY?: number;\r\n /**\r\n * KVP of the content\r\n */\r\n content?: any;\r\n /**\r\n * KVPs to be added to the content tags collected on a Page Action event; extends the items in the Content blob in Page Action events\r\n */\r\n contentTags?: any;\r\n}\r\n\r\n/**\r\n * Overrides for Content Update event\r\n */\r\nexport interface IContentUpdateOverrideValues extends IOverrideValues {\r\n /**\r\n * KVP of the content\r\n */\r\n content?: any;\r\n /**\r\n * Indicates if the Contentupdate event is the first ContentUpdate event\r\n */\r\n isDomComplete?: boolean;\r\n /**\r\n * One of the awa.actionType values\r\n */\r\n actionType?: string;\r\n}\r\n\r\n/**\r\n * Overrides for Page Unload event\r\n */\r\nexport interface IPageUnloadOverrideValues extends IOverrideValues {\r\n /**\r\n * Scroll depth override\r\n */\r\n scrollDepth?: string;\r\n /**\r\n * Vertical scroll position/offset when event was fired in pixels.\r\n */\r\n vScrollOffset?: number;\r\n}\r\n\r\n/**\r\n * Overrides for Page View Performance event\r\n */\r\nexport interface IPageViewPerformanceOverrideValues extends IOverrideValues {\r\n /**\r\n * Viewport height\r\n */\r\n vpHeight?: number;\r\n /**\r\n * Viewport width\r\n */\r\n vpWidth?: number;\r\n /**\r\n * Represents UX Framework name and version used.\r\n */\r\n framework?: string;\r\n /**\r\n * These are timings pulled from the browser/container.\r\n * They are standards which are captured by the browser, like the navigationStart/End, LoadEventStart/End\r\n */\r\n systemTiming?: string;\r\n /**\r\n * These are user set timings\r\n */\r\n customTiming?: string;\r\n}\r\n"]}
|
|
@@ -171,4 +171,24 @@ export declare class SmeWebTelemetry {
|
|
|
171
171
|
* @returns
|
|
172
172
|
*/
|
|
173
173
|
static tracePowershellBatchEvent(commands: string[], state: TelemetryEventStates, details?: PowershellDetails): void;
|
|
174
|
+
/**
|
|
175
|
+
* Helper to redactGenericModel function
|
|
176
|
+
* Determines whether field should be redacted according to fields provided for redacting and exceptions
|
|
177
|
+
* @param key The field in question
|
|
178
|
+
* @param keywordsToRedact List of string inclusions to redact - if the field contains any part of this, it will be redacted
|
|
179
|
+
* @param exceptions Set of exceptions to the above - if the field matches an exception, it will not be redacted
|
|
180
|
+
* @returns True if field should be redacted, false otherwise
|
|
181
|
+
*/
|
|
182
|
+
private static fieldShouldBeRedacted;
|
|
183
|
+
/**
|
|
184
|
+
* Telemetry utility function to redact a model object. This function will traverse the model in BFS fashion and redact any fields
|
|
185
|
+
* that contain any string in the keywordsToRedact array, unless the field is an exception (in the exceptions array).
|
|
186
|
+
* This function will not affect keys in StringMaps or Maps - if names exist there, they should be handled separately.
|
|
187
|
+
*
|
|
188
|
+
* @param model Model to redact
|
|
189
|
+
* @param keywordsToRedact List of string inclusions to redact
|
|
190
|
+
* @param fieldExceptions List of exceptions to the above
|
|
191
|
+
* @returns Redacted model
|
|
192
|
+
*/
|
|
193
|
+
static redactGenericModel(model: any, keywordsToRedact: string[], fieldExceptions: string[]): any;
|
|
174
194
|
}
|
|
@@ -515,6 +515,65 @@ export class SmeWebTelemetry {
|
|
|
515
515
|
}
|
|
516
516
|
SmeWebTelemetry.traceAction(null, { content: psContent }, { type: TelemetryEventTypes.Powershell });
|
|
517
517
|
}
|
|
518
|
+
/**
|
|
519
|
+
* Helper to redactGenericModel function
|
|
520
|
+
* Determines whether field should be redacted according to fields provided for redacting and exceptions
|
|
521
|
+
* @param key The field in question
|
|
522
|
+
* @param keywordsToRedact List of string inclusions to redact - if the field contains any part of this, it will be redacted
|
|
523
|
+
* @param exceptions Set of exceptions to the above - if the field matches an exception, it will not be redacted
|
|
524
|
+
* @returns True if field should be redacted, false otherwise
|
|
525
|
+
*/
|
|
526
|
+
static fieldShouldBeRedacted(key, keywordsToRedact, exceptions) {
|
|
527
|
+
if (exceptions.has(key)) {
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
for (const field of keywordsToRedact) {
|
|
531
|
+
if (key.toLowerCase().includes(field.toLowerCase())) {
|
|
532
|
+
return true;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Telemetry utility function to redact a model object. This function will traverse the model in BFS fashion and redact any fields
|
|
539
|
+
* that contain any string in the keywordsToRedact array, unless the field is an exception (in the exceptions array).
|
|
540
|
+
* This function will not affect keys in StringMaps or Maps - if names exist there, they should be handled separately.
|
|
541
|
+
*
|
|
542
|
+
* @param model Model to redact
|
|
543
|
+
* @param keywordsToRedact List of string inclusions to redact
|
|
544
|
+
* @param fieldExceptions List of exceptions to the above
|
|
545
|
+
* @returns Redacted model
|
|
546
|
+
*/
|
|
547
|
+
static redactGenericModel(model, keywordsToRedact, fieldExceptions) {
|
|
548
|
+
const redacted_model = JSON.parse(JSON.stringify(model));
|
|
549
|
+
const remainingObjects = [redacted_model];
|
|
550
|
+
const exceptionSet = new Set(fieldExceptions);
|
|
551
|
+
while (remainingObjects.length > 0) {
|
|
552
|
+
const currentTree = remainingObjects[0];
|
|
553
|
+
Object.keys(currentTree).forEach(key => {
|
|
554
|
+
if (MsftSme.isPlainObject(currentTree[key])) {
|
|
555
|
+
remainingObjects.push(currentTree[key]);
|
|
556
|
+
}
|
|
557
|
+
else if (Array.isArray(currentTree[key]) && currentTree[key].some((field) => MsftSme.isPlainObject(field))) {
|
|
558
|
+
// If array intermixes objects and non-objects, we will push the objects into the queue and ignore the non-objects.
|
|
559
|
+
// The non-objects will avoid redaction, but this should never be a concern in practice.
|
|
560
|
+
remainingObjects.push(currentTree[key].filter((field) => MsftSme.isPlainObject(field)));
|
|
561
|
+
}
|
|
562
|
+
else if (this.fieldShouldBeRedacted(key, keywordsToRedact, exceptionSet)) {
|
|
563
|
+
if (Array.isArray(currentTree[key])) {
|
|
564
|
+
for (let i = 0; i < currentTree[key].length; ++i) {
|
|
565
|
+
currentTree[key][i] = '***';
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
currentTree[key] = '***';
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
remainingObjects.shift();
|
|
574
|
+
}
|
|
575
|
+
return redacted_model;
|
|
576
|
+
}
|
|
518
577
|
}
|
|
519
578
|
SmeWebTelemetry.eventBacklog = [];
|
|
520
579
|
SmeWebTelemetry.telemetryHandler = null;
|