@microsoft/windows-admin-center-sdk 6.0.0 → 6.1.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/3rdPartyDisclosure.html +10 -13
- package/README.md +110 -33
- package/angular/fesm2022/msft-sme-angular.mjs +1235 -1213
- package/angular/fesm2022/msft-sme-angular.mjs.map +1 -1
- package/angular/index.d.ts +29 -14
- package/angular/package.json +1 -1
- package/core/azure/azure-manager.d.ts +15 -3
- package/core/azure/azure-manager.d.ts.map +1 -1
- package/core/azure/azure-manager.js +29 -10
- package/core/azure/azure-manager.js.map +1 -1
- package/core/azure/models/aadAppConfig-data.d.ts +16 -0
- package/core/azure/models/aadAppConfig-data.d.ts.map +1 -1
- package/core/azure/models/aadAppConfig-data.js.map +1 -1
- package/core/base/environment.d.ts +1 -1
- package/core/base/environment.d.ts.map +1 -1
- package/core/base/environment.js.map +1 -1
- package/core/base/utilities.d.ts +10 -2
- package/core/base/utilities.d.ts.map +1 -1
- package/core/base/utilities.js +45 -25
- package/core/base/utilities.js.map +1 -1
- package/core/data/gateway-connection.d.ts.map +1 -1
- package/core/data/gateway-connection.js +1 -0
- package/core/data/gateway-connection.js.map +1 -1
- package/core/diagnostics/sme-web-telemetry.d.ts +17 -1
- package/core/diagnostics/sme-web-telemetry.d.ts.map +1 -1
- package/core/diagnostics/sme-web-telemetry.js +16 -0
- package/core/diagnostics/sme-web-telemetry.js.map +1 -1
- package/core/enterprise/enterprise-models.d.ts +10 -4
- package/core/enterprise/enterprise-models.d.ts.map +1 -1
- package/core/enterprise/enterprise-models.js +9 -4
- package/core/enterprise/enterprise-models.js.map +1 -1
- package/core/index.d.ts +5 -3
- package/core/index.d.ts.map +1 -1
- package/core/index.js +2 -1
- package/core/index.js.map +1 -1
- package/core/manifest/environment-modules.d.ts +2 -2
- package/core/manifest/environment-modules.d.ts.map +1 -1
- package/core/manifest/environment-modules.js.map +1 -1
- package/core/manifest/gateway-url-validator.d.ts +17 -0
- package/core/manifest/gateway-url-validator.d.ts.map +1 -0
- package/core/manifest/gateway-url-validator.js +56 -0
- package/core/manifest/gateway-url-validator.js.map +1 -0
- package/core/manifest/manifest-loader.d.ts +47 -11
- package/core/manifest/manifest-loader.d.ts.map +1 -1
- package/core/manifest/manifest-loader.js +141 -72
- package/core/manifest/manifest-loader.js.map +1 -1
- package/core/manifest/module-schema.json +1 -1
- package/core/performance/performance-tracker.d.ts +2 -0
- package/core/performance/performance-tracker.d.ts.map +1 -1
- package/core/performance/performance-tracker.js +18 -0
- package/core/performance/performance-tracker.js.map +1 -1
- package/core/rpc/azure/rpc-azure-model.d.ts +19 -1
- package/core/rpc/azure/rpc-azure-model.d.ts.map +1 -1
- package/core/rpc/azure/rpc-azure-model.js.map +1 -1
- package/core/rpc/forward/rpc-forward-auto-client.d.ts +5 -0
- package/core/rpc/forward/rpc-forward-auto-client.d.ts.map +1 -1
- package/core/rpc/forward/rpc-forward-auto-client.js +13 -0
- package/core/rpc/forward/rpc-forward-auto-client.js.map +1 -1
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-client.d.ts +16 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-client.d.ts.map +1 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-client.js +18 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-client.js.map +1 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-handler.d.ts +8 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-handler.d.ts.map +1 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-handler.js +2 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-handler.js.map +1 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-model.d.ts +18 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-model.d.ts.map +1 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-model.js +8 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-model.js.map +1 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-subject-server.d.ts +27 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-subject-server.d.ts.map +1 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-subject-server.js +23 -0
- package/core/rpc/resource-data-changed/rpc-resource-data-changed-subject-server.js.map +1 -0
- package/core/rpc/rpc-forwarder.d.ts +16 -2
- package/core/rpc/rpc-forwarder.d.ts.map +1 -1
- package/core/rpc/rpc-forwarder.js +50 -6
- package/core/rpc/rpc-forwarder.js.map +1 -1
- package/core/security/authorization-manager.d.ts +126 -4
- package/core/security/authorization-manager.d.ts.map +1 -1
- package/core/security/authorization-manager.js +381 -49
- package/core/security/authorization-manager.js.map +1 -1
- package/core/security/connection-manager.d.ts +2 -1
- package/core/security/connection-manager.d.ts.map +1 -1
- package/core/security/connection-manager.js +10 -6
- package/core/security/connection-manager.js.map +1 -1
- package/core/security/tool-condition-validator.d.ts +8 -3
- package/core/security/tool-condition-validator.d.ts.map +1 -1
- package/core/security/tool-condition-validator.js +43 -28
- package/core/security/tool-condition-validator.js.map +1 -1
- package/core/version.js +1 -1
- package/core/version.js.map +1 -1
- package/core/virtualization/virtualization-client.d.ts +47 -78
- package/core/virtualization/virtualization-client.d.ts.map +1 -1
- package/core/virtualization/virtualization-client.js +57 -77
- package/core/virtualization/virtualization-client.js.map +1 -1
- package/core/virtualization/virtualization-models.d.ts +9 -8
- package/core/virtualization/virtualization-models.d.ts.map +1 -1
- package/core/virtualization/virtualization-models.js +7 -5
- package/core/virtualization/virtualization-models.js.map +1 -1
- package/core/virtualization/virtualization-unavailable-error.d.ts +1 -1
- package/core/virtualization/virtualization-unavailable-error.js +1 -1
- package/core/virtualization/virtualization-unavailable-error.js.map +1 -1
- package/package.json +12 -17
- package/{react-sdk-core → react}/hooks/useAppContextInit.d.ts +2 -0
- package/react/hooks/useAppContextInit.d.ts.map +1 -0
- package/{react-sdk-core → react}/hooks/useAppContextInit.js +18 -2
- package/{react-sdk-core → react}/index.js +1 -1
- package/react/services/BaseNavigationService.d.ts.map +1 -0
- package/{react-sdk-core → react}/services/BaseNavigationService.js +4 -0
- package/{react-sdk-core → react}/version.d.ts.map +1 -1
- package/react/version.js +3 -0
- package/{react-sdk-core → react}/vite/smeCoreStringsPlugin.d.ts +1 -1
- package/{react-sdk-core → react}/vite/smeCoreStringsPlugin.js +1 -1
- package/{react-sdk-core → react}/vite/smeManifestResourcesPlugin.d.ts +1 -1
- package/{react-sdk-core → react}/vite/smeManifestResourcesPlugin.js +1 -1
- package/{react-sdk-core → react}/vite/smePowerShellPlugin.d.ts +1 -1
- package/{react-sdk-core → react}/vite/smePowerShellPlugin.js +1 -1
- package/styles/css/main-v2.css +1 -1
- package/styles/package.json +1 -1
- package/wac-cli/dist/angular20/configs/ci-build-yml-config.js +3 -2
- package/wac-cli/dist/angular20/configs/ci-build-yml-config.js.map +1 -1
- package/wac-cli/dist/angular20/upgrader/nvmrc-engines-upgrader.js +2 -2
- package/wac-cli/dist/create-react/main.js +3 -2
- package/wac-cli/dist/create-react/main.js.map +1 -1
- package/wac-cli/module-template/build/pipelines/ci-build.yml +2 -2
- package/wac-cli/module-template/build/pipelines/pull-request.yml +2 -2
- package/wac-cli/templates/internal/main.ts +2 -2
- package/wac-cli/templates/internal/package.json +26 -14
- package/wac-cli/templates/react-template/package.json +3 -2
- package/wac-cli/templates/react-template/src/App.tsx +1 -1
- package/wac-cli/templates/react-template/src/hooks/useServicesData.ts +1 -1
- package/wac-cli/templates/react-template/vite.config.ts +1 -1
- package/wac-cli/templates/wac-template/angular.json +8 -13
- package/wac-cli/templates/wac-template/package.json +26 -14
- package/wac-cli/templates/wac-template/src/main.ts +2 -2
- package/react-sdk-core/hooks/useAppContextInit.d.ts.map +0 -1
- package/react-sdk-core/services/BaseNavigationService.d.ts.map +0 -1
- package/react-sdk-core/version.js +0 -3
- /package/{react-sdk-core → react}/components/SplashScreen.d.ts +0 -0
- /package/{react-sdk-core → react}/components/SplashScreen.d.ts.map +0 -0
- /package/{react-sdk-core → react}/components/SplashScreen.js +0 -0
- /package/{react-sdk-core → react}/context/AppContextProvider.d.ts +0 -0
- /package/{react-sdk-core → react}/context/AppContextProvider.d.ts.map +0 -0
- /package/{react-sdk-core → react}/context/AppContextProvider.js +0 -0
- /package/{react-sdk-core → react}/hooks/useAppContext.d.ts +0 -0
- /package/{react-sdk-core → react}/hooks/useAppContext.d.ts.map +0 -0
- /package/{react-sdk-core → react}/hooks/useAppContext.js +0 -0
- /package/{react-sdk-core → react}/hooks/useSkeletonStyles.d.ts +0 -0
- /package/{react-sdk-core → react}/hooks/useSkeletonStyles.d.ts.map +0 -0
- /package/{react-sdk-core → react}/hooks/useSkeletonStyles.js +0 -0
- /package/{react-sdk-core → react}/hooks/useWacTheme.d.ts +0 -0
- /package/{react-sdk-core → react}/hooks/useWacTheme.d.ts.map +0 -0
- /package/{react-sdk-core → react}/hooks/useWacTheme.js +0 -0
- /package/{react-sdk-core → react}/index.d.ts +0 -0
- /package/{react-sdk-core → react}/index.d.ts.map +0 -0
- /package/{react-sdk-core → react}/services/AppContextService.d.ts +0 -0
- /package/{react-sdk-core → react}/services/AppContextService.d.ts.map +0 -0
- /package/{react-sdk-core → react}/services/AppContextService.js +0 -0
- /package/{react-sdk-core → react}/services/BaseNavigationService.d.ts +0 -0
- /package/{react-sdk-core → react}/services/NavigationService.d.ts +0 -0
- /package/{react-sdk-core → react}/services/NavigationService.d.ts.map +0 -0
- /package/{react-sdk-core → react}/services/NavigationService.js +0 -0
- /package/{react-sdk-core → react}/services/Polyfills.d.ts +0 -0
- /package/{react-sdk-core → react}/services/Polyfills.d.ts.map +0 -0
- /package/{react-sdk-core → react}/services/Polyfills.js +0 -0
- /package/{react-sdk-core → react}/version.d.ts +0 -0
- /package/{react-sdk-core → react}/vite/index.d.ts +0 -0
- /package/{react-sdk-core → react}/vite/index.d.ts.map +0 -0
- /package/{react-sdk-core → react}/vite/index.js +0 -0
- /package/{react-sdk-core → react}/vite/log.d.ts +0 -0
- /package/{react-sdk-core → react}/vite/log.d.ts.map +0 -0
- /package/{react-sdk-core → react}/vite/log.js +0 -0
- /package/{react-sdk-core → react}/vite/smeCoreStringsPlugin.d.ts.map +0 -0
- /package/{react-sdk-core → react}/vite/smeManifestResourcesPlugin.d.ts.map +0 -0
- /package/{react-sdk-core → react}/vite/smePowerShellPlugin.d.ts.map +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-manager.js","sourceRoot":"","sources":["../../src/security/connection-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAwB,eAAe,EAA8B,MAAM,0BAA0B,CAAC;AAE7G,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAc,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAOvF,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC5B,6EAAe,CAAA;IACf,yEAAa,CAAA;IACb,iEAAS,CAAA;IACT,qEAAW,CAAA;AACf,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B;AA6BD,MAAM,OAAO,iBAAkB,SAAQ,mBAAmB;IAqD1C;IApDJ,MAAM,CAAC,4BAA4B,GAAG,kBAAkB,CAAC;IACzD,MAAM,CAAC,uBAAuB,GAAG,aAAa,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AC,IAAI,CACtB,GAAG,CAAC,gBAAgB,CAAC,EAAE;YACnB,OAAO,gBAAgB,CAAC,QAAQ,CAAC;QACrC,CAAC,CAAC,EACF,IAAI,CAAC,CAAC,CAAC,EACP,UAAU,CAAC,KAAK,CAAC,EAAE;YACf,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,EAAW,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,aAAa,CAAC;YAC3G,OAAO,CAAC,QAAQ,CAAC,yCAAyC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9G,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC,CAAC,EACF,GAAG,CAAC,CAAC,QAA8B,EAAE,EAAE;YACnC,6FAA6F;YAC7F,QAAQ,GAAG,eAAe,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YAE7D,wCAAwC;YACxC,OAAO,IAAI,kBAAkB,CAAC,QAAQ,EAAE;gBACpC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC;aACjE,CAAC,CAAC;QACP,CAAC,CAAC,CACL,CAAC;IACN,CAAC;IAED;;;;OAIG;IACK,qBAAqB,CAAC,QAA8B,EAAE,UAAsB;QAChF,iDAAiD;QACjD,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC","sourcesContent":["import { concat, Observable, of, ReplaySubject, Subject, throwError } from 'rxjs';\r\nimport { catchError, map, mergeMap, take, tap } from 'rxjs/operators';\r\nimport { PlainVersionedObject, VersionedObject, VersionedObjectConstructor } from '../base/versioned-object';\r\nimport { GatewayConnection } from '../data/gateway-connection';\r\nimport { Net } from '../data/net';\r\nimport { LogLevel } from '../diagnostics/log-level';\r\nimport { Logging } from '../diagnostics/logging';\r\nimport { Strings } from '../generated/strings';\r\nimport { RpcForwardResponse } from '../rpc/forward/rpc-forward-model';\r\nimport { Rpc } from '../rpc/rpc';\r\nimport { RpcRelationshipType } from '../rpc/rpc-base';\r\nimport { RpcServiceForwarder } from '../rpc/rpc-forwarder';\r\nimport { Connection, connectionTypeConstants, ConnectionUtility } from './connection';\r\nimport { CommonConnectionSettings } from './connection-manager-settings/common-connection-settings';\r\nimport { ConnectionSettings } from './connection-manager-settings/connection-settings';\r\n\r\nexport interface ConnectionManagerInitProperties {\r\n connections: Connection[];\r\n activeConnection: Connection;\r\n}\r\n\r\nexport enum ConnectionChangeType {\r\n Initialized = 0,\r\n Activated = 1,\r\n Added = 2,\r\n Removed = 3\r\n}\r\n\r\nexport interface ConnectionsChangedEvent {\r\n type: ConnectionChangeType;\r\n}\r\nexport interface ConnectionChangedEvent extends ConnectionsChangedEvent {\r\n connection: Connection;\r\n}\r\n\r\nexport interface ConnectionsInitializedEvent extends ConnectionsChangedEvent {\r\n connections: Connection[];\r\n}\r\n\r\n/**\r\n * Node aliases visit list.\r\n * This is created when retry connection to aliases while connection.name not reacheable;\r\n * and is deleted when find the reacheable alias or end of the list\r\n */\r\nexport interface AliasesVisitList {\r\n /**\r\n * current visit index\r\n */\r\n currentIndex: number;\r\n /**\r\n * aliases list\r\n */\r\n aliases: string[];\r\n}\r\n\r\nexport class ConnectionManager extends RpcServiceForwarder implements ConnectionManagerInitProperties {\r\n private static activeConnectionPropertyName = 'activeConnection';\r\n private static connectionsPropertyName = 'connections';\r\n private static saveConnectionMethodName = 'saveConnection';\r\n private static saveConnectionsMethodName = 'saveConnections';\r\n private static removeConnectionMethodName = 'removeConnection';\r\n\r\n private static gatewayConnectionApi = 'connections';\r\n\r\n private allConnections: Connection[] = [];\r\n private activeConnectionIndex = -1;\r\n\r\n /**\r\n * The map of active nodes aliases list, this will be build on demand and clear up whenever any connection aliases changed\r\n * key: nodeName, this is unique, that means same nodeName with different connection type treat as one entry\r\n * value: A aliases list for this nodeName (say cluster name),\r\n * this may contains child aliases (say IP address) of any alias (say server node).\r\n */\r\n private connectionAliasesMap: MsftSme.StringMap<string[]> = {};\r\n\r\n /**\r\n * nodeAliasesVisit map, the key is connection nodeName\r\n */\r\n private nodeAliasesVisitMap: MsftSme.StringMap<AliasesVisitList> = {};\r\n\r\n /**\r\n * Subject that Fires once and remembers when connections have been initialized\r\n */\r\n public connectionsInitialized = new ReplaySubject<Connection[]>(1);\r\n\r\n /**\r\n * Event subject that signals that the connection(s) have changed.\r\n * Filter on changeType to determine what type of change has occurred\r\n */\r\n public connectionsChanged = new Subject<ConnectionsChangedEvent>();\r\n\r\n /**\r\n * Indicates that restoring connections has started and shouldnt call the gateway again\r\n */\r\n private restoreInProgress = false;\r\n\r\n /**\r\n * Indicates that restoring connections has started and shouldnt call the gateway again\r\n */\r\n private restoreCompleted = false;\r\n\r\n /**\r\n * The connection settings subject for caching the connection's settings while active.\r\n */\r\n private connectionSettings = new ReplaySubject<ConnectionSettings>(1);\r\n\r\n constructor(\r\n rpc: Rpc,\r\n private gatewayConnection: GatewayConnection\r\n ) {\r\n super('connection-manager', rpc);\r\n }\r\n\r\n public restoreConnections(refresh = false): Observable<Connection[]> {\r\n if (!this.canForward(RpcRelationshipType.Parent) && (refresh || (!this.restoreCompleted && !this.restoreInProgress))) {\r\n this.restoreInProgress = true;\r\n this.gatewayConnection\r\n .get(ConnectionManager.gatewayConnectionApi)\r\n .pipe(\r\n map(data => {\r\n if (data.value) {\r\n (Array.isArray(data.value) ? data.value : [data.value]).forEach(connection => {\r\n // for some reason the node api returns properties in a nested format. Unpack it into the correct format\r\n if (connection.properties) {\r\n connection = connection.properties;\r\n }\r\n\r\n // ensure bare minimum properties exist, ignore otherwise\r\n if (connection && connection.name && connection.type && connection.id) {\r\n this.addOrUpdateConnection(connection, false);\r\n return;\r\n }\r\n });\r\n }\r\n\r\n return this.allConnections;\r\n }),\r\n catchError(error => {\r\n this.restoreInProgress = false;\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.ServerListRetrieve.message;\r\n Logging.log({\r\n source: 'ConnectionManager',\r\n level: LogLevel.Error,\r\n message: message.format(Net.getErrorMessage(error))\r\n });\r\n this.connectionsInitialized.error(error);\r\n return of(this.allConnections);\r\n })\r\n )\r\n .subscribe(() => {\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n\r\n this.connectionsChanged.next(<ConnectionsInitializedEvent>{\r\n type: ConnectionChangeType.Initialized,\r\n connections: this.allConnections\r\n });\r\n\r\n this.connectionsInitialized.next(this.allConnections);\r\n this.restoreInProgress = false;\r\n this.restoreCompleted = true;\r\n });\r\n }\r\n\r\n return this.connectionsInitialized;\r\n }\r\n\r\n /**\r\n * Gets all connections\r\n */\r\n public get connections(): Connection[] {\r\n return this.allConnections;\r\n }\r\n\r\n /**\r\n * Gets active connection.\r\n */\r\n public get activeConnection(): Connection {\r\n return this.allConnections[this.activeConnectionIndex];\r\n }\r\n\r\n /**\r\n * Sets active connection.\r\n */\r\n public set activeConnection(connection: Connection) {\r\n // only change active connection if it has really changed\r\n if (!ConnectionUtility.areEqual(this.activeConnection, connection)) {\r\n if (!connection) {\r\n this.activeConnectionIndex = -1;\r\n } else {\r\n this.activeConnectionIndex = this.addOrUpdateConnection(connection, false);\r\n }\r\n\r\n this.connectionsChanged.next(<ConnectionChangedEvent>{ type: ConnectionChangeType.Activated, connection: connection });\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.activeConnectionPropertyName, this.activeConnection);\r\n this.forwardNotify(RpcRelationshipType.Parent, ConnectionManager.activeConnectionPropertyName, this.activeConnection);\r\n // collect connection settings for new active connection\r\n this.getConnectionSettings()\r\n .pipe(take(1))\r\n .subscribe(settings => this.connectionSettings.next(settings));\r\n }\r\n }\r\n\r\n /**\r\n * Add or update connection.\r\n */\r\n public addOrUpdateConnection(connection: Connection, save: boolean = true, merge = false): number {\r\n connection.id = ConnectionUtility.createConnectionId(connection.type, connection.name, connection.groupId);\r\n ConnectionUtility.forceLowercase(connection);\r\n let index = this.allConnections.findIndex(c => ConnectionUtility.areEqual(c, connection));\r\n if (index >= 0) {\r\n if (merge) {\r\n const oldConnection = this.allConnections[index];\r\n if (oldConnection.tags) {\r\n connection.tags = oldConnection.tags.concat(connection.tags || []).unique();\r\n }\r\n if (oldConnection.properties) {\r\n connection.properties = { ...oldConnection.properties, ...(connection.properties || {}) };\r\n }\r\n }\r\n\r\n this.allConnections[index] = connection;\r\n this.connectionsChanged.next(<ConnectionChangedEvent>{ type: ConnectionChangeType.Added, connection: connection });\r\n } else {\r\n this.allConnections.push(connection);\r\n this.connectionsChanged.next(<ConnectionChangedEvent>{ type: ConnectionChangeType.Added, connection: connection });\r\n if (!this.restoreInProgress) {\r\n this.connectionsInitialized.next(this.allConnections);\r\n }\r\n index = this.allConnections.length - 1;\r\n // notify parent and child of collection changed.\r\n this.forwardNotify(RpcRelationshipType.Parent, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n }\r\n\r\n if (save) {\r\n this.saveConnection(connection).subscribe();\r\n }\r\n\r\n return index;\r\n }\r\n\r\n /**\r\n * Remove connection.\r\n */\r\n public removeConnection(connection: Connection): Observable<any> {\r\n const forward = this.forwardExecute(RpcRelationshipType.Parent, ConnectionManager.removeConnectionMethodName, [connection]);\r\n if (forward) {\r\n return <Observable<any>>forward;\r\n }\r\n\r\n const urlEncodedID = encodeURIComponent(connection.id);\r\n return this.gatewayConnection.delete(`${ConnectionManager.gatewayConnectionApi}/${urlEncodedID}`).pipe(\r\n map(response => {\r\n const index = this.allConnections.findIndex(c => ConnectionUtility.areEqual(c, connection));\r\n if (index >= 0) {\r\n // if this connection is active, set active connection to null\r\n if (this.activeConnectionIndex === index) {\r\n this.activeConnection = null;\r\n }\r\n\r\n // remove the connection from all connections\r\n this.allConnections.splice(index, 1);\r\n }\r\n this.connectionsChanged.next(<ConnectionChangedEvent>{ type: ConnectionChangeType.Removed, connection: connection });\r\n if (!this.restoreInProgress) {\r\n this.connectionsInitialized.next(this.allConnections);\r\n }\r\n\r\n // notify our children that connections have changed\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n\r\n return response;\r\n })\r\n );\r\n }\r\n\r\n public updateConnectionsLastCheckedTime(connections: Connection[]): Observable<any> {\r\n const now = Date.now();\r\n const observables = [];\r\n if (connections && connections.length > 0) {\r\n connections.forEach(connection => {\r\n if (\r\n connection.properties == null ||\r\n connection.properties.lastUpdatedTime == null ||\r\n MsftSme.round(connection.properties.lastUpdatedTime / 1000) + 2 < MsftSme.round(now / 1000)\r\n ) {\r\n // update if there is more than 2 second difference.\r\n connection.properties = connection.properties || {};\r\n connection.properties.lastUpdatedTime = now;\r\n observables.push(this.saveConnection(connection));\r\n }\r\n\r\n observables.push(of(null));\r\n });\r\n } else {\r\n observables.push(of(null));\r\n }\r\n\r\n return concat(...observables);\r\n }\r\n\r\n public saveConnection(connection: Connection): Observable<any> {\r\n ConnectionUtility.forceLowercase(connection);\r\n const forward = this.forwardExecute(RpcRelationshipType.Parent, ConnectionManager.saveConnectionMethodName, [connection]);\r\n if (forward) {\r\n return <Observable<any>>forward;\r\n }\r\n\r\n if (!connection.type || !connection.name) {\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.ServerListFailedSave.message;\r\n return throwError(() => new Error(message));\r\n }\r\n\r\n connection.id = ConnectionUtility.createConnectionId(connection.type, connection.name, connection.groupId);\r\n\r\n // define properties if it doesn't exist on the connection\r\n if (MsftSme.isNullOrUndefined(connection.properties)) {\r\n connection.properties = {};\r\n }\r\n this.addOrUpdateConnection(connection, false);\r\n\r\n const urlEncodedID = encodeURIComponent(connection.id);\r\n return this.gatewayConnection.put(`${ConnectionManager.gatewayConnectionApi}/${urlEncodedID}`, JSON.stringify(connection)).pipe(\r\n tap((data: any) => {\r\n if (data.properties && data.properties.displayName) {\r\n // merge the display name from the gateway into the connection properties\r\n connection.properties.displayName = data.properties.displayName;\r\n }\r\n\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Bulk operation for saving multiple connections\r\n * @param connection the connection object.\r\n */\r\n public saveConnections(connections: Connection[]): Observable<any> {\r\n connections.forEach(connection => {\r\n this.addOrUpdateConnection(connection, false);\r\n ConnectionUtility.forceLowercase(connection);\r\n\r\n if (!connection.type || !connection.name) {\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.ServerListFailedSave.message;\r\n return throwError(() => new Error(message));\r\n }\r\n\r\n connection.id = ConnectionUtility.createConnectionId(connection.type, connection.name, connection.groupId);\r\n });\r\n\r\n const forward = this.forwardExecute(RpcRelationshipType.Parent, ConnectionManager.saveConnectionsMethodName, [connections]);\r\n if (forward) {\r\n return <Observable<any>>forward;\r\n }\r\n\r\n return this.gatewayConnection.put(`${ConnectionManager.gatewayConnectionApi}`, JSON.stringify(connections)).pipe(\r\n tap(_ => {\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Finds a connection given a name and type\r\n * @param name the name of the connection to find\r\n * @param type the type of the connection to find, defaults to server type\r\n */\r\n public findConnection(name: string, type?: string): Observable<Connection> {\r\n if (!name) {\r\n return of(null);\r\n }\r\n\r\n type = type || connectionTypeConstants.server;\r\n\r\n if (this.activeConnection && this.activeConnection.name === name && this.activeConnection.type === type) {\r\n return of(this.activeConnection);\r\n }\r\n\r\n return this.connectionsInitialized.pipe(\r\n map(_ => {\r\n return this.connections.find(c => c.name === name && c.type === type);\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Called on a child service instance when onForwardInit returns from the parent\r\n * @param data The response from the forwardInit call\r\n */\r\n protected onForwardInitResponse(data: RpcForwardResponse<ConnectionManagerInitProperties>): void {\r\n if (data.error) {\r\n // if there is an error, we cannot continue, so throw its\r\n throw data.error;\r\n }\r\n\r\n this.allConnections = data.result.connections;\r\n this.activeConnection = data.result.activeConnection;\r\n this.connectionsChanged.next(<ConnectionsInitializedEvent>{\r\n type: ConnectionChangeType.Initialized,\r\n connections: this.allConnections\r\n });\r\n this.connectionsInitialized.next(this.allConnections);\r\n }\r\n\r\n /**\r\n * Called when a new instance of the service in another window is initialized and needs to synchronize with its parent\r\n * @param from The RpcRelationshipType that this request is from\r\n * @returns an observable for the all the values needed to initialize the service\r\n */\r\n protected onForwardInit(): Observable<ConnectionManagerInitProperties> {\r\n return of({\r\n connections: this.connections,\r\n activeConnection: this.activeConnection\r\n });\r\n }\r\n\r\n /**\r\n * Called when the forwarded services counterpart wants to get data from the parent\r\n * @param from The RpcRelationshipType that this request is from\r\n * @param name The name of the method to forward to\r\n * @param args The arguments of the method\r\n * @returns an observable for the result of the method call\r\n */\r\n protected onForwardExecute(from: RpcRelationshipType, name: string, args: any[]): Observable<any> {\r\n if (from === RpcRelationshipType.Child && args && args.length >= 1) {\r\n if (name === ConnectionManager.saveConnectionMethodName) {\r\n // we dont actually have anything to return here.\r\n return this.saveConnection(args[0]).pipe(map(() => null));\r\n }\r\n if (name === ConnectionManager.saveConnectionsMethodName) {\r\n return this.saveConnections(args[0]);\r\n }\r\n if (name === ConnectionManager.removeConnectionMethodName) {\r\n // we dont actually have anything to return here.\r\n return this.removeConnection(args[0]).pipe(map(() => null));\r\n }\r\n }\r\n // ConnectionManager does not allow any method calls at this time\r\n return this.nameNotFound(name);\r\n }\r\n\r\n /**\r\n * Called when the forwarded services counterpart sends a notify message\r\n * @param from The RpcRelationshipType that this request is from\r\n * @param name The name of the property to change\r\n * @param value The new value of the property\r\n * @returns an observable that completes when the property has been changed.\r\n */\r\n protected onForwardNotify(from: RpcRelationshipType, name: string, value: any): Observable<void> {\r\n if (name === ConnectionManager.connectionsPropertyName) {\r\n this.allConnections = value;\r\n this.connectionsChanged.next(<ConnectionsInitializedEvent>{\r\n type: ConnectionChangeType.Initialized,\r\n connections: this.allConnections\r\n });\r\n this.connectionsInitialized.next(this.allConnections);\r\n return of(null);\r\n }\r\n if (name === ConnectionManager.activeConnectionPropertyName) {\r\n this.activeConnection = value;\r\n return of(null);\r\n }\r\n return this.nameNotFound(name);\r\n }\r\n\r\n /**\r\n * Get aliases data and save the change with connection\r\n * @param aliases the alias list.\r\n * @param connection the connection object.\r\n * @param nodeName the node name.\r\n */\r\n public saveAliasesData(aliases: string[], connection: Connection, nodeName: string) {\r\n let save = false;\r\n // save the connection if aliase info changed\r\n if (!this.isArraySame(aliases, connection.aliases)) {\r\n connection.aliases = aliases;\r\n // remove the activeAlias if it's not in aliases any more\r\n if (connection.aliases.indexOf(connection.activeAlias) === -1) {\r\n connection.activeAlias = null;\r\n }\r\n save = true;\r\n }\r\n // if current nodeName is not connection name save it as activeAlias\r\n if (connection.name !== nodeName && connection.activeAlias !== nodeName) {\r\n connection.activeAlias = nodeName;\r\n save = true;\r\n } else {\r\n // current nodeName is connection name, remove connection activeAlias\r\n if (connection.name === nodeName && !!connection.activeAlias) {\r\n connection.activeAlias = null;\r\n save = true;\r\n }\r\n }\r\n\r\n if (save) {\r\n this.saveConnection(connection);\r\n }\r\n\r\n // delete visit map entry when succeed\r\n this.deleteAliasesVisitList(connection.name);\r\n }\r\n\r\n /**\r\n * Get active alias from nodeAliasesVisit map with given nodeName\r\n * return the node in aliases list in order,\r\n * return null if no alias or end of list\r\n * @param nodeName key in nodeAliasesVisitMap\r\n */\r\n public getActiveAlias(nodeName: string): string {\r\n // aliases visit list already exists\r\n if (nodeName in this.nodeAliasesVisitMap) {\r\n const vlist = this.nodeAliasesVisitMap[nodeName];\r\n // move currentIndex to next\r\n if (++vlist.currentIndex < vlist.aliases.length) {\r\n return vlist.aliases[vlist.currentIndex];\r\n } else {\r\n // end of the list\r\n this.deleteAliasesVisitList(nodeName);\r\n return null;\r\n }\r\n } else {\r\n // no aliases list yet (first time or none)\r\n const aliases = this.getNodeAliasesList(nodeName);\r\n if (aliases) {\r\n // create aliases visit list for the first time\r\n const vlist: AliasesVisitList = {\r\n currentIndex: 0,\r\n aliases: aliases\r\n };\r\n this.nodeAliasesVisitMap[nodeName] = vlist;\r\n // return first item, aliases[vlist.currentIndex]\r\n return aliases[0];\r\n } else {\r\n // no aliases, return null\r\n return null;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Delete aliasesVistList entry with given nodeName from nodeAliasesVisitMap\r\n * @param nodeName the node name.\r\n */\r\n private deleteAliasesVisitList(nodeName: string): void {\r\n if (nodeName in this.nodeAliasesVisitMap) {\r\n delete this.nodeAliasesVisitMap[nodeName];\r\n }\r\n }\r\n\r\n private isArraySame(array1: string[], array2: string[]): boolean {\r\n // both are not null, compare every element\r\n array1 = [].concat(array1);\r\n array2 = [].concat(array2);\r\n if (array1 && array2) {\r\n return (\r\n array1.length === array2.length &&\r\n array1.every(function (element, index) {\r\n return element === array2[index];\r\n })\r\n );\r\n } else {\r\n // both are null\r\n if (!array1 && !array2) {\r\n return true;\r\n } else {\r\n // one of it is null\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get nodeAliasesList from map; if not exists create it\r\n * @param nodeName name of the node, this is unique regardless connection type\r\n */\r\n private getNodeAliasesList(nodeName: string): string[] {\r\n if (nodeName in this.connectionAliasesMap) {\r\n return this.connectionAliasesMap[nodeName];\r\n } else {\r\n return this.buildNodeAliasesList(nodeName);\r\n }\r\n }\r\n\r\n /**\r\n * Build nodeAliasesList entry with given nodeName, then add it into the map,\r\n * return the list of aliases\r\n * @param nodeName name of the node\r\n */\r\n private buildNodeAliasesList(nodeName: string): string[] {\r\n const connection = this.findConnectionWithAliases(nodeName);\r\n if (!connection) {\r\n return null;\r\n }\r\n // assume activeAlias is in aliases[]\r\n let aliases: string[] = [];\r\n if (connection.activeAlias) {\r\n // put activeAlias at the first of the list\r\n aliases.push(connection.activeAlias);\r\n aliases = aliases.concat(connection.aliases.filter(item => item !== connection.activeAlias));\r\n } else {\r\n aliases = connection.aliases;\r\n }\r\n for (let i = 0; i < aliases.length; i++) {\r\n const childList = this.buildNodeAliasesList(aliases[i]);\r\n // insert the childList to list, the list.length will increase\r\n if (childList) {\r\n // remove remaining items after current item\r\n const remainList = aliases.splice(i + 1, aliases.length - i);\r\n aliases = aliases.concat(childList, remainList);\r\n // next iteration move to node in childList\r\n }\r\n }\r\n this.connectionAliasesMap[nodeName] = aliases;\r\n return aliases;\r\n }\r\n\r\n /**\r\n * Finds the first connection with aliases info given a name, assume the connections already initialized\r\n * @param name the name of the connection to find\r\n */\r\n private findConnectionWithAliases(name: string): Connection {\r\n if (!name) {\r\n return null;\r\n }\r\n\r\n if (this.activeConnection && this.activeConnection.name === name && !!this.activeConnection.aliases) {\r\n return this.activeConnection;\r\n }\r\n\r\n return this.connections.find(c => c.name === name && !!c.aliases);\r\n }\r\n\r\n /**\r\n * Gets the common connection settings.\r\n * By default, will use the active connection, but allows input for different connection objects.\r\n * @return Observable of the common connection settings object\r\n */\r\n public getCommonConnectionSettings(connection?: Connection): Observable<CommonConnectionSettings> {\r\n if (connection) {\r\n return this.getConnectionSettings(connection).pipe(\r\n take(1),\r\n map(settings => settings.common),\r\n take(1)\r\n );\r\n } else {\r\n return this.connectionSettings.pipe(\r\n map(settings => settings.common),\r\n take(1)\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Get extension connection settings for the active connection.\r\n * @return Observable of specified type\r\n */\r\n public getExtensionConnectionSettings<T extends VersionedObject>(type: VersionedObjectConstructor<T>): Observable<T> {\r\n const name = MsftSme.self().Environment.name;\r\n return this.connectionSettings.pipe(\r\n map(settings => VersionedObject.ensureIsVersionedObject(settings.extensions[name])),\r\n map(settings => {\r\n return new type(settings, { save: object => this.setExtensionSettings(name, object) });\r\n }),\r\n take(1)\r\n );\r\n }\r\n\r\n /**\r\n * Sets extension settings for the active connection.\r\n * @param extensionName the extension name.\r\n * @param extensionSettings the extension settings.\r\n */\r\n public setExtensionSettings(extensionName: string, extensionSettings: PlainVersionedObject): Observable<void> {\r\n return this.connectionSettings.pipe(\r\n mergeMap(settings =>\r\n settings.trySave(() => {\r\n settings.extensions[extensionName] = extensionSettings;\r\n })\r\n )\r\n );\r\n }\r\n\r\n /**\r\n * Gets the connection settings object\r\n * By default, will use the active connection, but allows input for different connection objects.\r\n * @return Observable of ConnectionSettings\r\n */\r\n private getConnectionSettings(connection = this.activeConnection): Observable<ConnectionSettings> {\r\n return of(connection).pipe(\r\n map(connectionObject => {\r\n return connectionObject.settings;\r\n }),\r\n take(1),\r\n catchError(error => {\r\n const messageFormat = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Errors.UserProfile.Get.formatMessage;\r\n Logging.logError('ConnectionManager.getConnectionSettings', messageFormat.format(Net.getErrorMessage(error)));\r\n return throwError(() => error);\r\n }),\r\n map((settings: PlainVersionedObject) => {\r\n // If the setttings are not versioned (or not defined), then start with empty settings object\r\n settings = VersionedObject.ensureIsVersionedObject(settings);\r\n\r\n // return new connection settings object\r\n return new ConnectionSettings(settings, {\r\n save: object => this.setConnectionSettings(object, connection)\r\n });\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Sets the connection settings from the active connection\r\n * @param settings a PlainVersionedObject\r\n * @return An observable with the result from the set operation\r\n */\r\n private setConnectionSettings(settings: PlainVersionedObject, connection: Connection): Observable<any> {\r\n // return an observable that saves the connection\r\n connection.settings = settings;\r\n return this.saveConnection(connection);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"connection-manager.js","sourceRoot":"","sources":["../../src/security/connection-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE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AM,CAAC,WAAW,CAAC,GAAG,CAAC,aAAa,CAAC;YAC3G,OAAO,CAAC,QAAQ,CAAC,yCAAyC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9G,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC,CAAC,EACF,GAAG,CAAC,CAAC,QAA8B,EAAE,EAAE;YACnC,6FAA6F;YAC7F,QAAQ,GAAG,eAAe,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YAE7D,wCAAwC;YACxC,OAAO,IAAI,kBAAkB,CAAC,QAAQ,EAAE;gBACpC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC;aACjE,CAAC,CAAC;QACP,CAAC,CAAC,CACL,CAAC;IACN,CAAC;IAED;;;;OAIG;IACK,qBAAqB,CAAC,QAA8B,EAAE,UAAsB;QAChF,iDAAiD;QACjD,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC","sourcesContent":["import { concat, Observable, of, ReplaySubject, Subject, throwError } from 'rxjs';\r\nimport { catchError, filter, map, mergeMap, take, tap } from 'rxjs/operators';\r\nimport { PlainVersionedObject, VersionedObject, VersionedObjectConstructor } from '../base/versioned-object';\r\nimport { GatewayConnection } from '../data/gateway-connection';\r\nimport { Net } from '../data/net';\r\nimport { LogLevel } from '../diagnostics/log-level';\r\nimport { Logging } from '../diagnostics/logging';\r\nimport { Strings } from '../generated/strings';\r\nimport { RpcForwardResponse } from '../rpc/forward/rpc-forward-model';\r\nimport { Rpc } from '../rpc/rpc';\r\nimport { RpcRelationshipType } from '../rpc/rpc-base';\r\nimport { RpcServiceForwarder } from '../rpc/rpc-forwarder';\r\nimport { Connection, connectionTypeConstants, ConnectionUtility } from './connection';\r\nimport { CommonConnectionSettings } from './connection-manager-settings/common-connection-settings';\r\nimport { ConnectionSettings } from './connection-manager-settings/connection-settings';\r\n\r\nexport interface ConnectionManagerInitProperties {\r\n connections: Connection[];\r\n activeConnection: Connection;\r\n}\r\n\r\nexport enum ConnectionChangeType {\r\n Initialized = 0,\r\n Activated = 1,\r\n Added = 2,\r\n Removed = 3\r\n}\r\n\r\nexport interface ConnectionsChangedEvent {\r\n type: ConnectionChangeType;\r\n}\r\nexport interface ConnectionChangedEvent extends ConnectionsChangedEvent {\r\n connection: Connection;\r\n}\r\n\r\nexport interface ConnectionsInitializedEvent extends ConnectionsChangedEvent {\r\n connections: Connection[];\r\n}\r\n\r\n/**\r\n * Node aliases visit list.\r\n * This is created when retry connection to aliases while connection.name not reacheable;\r\n * and is deleted when find the reacheable alias or end of the list\r\n */\r\nexport interface AliasesVisitList {\r\n /**\r\n * current visit index\r\n */\r\n currentIndex: number;\r\n /**\r\n * aliases list\r\n */\r\n aliases: string[];\r\n}\r\n\r\nexport class ConnectionManager extends RpcServiceForwarder implements ConnectionManagerInitProperties {\r\n private static activeConnectionPropertyName = 'activeConnection';\r\n private static connectionsPropertyName = 'connections';\r\n private static saveConnectionMethodName = 'saveConnection';\r\n private static saveConnectionsMethodName = 'saveConnections';\r\n private static removeConnectionMethodName = 'removeConnection';\r\n\r\n private static gatewayConnectionApi = 'connections';\r\n\r\n private allConnections: Connection[] = [];\r\n private activeConnectionIndex = -1;\r\n\r\n /**\r\n * The map of active nodes aliases list, this will be build on demand and clear up whenever any connection aliases changed\r\n * key: nodeName, this is unique, that means same nodeName with different connection type treat as one entry\r\n * value: A aliases list for this nodeName (say cluster name),\r\n * this may contains child aliases (say IP address) of any alias (say server node).\r\n */\r\n private connectionAliasesMap: MsftSme.StringMap<string[]> = {};\r\n\r\n /**\r\n * nodeAliasesVisit map, the key is connection nodeName\r\n */\r\n private nodeAliasesVisitMap: MsftSme.StringMap<AliasesVisitList> = {};\r\n\r\n /**\r\n * Subject that Fires once and remembers when connections have been initialized\r\n */\r\n public connectionsInitialized = new ReplaySubject<Connection[]>(1);\r\n\r\n /**\r\n * Event subject that signals that the connection(s) have changed.\r\n * Filter on changeType to determine what type of change has occurred\r\n */\r\n public connectionsChanged = new Subject<ConnectionsChangedEvent>();\r\n\r\n /**\r\n * Indicates that restoring connections has started and shouldnt call the gateway again\r\n */\r\n private restoreInProgress = false;\r\n\r\n /**\r\n * Whether the gateway restore has finished, independently of local connection initialization.\r\n */\r\n private restoreCompleted = false;\r\n\r\n /**\r\n * The connection settings subject for caching the connection's settings while active.\r\n */\r\n private connectionSettings = new ReplaySubject<ConnectionSettings>(1);\r\n\r\n constructor(\r\n rpc: Rpc,\r\n private gatewayConnection: GatewayConnection\r\n ) {\r\n super('connection-manager', rpc);\r\n }\r\n\r\n /** Waits for the gateway restore in the shell, or for forwarded initialization in a child frame. */\r\n public restoreConnections(refresh = false): Observable<Connection[]> {\r\n const hasParent = this.canForward(RpcRelationshipType.Parent);\r\n if (!hasParent && (refresh || (!this.restoreCompleted && !this.restoreInProgress))) {\r\n this.restoreInProgress = true;\r\n this.restoreCompleted = false;\r\n this.gatewayConnection\r\n .get(ConnectionManager.gatewayConnectionApi)\r\n .pipe(\r\n map(data => {\r\n if (data.value) {\r\n (Array.isArray(data.value) ? data.value : [data.value]).forEach(connection => {\r\n // for some reason the node api returns properties in a nested format. Unpack it into the correct format\r\n if (connection.properties) {\r\n connection = connection.properties;\r\n }\r\n\r\n // ensure bare minimum properties exist, ignore otherwise\r\n if (connection && connection.name && connection.type && connection.id) {\r\n this.addOrUpdateConnection(connection, false);\r\n return;\r\n }\r\n });\r\n }\r\n\r\n return this.allConnections;\r\n }),\r\n catchError(error => {\r\n this.restoreInProgress = false;\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.ServerListRetrieve.message;\r\n Logging.log({\r\n source: 'ConnectionManager',\r\n level: LogLevel.Error,\r\n message: message.format(Net.getErrorMessage(error))\r\n });\r\n this.connectionsInitialized.error(error);\r\n return of(this.allConnections);\r\n })\r\n )\r\n .subscribe(() => {\r\n this.restoreInProgress = false;\r\n this.restoreCompleted = true;\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n\r\n this.connectionsChanged.next(<ConnectionsInitializedEvent>{\r\n type: ConnectionChangeType.Initialized,\r\n connections: this.allConnections\r\n });\r\n\r\n this.connectionsInitialized.next(this.allConnections);\r\n });\r\n }\r\n\r\n // Local additions also seed this replay subject; they do not mean the gateway records have loaded.\r\n return hasParent ? this.connectionsInitialized : this.connectionsInitialized.pipe(filter(() => this.restoreCompleted));\r\n }\r\n\r\n /**\r\n * Gets all connections\r\n */\r\n public get connections(): Connection[] {\r\n return this.allConnections;\r\n }\r\n\r\n /**\r\n * Gets active connection.\r\n */\r\n public get activeConnection(): Connection {\r\n return this.allConnections[this.activeConnectionIndex];\r\n }\r\n\r\n /**\r\n * Sets active connection.\r\n */\r\n public set activeConnection(connection: Connection) {\r\n // only change active connection if it has really changed\r\n if (!ConnectionUtility.areEqual(this.activeConnection, connection)) {\r\n if (!connection) {\r\n this.activeConnectionIndex = -1;\r\n } else {\r\n this.activeConnectionIndex = this.addOrUpdateConnection(connection, false);\r\n }\r\n\r\n this.connectionsChanged.next(<ConnectionChangedEvent>{ type: ConnectionChangeType.Activated, connection: connection });\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.activeConnectionPropertyName, this.activeConnection);\r\n this.forwardNotify(RpcRelationshipType.Parent, ConnectionManager.activeConnectionPropertyName, this.activeConnection);\r\n // collect connection settings for new active connection\r\n this.getConnectionSettings()\r\n .pipe(take(1))\r\n .subscribe(settings => this.connectionSettings.next(settings));\r\n }\r\n }\r\n\r\n /**\r\n * Add or update connection.\r\n */\r\n public addOrUpdateConnection(connection: Connection, save: boolean = true, merge = false): number {\r\n connection.id = ConnectionUtility.createConnectionId(connection.type, connection.name, connection.groupId);\r\n ConnectionUtility.forceLowercase(connection);\r\n let index = this.allConnections.findIndex(c => ConnectionUtility.areEqual(c, connection));\r\n if (index >= 0) {\r\n if (merge) {\r\n const oldConnection = this.allConnections[index];\r\n if (oldConnection.tags) {\r\n connection.tags = oldConnection.tags.concat(connection.tags || []).unique();\r\n }\r\n if (oldConnection.properties) {\r\n connection.properties = { ...oldConnection.properties, ...(connection.properties || {}) };\r\n }\r\n }\r\n\r\n this.allConnections[index] = connection;\r\n this.connectionsChanged.next(<ConnectionChangedEvent>{ type: ConnectionChangeType.Added, connection: connection });\r\n } else {\r\n this.allConnections.push(connection);\r\n this.connectionsChanged.next(<ConnectionChangedEvent>{ type: ConnectionChangeType.Added, connection: connection });\r\n if (!this.restoreInProgress) {\r\n this.connectionsInitialized.next(this.allConnections);\r\n }\r\n index = this.allConnections.length - 1;\r\n // notify parent and child of collection changed.\r\n this.forwardNotify(RpcRelationshipType.Parent, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n }\r\n\r\n if (save) {\r\n this.saveConnection(connection).subscribe();\r\n }\r\n\r\n return index;\r\n }\r\n\r\n /**\r\n * Remove connection.\r\n */\r\n public removeConnection(connection: Connection): Observable<any> {\r\n const forward = this.forwardExecute(RpcRelationshipType.Parent, ConnectionManager.removeConnectionMethodName, [connection]);\r\n if (forward) {\r\n return <Observable<any>>forward;\r\n }\r\n\r\n const urlEncodedID = encodeURIComponent(connection.id);\r\n return this.gatewayConnection.delete(`${ConnectionManager.gatewayConnectionApi}/${urlEncodedID}`).pipe(\r\n map(response => {\r\n const index = this.allConnections.findIndex(c => ConnectionUtility.areEqual(c, connection));\r\n if (index >= 0) {\r\n // if this connection is active, set active connection to null\r\n if (this.activeConnectionIndex === index) {\r\n this.activeConnection = null;\r\n }\r\n\r\n // remove the connection from all connections\r\n this.allConnections.splice(index, 1);\r\n }\r\n this.connectionsChanged.next(<ConnectionChangedEvent>{ type: ConnectionChangeType.Removed, connection: connection });\r\n if (!this.restoreInProgress) {\r\n this.connectionsInitialized.next(this.allConnections);\r\n }\r\n\r\n // notify our children that connections have changed\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n\r\n return response;\r\n })\r\n );\r\n }\r\n\r\n public updateConnectionsLastCheckedTime(connections: Connection[]): Observable<any> {\r\n const now = Date.now();\r\n const observables = [];\r\n if (connections && connections.length > 0) {\r\n connections.forEach(connection => {\r\n if (\r\n connection.properties == null ||\r\n connection.properties.lastUpdatedTime == null ||\r\n MsftSme.round(connection.properties.lastUpdatedTime / 1000) + 2 < MsftSme.round(now / 1000)\r\n ) {\r\n // update if there is more than 2 second difference.\r\n connection.properties = connection.properties || {};\r\n connection.properties.lastUpdatedTime = now;\r\n observables.push(this.saveConnection(connection));\r\n }\r\n\r\n observables.push(of(null));\r\n });\r\n } else {\r\n observables.push(of(null));\r\n }\r\n\r\n return concat(...observables);\r\n }\r\n\r\n public saveConnection(connection: Connection): Observable<any> {\r\n ConnectionUtility.forceLowercase(connection);\r\n const forward = this.forwardExecute(RpcRelationshipType.Parent, ConnectionManager.saveConnectionMethodName, [connection]);\r\n if (forward) {\r\n return <Observable<any>>forward;\r\n }\r\n\r\n if (!connection.type || !connection.name) {\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.ServerListFailedSave.message;\r\n return throwError(() => new Error(message));\r\n }\r\n\r\n connection.id = ConnectionUtility.createConnectionId(connection.type, connection.name, connection.groupId);\r\n\r\n // define properties if it doesn't exist on the connection\r\n if (MsftSme.isNullOrUndefined(connection.properties)) {\r\n connection.properties = {};\r\n }\r\n this.addOrUpdateConnection(connection, false);\r\n\r\n const urlEncodedID = encodeURIComponent(connection.id);\r\n return this.gatewayConnection.put(`${ConnectionManager.gatewayConnectionApi}/${urlEncodedID}`, JSON.stringify(connection)).pipe(\r\n tap((data: any) => {\r\n if (data.properties && data.properties.displayName) {\r\n // merge the display name from the gateway into the connection properties\r\n connection.properties.displayName = data.properties.displayName;\r\n }\r\n\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Bulk operation for saving multiple connections\r\n * @param connection the connection object.\r\n */\r\n public saveConnections(connections: Connection[]): Observable<any> {\r\n connections.forEach(connection => {\r\n this.addOrUpdateConnection(connection, false);\r\n ConnectionUtility.forceLowercase(connection);\r\n\r\n if (!connection.type || !connection.name) {\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.ServerListFailedSave.message;\r\n return throwError(() => new Error(message));\r\n }\r\n\r\n connection.id = ConnectionUtility.createConnectionId(connection.type, connection.name, connection.groupId);\r\n });\r\n\r\n const forward = this.forwardExecute(RpcRelationshipType.Parent, ConnectionManager.saveConnectionsMethodName, [connections]);\r\n if (forward) {\r\n return <Observable<any>>forward;\r\n }\r\n\r\n return this.gatewayConnection.put(`${ConnectionManager.gatewayConnectionApi}`, JSON.stringify(connections)).pipe(\r\n tap(_ => {\r\n this.forwardNotify(RpcRelationshipType.Child, ConnectionManager.connectionsPropertyName, this.allConnections);\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Finds a connection given a name and type\r\n * @param name the name of the connection to find\r\n * @param type the type of the connection to find, defaults to server type\r\n */\r\n public findConnection(name: string, type?: string): Observable<Connection> {\r\n if (!name) {\r\n return of(null);\r\n }\r\n\r\n type = type || connectionTypeConstants.server;\r\n\r\n if (this.activeConnection && this.activeConnection.name === name && this.activeConnection.type === type) {\r\n return of(this.activeConnection);\r\n }\r\n\r\n return this.connectionsInitialized.pipe(\r\n map(_ => {\r\n return this.connections.find(c => c.name === name && c.type === type);\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Called on a child service instance when onForwardInit returns from the parent\r\n * @param data The response from the forwardInit call\r\n */\r\n protected onForwardInitResponse(data: RpcForwardResponse<ConnectionManagerInitProperties>): void {\r\n if (data.error) {\r\n // if there is an error, we cannot continue, so throw its\r\n throw data.error;\r\n }\r\n\r\n this.allConnections = data.result.connections;\r\n this.activeConnection = data.result.activeConnection;\r\n this.connectionsChanged.next(<ConnectionsInitializedEvent>{\r\n type: ConnectionChangeType.Initialized,\r\n connections: this.allConnections\r\n });\r\n this.connectionsInitialized.next(this.allConnections);\r\n }\r\n\r\n /**\r\n * Called when a new instance of the service in another window is initialized and needs to synchronize with its parent\r\n * @param from The RpcRelationshipType that this request is from\r\n * @returns an observable for the all the values needed to initialize the service\r\n */\r\n protected onForwardInit(): Observable<ConnectionManagerInitProperties> {\r\n return of({\r\n connections: this.connections,\r\n activeConnection: this.activeConnection\r\n });\r\n }\r\n\r\n /**\r\n * Called when the forwarded services counterpart wants to get data from the parent\r\n * @param from The RpcRelationshipType that this request is from\r\n * @param name The name of the method to forward to\r\n * @param args The arguments of the method\r\n * @returns an observable for the result of the method call\r\n */\r\n protected onForwardExecute(from: RpcRelationshipType, name: string, args: any[]): Observable<any> {\r\n if (from === RpcRelationshipType.Child && args && args.length >= 1) {\r\n if (name === ConnectionManager.saveConnectionMethodName) {\r\n // we dont actually have anything to return here.\r\n return this.saveConnection(args[0]).pipe(map(() => null));\r\n }\r\n if (name === ConnectionManager.saveConnectionsMethodName) {\r\n return this.saveConnections(args[0]);\r\n }\r\n if (name === ConnectionManager.removeConnectionMethodName) {\r\n // we dont actually have anything to return here.\r\n return this.removeConnection(args[0]).pipe(map(() => null));\r\n }\r\n }\r\n // ConnectionManager does not allow any method calls at this time\r\n return this.nameNotFound(name);\r\n }\r\n\r\n /**\r\n * Called when the forwarded services counterpart sends a notify message\r\n * @param from The RpcRelationshipType that this request is from\r\n * @param name The name of the property to change\r\n * @param value The new value of the property\r\n * @returns an observable that completes when the property has been changed.\r\n */\r\n protected onForwardNotify(from: RpcRelationshipType, name: string, value: any): Observable<void> {\r\n if (name === ConnectionManager.connectionsPropertyName) {\r\n this.allConnections = value;\r\n this.connectionsChanged.next(<ConnectionsInitializedEvent>{\r\n type: ConnectionChangeType.Initialized,\r\n connections: this.allConnections\r\n });\r\n this.connectionsInitialized.next(this.allConnections);\r\n return of(null);\r\n }\r\n if (name === ConnectionManager.activeConnectionPropertyName) {\r\n this.activeConnection = value;\r\n return of(null);\r\n }\r\n return this.nameNotFound(name);\r\n }\r\n\r\n /**\r\n * Get aliases data and save the change with connection\r\n * @param aliases the alias list.\r\n * @param connection the connection object.\r\n * @param nodeName the node name.\r\n */\r\n public saveAliasesData(aliases: string[], connection: Connection, nodeName: string) {\r\n let save = false;\r\n // save the connection if aliase info changed\r\n if (!this.isArraySame(aliases, connection.aliases)) {\r\n connection.aliases = aliases;\r\n // remove the activeAlias if it's not in aliases any more\r\n if (connection.aliases.indexOf(connection.activeAlias) === -1) {\r\n connection.activeAlias = null;\r\n }\r\n save = true;\r\n }\r\n // if current nodeName is not connection name save it as activeAlias\r\n if (connection.name !== nodeName && connection.activeAlias !== nodeName) {\r\n connection.activeAlias = nodeName;\r\n save = true;\r\n } else {\r\n // current nodeName is connection name, remove connection activeAlias\r\n if (connection.name === nodeName && !!connection.activeAlias) {\r\n connection.activeAlias = null;\r\n save = true;\r\n }\r\n }\r\n\r\n if (save) {\r\n this.saveConnection(connection);\r\n }\r\n\r\n // delete visit map entry when succeed\r\n this.deleteAliasesVisitList(connection.name);\r\n }\r\n\r\n /**\r\n * Get active alias from nodeAliasesVisit map with given nodeName\r\n * return the node in aliases list in order,\r\n * return null if no alias or end of list\r\n * @param nodeName key in nodeAliasesVisitMap\r\n */\r\n public getActiveAlias(nodeName: string): string {\r\n // aliases visit list already exists\r\n if (nodeName in this.nodeAliasesVisitMap) {\r\n const vlist = this.nodeAliasesVisitMap[nodeName];\r\n // move currentIndex to next\r\n if (++vlist.currentIndex < vlist.aliases.length) {\r\n return vlist.aliases[vlist.currentIndex];\r\n } else {\r\n // end of the list\r\n this.deleteAliasesVisitList(nodeName);\r\n return null;\r\n }\r\n } else {\r\n // no aliases list yet (first time or none)\r\n const aliases = this.getNodeAliasesList(nodeName);\r\n if (aliases) {\r\n // create aliases visit list for the first time\r\n const vlist: AliasesVisitList = {\r\n currentIndex: 0,\r\n aliases: aliases\r\n };\r\n this.nodeAliasesVisitMap[nodeName] = vlist;\r\n // return first item, aliases[vlist.currentIndex]\r\n return aliases[0];\r\n } else {\r\n // no aliases, return null\r\n return null;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Delete aliasesVistList entry with given nodeName from nodeAliasesVisitMap\r\n * @param nodeName the node name.\r\n */\r\n private deleteAliasesVisitList(nodeName: string): void {\r\n if (nodeName in this.nodeAliasesVisitMap) {\r\n delete this.nodeAliasesVisitMap[nodeName];\r\n }\r\n }\r\n\r\n private isArraySame(array1: string[], array2: string[]): boolean {\r\n // both are not null, compare every element\r\n array1 = [].concat(array1);\r\n array2 = [].concat(array2);\r\n if (array1 && array2) {\r\n return (\r\n array1.length === array2.length &&\r\n array1.every(function (element, index) {\r\n return element === array2[index];\r\n })\r\n );\r\n } else {\r\n // both are null\r\n if (!array1 && !array2) {\r\n return true;\r\n } else {\r\n // one of it is null\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get nodeAliasesList from map; if not exists create it\r\n * @param nodeName name of the node, this is unique regardless connection type\r\n */\r\n private getNodeAliasesList(nodeName: string): string[] {\r\n if (nodeName in this.connectionAliasesMap) {\r\n return this.connectionAliasesMap[nodeName];\r\n } else {\r\n return this.buildNodeAliasesList(nodeName);\r\n }\r\n }\r\n\r\n /**\r\n * Build nodeAliasesList entry with given nodeName, then add it into the map,\r\n * return the list of aliases\r\n * @param nodeName name of the node\r\n */\r\n private buildNodeAliasesList(nodeName: string): string[] {\r\n const connection = this.findConnectionWithAliases(nodeName);\r\n if (!connection) {\r\n return null;\r\n }\r\n // assume activeAlias is in aliases[]\r\n let aliases: string[] = [];\r\n if (connection.activeAlias) {\r\n // put activeAlias at the first of the list\r\n aliases.push(connection.activeAlias);\r\n aliases = aliases.concat(connection.aliases.filter(item => item !== connection.activeAlias));\r\n } else {\r\n aliases = connection.aliases;\r\n }\r\n for (let i = 0; i < aliases.length; i++) {\r\n const childList = this.buildNodeAliasesList(aliases[i]);\r\n // insert the childList to list, the list.length will increase\r\n if (childList) {\r\n // remove remaining items after current item\r\n const remainList = aliases.splice(i + 1, aliases.length - i);\r\n aliases = aliases.concat(childList, remainList);\r\n // next iteration move to node in childList\r\n }\r\n }\r\n this.connectionAliasesMap[nodeName] = aliases;\r\n return aliases;\r\n }\r\n\r\n /**\r\n * Finds the first connection with aliases info given a name, assume the connections already initialized\r\n * @param name the name of the connection to find\r\n */\r\n private findConnectionWithAliases(name: string): Connection {\r\n if (!name) {\r\n return null;\r\n }\r\n\r\n if (this.activeConnection && this.activeConnection.name === name && !!this.activeConnection.aliases) {\r\n return this.activeConnection;\r\n }\r\n\r\n return this.connections.find(c => c.name === name && !!c.aliases);\r\n }\r\n\r\n /**\r\n * Gets the common connection settings.\r\n * By default, will use the active connection, but allows input for different connection objects.\r\n * @return Observable of the common connection settings object\r\n */\r\n public getCommonConnectionSettings(connection?: Connection): Observable<CommonConnectionSettings> {\r\n if (connection) {\r\n return this.getConnectionSettings(connection).pipe(\r\n take(1),\r\n map(settings => settings.common),\r\n take(1)\r\n );\r\n } else {\r\n return this.connectionSettings.pipe(\r\n map(settings => settings.common),\r\n take(1)\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Get extension connection settings for the active connection.\r\n * @return Observable of specified type\r\n */\r\n public getExtensionConnectionSettings<T extends VersionedObject>(type: VersionedObjectConstructor<T>): Observable<T> {\r\n const name = MsftSme.self().Environment.name;\r\n return this.connectionSettings.pipe(\r\n map(settings => VersionedObject.ensureIsVersionedObject(settings.extensions[name])),\r\n map(settings => {\r\n return new type(settings, { save: object => this.setExtensionSettings(name, object) });\r\n }),\r\n take(1)\r\n );\r\n }\r\n\r\n /**\r\n * Sets extension settings for the active connection.\r\n * @param extensionName the extension name.\r\n * @param extensionSettings the extension settings.\r\n */\r\n public setExtensionSettings(extensionName: string, extensionSettings: PlainVersionedObject): Observable<void> {\r\n return this.connectionSettings.pipe(\r\n mergeMap(settings =>\r\n settings.trySave(() => {\r\n settings.extensions[extensionName] = extensionSettings;\r\n })\r\n )\r\n );\r\n }\r\n\r\n /**\r\n * Gets the connection settings object\r\n * By default, will use the active connection, but allows input for different connection objects.\r\n * @return Observable of ConnectionSettings\r\n */\r\n private getConnectionSettings(connection = this.activeConnection): Observable<ConnectionSettings> {\r\n return of(connection).pipe(\r\n map(connectionObject => {\r\n return connectionObject.settings;\r\n }),\r\n take(1),\r\n catchError(error => {\r\n const messageFormat = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Errors.UserProfile.Get.formatMessage;\r\n Logging.logError('ConnectionManager.getConnectionSettings', messageFormat.format(Net.getErrorMessage(error)));\r\n return throwError(() => error);\r\n }),\r\n map((settings: PlainVersionedObject) => {\r\n // If the setttings are not versioned (or not defined), then start with empty settings object\r\n settings = VersionedObject.ensureIsVersionedObject(settings);\r\n\r\n // return new connection settings object\r\n return new ConnectionSettings(settings, {\r\n save: object => this.setConnectionSettings(object, connection)\r\n });\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Sets the connection settings from the active connection\r\n * @param settings a PlainVersionedObject\r\n * @return An observable with the result from the set operation\r\n */\r\n private setConnectionSettings(settings: PlainVersionedObject, connection: Connection): Observable<any> {\r\n // return an observable that saves the connection\r\n connection.settings = settings;\r\n return this.saveConnection(connection);\r\n }\r\n}\r\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { AppContext } from '../data/app-context';
|
|
3
|
-
import { EnvironmentModuleEntryPoint, EnvironmentModuleEntryPointWithToolConditionResult } from '../manifest/environment-modules';
|
|
3
|
+
import { EnvironmentMode, EnvironmentModuleEntryPoint, EnvironmentModuleEntryPointWithToolConditionResult, VirtualizationView } from '../manifest/environment-modules';
|
|
4
4
|
import { Connection } from '../security/connection';
|
|
5
5
|
import { InventoryQueryCaches } from '../shared/inventory-query-caches';
|
|
6
6
|
/**
|
|
@@ -57,12 +57,12 @@ export declare class ToolConditionValidator {
|
|
|
57
57
|
* String comparison uses caseinsesitive pattern.
|
|
58
58
|
*/
|
|
59
59
|
private static operators;
|
|
60
|
-
private static
|
|
60
|
+
private static readonly currentByCaches;
|
|
61
61
|
private caches;
|
|
62
62
|
private toolInventoryCache;
|
|
63
63
|
private errorStrings;
|
|
64
64
|
/**
|
|
65
|
-
* Gets the
|
|
65
|
+
* Gets the ToolConditionValidator associated with the provided inventory caches.
|
|
66
66
|
*
|
|
67
67
|
* @param appContext the application context.
|
|
68
68
|
* @param caches the instance of the inventory query caches to share the resource.
|
|
@@ -75,6 +75,11 @@ export declare class ToolConditionValidator {
|
|
|
75
75
|
* @param caches the instance of the inventory query caches to share the resource.
|
|
76
76
|
*/
|
|
77
77
|
constructor(appContext: AppContext, caches: InventoryQueryCaches);
|
|
78
|
+
/**
|
|
79
|
+
* Checks a manifest condition's environment mode and view without a connection.
|
|
80
|
+
* Missing environmentModes allows only standard mode; missing virtualizationViews allows no virtualization view.
|
|
81
|
+
*/
|
|
82
|
+
static matchesEnvironment(environmentModes?: EnvironmentMode[], virtualizationViews?: VirtualizationView[]): boolean;
|
|
78
83
|
/**
|
|
79
84
|
* Scan the tool condition to be present or not.
|
|
80
85
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-condition-validator.d.ts","sourceRoot":"","sources":["../../src/security/tool-condition-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAM,MAAM,MAAM,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMjD,OAAO,
|
|
1
|
+
{"version":3,"file":"tool-condition-validator.d.ts","sourceRoot":"","sources":["../../src/security/tool-condition-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAM,MAAM,MAAM,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;A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,UAAU,EAAE,QAAQ,EAAE,2BAA2B,EAAE,IAAI,EAAE,2BAA2B,GAAG,6BAA6B;IAyKzJ,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,wBAAwB;IA6BhC,OAAO,CAAC,uBAAuB;IAM/B,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,qBAAqB;IAuB7B,OAAO,CAAC,6BAA6B;IAWrC,OAAO,CAAC,cAAc;IAiJtB,OAAO,CAAC,cAAc;IAkDtB,OAAO,CAAC,eAAe;CAI1B"}
|
|
@@ -161,21 +161,23 @@ export class ToolConditionValidator {
|
|
|
161
161
|
*/
|
|
162
162
|
anyNotContains: 'anyNotContains'
|
|
163
163
|
};
|
|
164
|
-
static
|
|
164
|
+
static currentByCaches = new WeakMap();
|
|
165
165
|
caches;
|
|
166
166
|
toolInventoryCache;
|
|
167
167
|
errorStrings = MsftSme.getStrings().MsftSmeShell.Core.Error;
|
|
168
168
|
/**
|
|
169
|
-
* Gets the
|
|
169
|
+
* Gets the ToolConditionValidator associated with the provided inventory caches.
|
|
170
170
|
*
|
|
171
171
|
* @param appContext the application context.
|
|
172
172
|
* @param caches the instance of the inventory query caches to share the resource.
|
|
173
173
|
*/
|
|
174
174
|
static current(appContext, caches) {
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
let current = ToolConditionValidator.currentByCaches.get(caches);
|
|
176
|
+
if (!current) {
|
|
177
|
+
current = new ToolConditionValidator(appContext, caches);
|
|
178
|
+
ToolConditionValidator.currentByCaches.set(caches, current);
|
|
177
179
|
}
|
|
178
|
-
return
|
|
180
|
+
return current;
|
|
179
181
|
}
|
|
180
182
|
/**
|
|
181
183
|
* Initializes a new instance of the ToolConditionValidator class.
|
|
@@ -189,6 +191,27 @@ export class ToolConditionValidator {
|
|
|
189
191
|
this.caches = caches;
|
|
190
192
|
this.toolInventoryCache = new ToolInventoryCache(appContext, { expiration: statusExpiration });
|
|
191
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Checks a manifest condition's environment mode and view without a connection.
|
|
196
|
+
* Missing environmentModes allows only standard mode; missing virtualizationViews allows no virtualization view.
|
|
197
|
+
*/
|
|
198
|
+
static matchesEnvironment(environmentModes, virtualizationViews) {
|
|
199
|
+
const environmentMode = MsftSme.getValue(MsftSme.self().Environment.configuration, 'environmentMode') ?? 'standard';
|
|
200
|
+
if (!environmentModes || !Array.isArray(environmentModes) || environmentModes.length === 0) {
|
|
201
|
+
environmentModes = ['standard'];
|
|
202
|
+
}
|
|
203
|
+
if (!environmentModes.some(mode => environmentMode === mode)) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
if (environmentMode !== 'virtualization') {
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
const virtualizationView = MsftSme.getValue(MsftSme.self().Environment.configuration, 'virtualizationView') ?? 'compute';
|
|
210
|
+
if (!virtualizationViews || !Array.isArray(virtualizationViews) || virtualizationViews.length === 0) {
|
|
211
|
+
virtualizationViews = [];
|
|
212
|
+
}
|
|
213
|
+
return virtualizationViews.some(view => virtualizationView === view);
|
|
214
|
+
}
|
|
192
215
|
/**
|
|
193
216
|
* Scan the tool condition to be present or not.
|
|
194
217
|
*
|
|
@@ -374,36 +397,28 @@ export class ToolConditionValidator {
|
|
|
374
397
|
})));
|
|
375
398
|
}
|
|
376
399
|
environmentModeValidate(environmentModes, virtualizationViews) {
|
|
377
|
-
// Set default environment mode to standard if not defined (pre-virtualization mode)
|
|
378
|
-
const environmentMode = MsftSme.getValue(MsftSme.self().Environment.configuration, 'environmentMode') ?? 'standard';
|
|
379
|
-
if (!environmentModes || !Array.isArray(environmentModes) || environmentModes.length === 0) {
|
|
380
|
-
// Default to only showing in standard if property isn't defined in manifest
|
|
381
|
-
environmentModes = ['standard'];
|
|
382
|
-
}
|
|
383
|
-
if (environmentMode === 'virtualization') {
|
|
384
|
-
// Default to compute view only if connection type is not defined in configuration
|
|
385
|
-
const virtualizationView = MsftSme.getValue(MsftSme.self().Environment.configuration, 'virtualizationView') ?? 'compute';
|
|
386
|
-
if (!virtualizationViews || !Array.isArray(virtualizationViews) || virtualizationViews.length === 0) {
|
|
387
|
-
virtualizationViews = [];
|
|
388
|
-
}
|
|
389
|
-
return of({
|
|
390
|
-
show: environmentModes.some(mode => environmentMode === mode) && virtualizationViews.some(view => virtualizationView === view)
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
400
|
return of({
|
|
394
|
-
show:
|
|
401
|
+
show: ToolConditionValidator.matchesEnvironment(environmentModes, virtualizationViews)
|
|
395
402
|
});
|
|
396
403
|
}
|
|
397
404
|
inventoryValidate(connection, condition) {
|
|
398
405
|
const nodeName = connection.activeAlias ? connection.activeAlias : connection.name;
|
|
399
|
-
return this.caches.serverCache.createObservable({ params: { name: nodeName } }).pipe(
|
|
406
|
+
return this.caches.serverCache.createObservable({ params: { name: nodeName } }).pipe(filter((instance) => instance.serverName === nodeName), map(instance => ({
|
|
407
|
+
show: this.checkServerInventoryCondition(condition, instance)
|
|
408
|
+
})),
|
|
409
|
+
// Must stay after the filter and map: recovering earlier would make the filter dereference null,
|
|
410
|
+
// and that error escapes the partial catchError in toolValidate.
|
|
411
|
+
catchError(error => {
|
|
412
|
+
const message = Net.getErrorMessage(error);
|
|
400
413
|
const errorStrings = MsftSme.getStrings().MsftSmeShell.Core.Error;
|
|
401
414
|
const notification = this.appContext.notification.create(connection.name);
|
|
402
|
-
notification.showError(errorStrings.ToolValidationInventoryError.title, errorStrings.ToolValidationInventoryError.message.format(
|
|
403
|
-
return of(
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
415
|
+
notification.showError(errorStrings.ToolValidationInventoryError.title, errorStrings.ToolValidationInventoryError.message.format(message));
|
|
416
|
+
return of({
|
|
417
|
+
show: false,
|
|
418
|
+
detail: EnvironmentModuleToolState.NotSupported,
|
|
419
|
+
message
|
|
420
|
+
});
|
|
421
|
+
}));
|
|
407
422
|
}
|
|
408
423
|
propertyValidate(connection, condition) {
|
|
409
424
|
const propertyNames = Object.keys(condition);
|