Socket
Socket
Sign inDemoInstall

@launchdarkly/js-sdk-common

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@launchdarkly/js-sdk-common - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

dist/internal/events/LDInternalOptions.d.ts

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

## [2.1.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v2.0.0...js-sdk-common-v2.1.0) (2023-11-14)
### Features
* edge sdks should send events to bulk/environment endpoint ([#256](https://github.com/launchdarkly/js-core/issues/256)) ([f45910f](https://github.com/launchdarkly/js-core/commit/f45910f171d434ca080bb6486331fbfbd2793985))
## [2.0.0](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v1.1.0...js-sdk-common-v2.0.0) (2023-10-16)

@@ -7,0 +14,0 @@

8

dist/internal/events/EventSender.js

@@ -9,7 +9,7 @@ "use strict";

const { basicConfiguration, platform } = clientContext;
const { sdkKey, serviceEndpoints, tags } = basicConfiguration;
const { sdkKey, serviceEndpoints: { events, analyticsEventPath, diagnosticEventPath, includeAuthorizationHeader, }, tags, } = basicConfiguration;
const { crypto, info, requests } = platform;
this.defaultHeaders = (0, utils_1.defaultHeaders)(sdkKey, info, tags);
this.eventsUri = `${serviceEndpoints.events}/bulk`;
this.diagnosticEventsUri = `${serviceEndpoints.events}/diagnostic`;
this.defaultHeaders = (0, utils_1.defaultHeaders)(sdkKey, info, tags, includeAuthorizationHeader);
this.eventsUri = `${events}${analyticsEventPath}`;
this.diagnosticEventsUri = `${events}${diagnosticEventPath}`;
this.requests = requests;

@@ -16,0 +16,0 @@ this.crypto = crypto;

@@ -8,5 +8,6 @@ import ClientMessages from './ClientMessages';

import InputMigrationEvent from './InputMigrationEvent';
import type { LDInternalOptions } from './LDInternalOptions';
import NullEventProcessor from './NullEventProcessor';
import shouldSample from './sampling';
export { ClientMessages, InputCustomEvent, InputEvalEvent, InputEvent, InputIdentifyEvent, InputMigrationEvent, EventProcessor, shouldSample, NullEventProcessor, };
export { ClientMessages, InputCustomEvent, InputEvalEvent, InputEvent, InputIdentifyEvent, InputMigrationEvent, EventProcessor, shouldSample, NullEventProcessor, LDInternalOptions, };
//# sourceMappingURL=index.d.ts.map

@@ -9,4 +9,17 @@ /**

readonly events: string;
constructor(streaming: string, polling: string, events?: string);
/** Valid paths are:
* /bulk
* /events/bulk/envId
* /mobile
*/
readonly analyticsEventPath: string;
/** Valid paths are:
* /diagnostic
* /events/diagnostic/envId
* /mobile/events/diagnostic
*/
readonly diagnosticEventPath: string;
readonly includeAuthorizationHeader: boolean;
constructor(streaming: string, polling: string, events?: string, analyticsEventPath?: string, diagnosticEventPath?: string, includeAuthorizationHeader?: boolean);
}
//# sourceMappingURL=ServiceEndpoints.d.ts.map

@@ -10,6 +10,9 @@ "use strict";

class ServiceEndpoints {
constructor(streaming, polling, events = ServiceEndpoints.DEFAULT_EVENTS) {
constructor(streaming, polling, events = ServiceEndpoints.DEFAULT_EVENTS, analyticsEventPath = '/bulk', diagnosticEventPath = '/diagnostic', includeAuthorizationHeader = true) {
this.streaming = canonicalizeUri(streaming);
this.polling = canonicalizeUri(polling);
this.events = canonicalizeUri(events);
this.analyticsEventPath = analyticsEventPath;
this.diagnosticEventPath = diagnosticEventPath;
this.includeAuthorizationHeader = includeAuthorizationHeader;
}

@@ -16,0 +19,0 @@ }

import { Info } from '../api';
import { ApplicationTags } from '../options';
export type LDHeaders = {
authorization: string;
authorization?: string;
'user-agent': string;

@@ -9,3 +9,3 @@ 'x-launchdarkly-wrapper'?: string;

};
export declare function defaultHeaders(sdkKey: string, info: Info, tags?: ApplicationTags): LDHeaders;
export declare function defaultHeaders(sdkKey: string, info: Info, tags?: ApplicationTags, includeAuthorizationHeader?: boolean): LDHeaders;
export declare function httpErrorMessage(err: {

@@ -12,0 +12,0 @@ status: number;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.httpErrorMessage = exports.defaultHeaders = void 0;
function defaultHeaders(sdkKey, info, tags) {
function defaultHeaders(sdkKey, info, tags, includeAuthorizationHeader = true) {
const { userAgentBase, version, wrapperName, wrapperVersion } = info.sdkData();
const headers = {
authorization: sdkKey,
'user-agent': `${userAgentBase !== null && userAgentBase !== void 0 ? userAgentBase : 'NodeJSClient'}/${version}`,
};
// edge sdks sets this to false because they use the clientSideID
// and they don't need the authorization header
if (includeAuthorizationHeader) {
headers.authorization = sdkKey;
}
if (wrapperName) {

@@ -11,0 +15,0 @@ headers['x-launchdarkly-wrapper'] = wrapperVersion

{
"name": "@launchdarkly/js-sdk-common",
"version": "2.0.0",
"version": "2.1.0",
"type": "commonjs",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc