Skip to content

Commit

Permalink
Merge pull request #366 from splitio/chore_rename_nodejs
Browse files Browse the repository at this point in the history
Refactor: rename occurrences to Node.js
  • Loading branch information
EmilianoSanchez authored Nov 8, 2024
2 parents 6a13969 + 61d33bc commit d6d14f9
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- Updated some transitive dependencies for vulnerability fixes.

1.16.0 (June 13, 2024)
- Added the `getOptions` method to the `IPlatform` interface to allow the SDK to pass request options to the `fetch` function and `EventSource` constructor when fetching data from the Split servers. The method is optional and, if provided, it is called twice: first for the `fetch` options and then for the `EventSource` options. Useful for advanced use cases like configuring a proxy or validating HTTPS certificates in NodeJS.
- Added the `getOptions` method to the `IPlatform` interface to allow the SDK to pass request options to the `fetch` function and `EventSource` constructor when fetching data from the Split servers. The method is optional and, if provided, it is called twice: first for the `fetch` options and then for the `EventSource` options. Useful for advanced use cases like configuring a proxy or validating HTTPS certificates in Node.js.
- Updated the Redis storage to lazily import the `ioredis` dependency when the storage is created. This prevents errors when the SDK is imported or bundled in a .mjs file, as `ioredis` is a CommonJS module.
- Bugfixing - Restored some input validation error logs that were removed in version 1.12.0. The logs inform the user when the `getTreatment(s)` methods are called with an invalid value as feature flag name or flag set name.
- Bugfixing - Fixed localhost mode to emit SDK_UPDATE when mocked feature flags are updated in the `features` object map of the config object (Related to issue https://github.com/splitio/javascript-browser-client/issues/119).
Expand Down Expand Up @@ -57,7 +57,7 @@
- Added a new optional Split Filter configuration option. This allows the SDK and Split services to only synchronize the flags in the specified flag sets, avoiding unused or unwanted flags from being synced on the SDK instance, bringing all the benefits from a reduced payload.
- Note: Only applicable when the SDK is in charge of the rollout data synchronization. When not applicable, the SDK will log a warning on init.
- Added `sets` property to the `SplitView` object returned by the `split` and `splits` methods of the SDK manager to expose flag sets on flag views.
- Bugfixing - Fixed SDK key validation in NodeJS to ensure the SDK_READY_TIMED_OUT event is emitted when a client-side type SDK key is provided instead of a server-side one (Related to issue https://github.com/splitio/javascript-client/issues/768).
- Bugfixing - Fixed SDK key validation in Node.js to ensure the SDK_READY_TIMED_OUT event is emitted when a client-side type SDK key is provided instead of a server-side one (Related to issue https://github.com/splitio/javascript-client/issues/768).

1.10.0 (October 20, 2023)
- Added `defaultTreatment` property to the `SplitView` object returned by the `split` and `splits` methods of the SDK manager (Related to issue https://github.com/splitio/javascript-commons/issues/225).
Expand Down Expand Up @@ -135,7 +135,7 @@
1.3.0 (April 6, 2022)
- Added user consent feature to allow delaying or disabling the data tracking from SDK until user consent is explicitly granted or declined. Read more in our docs.
- Added `scheduler.impressionsQueueSize` property to SDK configuration to limit the amount of impressions tracked in memory. Read more in our docs.
- Added support to accept TLS configuration options to the Redis storage in NodeJS. Read more in our docs.
- Added support to accept TLS configuration options to the Redis storage in Node.js. Read more in our docs.
- Updated format for MySegments keys in LocalStorage, keeping backwards compatibility (issue https://github.com/splitio/javascript-client/issues/638).
- Updated some modules due to general polishing and refactors, including updates in some log messages.
- Updated some dependencies for vulnerability fixes.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Split has built and maintains SDKs for:
* Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
* JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
* JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
* Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
* Node.js [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
* PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
* PHP thin-client [Github](https://github.com/splitio/php-thin-client) [Docs](https://help.split.io/hc/en-us/articles/18305128673933-PHP-Thin-Client-SDK)
* Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
Expand Down
10 changes: 5 additions & 5 deletions src/listeners/__tests__/node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const processOnSpy = jest.spyOn(process, 'on');
const processRemoveListenerSpy = jest.spyOn(process, 'removeListener');
const processKillSpy = jest.spyOn(process, 'kill').mockImplementation(() => true);

test('Node JS listener / Signal Listener class methods and start/stop functionality', () => {
test('NodeSignalListener / Signal Listener class methods and start/stop functionality', () => {

const syncManagerMock = { flush: jest.fn() }; // @ts-expect-error
const listener = new NodeSignalListener(syncManagerMock, fullSettings);
Expand All @@ -25,7 +25,7 @@ test('Node JS listener / Signal Listener class methods and start/stop functional
expect(processRemoveListenerSpy.mock.calls).toEqual([['SIGTERM', listener._sigtermHandler]]);
});

test('Node JS listener / Signal Listener SIGTERM callback with sync handler', () => {
test('NodeSignalListener / Signal Listener SIGTERM callback with sync handler', () => {

const syncManagerMock = { flush: jest.fn() }; // @ts-expect-error
const listener = new NodeSignalListener(syncManagerMock, fullSettings);
Expand Down Expand Up @@ -55,7 +55,7 @@ test('Node JS listener / Signal Listener SIGTERM callback with sync handler', ()
processKillSpy.mockClear();
});

test('Node JS listener / Signal Listener SIGTERM callback with sync handler that throws an error', () => {
test('NodeSignalListener / Signal Listener SIGTERM callback with sync handler that throws an error', () => {
const syncManagerMock = { flush: jest.fn(() => { throw 'some error'; }) }; // @ts-expect-error
const listener = new NodeSignalListener(syncManagerMock, fullSettings);

Expand Down Expand Up @@ -85,7 +85,7 @@ test('Node JS listener / Signal Listener SIGTERM callback with sync handler that
processKillSpy.mockClear();
});

test('Node JS listener / Signal Listener SIGTERM callback with async handler', async () => {
test('NodeSignalListener / Signal Listener SIGTERM callback with async handler', async () => {

const fakePromise = new Promise<void>(res => {
setTimeout(() => {
Expand Down Expand Up @@ -125,7 +125,7 @@ test('Node JS listener / Signal Listener SIGTERM callback with async handler', a
});
});

test('Node JS listener / Signal Listener SIGTERM callback with async handler that throws an error', async () => {
test('NodeSignalListener / Signal Listener SIGTERM callback with async handler that throws an error', async () => {

const fakePromise = new Promise<void>((res, rej) => {
setTimeout(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/listeners/node.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @TODO eventually migrate to JS-Node-SDK package.
// @TODO eventually migrate to Node.js SDK package.
import { ISignalListener } from './types';
import { thenable } from '../utils/promise/thenable';
import { MaybeThenable } from '../dtos/types';
Expand All @@ -25,7 +25,7 @@ export class NodeSignalListener implements ISignalListener {
syncManager: ISyncManager | undefined, // private handler: () => MaybeThenable<void>,
settings: ISettings
) {
// @TODO review handler logic when implementing Node SDK
// @TODO review handler logic when implementing Node.js SDK
this.handler = function () {
if (syncManager) {
// syncManager.stop();
Expand Down
4 changes: 2 additions & 2 deletions src/sdkFactory/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface IPlatform {
*/
getEventSource?: (settings: ISettings) => (IEventSourceConstructor | undefined)
/**
* EventEmitter constructor, like NodeJS.EventEmitter or a polyfill.
* EventEmitter constructor, like Node.js EventEmitter or a polyfill.
*/
EventEmitter: new () => SplitIO.IEventEmitter,
/**
Expand Down Expand Up @@ -104,7 +104,7 @@ export interface ISdkFactoryParams {
filterAdapterFactory?: () => IFilterAdapter

// Optional signal listener constructor. Used to handle special app states, like shutdown, app paused or resumed.
// Pass only if `syncManager` (used by Node listener) and `splitApi` (used by Browser listener) are passed.
// Pass only if `syncManager` (used by NodeSignalListener) and `splitApi` (used by Browser listener) are passed.
SignalListener?: new (
syncManager: ISyncManager | undefined, // Used by NodeSignalListener to flush data, and by BrowserSignalListener to close streaming connection.
settings: ISettings, // Used by BrowserSignalListener
Expand Down
2 changes: 1 addition & 1 deletion src/storages/inRedis/SplitsCacheInRedis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function processPipelineAnswer(results: Array<[Error | null, string]>): string[]

/**
* ISplitsCacheAsync implementation that stores split definitions in Redis.
* Supported by Node.
* Supported by Node.js
*/
export class SplitsCacheInRedis extends AbstractSplitsCacheAsync {

Expand Down
2 changes: 1 addition & 1 deletion src/storages/inRedis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface InRedisStorageOptions {
}

/**
* InRedis storage factory for consumer server-side SplitFactory, that uses `Ioredis` Redis client for Node.
* InRedis storage factory for consumer server-side SplitFactory, that uses `Ioredis` Redis client for Node.js
* @see {@link https://www.npmjs.com/package/ioredis}
*/
export function InRedisStorage(options: InRedisStorageOptions = {}): IStorageAsyncFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test('Hasher 128 / Impression Hasher Does Not Crash', () => {
expect(hashImpression128(imp1)).not.toBe(null);
});

test('Server-side (Node JS) / Impression Observer Basic Functionality', () => {
test('Server-side (Node.js) / Impression Observer Basic Functionality', () => {
const observer = impressionObserverSSFactory();

const imp = {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/settingsValidation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const base = {
// Defines if the logs are enabled, SDK wide.
debug: undefined,

// Defines the impression listener, but will only be used on NodeJS.
// Defines the impression listener.
impressionListener: undefined,

// Instance version.
Expand Down
2 changes: 1 addition & 1 deletion src/utils/settingsValidation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ISettings } from '../../types';

/**
* Parameters used to specialize the settings validation for each API variant
* (client-side, server-side) and environment (Node server, Browser, etc)
* (client-side, server-side) and environment (Node.js, Browser, etc)
*/
export interface ISettingsValidationParams {
/**
Expand Down
34 changes: 17 additions & 17 deletions types/splitio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ interface INonPluggableSharedSettings {
*/
interface IServerSideSharedSettings {
/**
* SDK Core settings for NodeJS.
* SDK Core settings for Node.js.
*/
core: {
/**
Expand All @@ -187,7 +187,7 @@ interface IServerSideSharedSettings {
IPAddressesEnabled?: boolean;
};
/**
* SDK Startup settings for NodeJS.
* SDK Startup settings for Node.js.
*/
startup?: {
/**
Expand Down Expand Up @@ -450,7 +450,7 @@ interface IClientSideSyncSharedSettings extends IClientSideSharedSettings, ISync
declare namespace SplitIO {

/**
* EventEmitter interface based on a subset of the NodeJS.EventEmitter methods.
* EventEmitter interface based on a subset of the Node.js EventEmitter methods.
*/
interface IEventEmitter {
addListener(event: string, listener: (...args: any[]) => void): this;
Expand All @@ -462,7 +462,7 @@ declare namespace SplitIO {
emit(event: string, ...args: any[]): boolean;
}
/**
* NodeJS.EventEmitter interface
* Node.js EventEmitter interface
* @see {@link https://nodejs.org/api/events.html}
*/
interface EventEmitter extends IEventEmitter {
Expand All @@ -478,7 +478,7 @@ declare namespace SplitIO {
listeners(event: string | symbol): Function[];
rawListeners(event: string | symbol): Function[];
listenerCount(type: string | symbol): number;
// Added in Node 6...
// Added in Node.js 6...
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
eventNames(): Array<string | symbol>;
Expand Down Expand Up @@ -557,7 +557,7 @@ declare namespace SplitIO {
readonly debug: boolean | LogLevel | ILogger;
readonly version: string;
/**
* Mocked features map if using in client-side, or mocked features file path string if using in server-side (NodeJS).
* Mocked features map if using in client-side, or mocked features file path string if using in server-side (Node.js).
*/
features: MockedFeaturesMap | MockedFeaturesFilePath;
readonly streamingEnabled: boolean;
Expand All @@ -576,7 +576,7 @@ declare namespace SplitIO {
};
readonly impressionListener?: IImpressionListener;
/**
* User consent status if using in client-side. Undefined if using in server-side (NodeJS).
* User consent status if using in client-side. Undefined if using in server-side (Node.js).
*/
readonly userConsent?: ConsentStatus;
}
Expand Down Expand Up @@ -936,11 +936,11 @@ declare namespace SplitIO {
wrapper: Object;
}
/**
* Synchronous storage valid types for NodeJS.
* Synchronous storage valid types for Node.js.
*/
type NodeSyncStorage = 'MEMORY';
/**
* Asynchronous storages valid types for NodeJS.
* Asynchronous storages valid types for Node.js.
*/
type NodeAsyncStorage = 'REDIS';
/**
Expand Down Expand Up @@ -1237,14 +1237,14 @@ declare namespace SplitIO {
};
}
/**
* Settings interface for JavaScript SDK instances created on NodeJS, with server-side API and synchronous in-memory storage.
* Settings interface for JavaScript SDK instances created on Node.js, with server-side API and synchronous in-memory storage.
* If your storage is asynchronous (Redis for example) use SplitIO.INodeAsyncSettings instead.
*
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
*/
interface INodeSettings extends IServerSideSharedSettings, ISyncSharedSettings, INonPluggableSharedSettings {
/**
* Defines which kind of storage we can instantiate on NodeJS for 'standalone' mode.
* Defines which kind of storage we can instantiate on Node.js for 'standalone' mode.
* The only possible storage type is 'MEMORY', which is the default.
*/
storage?: {
Expand All @@ -1263,7 +1263,7 @@ declare namespace SplitIO {
};
sync?: ISyncSharedSettings['sync'] & {
/**
* Custom options object for HTTP(S) requests in NodeJS.
* Custom options object for HTTP(S) requests in Node.js.
* If provided, this object is merged with the options object passed by the SDK for EventSource and Node-Fetch calls.
* @see {@link https://www.npmjs.com/package/node-fetch#options}
*/
Expand Down Expand Up @@ -1291,7 +1291,7 @@ declare namespace SplitIO {
*/
getHeaderOverrides?: (context: { headers: Record<string, string> }) => Record<string, string>;
/**
* Custom NodeJS HTTP(S) Agent used by the SDK for HTTP(S) requests.
* Custom Node.js HTTP(S) Agent used by the SDK for HTTP(S) requests.
*
* You can use it, for example, for certificate pinning or setting a network proxy:
*
Expand Down Expand Up @@ -1319,7 +1319,7 @@ declare namespace SplitIO {
};
}
/**
* Settings interface for JavaScript SDK instances created on NodeJS, with asynchronous storage like Redis.
* Settings interface for JavaScript SDK instances created on Node.js, with asynchronous storage like Redis.
* If your storage is synchronous (by default we use memory, which is sync) use SplitIO.INodeSettings instead.
*
* @see {@link https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK#configuration}
Expand All @@ -1332,7 +1332,7 @@ declare namespace SplitIO {
*/
mode: 'consumer';
/**
* Defines which kind of async storage we can instantiate on NodeJS for 'consumer' mode.
* Defines which kind of async storage we can instantiate on Node.js for 'consumer' mode.
* The only possible storage type is 'REDIS'.
*/
storage: {
Expand Down Expand Up @@ -1501,7 +1501,7 @@ declare namespace SplitIO {
}
/**
* This represents the interface for the Client instance on server-side, where the user key is not bound to the instance and must be provided on each method call.
* This interface is available in NodeJS, or when importing the 'server' sub-package of JS SDK (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
* This interface is available in Node.js, or when importing the 'server' sub-package of JS SDK (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
*/
interface IClient extends IBasicClient {
/**
Expand Down Expand Up @@ -1592,7 +1592,7 @@ declare namespace SplitIO {
/**
* This represents the interface for the Client instance on server-side with asynchronous storage, like REDIS.
* User key is not bound to the instance and must be provided on each method call, which returns a promise.
* This interface is available in NodeJS, or when importing the 'server' sub-package in JS SDK (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
* This interface is available in Node.js, or when importing the 'server' sub-package in JS SDK (e.g., `import { SplitFactory } from '@splitsoftware/splitio/server'`).
*/
interface IAsyncClient extends IBasicClient {
/**
Expand Down

0 comments on commit d6d14f9

Please sign in to comment.