Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@launchdarkly/js-sdk-common

Package Overview
Dependencies
Maintainers
1
Versions
32
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 1.0.2 to 1.0.3

7

CHANGELOG.md

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

## [1.0.3](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v1.0.2...js-sdk-common-v1.0.3) (2023-08-10)
### Bug Fixes
* Switch to es2017 target to ensure native async/await. ([a83e4e6](https://github.com/launchdarkly/js-core/commit/a83e4e62d04c66105a1b0e8893640a7ca2d641e4))
## [1.0.2](https://github.com/launchdarkly/js-core/compare/js-sdk-common-v1.0.1...js-sdk-common-v1.0.2) (2023-06-13)

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

1

dist/api/options/index.js
"use strict";
// Lint issue is because there is 1 item currently. We do not want to default export it.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=index.js.map

3

dist/api/platform/Requests.js
"use strict";
// The interfaces in this file are intended to be as close as possible to the
// interfaces used for the `fetch` Web API. Doing so should allow implementations
// which are more easily portable.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Requests.js.map

@@ -0,5 +1,5 @@

import LDContextDeduplicator from './LDContextDeduplicator';
import LDEventProcessor from './LDEventProcessor';
import LDContextDeduplicator from './LDContextDeduplicator';
import LDEventSender, { LDDeliveryStatus, LDEventType, LDEventSenderResult } from './LDEventSender';
import LDEventSender, { LDDeliveryStatus, LDEventSenderResult, LDEventType } from './LDEventSender';
export { LDEventProcessor, LDContextDeduplicator, LDEventSender, LDDeliveryStatus, LDEventType, LDEventSenderResult, };
//# sourceMappingURL=index.d.ts.map

@@ -8,3 +8,3 @@ "use strict";

LDEventType[LDEventType["DiagnosticEvent"] = 1] = "DiagnosticEvent";
})(LDEventType = exports.LDEventType || (exports.LDEventType = {}));
})(LDEventType || (exports.LDEventType = LDEventType = {}));
var LDDeliveryStatus;

@@ -15,3 +15,3 @@ (function (LDDeliveryStatus) {

LDDeliveryStatus[LDDeliveryStatus["FailedAndMustShutDown"] = 2] = "FailedAndMustShutDown";
})(LDDeliveryStatus = exports.LDDeliveryStatus || (exports.LDDeliveryStatus = {}));
})(LDDeliveryStatus || (exports.LDDeliveryStatus = LDDeliveryStatus = {}));
//# sourceMappingURL=LDEventSender.js.map

@@ -121,3 +121,2 @@ "use strict";

}
exports.default = AttributeReference;
/**

@@ -127,2 +126,3 @@ * For use as invalid references when deserializing Flag/Segment data.

AttributeReference.invalidReference = new AttributeReference('');
exports.default = AttributeReference;
//# sourceMappingURL=AttributeReference.js.map

@@ -383,4 +383,4 @@ "use strict";

}
Context.userKind = DEFAULT_KIND;
exports.default = Context;
Context.userKind = DEFAULT_KIND;
//# sourceMappingURL=Context.js.map
"use strict";
// _meta is part of the specification.
Object.defineProperty(exports, "__esModule", { value: true });

@@ -3,0 +4,0 @@ const AttributeReference_1 = require("./AttributeReference");

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -40,5 +31,5 @@ const LDEventSender_1 = require("../../api/subsystem/LDEventSender");

}
this.flushTimer = setInterval(() => __awaiter(this, void 0, void 0, function* () {
this.flushTimer = setInterval(async () => {
try {
yield this.flush();
await this.flush();
}

@@ -48,3 +39,3 @@ catch (_a) {

}
}), config.flushInterval * 1000);
}, config.flushInterval * 1000);
if (this.diagnosticsManager) {

@@ -73,22 +64,20 @@ const initEvent = diagnosticsManager.createInitEvent();

}
flush() {
async flush() {
var _a;
return __awaiter(this, void 0, void 0, function* () {
if (this.shutdown) {
throw new LDInvalidSDKKeyError_1.default('Events cannot be posted because SDK key is invalid');
}
const eventsToFlush = this.queue;
this.queue = [];
const summary = this.summarizer.getSummary();
this.summarizer.clearSummary();
if (Object.keys(summary.features).length) {
eventsToFlush.push(summary);
}
if (!eventsToFlush.length) {
return;
}
this.eventsInLastBatch = eventsToFlush.length;
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.debug('Flushing %d events', eventsToFlush.length);
yield this.tryPostingEvents(eventsToFlush);
});
if (this.shutdown) {
throw new LDInvalidSDKKeyError_1.default('Events cannot be posted because SDK key is invalid');
}
const eventsToFlush = this.queue;
this.queue = [];
const summary = this.summarizer.getSummary();
this.summarizer.clearSummary();
if (Object.keys(summary.features).length) {
eventsToFlush.push(summary);
}
if (!eventsToFlush.length) {
return;
}
this.eventsInLastBatch = eventsToFlush.length;
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.debug('Flushing %d events', eventsToFlush.length);
await this.tryPostingEvents(eventsToFlush);
}

@@ -201,15 +190,13 @@ sendEvent(inputEvent) {

}
tryPostingEvents(events) {
return __awaiter(this, void 0, void 0, function* () {
const res = yield this.eventSender.sendEventData(LDEventSender_1.LDEventType.AnalyticsEvents, events);
if (res.status === LDEventSender_1.LDDeliveryStatus.FailedAndMustShutDown) {
this.shutdown = true;
}
if (res.serverTime) {
this.lastKnownPastTime = res.serverTime;
}
if (res.error) {
throw res.error;
}
});
async tryPostingEvents(events) {
const res = await this.eventSender.sendEventData(LDEventSender_1.LDEventType.AnalyticsEvents, events);
if (res.status === LDEventSender_1.LDDeliveryStatus.FailedAndMustShutDown) {
this.shutdown = true;
}
if (res.serverTime) {
this.lastKnownPastTime = res.serverTime;
}
if (res.error) {
throw res.error;
}
}

@@ -216,0 +203,0 @@ }

@@ -0,1 +1,2 @@

import EventProcessor from './EventProcessor';
import InputCustomEvent from './InputCustomEvent';

@@ -5,4 +6,3 @@ import InputEvalEvent from './InputEvalEvent';

import InputIdentifyEvent from './InputIdentifyEvent';
import EventProcessor from './EventProcessor';
export { InputCustomEvent, InputEvalEvent, InputEvent, InputIdentifyEvent, EventProcessor };
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventProcessor = exports.InputIdentifyEvent = exports.InputEvalEvent = exports.InputCustomEvent = void 0;
const EventProcessor_1 = require("./EventProcessor");
exports.EventProcessor = EventProcessor_1.default;
const InputCustomEvent_1 = require("./InputCustomEvent");

@@ -10,4 +12,2 @@ exports.InputCustomEvent = InputCustomEvent_1.default;

exports.InputIdentifyEvent = InputIdentifyEvent_1.default;
const EventProcessor_1 = require("./EventProcessor");
exports.EventProcessor = EventProcessor_1.default;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import { LDEvaluationReason, LDEvaluationDetail } from '../../api/data';
import { LDEvaluationDetail, LDEvaluationReason } from '../../api/data';
import Context from '../../Context';

@@ -3,0 +3,0 @@ export default class InputEvalEvent {

@@ -1,2 +0,2 @@

import { LDLogger, LDClientContext, Platform } from '../api';
import { LDClientContext, LDLogger, Platform } from '../api';
import ServiceEndpoints from './ServiceEndpoints';

@@ -3,0 +3,0 @@ /**

import ApplicationTags from './ApplicationTags';
import ClientContext from './ClientContext';
import OptionMessages from './OptionMessages';
import ServiceEndpoints from './ServiceEndpoints';
import ClientContext from './ClientContext';
export { ApplicationTags, OptionMessages, ServiceEndpoints, ClientContext };
//# sourceMappingURL=index.d.ts.map

@@ -6,2 +6,4 @@ "use strict";

exports.ApplicationTags = ApplicationTags_1.default;
const ClientContext_1 = require("./ClientContext");
exports.ClientContext = ClientContext_1.default;
const OptionMessages_1 = require("./OptionMessages");

@@ -11,4 +13,2 @@ exports.OptionMessages = OptionMessages_1.default;

exports.ServiceEndpoints = ServiceEndpoints_1.default;
const ClientContext_1 = require("./ClientContext");
exports.ClientContext = ClientContext_1.default;
//# sourceMappingURL=index.js.map
{
"name": "@launchdarkly/js-sdk-common",
"version": "1.0.2",
"version": "1.0.3",
"type": "commonjs",

@@ -31,18 +31,19 @@ "main": "./dist/index.js",

"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@types/jest": "^29.4.0",
"@typescript-eslint/eslint-plugin": "^5.22.0",
"@typescript-eslint/parser": "^5.22.0",
"eslint": "^8.14.0",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"eslint": "^8.45.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.5.0",
"launchdarkly-js-test-helpers": "^2.2.0",
"prettier": "^2.8.4",
"prettier": "^3.0.0",
"ts-jest": "^29.0.5",
"typedoc": "0.23.26",
"typescript": "^4.6.3"
"typescript": "^5.1.6"
}
}
# LaunchDarkly SDK JavaScript Common Code
[![NPM][common-npm-badge]][common-npm-link]
[![Actions Status][shared-common-ci-badge]][shared-common-ci]
[![Actions Status][shared-common-ci-badge]][shared-common-ci]
[![Documentation](https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8)](https://launchdarkly.github.io/js-core/packages/shared/common/docs/)

@@ -31,4 +31,3 @@

[shared-common-ci]: https://github.com/launchdarkly/js-core/actions/workflows/common.yml
[common-npm-badge]: https://img.shields.io/npm/v/@launchdarkly/js-sdk-common.svg?style=flat-square
[common-npm-link]: https://www.npmjs.com/package/@launchdarkly/js-sdk-common

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

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

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