From d5b0634555404ceef1e125cb5bd7325d76bd4424 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Wed, 18 Dec 2024 11:07:43 -0500 Subject: [PATCH] feat(core)!: Remove urlEncode method --- docs/migration/v8-to-v9.md | 1 + packages/core/src/utils-hoist/index.ts | 2 -- packages/core/src/utils-hoist/object.ts | 15 --------------- packages/core/test/utils-hoist/object.test.ts | 18 ------------------ packages/utils/src/index.ts | 5 ----- 5 files changed, 1 insertion(+), 40 deletions(-) diff --git a/docs/migration/v8-to-v9.md b/docs/migration/v8-to-v9.md index 0f92cab5bc93..a9e4cda300b1 100644 --- a/docs/migration/v8-to-v9.md +++ b/docs/migration/v8-to-v9.md @@ -106,6 +106,7 @@ It will be removed in a future major version. - The `getNumberOfUrlSegments` method has been removed. There is no replacement. - The `validSeverityLevels` export has been removed. There is no replacement. +- The `urlEncode` method has been removed. There is no replacement. ### `@sentry/nestjs` diff --git a/packages/core/src/utils-hoist/index.ts b/packages/core/src/utils-hoist/index.ts index 4e1771ffb8fa..d724b9cb42ff 100644 --- a/packages/core/src/utils-hoist/index.ts +++ b/packages/core/src/utils-hoist/index.ts @@ -61,8 +61,6 @@ export { getOriginalFunction, markFunctionWrapped, objectify, - // eslint-disable-next-line deprecation/deprecation - urlEncode, } from './object'; export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve } from './path'; export { makePromiseBuffer } from './promisebuffer'; diff --git a/packages/core/src/utils-hoist/object.ts b/packages/core/src/utils-hoist/object.ts index 7d779cf6e211..31d1d862d01f 100644 --- a/packages/core/src/utils-hoist/object.ts +++ b/packages/core/src/utils-hoist/object.ts @@ -86,21 +86,6 @@ export function getOriginalFunction(func: WrappedFunction return func.__sentry_original__; } -/** - * Encodes given object into url-friendly format - * - * @param object An object that contains serializable values - * @returns string Encoded - * - * @deprecated This function is deprecated and will be removed in the next major version of the SDK. - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export function urlEncode(object: { [key: string]: any }): string { - return Object.entries(object) - .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`) - .join('&'); -} - /** * Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their * non-enumerable properties attached. diff --git a/packages/core/test/utils-hoist/object.test.ts b/packages/core/test/utils-hoist/object.test.ts index ed83b5d87aef..255c4ed428f5 100644 --- a/packages/core/test/utils-hoist/object.test.ts +++ b/packages/core/test/utils-hoist/object.test.ts @@ -11,7 +11,6 @@ import { fill, markFunctionWrapped, objectify, - urlEncode, } from '../../src/utils-hoist/object'; import { testOnlyIfNodeVersionAtLeast } from './testutils'; @@ -128,23 +127,6 @@ describe('fill()', () => { }); }); -describe('urlEncode()', () => { - test('returns empty string for empty object input', () => { - // eslint-disable-next-line deprecation/deprecation - expect(urlEncode({})).toEqual(''); - }); - - test('returns single key/value pair joined with = sign', () => { - // eslint-disable-next-line deprecation/deprecation - expect(urlEncode({ foo: 'bar' })).toEqual('foo=bar'); - }); - - test('returns multiple key/value pairs joined together with & sign', () => { - // eslint-disable-next-line deprecation/deprecation - expect(urlEncode({ foo: 'bar', pickle: 'rick', morty: '4 2' })).toEqual('foo=bar&pickle=rick&morty=4%202'); - }); -}); - describe('extractExceptionKeysForMessage()', () => { test('no keys', () => { expect(extractExceptionKeysForMessage({}, 10)).toEqual('[object has no keys]'); diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index f730b41b30fa..81892d08b89b 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -153,7 +153,6 @@ import { triggerHandlers as triggerHandlers_imported, truncate as truncate_imported, updateRateLimits as updateRateLimits_imported, - urlEncode as urlEncode_imported, uuid4 as uuid4_imported, vercelWaitUntil as vercelWaitUntil_imported, watchdogTimer as watchdogTimer_imported, @@ -615,10 +614,6 @@ export const arrayify = arrayify_imported; /** @deprecated Import from `@sentry/core` instead. */ export const normalizeUrlToBase = normalizeUrlToBase_imported; -/** @deprecated Import from `@sentry/core` instead. */ -// eslint-disable-next-line deprecation/deprecation -export const urlEncode = urlEncode_imported; - /** @deprecated Import from `@sentry/core` instead. */ // eslint-disable-next-line deprecation/deprecation export const extractPathForTransaction = extractPathForTransaction_imported;