From df870f452ffe77d7f6d3e47110d750844810590e Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Thu, 7 Nov 2024 15:54:05 -0300 Subject: [PATCH] Re-export TypeScript SplitIO namespace at ./types/splitio.d.ts to allow explicit imports of types --- CHANGES.txt | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- src/settings/defaults/version.js | 2 +- ts-tests/index.ts | 8 ++++++++ types/index.d.ts | 2 +- types/splitio.d.ts | 6 ++++++ 7 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 types/splitio.d.ts diff --git a/CHANGES.txt b/CHANGES.txt index 4dfe7bf8d..53c49cccc 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,11 +1,16 @@ +11.0.1 (November 8, 2024) + - Bugfixing - Revert removal of TypeScript `SplitIO` namespace at `/types/splitio.d.ts` to allow explicit imports of types from the JavaScript SDK package. E.g., `import type { IBrowserSettings } from '@splitsoftware/splitio/types/splitio';`. + 11.0.0 (November 1, 2024) - Added support for targeting rules based on large segments for browsers (client-side API). - Added `factory.destroy()` method, which invokes the `destroy` method of all clients created by the factory. - Updated @splitsoftware/splitio-commons package to version 2.0.0 that includes major updates and updated some transitive dependencies for vulnerability fixes. - Renamed distribution folders from `/lib` to `/cjs` for CommonJS build, and `/es` to `/esm` for ECMAScript Modules build. - BREAKING CHANGES: + - NOTE: Refer to ./MIGRATION-GUIDE.md for instructions on how to migrate your codebase from version 0.x to 1.0.0. - Dropped support for Split Proxy below version 5.9.0, when using in the browser (client-side API). The SDK now requires Split Proxy 5.9.0 or above. - Dropped support for NodeJS v6. The SDK now requires NodeJS v14 or above. + - Removed TypeScript `SplitIO` namespace from `@splitsoftware/splitio/types/splitio`. Reverted in 11.0.1. - Removed internal ponyfills for the `Map` and `Set` global objects, dropping support for IE and other outdated browsers. The SDK now requires the runtime environment to support these features natively or provide a polyfill. - Removed the deprecated `GOOGLE_ANALYTICS_TO_SPLIT` and `SPLIT_TO_GOOGLE_ANALYTICS` integrations. The `integrations` configuration option has been removed from the SDK factory configuration, along with the associated interfaces in the TypeScript definitions. - Removed the `core.trafficType` configuration option (`SplitIO.IBrowserSettings['core']['trafficType]`) and the `trafficType` parameter from the SDK `client()` method in Browser (`SplitIO.IBrowserSDK['client']`). As a result, traffic types can no longer be bound to SDK clients, and the traffic type must be provided in the `track` method. diff --git a/package-lock.json b/package-lock.json index d5457999a..afd28f867 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@splitsoftware/splitio", - "version": "11.0.0", + "version": "11.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@splitsoftware/splitio", - "version": "11.0.0", + "version": "11.0.1", "license": "Apache-2.0", "dependencies": { "@splitsoftware/splitio-commons": "2.0.0", diff --git a/package.json b/package.json index f6083e0b2..2a0cd4390 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio", - "version": "11.0.0", + "version": "11.0.1", "description": "Split SDK", "files": [ "README.md", diff --git a/src/settings/defaults/version.js b/src/settings/defaults/version.js index 087efdda2..feec3d6b5 100644 --- a/src/settings/defaults/version.js +++ b/src/settings/defaults/version.js @@ -1 +1 @@ -export const packageVersion = '11.0.0'; +export const packageVersion = '11.0.1'; diff --git a/ts-tests/index.ts b/ts-tests/index.ts index 2e2588d9f..f03c20f40 100644 --- a/ts-tests/index.ts +++ b/ts-tests/index.ts @@ -11,10 +11,17 @@ * @author Nico Zelaya */ +import type * as SplitTypes from '../types/splitio'; + import { SplitFactory } from '../types/index'; import { SplitFactory as SplitFactoryCS } from '../types/client'; import { SplitFactory as SplitFactorySS } from '../types/server'; +// Validate that the SplitIO namespace is available and matches the types when imported explicitly +let ambientType: SplitIO.ISDK; +let importedType: SplitTypes.ISDK; +ambientType = importedType; + let stringPromise: Promise; let splitNamesPromise: Promise; let splitViewPromise: Promise; @@ -468,6 +475,7 @@ let attr: SplitIO.Attributes = { stringArrayAttribute: ['value1', 'value2'], numberArrayAttribute: [1, 2] } +let attr2: SplitTypes.Attributes = attr; stored = browserClient.setAttributes(attr); let storedAttr: SplitIO.Attributes = browserClient.getAttributes(); diff --git a/types/index.d.ts b/types/index.d.ts index e3f81c3e4..adaf540dd 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -2,7 +2,7 @@ // Project: http://www.split.io/ // Definitions by: Nico Zelaya -import '@splitsoftware/splitio-commons'; +/// export = JsSdk; diff --git a/types/splitio.d.ts b/types/splitio.d.ts new file mode 100644 index 000000000..bac1acf49 --- /dev/null +++ b/types/splitio.d.ts @@ -0,0 +1,6 @@ +// Type definitions for JavaScript and NodeJS Split Software SDK + +import '@splitsoftware/splitio-commons'; + +export as namespace SplitIO; +export = SplitIO;