/* * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var BaggageImpl = /** @class */ (function () { function BaggageImpl(entries) { this._entries = entries ? new Map(entries) : new Map(); } BaggageImpl.prototype.getEntry = function (key) { var entry = this._entries.get(key); if (!entry) { return undefined; } return Object.assign({}, entry); }; BaggageImpl.prototype.getAllEntries = function () { return Array.from(this._entries.entries()).map(function (_a) { var k = _a[0], v = _a[1]; return [k, v]; }); }; BaggageImpl.prototype.setEntry = function (key, entry) { var newBaggage = new BaggageImpl(this._entries); newBaggage._entries.set(key, entry); return newBaggage; }; BaggageImpl.prototype.removeEntry = function (key) { var newBaggage = new BaggageImpl(this._entries); newBaggage._entries.delete(key); return newBaggage; }; BaggageImpl.prototype.removeEntries = function () { var keys = []; for (var _i = 0; _i < arguments.length; _i++) { keys[_i] = arguments[_i]; } var newBaggage = new BaggageImpl(this._entries); for (var _a = 0, keys_1 = keys; _a < keys_1.length; _a++) { var key = keys_1[_a]; newBaggage._entries.delete(key); } return newBaggage; }; BaggageImpl.prototype.clear = function () { return new BaggageImpl(); }; return BaggageImpl; }()); export { BaggageImpl }; //# sourceMappingURL=baggage-impl.js.map