Skip to content

Commit 51bb39c

Browse files
Merge branch 'SDKS-8407_baseline' into SDKS-8407_unify_endpoint
2 parents cdf411f + f7894ec commit 51bb39c

File tree

6 files changed

+83
-16
lines changed

6 files changed

+83
-16
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
10.28.0 (September 6, 2024)
2+
- Updated @splitsoftware/splitio-commons package to version 1.17.0 that includes minor updates:
3+
- Added `sync.requestOptions.getHeaderOverrides` configuration option to enhance SDK HTTP request Headers for Authorization Frameworks.
4+
- Updated some transitive dependencies for vulnerability fixes.
5+
16
10.27.0 (June 25, 2024)
27
- Added `sync.requestOptions.agent` option to SDK configuration for NodeJS. This allows passing a custom NodeJS HTTP(S) Agent with specific configurations for the SDK requests, like custom TLS settings or a network proxy (See https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#proxy).
38
- Updated some transitive dependencies for vulnerability fixes.

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@splitsoftware/splitio",
3-
"version": "10.27.1-rc.4",
3+
"version": "10.28.0",
44
"description": "Split SDK",
55
"files": [
66
"README.md",
@@ -40,7 +40,7 @@
4040
"node": ">=6"
4141
},
4242
"dependencies": {
43-
"@splitsoftware/splitio-commons": "1.16.1-rc.12",
43+
"@splitsoftware/splitio-commons": "1.17.0",
4444
"@types/google.analytics": "0.0.40",
4545
"@types/ioredis": "^4.28.0",
4646
"bloom-filters": "^3.0.0",

src/settings/defaults/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const packageVersion = '10.27.1-rc.4';
1+
export const packageVersion = '10.28.0';

ts-tests/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,10 @@ let fullBrowserSettings: SplitIO.IBrowserSettings = {
565565
sync: {
566566
splitFilters: splitFilters,
567567
impressionsMode: 'DEBUG',
568-
enabled: true
568+
enabled: true,
569+
requestOptions: {
570+
getHeaderOverrides(context) { return { ...context.headers, 'header': 'value' } },
571+
}
569572
},
570573
userConsent: 'GRANTED'
571574
};
@@ -618,6 +621,7 @@ let fullNodeSettings: SplitIO.INodeSettings = {
618621
impressionsMode: 'OPTIMIZED',
619622
enabled: true,
620623
requestOptions: {
624+
getHeaderOverrides(context) { return { ...context.headers, 'header': 'value' } },
621625
agent: new (require('https')).Agent(),
622626
}
623627
}
@@ -666,7 +670,7 @@ let fullAsyncSettings: SplitIO.INodeAsyncSettings = {
666670
mode: 'consumer',
667671
debug: true,
668672
sync: {
669-
splitFilters: splitFilters
673+
splitFilters: splitFilters,
670674
}
671675
};
672676

types/splitio.d.ts

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ interface ISettings {
112112
splitFilters: SplitIO.SplitFilter[],
113113
impressionsMode: SplitIO.ImpressionsMode,
114114
enabled: boolean,
115-
flagSpecVersion: string
115+
flagSpecVersion: string,
116+
requestOptions?: {
117+
getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
118+
}
116119
}
117120
/**
118121
* User consent status if using in browser. Undefined if using in NodeJS.
@@ -1127,7 +1130,40 @@ declare namespace SplitIO {
11271130
* @typedef {string} userConsent
11281131
* @default 'GRANTED'
11291132
*/
1130-
userConsent?: ConsentStatus
1133+
userConsent?: ConsentStatus,
1134+
sync?: ISharedSettings['sync'] & {
1135+
/**
1136+
* Custom options object for HTTP(S) requests in the Browser.
1137+
* If provided, this object is merged with the options object passed by the SDK for EventSource and Fetch calls.
1138+
*/
1139+
requestOptions?: {
1140+
/**
1141+
* Custom function called before each request, allowing you to add or update headers in SDK HTTP requests.
1142+
* Some headers, such as `SplitSDKVersion`, are required by the SDK and cannot be overridden.
1143+
* To pass multiple headers with the same name, combine their values into a single line, separated by commas. Example: `{ 'Authorization': 'value1, value2' }`
1144+
* Or provide keys with different case since headers are case-insensitive. Example: `{ 'authorization': 'value1', 'Authorization': 'value2' }`
1145+
*
1146+
* NOTE: to pass custom headers to the streaming connection in Browser, you should polyfill the `window.EventSource` object with a library that supports headers,
1147+
* like https://www.npmjs.com/package/event-source-polyfill, since native EventSource does not support them and will be ignored.
1148+
*
1149+
* @property getHeaderOverrides
1150+
* @default undefined
1151+
*
1152+
* @param context - The context for the request.
1153+
* @param context.headers - The current headers in the request.
1154+
* @returns A set of headers to be merged with the current headers.
1155+
*
1156+
* @example
1157+
* const getHeaderOverrides = (context) => {
1158+
* return {
1159+
* 'Authorization': context.headers['Authorization'] + ', other-value',
1160+
* 'custom-header': 'custom-value'
1161+
* };
1162+
* };
1163+
*/
1164+
getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
1165+
},
1166+
}
11311167
}
11321168
/**
11331169
* Settings interface for SDK instances created on NodeJS.
@@ -1177,6 +1213,28 @@ declare namespace SplitIO {
11771213
* @see {@link https://www.npmjs.com/package/node-fetch#options}
11781214
*/
11791215
requestOptions?: {
1216+
/**
1217+
* Custom function called before each request, allowing you to add or update headers in SDK HTTP requests.
1218+
* Some headers, such as `SplitSDKVersion`, are required by the SDK and cannot be overridden.
1219+
* To pass multiple headers with the same name, combine their values into a single line, separated by commas. Example: `{ 'Authorization': 'value1, value2' }`
1220+
* Or provide keys with different case since headers are case-insensitive. Example: `{ 'authorization': 'value1', 'Authorization': 'value2' }`
1221+
*
1222+
* @property getHeaderOverrides
1223+
* @default undefined
1224+
*
1225+
* @param context - The context for the request.
1226+
* @param context.headers - The current headers in the request.
1227+
* @returns A set of headers to be merged with the current headers.
1228+
*
1229+
* @example
1230+
* const getHeaderOverrides = (context) => {
1231+
* return {
1232+
* 'Authorization': context.headers['Authorization'] + ', other-value',
1233+
* 'custom-header': 'custom-value'
1234+
* };
1235+
* };
1236+
*/
1237+
getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>
11801238
/**
11811239
* Custom NodeJS HTTP(S) Agent used by the SDK for HTTP(S) requests.
11821240
*

0 commit comments

Comments
 (0)