@featbit/js-client-sdk 2.0.2 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -201
- package/README.md +160 -152
- package/dist/esm/Configuration.d.ts +35 -0
- package/dist/esm/Configuration.d.ts.map +1 -0
- package/dist/esm/Configuration.js +179 -0
- package/dist/esm/Configuration.js.map +1 -0
- package/dist/esm/Context.d.ts +23 -0
- package/dist/esm/Context.d.ts.map +1 -0
- package/dist/esm/Context.js +49 -0
- package/dist/esm/Context.js.map +1 -0
- package/dist/esm/FbClientBuilder.d.ts +90 -0
- package/dist/esm/FbClientBuilder.d.ts.map +1 -0
- package/dist/esm/FbClientBuilder.js +133 -0
- package/dist/esm/FbClientBuilder.js.map +1 -0
- package/dist/esm/FbClientCore.d.ts +57 -0
- package/dist/esm/FbClientCore.d.ts.map +1 -0
- package/dist/esm/FbClientCore.js +283 -0
- package/dist/esm/FbClientCore.js.map +1 -0
- package/dist/esm/IContextProperty.d.ts +5 -0
- package/dist/esm/IContextProperty.d.ts.map +1 -0
- package/dist/esm/IContextProperty.js +3 -0
- package/dist/esm/IContextProperty.js.map +1 -0
- package/dist/esm/IDataKind.d.ts +12 -0
- package/dist/esm/IDataKind.d.ts.map +1 -0
- package/dist/esm/IDataKind.js +3 -0
- package/dist/esm/IDataKind.js.map +1 -0
- package/dist/esm/IFbClient.d.ts +30 -0
- package/dist/esm/IFbClient.d.ts.map +1 -0
- package/dist/esm/IFbClient.js +3 -0
- package/dist/esm/IFbClient.js.map +1 -0
- package/dist/esm/IFbClientCore.d.ts +240 -0
- package/dist/esm/IFbClientCore.d.ts.map +1 -0
- package/dist/esm/IFbClientCore.js +3 -0
- package/dist/esm/IFbClientCore.js.map +1 -0
- package/dist/esm/IVersionedData.d.ts +18 -0
- package/dist/esm/IVersionedData.d.ts.map +1 -0
- package/dist/esm/IVersionedData.js +3 -0
- package/dist/esm/IVersionedData.js.map +1 -0
- package/dist/esm/bootstrap/IBootstrapProvider.d.ts +5 -0
- package/dist/esm/bootstrap/IBootstrapProvider.d.ts.map +1 -0
- package/dist/esm/bootstrap/IBootstrapProvider.js +3 -0
- package/dist/esm/bootstrap/IBootstrapProvider.js.map +1 -0
- package/dist/esm/bootstrap/JsonBootstrapProvider.d.ts +9 -0
- package/dist/esm/bootstrap/JsonBootstrapProvider.d.ts.map +1 -0
- package/dist/esm/bootstrap/JsonBootstrapProvider.js +29 -0
- package/dist/esm/bootstrap/JsonBootstrapProvider.js.map +1 -0
- package/dist/esm/bootstrap/NullBootstrapProvider.d.ts +8 -0
- package/dist/esm/bootstrap/NullBootstrapProvider.d.ts.map +1 -0
- package/dist/esm/bootstrap/NullBootstrapProvider.js +19 -0
- package/dist/esm/bootstrap/NullBootstrapProvider.js.map +1 -0
- package/dist/esm/bootstrap/index.d.ts +4 -0
- package/dist/esm/bootstrap/index.d.ts.map +1 -0
- package/dist/esm/bootstrap/index.js +20 -0
- package/dist/esm/bootstrap/index.js.map +1 -0
- package/dist/esm/constants.d.ts +3 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +6 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/data-sources/DataSourceUpdates.d.ts +17 -0
- package/dist/esm/data-sources/DataSourceUpdates.d.ts.map +1 -0
- package/dist/esm/data-sources/DataSourceUpdates.js +89 -0
- package/dist/esm/data-sources/DataSourceUpdates.js.map +1 -0
- package/dist/esm/data-sources/createStreamListeners.d.ts +19 -0
- package/dist/esm/data-sources/createStreamListeners.d.ts.map +1 -0
- package/dist/esm/data-sources/createStreamListeners.js +49 -0
- package/dist/esm/data-sources/createStreamListeners.js.map +1 -0
- package/dist/esm/data-sources/index.d.ts +3 -0
- package/dist/esm/data-sources/index.d.ts.map +1 -0
- package/dist/esm/data-sources/index.js +19 -0
- package/dist/esm/data-sources/index.js.map +1 -0
- package/dist/esm/data-sync/DataSyncMode.d.ts +5 -0
- package/dist/esm/data-sync/DataSyncMode.d.ts.map +1 -0
- package/dist/esm/data-sync/DataSyncMode.js +9 -0
- package/dist/esm/data-sync/DataSyncMode.js.map +1 -0
- package/dist/esm/data-sync/IDataSynchronizer.d.ts +15 -0
- package/dist/esm/data-sync/IDataSynchronizer.d.ts.map +1 -0
- package/dist/esm/data-sync/IDataSynchronizer.js +3 -0
- package/dist/esm/data-sync/IDataSynchronizer.js.map +1 -0
- package/dist/esm/data-sync/IRequestor.d.ts +11 -0
- package/dist/esm/data-sync/IRequestor.d.ts.map +1 -0
- package/dist/esm/data-sync/IRequestor.js +3 -0
- package/dist/esm/data-sync/IRequestor.js.map +1 -0
- package/dist/esm/data-sync/NullDataSynchronizer.d.ts +8 -0
- package/dist/esm/data-sync/NullDataSynchronizer.d.ts.map +1 -0
- package/dist/esm/data-sync/NullDataSynchronizer.js +15 -0
- package/dist/esm/data-sync/NullDataSynchronizer.js.map +1 -0
- package/dist/esm/data-sync/PollingDataSynchronizer.d.ts +23 -0
- package/dist/esm/data-sync/PollingDataSynchronizer.d.ts.map +1 -0
- package/dist/esm/data-sync/PollingDataSynchronizer.js +87 -0
- package/dist/esm/data-sync/PollingDataSynchronizer.js.map +1 -0
- package/dist/esm/data-sync/Requestor.d.ts +20 -0
- package/dist/esm/data-sync/Requestor.d.ts.map +1 -0
- package/dist/esm/data-sync/Requestor.js +56 -0
- package/dist/esm/data-sync/Requestor.js.map +1 -0
- package/dist/esm/data-sync/WebSocketDataSynchronizer.d.ts +20 -0
- package/dist/esm/data-sync/WebSocketDataSynchronizer.d.ts.map +1 -0
- package/dist/esm/data-sync/WebSocketDataSynchronizer.js +55 -0
- package/dist/esm/data-sync/WebSocketDataSynchronizer.js.map +1 -0
- package/dist/esm/data-sync/index.d.ts +10 -0
- package/dist/esm/data-sync/index.d.ts.map +1 -0
- package/dist/esm/data-sync/index.js +26 -0
- package/dist/esm/data-sync/index.js.map +1 -0
- package/dist/esm/data-sync/types.d.ts +17 -0
- package/dist/esm/data-sync/types.d.ts.map +1 -0
- package/dist/esm/data-sync/types.js +9 -0
- package/dist/esm/data-sync/types.js.map +1 -0
- package/dist/esm/data-sync/utils.d.ts +3 -0
- package/dist/esm/data-sync/utils.d.ts.map +1 -0
- package/dist/esm/data-sync/utils.js +33 -0
- package/dist/esm/data-sync/utils.js.map +1 -0
- package/dist/esm/errors.d.ts +16 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +41 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/evaluation/EvalResult.d.ts +20 -0
- package/dist/esm/evaluation/EvalResult.d.ts.map +1 -0
- package/dist/esm/evaluation/EvalResult.js +33 -0
- package/dist/esm/evaluation/EvalResult.js.map +1 -0
- package/dist/esm/evaluation/Evaluator.d.ts +15 -0
- package/dist/esm/evaluation/Evaluator.d.ts.map +1 -0
- package/dist/esm/evaluation/Evaluator.js +28 -0
- package/dist/esm/evaluation/Evaluator.js.map +1 -0
- package/dist/esm/evaluation/IEvalDetail.d.ts +21 -0
- package/dist/esm/evaluation/IEvalDetail.d.ts.map +1 -0
- package/dist/esm/evaluation/IEvalDetail.js +3 -0
- package/dist/esm/evaluation/IEvalDetail.js.map +1 -0
- package/dist/esm/evaluation/ReasonKinds.d.ts +11 -0
- package/dist/esm/evaluation/ReasonKinds.d.ts.map +1 -0
- package/dist/esm/evaluation/ReasonKinds.js +15 -0
- package/dist/esm/evaluation/ReasonKinds.js.map +1 -0
- package/dist/esm/evaluation/data/IFlag.d.ts +26 -0
- package/dist/esm/evaluation/data/IFlag.d.ts.map +1 -0
- package/dist/esm/evaluation/data/IFlag.js +12 -0
- package/dist/esm/evaluation/data/IFlag.js.map +1 -0
- package/dist/esm/evaluation/data/index.d.ts +2 -0
- package/dist/esm/evaluation/data/index.d.ts.map +1 -0
- package/dist/esm/evaluation/data/index.js +18 -0
- package/dist/esm/evaluation/data/index.js.map +1 -0
- package/dist/esm/evaluation/index.d.ts +6 -0
- package/dist/esm/evaluation/index.d.ts.map +1 -0
- package/dist/esm/evaluation/index.js +22 -0
- package/dist/esm/evaluation/index.js.map +1 -0
- package/dist/esm/events/DefaultEventProcessor.d.ts +16 -0
- package/dist/esm/events/DefaultEventProcessor.d.ts.map +1 -0
- package/dist/esm/events/DefaultEventProcessor.js +79 -0
- package/dist/esm/events/DefaultEventProcessor.js.map +1 -0
- package/dist/esm/events/DefaultEventQueue.d.ts +18 -0
- package/dist/esm/events/DefaultEventQueue.d.ts.map +1 -0
- package/dist/esm/events/DefaultEventQueue.js +42 -0
- package/dist/esm/events/DefaultEventQueue.js.map +1 -0
- package/dist/esm/events/DefaultEventSender.d.ts +10 -0
- package/dist/esm/events/DefaultEventSender.d.ts.map +1 -0
- package/dist/esm/events/DefaultEventSender.js +67 -0
- package/dist/esm/events/DefaultEventSender.js.map +1 -0
- package/dist/esm/events/DefaultEventSerializer.d.ts +6 -0
- package/dist/esm/events/DefaultEventSerializer.d.ts.map +1 -0
- package/dist/esm/events/DefaultEventSerializer.js +14 -0
- package/dist/esm/events/DefaultEventSerializer.js.map +1 -0
- package/dist/esm/events/EventDispatcher.d.ts +17 -0
- package/dist/esm/events/EventDispatcher.d.ts.map +1 -0
- package/dist/esm/events/EventDispatcher.js +127 -0
- package/dist/esm/events/EventDispatcher.js.map +1 -0
- package/dist/esm/events/EventSerializer.d.ts +5 -0
- package/dist/esm/events/EventSerializer.d.ts.map +1 -0
- package/dist/esm/events/EventSerializer.js +3 -0
- package/dist/esm/events/EventSerializer.js.map +1 -0
- package/dist/esm/events/IEventProcessor.d.ts +7 -0
- package/dist/esm/events/IEventProcessor.d.ts.map +1 -0
- package/dist/esm/events/IEventProcessor.js +3 -0
- package/dist/esm/events/IEventProcessor.js.map +1 -0
- package/dist/esm/events/IEventQueue.d.ts +11 -0
- package/dist/esm/events/IEventQueue.d.ts.map +1 -0
- package/dist/esm/events/IEventQueue.js +3 -0
- package/dist/esm/events/IEventQueue.js.map +1 -0
- package/dist/esm/events/IEventSender.d.ts +13 -0
- package/dist/esm/events/IEventSender.d.ts.map +1 -0
- package/dist/esm/events/IEventSender.js +10 -0
- package/dist/esm/events/IEventSender.js.map +1 -0
- package/dist/esm/events/NullEventProcessor.d.ts +8 -0
- package/dist/esm/events/NullEventProcessor.d.ts.map +1 -0
- package/dist/esm/events/NullEventProcessor.js +16 -0
- package/dist/esm/events/NullEventProcessor.js.map +1 -0
- package/dist/esm/events/event.d.ts +44 -0
- package/dist/esm/events/event.d.ts.map +1 -0
- package/dist/esm/events/event.js +115 -0
- package/dist/esm/events/event.js.map +1 -0
- package/dist/esm/events/index.d.ts +12 -0
- package/dist/esm/events/index.d.ts.map +1 -0
- package/dist/esm/events/index.js +28 -0
- package/dist/esm/events/index.js.map +1 -0
- package/dist/esm/index.d.ts +21 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +37 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/integrations/TestLogger.d.ts +10 -0
- package/dist/esm/integrations/TestLogger.d.ts.map +1 -0
- package/dist/esm/integrations/TestLogger.js +25 -0
- package/dist/esm/integrations/TestLogger.js.map +1 -0
- package/dist/esm/integrations/index.d.ts +3 -0
- package/dist/esm/integrations/index.d.ts.map +1 -0
- package/dist/esm/integrations/index.js +21 -0
- package/dist/esm/integrations/index.js.map +1 -0
- package/dist/esm/integrations/test_data/FlagBuilder.d.ts +19 -0
- package/dist/esm/integrations/test_data/FlagBuilder.d.ts.map +1 -0
- package/dist/esm/integrations/test_data/FlagBuilder.js +56 -0
- package/dist/esm/integrations/test_data/FlagBuilder.js.map +1 -0
- package/dist/esm/integrations/test_data/TestData.d.ts +18 -0
- package/dist/esm/integrations/test_data/TestData.d.ts.map +1 -0
- package/dist/esm/integrations/test_data/TestData.js +38 -0
- package/dist/esm/integrations/test_data/TestData.js.map +1 -0
- package/dist/esm/integrations/test_data/TestDataSynchronizer.d.ts +21 -0
- package/dist/esm/integrations/test_data/TestDataSynchronizer.d.ts.map +1 -0
- package/dist/esm/integrations/test_data/TestDataSynchronizer.js +50 -0
- package/dist/esm/integrations/test_data/TestDataSynchronizer.js.map +1 -0
- package/dist/esm/integrations/test_data/index.d.ts +5 -0
- package/dist/esm/integrations/test_data/index.d.ts.map +1 -0
- package/dist/esm/integrations/test_data/index.js +13 -0
- package/dist/esm/integrations/test_data/index.js.map +1 -0
- package/dist/esm/logging/BasicLogger.d.ts +34 -0
- package/dist/esm/logging/BasicLogger.d.ts.map +1 -0
- package/dist/esm/logging/BasicLogger.js +101 -0
- package/dist/esm/logging/BasicLogger.js.map +1 -0
- package/dist/esm/logging/IBasicLoggerOptions.d.ts +43 -0
- package/dist/esm/logging/IBasicLoggerOptions.d.ts.map +1 -0
- package/dist/esm/logging/IBasicLoggerOptions.js +3 -0
- package/dist/esm/logging/IBasicLoggerOptions.js.map +1 -0
- package/dist/esm/logging/ILogger.d.ts +47 -0
- package/dist/esm/logging/ILogger.d.ts.map +1 -0
- package/dist/esm/logging/ILogger.js +3 -0
- package/dist/esm/logging/ILogger.js.map +1 -0
- package/dist/esm/logging/LogLevel.d.ts +10 -0
- package/dist/esm/logging/LogLevel.d.ts.map +1 -0
- package/dist/esm/logging/LogLevel.js +3 -0
- package/dist/esm/logging/LogLevel.js.map +1 -0
- package/dist/esm/logging/SafeLogger.d.ts +28 -0
- package/dist/esm/logging/SafeLogger.d.ts.map +1 -0
- package/dist/esm/logging/SafeLogger.js +64 -0
- package/dist/esm/logging/SafeLogger.js.map +1 -0
- package/dist/esm/logging/format.d.ts +12 -0
- package/dist/esm/logging/format.d.ts.map +1 -0
- package/dist/esm/logging/format.js +156 -0
- package/dist/esm/logging/format.js.map +1 -0
- package/dist/esm/logging/index.d.ts +7 -0
- package/dist/esm/logging/index.d.ts.map +1 -0
- package/dist/esm/logging/index.js +23 -0
- package/dist/esm/logging/index.js.map +1 -0
- package/dist/esm/options/ClientContext.d.ts +28 -0
- package/dist/esm/options/ClientContext.d.ts.map +1 -0
- package/dist/esm/options/ClientContext.js +21 -0
- package/dist/esm/options/ClientContext.js.map +1 -0
- package/dist/esm/options/IClientContext.d.ts +45 -0
- package/dist/esm/options/IClientContext.d.ts.map +1 -0
- package/dist/esm/options/IClientContext.js +3 -0
- package/dist/esm/options/IClientContext.js.map +1 -0
- package/dist/esm/options/IOptions.d.ts +101 -0
- package/dist/esm/options/IOptions.d.ts.map +1 -0
- package/dist/esm/options/IOptions.js +3 -0
- package/dist/esm/options/IOptions.js.map +1 -0
- package/dist/esm/options/IUser.d.ts +7 -0
- package/dist/esm/options/IUser.d.ts.map +1 -0
- package/dist/esm/options/IUser.js +3 -0
- package/dist/esm/options/IUser.js.map +1 -0
- package/dist/esm/options/IValidatedOptions.d.ts +27 -0
- package/dist/esm/options/IValidatedOptions.d.ts.map +1 -0
- package/dist/esm/options/IValidatedOptions.js +3 -0
- package/dist/esm/options/IValidatedOptions.js.map +1 -0
- package/dist/esm/options/OptionMessages.d.ts +14 -0
- package/dist/esm/options/OptionMessages.d.ts.map +1 -0
- package/dist/esm/options/OptionMessages.js +33 -0
- package/dist/esm/options/OptionMessages.js.map +1 -0
- package/dist/esm/options/UserBuilder.d.ts +17 -0
- package/dist/esm/options/UserBuilder.d.ts.map +1 -0
- package/dist/esm/options/UserBuilder.js +35 -0
- package/dist/esm/options/UserBuilder.js.map +1 -0
- package/dist/esm/options/Validators.d.ts +111 -0
- package/dist/esm/options/Validators.d.ts.map +1 -0
- package/dist/esm/options/Validators.js +247 -0
- package/dist/esm/options/Validators.js.map +1 -0
- package/dist/esm/options/index.d.ts +9 -0
- package/dist/esm/options/index.d.ts.map +1 -0
- package/dist/esm/options/index.js +25 -0
- package/dist/esm/options/index.js.map +1 -0
- package/dist/esm/platform/IInfo.d.ts +92 -0
- package/dist/esm/platform/IInfo.d.ts.map +1 -0
- package/dist/esm/platform/IInfo.js +3 -0
- package/dist/esm/platform/IInfo.js.map +1 -0
- package/dist/esm/platform/IPlatform.d.ts +19 -0
- package/dist/esm/platform/IPlatform.d.ts.map +1 -0
- package/dist/esm/platform/IPlatform.js +3 -0
- package/dist/esm/platform/IPlatform.js.map +1 -0
- package/dist/esm/platform/IStore.d.ts +104 -0
- package/dist/esm/platform/IStore.d.ts.map +1 -0
- package/dist/esm/platform/IStore.js +3 -0
- package/dist/esm/platform/IStore.js.map +1 -0
- package/dist/esm/platform/IWebSocket.d.ts +21 -0
- package/dist/esm/platform/IWebSocket.d.ts.map +1 -0
- package/dist/esm/platform/IWebSocket.js +3 -0
- package/dist/esm/platform/IWebSocket.js.map +1 -0
- package/dist/esm/platform/browser/BrowserInfo.d.ts +7 -0
- package/dist/esm/platform/browser/BrowserInfo.d.ts.map +1 -0
- package/dist/esm/platform/browser/BrowserInfo.js +24 -0
- package/dist/esm/platform/browser/BrowserInfo.js.map +1 -0
- package/dist/esm/platform/browser/BrowserPlatform.d.ts +12 -0
- package/dist/esm/platform/browser/BrowserPlatform.d.ts.map +1 -0
- package/dist/esm/platform/browser/BrowserPlatform.js +17 -0
- package/dist/esm/platform/browser/BrowserPlatform.js.map +1 -0
- package/dist/esm/platform/browser/BrowserRequests.d.ts +5 -0
- package/dist/esm/platform/browser/BrowserRequests.d.ts.map +1 -0
- package/dist/esm/platform/browser/BrowserRequests.js +10 -0
- package/dist/esm/platform/browser/BrowserRequests.js.map +1 -0
- package/dist/esm/platform/browser/BrowserWebSocket.d.ts +38 -0
- package/dist/esm/platform/browser/BrowserWebSocket.d.ts.map +1 -0
- package/dist/esm/platform/browser/BrowserWebSocket.js +129 -0
- package/dist/esm/platform/browser/BrowserWebSocket.js.map +1 -0
- package/dist/esm/platform/browser/FbClient.d.ts +30 -0
- package/dist/esm/platform/browser/FbClient.d.ts.map +1 -0
- package/dist/esm/platform/browser/FbClient.js +52 -0
- package/dist/esm/platform/browser/FbClient.js.map +1 -0
- package/dist/esm/platform/browser/LocalStorageStore.d.ts +12 -0
- package/dist/esm/platform/browser/LocalStorageStore.d.ts.map +1 -0
- package/dist/esm/platform/browser/LocalStorageStore.js +65 -0
- package/dist/esm/platform/browser/LocalStorageStore.js.map +1 -0
- package/dist/esm/platform/index.d.ts +9 -0
- package/dist/esm/platform/index.d.ts.map +1 -0
- package/dist/esm/platform/index.js +29 -0
- package/dist/esm/platform/index.js.map +1 -0
- package/dist/esm/platform/requests.d.ts +64 -0
- package/dist/esm/platform/requests.d.ts.map +1 -0
- package/dist/esm/platform/requests.js +7 -0
- package/dist/esm/platform/requests.js.map +1 -0
- package/dist/esm/store/BaseStore.d.ts +25 -0
- package/dist/esm/store/BaseStore.d.ts.map +1 -0
- package/dist/esm/store/BaseStore.js +125 -0
- package/dist/esm/store/BaseStore.js.map +1 -0
- package/dist/esm/store/DataKinds.d.ts +5 -0
- package/dist/esm/store/DataKinds.d.ts.map +1 -0
- package/dist/esm/store/DataKinds.js +9 -0
- package/dist/esm/store/DataKinds.js.map +1 -0
- package/dist/esm/store/IDataSourceUpdates.d.ts +48 -0
- package/dist/esm/store/IDataSourceUpdates.d.ts.map +1 -0
- package/dist/esm/store/IDataSourceUpdates.js +3 -0
- package/dist/esm/store/IDataSourceUpdates.js.map +1 -0
- package/dist/esm/store/InMemoryStore.d.ts +11 -0
- package/dist/esm/store/InMemoryStore.d.ts.map +1 -0
- package/dist/esm/store/InMemoryStore.js +46 -0
- package/dist/esm/store/InMemoryStore.js.map +1 -0
- package/dist/esm/store/index.d.ts +7 -0
- package/dist/esm/store/index.d.ts.map +1 -0
- package/dist/esm/store/index.js +23 -0
- package/dist/esm/store/index.js.map +1 -0
- package/dist/esm/store/serialization.d.ts +23 -0
- package/dist/esm/store/serialization.d.ts.map +1 -0
- package/dist/esm/store/serialization.js +37 -0
- package/dist/esm/store/serialization.js.map +1 -0
- package/dist/esm/store/store.d.ts +30 -0
- package/dist/esm/store/store.d.ts.map +1 -0
- package/dist/esm/store/store.js +6 -0
- package/dist/esm/store/store.js.map +1 -0
- package/dist/esm/utils/Emits.d.ts +30 -0
- package/dist/esm/utils/Emits.d.ts.map +1 -0
- package/dist/esm/utils/Emits.js +64 -0
- package/dist/esm/utils/Emits.js.map +1 -0
- package/dist/esm/utils/EventEmitter.d.ts +22 -0
- package/dist/esm/utils/EventEmitter.d.ts.map +1 -0
- package/dist/esm/utils/EventEmitter.js +108 -0
- package/dist/esm/utils/EventEmitter.js.map +1 -0
- package/dist/esm/utils/IEventEmitter.d.ts +16 -0
- package/dist/esm/utils/IEventEmitter.d.ts.map +1 -0
- package/dist/esm/utils/IEventEmitter.js +3 -0
- package/dist/esm/utils/IEventEmitter.js.map +1 -0
- package/dist/esm/utils/Regex.d.ts +7 -0
- package/dist/esm/utils/Regex.d.ts.map +1 -0
- package/dist/esm/utils/Regex.js +22 -0
- package/dist/esm/utils/Regex.js.map +1 -0
- package/dist/esm/utils/ValueConverters.d.ts +13 -0
- package/dist/esm/utils/ValueConverters.d.ts.map +1 -0
- package/dist/esm/utils/ValueConverters.js +46 -0
- package/dist/esm/utils/ValueConverters.js.map +1 -0
- package/dist/esm/utils/VoidFunction.d.ts +2 -0
- package/dist/esm/utils/VoidFunction.d.ts.map +1 -0
- package/dist/esm/utils/VoidFunction.js +3 -0
- package/dist/esm/utils/VoidFunction.js.map +1 -0
- package/dist/esm/utils/canonicalizeUri.d.ts +2 -0
- package/dist/esm/utils/canonicalizeUri.d.ts.map +1 -0
- package/dist/esm/utils/canonicalizeUri.js +9 -0
- package/dist/esm/utils/canonicalizeUri.js.map +1 -0
- package/dist/esm/utils/debounce.d.ts +22 -0
- package/dist/esm/utils/debounce.d.ts.map +1 -0
- package/dist/esm/utils/debounce.js +34 -0
- package/dist/esm/utils/debounce.js.map +1 -0
- package/dist/esm/utils/http.d.ts +12 -0
- package/dist/esm/utils/http.d.ts.map +1 -0
- package/dist/esm/utils/http.js +26 -0
- package/dist/esm/utils/http.js.map +1 -0
- package/dist/esm/utils/index.d.ts +7 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/index.js +23 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/isNullOrUndefined.d.ts +2 -0
- package/dist/esm/utils/isNullOrUndefined.d.ts.map +1 -0
- package/dist/esm/utils/isNullOrUndefined.js +8 -0
- package/dist/esm/utils/isNullOrUndefined.js.map +1 -0
- package/dist/esm/utils/serializeUser.d.ts +3 -0
- package/dist/esm/utils/serializeUser.d.ts.map +1 -0
- package/dist/esm/utils/serializeUser.js +24 -0
- package/dist/esm/utils/serializeUser.js.map +1 -0
- package/dist/esm/utils/sleep.d.ts +3 -0
- package/dist/esm/utils/sleep.d.ts.map +1 -0
- package/dist/esm/utils/sleep.js +18 -0
- package/dist/esm/utils/sleep.js.map +1 -0
- package/dist/esm/version.d.ts +3 -0
- package/dist/esm/version.d.ts.map +1 -0
- package/dist/esm/version.js +6 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/umd/featbit-js-client-sdk-3.0.1.js +2 -0
- package/dist/umd/featbit-js-client-sdk-3.0.1.js.map +1 -0
- package/dist/umd/featbit-js-client-sdk.js +2 -0
- package/dist/umd/featbit-js-client-sdk.js.map +1 -0
- package/package.json +22 -24
- package/src/Configuration.ts +233 -0
- package/src/Context.ts +62 -0
- package/src/FbClientBuilder.ts +161 -0
- package/src/FbClientCore.ts +389 -0
- package/src/IContextProperty.ts +4 -0
- package/src/IDataKind.ts +11 -0
- package/src/IFbClient.ts +30 -0
- package/src/IFbClientCore.ts +291 -0
- package/src/IVersionedData.ts +18 -0
- package/src/bootstrap/IBootstrapProvider.ts +5 -0
- package/src/bootstrap/JsonBootstrapProvider.ts +35 -0
- package/src/bootstrap/NullBootstrapProvider.ts +21 -0
- package/src/bootstrap/index.ts +3 -0
- package/src/constants.ts +2 -6
- package/src/data-sources/DataSourceUpdates.ts +89 -0
- package/src/data-sources/createStreamListeners.ts +66 -0
- package/src/data-sources/index.ts +2 -0
- package/src/data-sync/DataSyncMode.ts +4 -0
- package/src/data-sync/IDataSynchronizer.ts +15 -0
- package/src/data-sync/IRequestor.ts +10 -0
- package/src/data-sync/NullDataSynchronizer.ts +15 -0
- package/src/data-sync/PollingDataSynchronizer.ts +111 -0
- package/src/data-sync/Requestor.ts +61 -0
- package/src/data-sync/WebSocketDataSynchronizer.ts +74 -0
- package/src/data-sync/index.ts +9 -0
- package/src/data-sync/types.ts +20 -0
- package/src/data-sync/utils.ts +32 -0
- package/src/errors.ts +41 -0
- package/src/evaluation/EvalResult.ts +36 -0
- package/src/evaluation/Evaluator.ts +27 -0
- package/src/evaluation/IEvalDetail.ts +24 -0
- package/src/evaluation/ReasonKinds.ts +10 -0
- package/src/evaluation/data/IFlag.ts +29 -0
- package/src/evaluation/data/index.ts +1 -0
- package/src/evaluation/index.ts +5 -0
- package/src/events/DefaultEventProcessor.ts +84 -0
- package/src/events/DefaultEventQueue.ts +50 -0
- package/src/events/DefaultEventSender.ts +75 -0
- package/src/events/DefaultEventSerializer.ts +12 -0
- package/src/events/EventDispatcher.ts +128 -0
- package/src/events/EventSerializer.ts +5 -0
- package/src/events/IEventProcessor.ts +9 -0
- package/src/events/IEventQueue.ts +17 -0
- package/src/events/IEventSender.ts +14 -0
- package/src/events/NullEventProcessor.ts +16 -0
- package/src/events/event.ts +130 -0
- package/src/events/index.ts +11 -0
- package/src/index.ts +20 -4
- package/src/integrations/TestLogger.ts +25 -0
- package/src/integrations/index.ts +2 -0
- package/src/integrations/test_data/FlagBuilder.ts +60 -0
- package/src/integrations/test_data/TestData.ts +58 -0
- package/src/integrations/test_data/TestDataSynchronizer.ts +50 -0
- package/src/integrations/test_data/index.ts +5 -0
- package/src/logging/BasicLogger.ts +108 -0
- package/src/logging/IBasicLoggerOptions.ts +46 -0
- package/src/logging/ILogger.ts +49 -0
- package/src/logging/LogLevel.ts +9 -0
- package/src/logging/SafeLogger.ts +70 -0
- package/src/logging/format.ts +154 -0
- package/src/logging/index.ts +6 -0
- package/src/options/ClientContext.ts +40 -0
- package/src/options/IClientContext.ts +54 -0
- package/src/options/IOptions.ts +124 -0
- package/src/options/IUser.ts +7 -0
- package/src/options/IValidatedOptions.ts +30 -0
- package/src/options/OptionMessages.ts +36 -0
- package/src/options/UserBuilder.ts +36 -0
- package/src/options/Validators.ts +301 -0
- package/src/options/index.ts +8 -0
- package/src/platform/IInfo.ts +103 -0
- package/src/platform/IPlatform.ts +21 -0
- package/src/platform/IStore.ts +113 -0
- package/src/platform/IWebSocket.ts +23 -0
- package/src/platform/browser/BrowserInfo.ts +25 -0
- package/src/platform/browser/BrowserPlatform.ts +20 -0
- package/src/platform/browser/BrowserRequests.ts +7 -0
- package/src/platform/browser/BrowserWebSocket.ts +143 -0
- package/src/platform/browser/FbClient.ts +65 -0
- package/src/platform/browser/LocalStorageStore.ts +60 -0
- package/src/platform/index.ts +12 -0
- package/src/platform/requests.ts +77 -0
- package/src/store/BaseStore.ts +123 -0
- package/src/store/DataKinds.ts +7 -0
- package/src/store/IDataSourceUpdates.ts +49 -0
- package/src/store/InMemoryStore.ts +37 -0
- package/src/store/index.ts +6 -0
- package/src/store/serialization.ts +52 -0
- package/src/store/store.ts +38 -0
- package/src/utils/Emits.ts +76 -0
- package/src/utils/EventEmitter.ts +129 -0
- package/src/utils/IEventEmitter.ts +15 -0
- package/src/utils/Regex.ts +22 -0
- package/src/utils/ValueConverters.ts +56 -0
- package/src/utils/VoidFunction.ts +1 -0
- package/src/utils/canonicalizeUri.ts +4 -0
- package/src/utils/debounce.ts +33 -0
- package/src/utils/http.ts +40 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/isNullOrUndefined.ts +3 -0
- package/src/utils/serializeUser.ts +28 -0
- package/src/utils/sleep.ts +6 -0
- package/src/version.ts +1 -0
- package/esm/constants.d.ts +0 -6
- package/esm/constants.js +0 -7
- package/esm/constants.js.map +0 -1
- package/esm/events.d.ts +0 -14
- package/esm/events.js +0 -27
- package/esm/events.js.map +0 -1
- package/esm/featbit.d.ts +0 -34
- package/esm/featbit.js +0 -382
- package/esm/featbit.js.map +0 -1
- package/esm/index.d.ts +0 -4
- package/esm/index.js +0 -5
- package/esm/index.js.map +0 -1
- package/esm/logger.d.ts +0 -4
- package/esm/logger.js +0 -20
- package/esm/logger.js.map +0 -1
- package/esm/network.service.d.ts +0 -27
- package/esm/network.service.js +0 -288
- package/esm/network.service.js.map +0 -1
- package/esm/optionMessages.d.ts +0 -5
- package/esm/optionMessages.js +0 -16
- package/esm/optionMessages.js.map +0 -1
- package/esm/queue.d.ts +0 -8
- package/esm/queue.js +0 -35
- package/esm/queue.js.map +0 -1
- package/esm/store.d.ts +0 -20
- package/esm/store.js +0 -143
- package/esm/store.js.map +0 -1
- package/esm/throttleutil.d.ts +0 -9
- package/esm/throttleutil.js +0 -133
- package/esm/throttleutil.js.map +0 -1
- package/esm/types.d.ts +0 -94
- package/esm/types.js +0 -24
- package/esm/types.js.map +0 -1
- package/esm/umd.d.ts +0 -2
- package/esm/utils.d.ts +0 -11
- package/esm/utils.js +0 -142
- package/esm/utils.js.map +0 -1
- package/src/events.ts +0 -29
- package/src/featbit.ts +0 -343
- package/src/logger.ts +0 -13
- package/src/network.service.ts +0 -223
- package/src/optionMessages.ts +0 -13
- package/src/queue.ts +0 -23
- package/src/store.ts +0 -169
- package/src/throttleutil.ts +0 -72
- package/src/types.ts +0 -113
- package/src/umd.ts +0 -15
- package/src/utils.ts +0 -173
- package/umd/featbit-js-client-sdk-2.0.2.js +0 -2
- package/umd/featbit-js-client-sdk-2.0.2.js.map +0 -1
- package/umd/featbit-js-client-sdk.js +0 -2
- package/umd/featbit-js-client-sdk.js.map +0 -1
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { IEvalDetail } from "./evaluation/IEvalDetail";
|
|
2
|
+
import { IConvertResult } from "./utils/ValueConverters";
|
|
3
|
+
import { IUser } from "./options";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The FeatBit SDK client object.
|
|
7
|
+
*
|
|
8
|
+
* Create this object with {@link FbClientBuilder}. Applications should configure the client at startup time
|
|
9
|
+
* and continue to use it throughout the lifetime of the application, rather than creating instances
|
|
10
|
+
* on the fly.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export interface IFbClientCore {
|
|
14
|
+
/**
|
|
15
|
+
* Set the current user of the client.
|
|
16
|
+
*
|
|
17
|
+
* @param user
|
|
18
|
+
* The current user. The actual type of this parameter is
|
|
19
|
+
* {@link IUser}.
|
|
20
|
+
*/
|
|
21
|
+
identify(user: IUser): void;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Indicates whether the client is ready to be used.
|
|
25
|
+
*
|
|
26
|
+
* @returns true if the client is ready to be used, false otherwise.
|
|
27
|
+
*/
|
|
28
|
+
initialized(): boolean;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Wait until the client is initialized. The promise resolves when the client has finished initializing successfully.
|
|
32
|
+
* If the client fails to initialize, the promise will be rejected.
|
|
33
|
+
*
|
|
34
|
+
* @returns A promise.
|
|
35
|
+
*/
|
|
36
|
+
waitForInitialization(): Promise<IFbClientCore>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Calculates the boolean value of a feature flag for a given user.
|
|
40
|
+
*
|
|
41
|
+
* If the flag variation does not have a boolean value, {@link defaultValue} is returned.
|
|
42
|
+
* If an error makes it impossible to evaluate the flag (for instance, the feature flag key
|
|
43
|
+
* does not match any existing flag), {@link defaultValue} is returned.
|
|
44
|
+
*
|
|
45
|
+
* @param key
|
|
46
|
+
* The unique key of the feature flag.
|
|
47
|
+
* @param defaultValue
|
|
48
|
+
* The default value to return if the flag cannot be evaluated.
|
|
49
|
+
*
|
|
50
|
+
* @returns the variation for the given user, or {@link defaultValue} if the flag cannot be evaluated
|
|
51
|
+
*/
|
|
52
|
+
boolVariation(
|
|
53
|
+
key: string,
|
|
54
|
+
defaultValue: boolean
|
|
55
|
+
): boolean;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Calculates the boolean value of a feature flag for a given user, and returns an object that
|
|
59
|
+
* describes the way the value was determined.
|
|
60
|
+
*
|
|
61
|
+
* If the flag variation does not have a boolean value, {@link defaultValue} is returned.
|
|
62
|
+
* If an error makes it impossible to evaluate the flag (for instance, the feature flag key
|
|
63
|
+
* does not match any existing flag), {@link defaultValue} is returned.
|
|
64
|
+
*
|
|
65
|
+
* @param key
|
|
66
|
+
* The unique key of the feature flag.
|
|
67
|
+
* @param defaultValue
|
|
68
|
+
* The default value to return if the flag cannot be evaluated.
|
|
69
|
+
*
|
|
70
|
+
* @returns {@link IEvalDetail} object describing the way the value was determined.
|
|
71
|
+
*/
|
|
72
|
+
boolVariationDetail(
|
|
73
|
+
key: string,
|
|
74
|
+
defaultValue: boolean
|
|
75
|
+
): IEvalDetail<boolean>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Calculates the number value of a feature flag for a given user.
|
|
79
|
+
*
|
|
80
|
+
* If the flag variation does not have a number value, {@link defaultValue} is returned.
|
|
81
|
+
* If an error makes it impossible to evaluate the flag (for instance, the feature flag key
|
|
82
|
+
* does not match any existing flag), {@link defaultValue} is returned.
|
|
83
|
+
*
|
|
84
|
+
* @param key
|
|
85
|
+
* The unique key of the feature flag.
|
|
86
|
+
* @param defaultValue
|
|
87
|
+
* The default value to return if the flag cannot be evaluated.
|
|
88
|
+
*
|
|
89
|
+
* @returns the variation for the given user, or {@link defaultValue} if the flag cannot be evaluated
|
|
90
|
+
*/
|
|
91
|
+
numberVariation(
|
|
92
|
+
key: string,
|
|
93
|
+
defaultValue: number
|
|
94
|
+
): number;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Calculates the number value of a feature flag for a given user, and returns an object that
|
|
98
|
+
* describes the way the value was determined.
|
|
99
|
+
*
|
|
100
|
+
* If the flag variation does not have a number value, {@link defaultValue} is returned.
|
|
101
|
+
* If an error makes it impossible to evaluate the flag (for instance, the feature flag key
|
|
102
|
+
* does not match any existing flag), {@link defaultValue} is returned.
|
|
103
|
+
*
|
|
104
|
+
* @param key
|
|
105
|
+
* The unique key of the feature flag.
|
|
106
|
+
* @param defaultValue
|
|
107
|
+
* The default value to return if the flag cannot be evaluated.
|
|
108
|
+
*
|
|
109
|
+
* @returns {@link IEvalDetail} object describing the way the value was determined.
|
|
110
|
+
*/
|
|
111
|
+
numberVariationDetail(
|
|
112
|
+
key: string,
|
|
113
|
+
defaultValue: number
|
|
114
|
+
): IEvalDetail<number>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Calculates the string value of a feature flag for a given user.
|
|
118
|
+
*
|
|
119
|
+
* If the flag variation does not have a string value, {@link defaultValue} is returned.
|
|
120
|
+
* If an error makes it impossible to evaluate the flag (for instance, the feature flag key
|
|
121
|
+
* does not match any existing flag), {@link defaultValue} is returned.
|
|
122
|
+
*
|
|
123
|
+
* @param key
|
|
124
|
+
* The unique key of the feature flag.
|
|
125
|
+
* @param defaultValue
|
|
126
|
+
* The default value to return if the flag cannot be evaluated.
|
|
127
|
+
*
|
|
128
|
+
* @returns the variation for the given user, or {@link defaultValue} if the flag cannot be evaluated
|
|
129
|
+
*/
|
|
130
|
+
stringVariation(
|
|
131
|
+
key: string,
|
|
132
|
+
defaultValue: string
|
|
133
|
+
): string;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Calculates the string value of a feature flag for a given user, and returns an object that
|
|
137
|
+
* describes the way the value was determined.
|
|
138
|
+
*
|
|
139
|
+
* If the flag variation does not have a string value, {@link defaultValue} is returned.
|
|
140
|
+
* If an error makes it impossible to evaluate the flag (for instance, the feature flag key
|
|
141
|
+
* does not match any existing flag), {@link defaultValue} is returned.
|
|
142
|
+
*
|
|
143
|
+
* @param key
|
|
144
|
+
* The unique key of the feature flag.
|
|
145
|
+
* @param defaultValue
|
|
146
|
+
* The default value to return if the flag cannot be evaluated.
|
|
147
|
+
*
|
|
148
|
+
* @returns {@link IEvalDetail} object describing the way the value was determined.
|
|
149
|
+
*/
|
|
150
|
+
stringVariationDetail(
|
|
151
|
+
key: string,
|
|
152
|
+
defaultValue: string
|
|
153
|
+
): IEvalDetail<string>;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Calculates the JSON value of a feature flag for a given user.
|
|
157
|
+
*
|
|
158
|
+
* If the flag variation does not have a JSON value, {@link defaultValue} is returned.
|
|
159
|
+
* If an error makes it impossible to evaluate the flag (for instance, the feature flag key
|
|
160
|
+
* does not match any existing flag), {@link defaultValue} is returned.
|
|
161
|
+
*
|
|
162
|
+
* @param key
|
|
163
|
+
* The unique key of the feature flag.
|
|
164
|
+
* @param defaultValue
|
|
165
|
+
* The default value to return if the flag cannot be evaluated.
|
|
166
|
+
*
|
|
167
|
+
* @returns the variation for the given user, or {@link defaultValue} if the flag cannot be evaluated
|
|
168
|
+
*/
|
|
169
|
+
jsonVariation(
|
|
170
|
+
key: string,
|
|
171
|
+
defaultValue: any
|
|
172
|
+
): any;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Calculates the JSON value of a feature flag for a given user, and returns an object that
|
|
176
|
+
* describes the way the value was determined.
|
|
177
|
+
*
|
|
178
|
+
* If the flag variation does not have a JSON value, {@link defaultValue} is returned.
|
|
179
|
+
* If an error makes it impossible to evaluate the flag (for instance, the feature flag key
|
|
180
|
+
* does not match any existing flag), {@link defaultValue} is returned.
|
|
181
|
+
*
|
|
182
|
+
* @param key
|
|
183
|
+
* The unique key of the feature flag.
|
|
184
|
+
* @param defaultValue
|
|
185
|
+
* The default value to return if the flag cannot be evaluated.
|
|
186
|
+
*
|
|
187
|
+
* @returns {@link IEvalDetail} object describing the way the value was determined.
|
|
188
|
+
*/
|
|
189
|
+
jsonVariationDetail(
|
|
190
|
+
key: string,
|
|
191
|
+
defaultValue: any
|
|
192
|
+
): IEvalDetail<any>;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Calculates the string value of a feature flag for a given user.
|
|
196
|
+
*
|
|
197
|
+
* If the flag variation does not have a string value, {@link defaultValue} is returned.
|
|
198
|
+
* If an error makes it impossible to evaluate the flag (for instance, the feature flag key
|
|
199
|
+
* does not match any existing flag), {@link defaultValue} is returned.
|
|
200
|
+
*
|
|
201
|
+
* @param key
|
|
202
|
+
* The unique key of the feature flag.
|
|
203
|
+
* @param defaultValue
|
|
204
|
+
* The default value to return if the flag cannot be evaluated.
|
|
205
|
+
*
|
|
206
|
+
* @returns the variation for the given user, or {@link defaultValue} if the flag cannot be evaluated
|
|
207
|
+
*/
|
|
208
|
+
variation(
|
|
209
|
+
key: string,
|
|
210
|
+
defaultValue: string
|
|
211
|
+
): string;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Calculates the string value of a feature flag for a given user, and returns an object that
|
|
215
|
+
* describes the way the value was determined.
|
|
216
|
+
*
|
|
217
|
+
* If the flag variation does not have a string value, {@link defaultValue} is returned.
|
|
218
|
+
* If an error makes it impossible to evaluate the flag (for instance, the feature flag key
|
|
219
|
+
* does not match any existing flag), {@link defaultValue} is returned.
|
|
220
|
+
*
|
|
221
|
+
* @param key
|
|
222
|
+
* The unique key of the feature flag.
|
|
223
|
+
* @param defaultValue
|
|
224
|
+
* The default value to return if the flag cannot be evaluated.
|
|
225
|
+
*
|
|
226
|
+
* @returns {@link IEvalDetail} object describing the way the value was determined.
|
|
227
|
+
*/
|
|
228
|
+
variationDetail(
|
|
229
|
+
key: string,
|
|
230
|
+
defaultValue: string
|
|
231
|
+
): IEvalDetail<string>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* This method is exposed only for testing purpose, please DO NOT USE IT
|
|
235
|
+
*
|
|
236
|
+
* Calculates the value of a feature flag for a given user, and returns a {@link IEvalDetail} object that
|
|
237
|
+
* describes the way the value was determined.
|
|
238
|
+
*
|
|
239
|
+
* If an error makes it impossible to evaluate the flag (for instance, the feature flag key
|
|
240
|
+
* does not match any existing flag), {@link defaultValue} is returned.
|
|
241
|
+
*
|
|
242
|
+
* @param flagKey
|
|
243
|
+
* The unique key of the feature flag.
|
|
244
|
+
* @param defaultValue
|
|
245
|
+
* The default value to return if the flag cannot be evaluated.
|
|
246
|
+
* @param typeConverter
|
|
247
|
+
* the function to convert result.
|
|
248
|
+
*
|
|
249
|
+
* @returns {@link IEvalDetail} object describing the way the value was determined.
|
|
250
|
+
*/
|
|
251
|
+
evaluateCore<TValue>(
|
|
252
|
+
flagKey: string,
|
|
253
|
+
defaultValue: TValue,
|
|
254
|
+
typeConverter: (value: string) => IConvertResult<TValue>
|
|
255
|
+
): IEvalDetail<TValue>;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Returns the variation with of all feature flags for a given user, and returns an object that
|
|
259
|
+
* describes the way the value was determined for each flag.
|
|
260
|
+
*
|
|
261
|
+
* @returns A list of {@link IEvalDetail} objects describing the way the values were determined.
|
|
262
|
+
*/
|
|
263
|
+
getAllVariations(): Promise<IEvalDetail<string>[]>;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Shuts down the client and releases any resources it is using.
|
|
267
|
+
*
|
|
268
|
+
* @returns A promise that resolves when the client has been shut down.
|
|
269
|
+
*/
|
|
270
|
+
close(): Promise<void>;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Tracks that an application-defined event occurred, and provides an additional numeric value for custom metrics.
|
|
274
|
+
*
|
|
275
|
+
* @param eventName
|
|
276
|
+
* the name of the event.
|
|
277
|
+
* @param metricValue
|
|
278
|
+
* a numeric value used by the FeatBit experimentation feature in custom numeric metrics, the default value is 1 if not provided.
|
|
279
|
+
*/
|
|
280
|
+
track(eventName: string, metricValue?: number | undefined): void
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Tells the client that all pending events (if any) should be delivered as soon as possible.
|
|
284
|
+
*
|
|
285
|
+
* @param callback
|
|
286
|
+
* Will be called when the flush operation is complete. If the flush fails, the callback will be called with false.
|
|
287
|
+
*
|
|
288
|
+
* @returns A promise that resolves when the client has been shut down.
|
|
289
|
+
*/
|
|
290
|
+
flush(callback?: (res: boolean) => void): Promise<boolean>;
|
|
291
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used internally to describe the basic properties of stored data such as feature flags or user
|
|
3
|
+
* segments.
|
|
4
|
+
*
|
|
5
|
+
* This is the actual type of parameters and return values in `IStore` methods that refer
|
|
6
|
+
* to a flag or segment item. Those methods still use the `object` type for backward compatibility.
|
|
7
|
+
*/
|
|
8
|
+
export interface IVersionedData {
|
|
9
|
+
/**
|
|
10
|
+
* The item's unique key, such as a feature flag key.
|
|
11
|
+
*/
|
|
12
|
+
key: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A version number that FeatBit will increment each time this item is changed.
|
|
16
|
+
*/
|
|
17
|
+
version: number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IBootstrapProvider } from "./IBootstrapProvider";
|
|
2
|
+
import { deserializeAll } from "../store/serialization";
|
|
3
|
+
import { IDataSourceUpdates } from "../store/IDataSourceUpdates";
|
|
4
|
+
import { IStoreDataStorage } from "../store/store";
|
|
5
|
+
import { isNullOrUndefined } from "../utils/isNullOrUndefined";
|
|
6
|
+
import { IFlag, IFlagBase } from "../evaluation/data/IFlag";
|
|
7
|
+
|
|
8
|
+
export class JsonBootstrapProvider implements IBootstrapProvider {
|
|
9
|
+
private dataSet?: IStoreDataStorage;
|
|
10
|
+
|
|
11
|
+
constructor(bootstrap: IFlagBase[]) {
|
|
12
|
+
const flags: IFlag[] = (bootstrap || []).map((flag: IFlagBase) => ({...flag, variationOptions: flag.variationOptions || [{id: null, variation: flag.variation}]})) as IFlag[];
|
|
13
|
+
|
|
14
|
+
const data = deserializeAll(flags);
|
|
15
|
+
this.dataSet = {
|
|
16
|
+
flags: data.flags,
|
|
17
|
+
version: 0
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
populate(userKeyId: string, dataSourceUpdates: IDataSourceUpdates, callback?: () => void): Promise<void> {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
if (isNullOrUndefined(this.dataSet)) {
|
|
24
|
+
return resolve();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const internalCallback = () => {
|
|
28
|
+
resolve();
|
|
29
|
+
callback?.();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
dataSourceUpdates.init(userKeyId, this.dataSet!, internalCallback);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IBootstrapProvider } from "./IBootstrapProvider";
|
|
2
|
+
import { IDataSourceUpdates } from "../store/IDataSourceUpdates";
|
|
3
|
+
import { IStoreDataStorage } from "../store/store";
|
|
4
|
+
|
|
5
|
+
export class NullBootstrapProvider implements IBootstrapProvider {
|
|
6
|
+
private dataSet?: IStoreDataStorage;
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
this.dataSet = {
|
|
10
|
+
flags: {},
|
|
11
|
+
version: 0
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
populate(userKeyId: string, dataSourceUpdates: IDataSourceUpdates, callback?: () => void): Promise<void> {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
resolve();
|
|
18
|
+
callback?.();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
package/src/constants.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export const
|
|
3
|
-
export const featureFlagEvaluatedBufferTopic = 'featureflag.evaluated.buffer.topic';
|
|
4
|
-
export const websocketReconnectTopic = 'network.websocket.reconnect';
|
|
5
|
-
export const insightsTopic = 'insights.topic';
|
|
6
|
-
export const currentUserStorageKey = 'fb-user';
|
|
1
|
+
export const EmptyString = '';
|
|
2
|
+
export const MinInt: number = 0x80000000;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { IDataSourceUpdates } from "../store/IDataSourceUpdates";
|
|
2
|
+
import {
|
|
3
|
+
IStoreDataStorage,
|
|
4
|
+
IStoreItem,
|
|
5
|
+
IKeyedStoreItem
|
|
6
|
+
} from "../store/store";
|
|
7
|
+
import { IStore } from "../platform/IStore";
|
|
8
|
+
import { IDataKind } from "../IDataKind";
|
|
9
|
+
import DataKinds from "../store/DataKinds";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export default class DataSourceUpdates implements IDataSourceUpdates {
|
|
15
|
+
|
|
16
|
+
constructor(
|
|
17
|
+
private readonly store: IStore,
|
|
18
|
+
private readonly hasEventListeners: () => boolean,
|
|
19
|
+
private readonly onChange: (keys: string[]) => void,
|
|
20
|
+
) {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
init(userKeyId: string, allData: IStoreDataStorage, callback?: () => void): void {
|
|
24
|
+
if (userKeyId !== this.store.user.keyId) {
|
|
25
|
+
callback?.();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const checkForChanges = this.hasEventListeners();
|
|
30
|
+
const doInit = async (oldData?: IStoreDataStorage) => {
|
|
31
|
+
await this.store.init(allData);
|
|
32
|
+
Promise.resolve().then(() => {
|
|
33
|
+
if (checkForChanges) {
|
|
34
|
+
const updatedKeys = Object.keys(allData)
|
|
35
|
+
.flatMap((namespace) => {
|
|
36
|
+
const oldDataForKind = oldData?.[namespace] || {};
|
|
37
|
+
const newDataForKind = allData[namespace];
|
|
38
|
+
const mergedData = {...oldDataForKind, ...newDataForKind};
|
|
39
|
+
return Object.keys(mergedData)
|
|
40
|
+
.filter((key: string) => this.isUpdated(oldDataForKind && oldDataForKind[key], newDataForKind && newDataForKind[key]));
|
|
41
|
+
});
|
|
42
|
+
updatedKeys.length > 0 && this.onChange(updatedKeys);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
callback?.();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if (checkForChanges) {
|
|
49
|
+
const [flags, version] = this.store.all(DataKinds.Flags);
|
|
50
|
+
const oldData = {
|
|
51
|
+
flags,
|
|
52
|
+
version
|
|
53
|
+
};
|
|
54
|
+
doInit(oldData);
|
|
55
|
+
} else {
|
|
56
|
+
doInit();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
upsert(userKeyId: string, kind: IDataKind, data: IKeyedStoreItem, callback: () => void): void {
|
|
61
|
+
if (userKeyId !== this.store.user.keyId) {
|
|
62
|
+
callback?.();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const {key} = data;
|
|
67
|
+
const checkForChanges = this.hasEventListeners();
|
|
68
|
+
const doUpsert = async (oldItem?: IStoreItem) => {
|
|
69
|
+
await this.store.upsert(kind, data);
|
|
70
|
+
Promise.resolve().then(() => {
|
|
71
|
+
if (checkForChanges && this.isUpdated(oldItem, data[key])) {
|
|
72
|
+
this.onChange([key]);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
callback?.();
|
|
77
|
+
};
|
|
78
|
+
if (checkForChanges) {
|
|
79
|
+
const item = this.store.get(kind, key);
|
|
80
|
+
doUpsert(item || undefined);
|
|
81
|
+
} else {
|
|
82
|
+
doUpsert();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private isUpdated(oldData?: IStoreItem, newData?: IStoreItem): boolean {
|
|
87
|
+
return !oldData || !newData || newData.version > oldData.version
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { IDataSourceUpdates } from "../store/IDataSourceUpdates";
|
|
2
|
+
import { ILogger } from "../logging/ILogger";
|
|
3
|
+
import { VoidFunction } from "../utils/VoidFunction";
|
|
4
|
+
import {
|
|
5
|
+
deserializeAll,
|
|
6
|
+
deserializePatch,
|
|
7
|
+
IPatchData,
|
|
8
|
+
Flags
|
|
9
|
+
} from "../store/serialization";
|
|
10
|
+
import DataKinds from "../store/DataKinds";
|
|
11
|
+
import { IStoreDataStorage } from "../store/store";
|
|
12
|
+
import { EventName, ProcessStreamResponse } from "../data-sync/types";
|
|
13
|
+
|
|
14
|
+
export const createPutListener = (
|
|
15
|
+
dataSourceUpdates: IDataSourceUpdates,
|
|
16
|
+
logger?: ILogger,
|
|
17
|
+
onPutCompleteHandler: VoidFunction = () => {
|
|
18
|
+
},
|
|
19
|
+
) => ({
|
|
20
|
+
deserializeData: deserializeAll,
|
|
21
|
+
processJson: async (userKeyId: string, {flags}: Flags) => {
|
|
22
|
+
const initData: IStoreDataStorage = {
|
|
23
|
+
flags: flags,
|
|
24
|
+
version: 0
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
logger?.debug('Initializing all data');
|
|
28
|
+
dataSourceUpdates.init(userKeyId, initData, onPutCompleteHandler);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const createPatchListener = (
|
|
33
|
+
dataSourceUpdates: IDataSourceUpdates,
|
|
34
|
+
logger?: ILogger,
|
|
35
|
+
onPatchCompleteHandler: VoidFunction = () => {
|
|
36
|
+
},
|
|
37
|
+
) => ({
|
|
38
|
+
deserializeData: deserializePatch,
|
|
39
|
+
processJson: async (userKeyId: string, data: IPatchData[]) => {
|
|
40
|
+
if (data?.length === 0) {
|
|
41
|
+
onPatchCompleteHandler?.();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
data?.forEach(item => {
|
|
46
|
+
logger?.debug(`Updating ${ item.data.key } in ${ item.kind.namespace }`);
|
|
47
|
+
dataSourceUpdates.upsert(userKeyId, item.kind, item.data, onPatchCompleteHandler);
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
export const createStreamListeners = (
|
|
54
|
+
dataSourceUpdates: IDataSourceUpdates,
|
|
55
|
+
logger?: ILogger,
|
|
56
|
+
onCompleteHandlers?: {
|
|
57
|
+
put?: VoidFunction;
|
|
58
|
+
patch?: VoidFunction;
|
|
59
|
+
delete?: VoidFunction;
|
|
60
|
+
},
|
|
61
|
+
) => {
|
|
62
|
+
const listeners = new Map<EventName, ProcessStreamResponse>();
|
|
63
|
+
listeners.set('put', createPutListener(dataSourceUpdates, logger, onCompleteHandlers?.put));
|
|
64
|
+
listeners.set('patch', createPatchListener(dataSourceUpdates, logger, onCompleteHandlers?.patch));
|
|
65
|
+
return listeners;
|
|
66
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IUser } from "../options/IUser";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The client data synchronizer
|
|
5
|
+
*
|
|
6
|
+
* The client uses this internally to retrieve updates from the FeatBit server.
|
|
7
|
+
*
|
|
8
|
+
* @ignore
|
|
9
|
+
*/
|
|
10
|
+
export interface IDataSynchronizer {
|
|
11
|
+
start: () => void;
|
|
12
|
+
stop: () => void;
|
|
13
|
+
close: () => void;
|
|
14
|
+
identify: (user: IUser) => void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The FeatBit client feature flag requestor
|
|
3
|
+
*
|
|
4
|
+
* The client uses this internally to retrieve feature flags from FeatBit.
|
|
5
|
+
*
|
|
6
|
+
* @ignore
|
|
7
|
+
*/
|
|
8
|
+
export interface IRequestor {
|
|
9
|
+
requestData: (timestamp: number, payload: any, cb: (err: any, body: any) => void) => void;
|
|
10
|
+
}
|