/* * 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. */ export class BaggageImpl { constructor(entries) { this._entries = entries ? new Map(entries) : new Map(); } getEntry(key) { const entry = this._entries.get(key); if (!entry) { return undefined; } return Object.assign({}, entry); } getAllEntries() { return Array.from(this._entries.entries()).map(([k, v]) => [k, v]); } setEntry(key, entry) { const newBaggage = new BaggageImpl(this._entries); newBaggage._entries.set(key, entry); return newBaggage; } removeEntry(key) { const newBaggage = new BaggageImpl(this._entries); newBaggage._entries.delete(key); return newBaggage; } removeEntries(...keys) { const newBaggage = new BaggageImpl(this._entries); for (const key of keys) { newBaggage._entries.delete(key); } return newBaggage; } clear() { return new BaggageImpl(); } } //# sourceMappingURL=baggage-impl.js.map