UNPKG

@microsoft/windows-admin-center-sdk

Version:

Microsoft - Windows Admin Center Shell

1 lines 12.7 kB
{"version":3,"sources":["../../../packages/core/notification/work-item-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,oBAAY,mBAAmB;IAC3B,gBAAgB,IAAA;IAChB,UAAU,IAAA;IACV,cAAc,IAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,EAAE,iBAAiB,CAAC;IAEzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ;;OAEG;IACH,MAAM,CAAC,EAAE,GAAG,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,gBAAgB,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C;IAE1B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB,EAAE,gBAAgB;CAC/E;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACpD;;OAEG;IACH,OAAO,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,iBAAiB;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,WAAW,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAClB","file":"work-item-request.d.ts","sourcesContent":["import { NodeRequestOptions } from '../data/node-connection';\r\nimport { PowerShellCommand } from '../data/powershell';\r\nimport { RpcWorkItem } from '../rpc/work-item/rpc-work-item-model';\r\nimport { NotificationLinkType } from './notification-link-type';\r\nimport { NotificationState } from './notification-state';\r\n\r\n/**\r\n * Work item request type.\r\n */\r\nexport enum WorkItemRequestType {\r\n PowerShellSubmit,\r\n StateQuery,\r\n WorkItemSubmit\r\n}\r\n\r\n/**\r\n * Response at submit call of work item.\r\n */\r\nexport interface WorkItemResult {\r\n /**\r\n * The sequence id.\r\n */\r\n sequenceId: number;\r\n\r\n /**\r\n * The session id (or instance id).\r\n */\r\n id: string;\r\n\r\n /**\r\n * The state of notification.\r\n */\r\n state: NotificationState;\r\n\r\n /**\r\n * The progress state. (0 to 100 if the powershell script respond with it.)\r\n */\r\n percent?: number;\r\n\r\n /**\r\n * The error object.\r\n */\r\n error?: any;\r\n\r\n /**\r\n * The last response object.\r\n */\r\n object?: any;\r\n}\r\n\r\n/**\r\n * The work item base data.\r\n */\r\nexport interface WorkItemBaseData {\r\n /**\r\n * The node name.\r\n */\r\n nodeName: string;\r\n\r\n /**\r\n * The module source name.\r\n */\r\n sourceName: string;\r\n\r\n /**\r\n * The request time.\r\n */\r\n timestamp: number;\r\n}\r\n\r\n/**\r\n * The base meta data of work item. A module populates them.\r\n */\r\nexport interface WorkItemMetaDataCore {\r\n /**\r\n * The identity of workitem type. (Unique ID within the module.)\r\n * ex.) \"StopService\", \"InstallRole\", \"InstallWindowsUpdate\", \"CreateVM\" ...\r\n */\r\n typeId: string;\r\n\r\n /**\r\n * The target object name if any specific.\r\n * ex.) \"VM007\" (virtual machine), \"WinRm\" (service name)\r\n */\r\n objectName?: string;\r\n\r\n /**\r\n * @deprecated please use inProgressTitle, successTitle, and errorTitle fields\r\n */\r\n title?: string;\r\n\r\n /**\r\n * @deprecated\r\n * This field can be removed\r\n */\r\n description?: string;\r\n\r\n /**\r\n * @deprecated use started message to tell user the action is being worked on\r\n */\r\n submittedMessage?: string;\r\n\r\n /**\r\n * The localized notification title for in progress actions\r\n * Should be in the form \"Executing some action\"\r\n * ex) \"Stopping service\", \"Installing role\", \"Creating new virtual machine\"\r\n */\r\n inProgressTitle?: string;\r\n\r\n /**\r\n * The started message. (localized) Non format message.\r\n * This is shown after the powershell script has started executing (~3 seconds after submit message to create powershell session)\r\n */\r\n startedMessage?: string;\r\n\r\n /**\r\n * The progress message. (localized/optional)\r\n * At default, generic message displays.\r\n * A message can have insertion field with '{{<propertyName>, percent or objectName}}' from the latest PowerShell 'progress' object.\r\n * ex. 'Installation is in progress: {{percent}}%.'\r\n */\r\n progressMessage?: string;\r\n\r\n /**\r\n * The localized notification title for successful actions\r\n * Should be in the form \"Successfully executed some action\"\r\n * ex) \"Successfully stopped service\", \"Successfully installed role\", \"Successfully created new virtual machine\"\r\n */\r\n successTitle?: string;\r\n\r\n /**\r\n * The success message. (localized)\r\n * A message can have insertion field with '{{<propertyName> or objectName}}' from the last PowerShell 'results' object.\r\n * ex. 'Successfully installed {{productName}}.'\r\n */\r\n successMessage?: string;\r\n\r\n /**\r\n * The success link to navigate to the object view. (optional)\r\n * At default, it brings to the home page of the module.\r\n * This link is relative to the node/tool path unless linkType is specified.\r\n */\r\n successLink?: string;\r\n\r\n /**\r\n * The type of success link. Default behavior is RelativeToTool\r\n */\r\n successLinkType?: NotificationLinkType;\r\n\r\n /**\r\n * The text to show up on the success link text ex: \"Go to <successLinkText> on sme-xyz.domain.com\"\r\n * By default the text will be the auto detected source name like \"Files\"\r\n */\r\n successLinkText?: string;\r\n\r\n /**\r\n * The localized notification title for failed actions\r\n * Should be in the form \"Failed to execute some action\"\r\n * ex) \"Failed to stop service\", \"Failed to install role\", \"Failed to create new virtual machine\"\r\n */\r\n errorTitle?: string;\r\n\r\n /**\r\n * if true, an error will not be generated from the work item so custom error handling can be used.\r\n * If the work item is recovered from the gateway, the work item will fall back\r\n * to generating a notification with the configured errorMessage\r\n */\r\n disableErrorNotification?: boolean;\r\n\r\n /**\r\n * if true, no notification will be shown to the user.\r\n * If the work item is recovered from the gateway, the work item will fall back\r\n * to generating notifications with the configured messages.\r\n */\r\n disableAllNotifications?: boolean;\r\n\r\n /**\r\n * The error message. (localized/optional)\r\n * At default, error message from the result display.\r\n * A message can have insertion field with '{{<propertyName> or objectName}}' from the first PowerShell 'errors' object.\r\n * ex. 'Failed to install {productName}. <original error message>'\r\n */\r\n errorMessage?: string;\r\n\r\n /**\r\n * The error link to navigate to original view. (optional)\r\n * At default, it brings to the home page of the module.\r\n * This link is relative to the node/tool path unless linkType is specified.\r\n */\r\n errorLink?: string;\r\n\r\n /**\r\n * The type of error link. Default behavior is RelativeToTool\r\n */\r\n errorLinkType?: NotificationLinkType;\r\n\r\n /**\r\n * The text to show up on the error link text ex: \"Go to <errorLinkText> on sme-xyz.domain.com\"\r\n * By default the text will be the auto detected source name like \"Files\"\r\n */\r\n errorLinkText?: string;\r\n}\r\n\r\n/**\r\n * The work item request submit by a module.\r\n */\r\nexport interface WorkItemSubmitRequest extends WorkItemMetaDataCore {\r\n /**\r\n * The script code of PowerShell to execute on the node.\r\n * (Either powerShellScript or powerShellCommand. If both specified powerShellCommand will be used.)\r\n */\r\n powerShellScript?: string;\r\n\r\n /**\r\n * The PowerShell command object.\r\n * (Either powerShellScript or powerShellCommand. If both specified powerShellCommand will be used.)\r\n */\r\n powerShellCommand?: PowerShellCommand;\r\n\r\n /**\r\n * The work item id.\r\n * It's not from powershell scripts.\r\n * It's generated by a gateway api for long running c# task. The api returns 202 with workitem id.\r\n */\r\n id?: string;\r\n\r\n /**\r\n * The node request options\r\n */\r\n nodeRequestOptions?: NodeRequestOptions;\r\n}\r\n\r\n/**\r\n * The work item request for rpc data payload.\r\n */\r\nexport interface WorkItemRequest extends WorkItemSubmitRequest {\r\n /**\r\n * The request type.\r\n */\r\n type?: WorkItemRequestType;\r\n\r\n /**\r\n * The parent URI window.location.pathname.\r\n */\r\n locationPathname?: string;\r\n\r\n /**\r\n * The parent URI window.location.search\r\n */\r\n locationSearch?: string;\r\n\r\n /**\r\n * The sequence Id.\r\n */\r\n sequenceId?: number;\r\n}\r\n\r\n/**\r\n * The work item meta date to store on the gateway.\r\n * - sourceName and timestamp are auto populated when submits.\r\n */\r\nexport interface WorkItemMetaData extends WorkItemMetaDataCore, WorkItemBaseData {\r\n}\r\n\r\n/**\r\n * Find work item.\r\n */\r\nexport interface WorkItemFind {\r\n /**\r\n * name of node.\r\n */\r\n nodeName: string;\r\n\r\n /**\r\n * name of module.\r\n */\r\n moduleName: string;\r\n\r\n /**\r\n * id of notification type.\r\n */\r\n typeId: string;\r\n}\r\n\r\n/**\r\n * Find work item results.\r\n */\r\nexport interface WorkItemFindResult extends WorkItemFind {\r\n /**\r\n * result of work items if exist.\r\n */\r\n results: WorkItemResult[];\r\n}\r\n\r\n/**\r\n * The recovered work item data.\r\n *\r\n * ex)\r\n * {\r\n * \"id\": \"5972d0bc-a40a-439e-aab6-9785b407aa52\",\r\n * \"connection\": \"mycomputer\",\r\n * \"userId\": \"mydomain\\\\myname\",\r\n * \"appAuthorization\": \"\",\r\n * \"useHostIdentity\": true,\r\n * \"jobType\": \"PowerShellApi.GetOutput\",\r\n * \"startedTime\": \"2017-03-16T23:27:34.8001912Z\",\r\n * \"completedTime\": \"2017-03-16T23:27:38.5724403Z\",\r\n * \"failed\": true,\r\n * \"errorMessage\": \"Unhandled exception (AggregateException): One or more errors occurred.\",\r\n * \"completed\": true,\r\n * \"metadata\": {\r\n * }\r\n * }\r\n */\r\nexport interface RecoveredWorkItem {\r\n appAuthorization: string;\r\n completed: boolean;\r\n completedTime: string;\r\n connection: string;\r\n errorMessage: string;\r\n failed: boolean;\r\n id: string;\r\n jobType: string;\r\n metadata: RpcWorkItem;\r\n startedTime: string;\r\n useHostIdentity: boolean;\r\n userId: string;\r\n}\r\n"]}