@eppo/js-client-sdk-common
Advanced tools
Comparing version 4.6.1 to 4.6.2
@@ -35,2 +35,3 @@ import { IAssignmentLogger } from '../assignment-logger'; | ||
constructor(precomputedFlagStore: IConfigurationStore<PrecomputedFlag>, isObfuscated?: boolean); | ||
setPrecomputedFlagsRequestParameters(precomputedFlagsRequestParameters: PrecomputedFlagsRequestParameters): void; | ||
setSubjectAndPrecomputedFlagsRequestParameters(precomputedFlagsRequestParameters: PrecomputedFlagsRequestParameters): void; | ||
@@ -37,0 +38,0 @@ setPrecomputedFlagStore(precomputedFlagStore: IConfigurationStore<PrecomputedFlag>): void; |
@@ -22,6 +22,9 @@ "use strict"; | ||
} | ||
setPrecomputedFlagsRequestParameters(precomputedFlagsRequestParameters) { | ||
this.precomputedFlagsRequestParameters = precomputedFlagsRequestParameters; | ||
} | ||
setSubjectAndPrecomputedFlagsRequestParameters(precomputedFlagsRequestParameters) { | ||
this.setPrecomputedFlagsRequestParameters(precomputedFlagsRequestParameters); | ||
this.subjectKey = precomputedFlagsRequestParameters.precompute.subjectKey; | ||
this.subjectAttributes = precomputedFlagsRequestParameters.precompute.subjectAttributes; | ||
this.precomputedFlagsRequestParameters = precomputedFlagsRequestParameters; | ||
} | ||
@@ -28,0 +31,0 @@ setPrecomputedFlagStore(precomputedFlagStore) { |
@@ -108,3 +108,3 @@ "use strict"; | ||
const sdkKeyDecoder = new sdk_key_decoder_1.default(); | ||
const ingestionUrl = sdkKeyDecoder.decodeEventIngestionHostName(sdkKey); | ||
const ingestionUrl = sdkKeyDecoder.decodeEventIngestionUrl(sdkKey); | ||
if (!ingestionUrl) { | ||
@@ -111,0 +111,0 @@ application_logger_1.logger.debug('Unable to parse Event ingestion URL from SDK key, falling back to no-op event dispatcher'); |
@@ -6,4 +6,4 @@ export default class SdkKeyDecoder { | ||
*/ | ||
decodeEventIngestionHostName(sdkKey: string): string | null; | ||
decodeEventIngestionUrl(sdkKey: string): string | null; | ||
} | ||
//# sourceMappingURL=sdk-key-decoder.d.ts.map |
@@ -9,3 +9,3 @@ "use strict"; | ||
*/ | ||
decodeEventIngestionHostName(sdkKey) { | ||
decodeEventIngestionUrl(sdkKey) { | ||
const encodedPayload = sdkKey.split('.')[1]; | ||
@@ -16,3 +16,12 @@ if (!encodedPayload) | ||
const params = new URLSearchParams(decodedPayload); | ||
return params.get('eh'); | ||
const hostname = params.get('eh'); | ||
if (!hostname) | ||
return null; | ||
if (!hostname.startsWith('http://') && !hostname.startsWith('https://')) { | ||
// prefix hostname with https scheme if none present | ||
return `https://${hostname}`; | ||
} | ||
else { | ||
return hostname; | ||
} | ||
} | ||
@@ -19,0 +28,0 @@ } |
@@ -19,3 +19,3 @@ import ApiEndpoints from './api-endpoints'; | ||
import DefaultEventDispatcher, { DEFAULT_EVENT_DISPATCHER_CONFIG, DEFAULT_EVENT_DISPATCHER_BATCH_SIZE, newDefaultEventDispatcher } from './events/default-event-dispatcher'; | ||
import EventDispatcher from './events/event-dispatcher'; | ||
import EventDispatcher, { Event } from './events/event-dispatcher'; | ||
import NamedEventQueue from './events/named-event-queue'; | ||
@@ -27,3 +27,3 @@ import NetworkStatusListener from './events/network-status-listener'; | ||
import * as validation from './validation'; | ||
export { applicationLogger, AbstractAssignmentCache, IAssignmentDetails, IAssignmentHooks, IAssignmentLogger, IAssignmentEvent, IBanditLogger, IBanditEvent, IContainerExperiment, PrecomputedFlagsRequestParameters, EppoClient, constants, ApiEndpoints, FlagConfigRequestor, HttpClient, validation, EppoPrecomputedClient, IConfigurationStore, IAsyncStore, ISyncStore, MemoryStore, HybridConfigurationStore, MemoryOnlyConfigurationStore, AssignmentCacheKey, AssignmentCacheValue, AssignmentCacheEntry, AssignmentCache, AsyncMap, NonExpiringInMemoryAssignmentCache, LRUInMemoryAssignmentCache, assignmentCacheKeyToString, assignmentCacheValueToString, FlagConfigurationRequestParameters, Flag, ObfuscatedFlag, PrecomputedFlag, VariationType, AttributeType, Attributes, ContextAttributes, BanditSubjectAttributes, BanditActions, NamedEventQueue, EventDispatcher, BoundedEventQueue, DEFAULT_EVENT_DISPATCHER_CONFIG, DEFAULT_EVENT_DISPATCHER_BATCH_SIZE, newDefaultEventDispatcher, BatchEventProcessor, NetworkStatusListener, DefaultEventDispatcher, }; | ||
export { applicationLogger, AbstractAssignmentCache, IAssignmentDetails, IAssignmentHooks, IAssignmentLogger, IAssignmentEvent, IBanditLogger, IBanditEvent, IContainerExperiment, PrecomputedFlagsRequestParameters, EppoClient, constants, ApiEndpoints, FlagConfigRequestor, HttpClient, validation, EppoPrecomputedClient, IConfigurationStore, IAsyncStore, ISyncStore, MemoryStore, HybridConfigurationStore, MemoryOnlyConfigurationStore, AssignmentCacheKey, AssignmentCacheValue, AssignmentCacheEntry, AssignmentCache, AsyncMap, NonExpiringInMemoryAssignmentCache, LRUInMemoryAssignmentCache, assignmentCacheKeyToString, assignmentCacheValueToString, FlagConfigurationRequestParameters, Flag, ObfuscatedFlag, PrecomputedFlag, VariationType, AttributeType, Attributes, ContextAttributes, BanditSubjectAttributes, BanditActions, NamedEventQueue, EventDispatcher, BoundedEventQueue, DEFAULT_EVENT_DISPATCHER_CONFIG, DEFAULT_EVENT_DISPATCHER_BATCH_SIZE, newDefaultEventDispatcher, BatchEventProcessor, NetworkStatusListener, DefaultEventDispatcher, Event, }; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@eppo/js-client-sdk-common", | ||
"version": "4.6.1", | ||
"version": "4.6.2", | ||
"description": "Common library for Eppo JavaScript SDKs (web, react native, and node)", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -60,8 +60,14 @@ import ApiEndpoints from '../api-endpoints'; | ||
public setPrecomputedFlagsRequestParameters( | ||
precomputedFlagsRequestParameters: PrecomputedFlagsRequestParameters, | ||
) { | ||
this.precomputedFlagsRequestParameters = precomputedFlagsRequestParameters; | ||
} | ||
public setSubjectAndPrecomputedFlagsRequestParameters( | ||
precomputedFlagsRequestParameters: PrecomputedFlagsRequestParameters, | ||
) { | ||
this.setPrecomputedFlagsRequestParameters(precomputedFlagsRequestParameters); | ||
this.subjectKey = precomputedFlagsRequestParameters.precompute.subjectKey; | ||
this.subjectAttributes = precomputedFlagsRequestParameters.precompute.subjectAttributes; | ||
this.precomputedFlagsRequestParameters = precomputedFlagsRequestParameters; | ||
} | ||
@@ -68,0 +74,0 @@ |
@@ -140,3 +140,3 @@ import { logger } from '../application-logger'; | ||
const sdkKeyDecoder = new SdkKeyDecoder(); | ||
const ingestionUrl = sdkKeyDecoder.decodeEventIngestionHostName(sdkKey); | ||
const ingestionUrl = sdkKeyDecoder.decodeEventIngestionUrl(sdkKey); | ||
if (!ingestionUrl) { | ||
@@ -143,0 +143,0 @@ logger.debug( |
@@ -8,3 +8,3 @@ import { Base64 } from 'js-base64'; | ||
*/ | ||
decodeEventIngestionHostName(sdkKey: string): string | null { | ||
decodeEventIngestionUrl(sdkKey: string): string | null { | ||
const encodedPayload = sdkKey.split('.')[1]; | ||
@@ -15,4 +15,12 @@ if (!encodedPayload) return null; | ||
const params = new URLSearchParams(decodedPayload); | ||
return params.get('eh'); | ||
const hostname = params.get('eh'); | ||
if (!hostname) return null; | ||
if (!hostname.startsWith('http://') && !hostname.startsWith('https://')) { | ||
// prefix hostname with https scheme if none present | ||
return `https://${hostname}`; | ||
} else { | ||
return hostname; | ||
} | ||
} | ||
} |
@@ -42,3 +42,3 @@ import ApiEndpoints from './api-endpoints'; | ||
} from './events/default-event-dispatcher'; | ||
import EventDispatcher from './events/event-dispatcher'; | ||
import EventDispatcher, { Event } from './events/event-dispatcher'; | ||
import NamedEventQueue from './events/named-event-queue'; | ||
@@ -117,2 +117,3 @@ import NetworkStatusListener from './events/network-status-listener'; | ||
DefaultEventDispatcher, | ||
Event, | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1073233
9384