tracingDispatcher.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.TracingDispatcher = void 0;
  6. var _artifactDispatcher = require("./artifactDispatcher");
  7. var _dispatcher = require("./dispatcher");
  8. /**
  9. * Copyright (c) Microsoft Corporation.
  10. *
  11. * Licensed under the Apache License, Version 2.0 (the 'License");
  12. * you may not use this file except in compliance with the License.
  13. * You may obtain a copy of the License at
  14. *
  15. * http://www.apache.org/licenses/LICENSE-2.0
  16. *
  17. * Unless required by applicable law or agreed to in writing, software
  18. * distributed under the License is distributed on an "AS IS" BASIS,
  19. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. * See the License for the specific language governing permissions and
  21. * limitations under the License.
  22. */
  23. class TracingDispatcher extends _dispatcher.Dispatcher {
  24. static from(scope, tracing) {
  25. const result = (0, _dispatcher.existingDispatcher)(tracing);
  26. return result || new TracingDispatcher(scope, tracing);
  27. }
  28. constructor(scope, tracing) {
  29. super(scope, tracing, 'Tracing', {});
  30. this._type_Tracing = true;
  31. }
  32. async tracingStart(params) {
  33. await this._object.start(params);
  34. }
  35. async tracingStartChunk(params) {
  36. return await this._object.startChunk(params);
  37. }
  38. async tracingStopChunk(params) {
  39. const {
  40. artifact,
  41. entries
  42. } = await this._object.stopChunk(params);
  43. return {
  44. artifact: artifact ? _artifactDispatcher.ArtifactDispatcher.from(this, artifact) : undefined,
  45. entries
  46. };
  47. }
  48. async tracingStop(params) {
  49. await this._object.stop();
  50. }
  51. }
  52. exports.TracingDispatcher = TracingDispatcher;