New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@atlassian/clientside-extensions-base

Package Overview
Dependencies
Maintainers
0
Versions
234
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atlassian/clientside-extensions-base - npm Package Compare versions

Comparing version 3.1.2-test9-85e70efb to 4.0.0-jakarta-m001

./dist/cjs/index.js

50

dist/cjs/DeferredSubject.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var Subject_1 = tslib_1.__importDefault(require("./Subject"));
const tslib_1 = require("tslib");
const Subject_1 = (0, tslib_1.__importDefault)(require("./Subject"));
/**

@@ -11,10 +11,7 @@ * Subject for a single location and its observers

*/
var DeferredSubject = /** @class */ (function (_super) {
tslib_1.__extends(DeferredSubject, _super);
function DeferredSubject(timeout) {
if (timeout === void 0) { timeout = 0; }
var _this = _super.call(this) || this;
_this.timeout = timeout;
_this.notifyTimer = null;
return _this;
class DeferredSubject extends Subject_1.default {
constructor(timeout = 0) {
super();
this.timeout = timeout;
this.notifyTimer = null;
}

@@ -25,5 +22,4 @@ /**

*/
DeferredSubject.prototype.notify = function (payload) {
var _this = this;
clearTimeout(this.notifyTimer);
notify(payload) {
this.clearTimer();
this.lastPayload = payload;

@@ -33,8 +29,14 @@ // The resources for a specific location will be loaded all at once.

// so we dont call observers overly often, which could result in a waste of expensive calculations.
this.notifyTimer = setTimeout(function () {
_this.observers.forEach(function (observer) { return observer(_this.lastPayload); });
// reset timer
_this.notifyTimer = null;
this.notifyTimer = setTimeout(() => {
this.flush();
}, this.timeout);
};
}
clearTimer() {
clearTimeout(this.notifyTimer);
this.notifyTimer = null;
}
flush() {
this.clearTimer();
this.observers.forEach((observer) => observer(this.lastPayload));
}
/**

@@ -45,7 +47,6 @@ * @Override

*/
DeferredSubject.prototype.subscribe = function (observer) {
var _this = this;
subscribe(observer) {
this.observers.push(observer);
// no notify timer is running - otherwise just wait for the cycle to update the location observer
var noNotifyTimer = this.notifyTimer === null;
const noNotifyTimer = this.notifyTimer === null;
if (this.lastPayload !== undefined && noNotifyTimer) {

@@ -55,8 +56,7 @@ observer(this.lastPayload);

return {
unsubscribe: function () { return _this.unsubscribe(observer); },
unsubscribe: () => this.unsubscribe(observer),
};
};
return DeferredSubject;
}(Subject_1.default));
}
}
exports.default = DeferredSubject;
//# sourceMappingURL=DeferredSubject.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReplaySubject = exports.DeferredSubject = exports.Subject = void 0;
var tslib_1 = require("tslib");
var Subject_1 = tslib_1.__importDefault(require("./Subject"));
const tslib_1 = require("tslib");
const Subject_1 = (0, tslib_1.__importDefault)(require("./Subject"));
exports.Subject = Subject_1.default;
var DeferredSubject_1 = tslib_1.__importDefault(require("./DeferredSubject"));
const DeferredSubject_1 = (0, tslib_1.__importDefault)(require("./DeferredSubject"));
exports.DeferredSubject = DeferredSubject_1.default;
var ReplaySubject_1 = tslib_1.__importDefault(require("./ReplaySubject"));
const ReplaySubject_1 = (0, tslib_1.__importDefault)(require("./ReplaySubject"));
exports.ReplaySubject = ReplaySubject_1.default;
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var Subject_1 = tslib_1.__importDefault(require("./Subject"));
const tslib_1 = require("tslib");
const Subject_1 = (0, tslib_1.__importDefault)(require("./Subject"));
/**

@@ -11,12 +11,9 @@ * Subject for a single location and its observers

*/
var ReplaySubject = /** @class */ (function (_super) {
tslib_1.__extends(ReplaySubject, _super);
function ReplaySubject(replaySize) {
if (replaySize === void 0) { replaySize = 10; }
var _this = _super.call(this) || this;
_this.lastPayloads = [];
_this.replaySize = Math.abs(replaySize);
return _this;
class ReplaySubject extends Subject_1.default {
constructor(replaySize = 10) {
super();
this.lastPayloads = [];
this.replaySize = Math.abs(replaySize);
}
ReplaySubject.prototype.addPayload = function (payload) {
addPayload(payload) {
this.lastPayloads.push(payload);

@@ -26,3 +23,3 @@ if (this.lastPayloads.length > this.replaySize) {

}
};
}
/**

@@ -32,6 +29,6 @@ * @Override

*/
ReplaySubject.prototype.notify = function (payload) {
notify(payload) {
this.addPayload(payload);
_super.prototype.notify.call(this, payload);
};
super.notify(payload);
}
/**

@@ -42,11 +39,13 @@ * @Override

*/
ReplaySubject.prototype.subscribe = function (observer) {
this.lastPayloads.forEach(function (payload) {
subscribe(observer) {
this.lastPayloads.forEach((payload) => {
observer(payload);
});
return _super.prototype.subscribe.call(this, observer);
};
return ReplaySubject;
}(Subject_1.default));
return super.subscribe(observer);
}
prune() {
this.lastPayloads.length = 0;
}
}
exports.default = ReplaySubject;
//# sourceMappingURL=ReplaySubject.js.map

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

*/
var Subject = /** @class */ (function () {
function Subject() {
class Subject {
constructor() {
this.observers = [];

@@ -17,5 +17,5 @@ }

*/
Subject.prototype.notify = function (payload) {
this.observers.forEach(function (observer) { return observer(payload); });
};
notify(payload) {
this.observers.forEach((observer) => observer(payload));
}
/**

@@ -25,16 +25,15 @@ * Add an observer to the location subject. The observer will be notified each time there's a new list of

*/
Subject.prototype.subscribe = function (observer) {
var _this = this;
subscribe(observer) {
this.observers.push(observer);
return {
unsubscribe: function () { return _this.unsubscribe(observer); },
unsubscribe: () => this.unsubscribe(observer),
};
};
}
/**
* Remove an observer from the location subject.
*/
Subject.prototype.unsubscribe = function (observer) {
var observerIndex = this.observers.indexOf(observer);
unsubscribe(observer) {
const observerIndex = this.observers.indexOf(observer);
this.observers.splice(observerIndex, 1);
};
}
/**

@@ -44,11 +43,9 @@ * Converts a Subject into an Observable.

*/
Subject.prototype.asObservable = function () {
var _this = this;
asObservable() {
return {
subscribe: function (observer) { return _this.subscribe(observer); },
subscribe: (observer) => this.subscribe(observer),
};
};
return Subject;
}());
}
}
exports.default = Subject;
//# sourceMappingURL=Subject.js.map

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

import { __extends } from "tslib";
import Subject from './Subject';

@@ -9,10 +8,7 @@ /**

*/
var DeferredSubject = /** @class */ (function (_super) {
__extends(DeferredSubject, _super);
function DeferredSubject(timeout) {
if (timeout === void 0) { timeout = 0; }
var _this = _super.call(this) || this;
_this.timeout = timeout;
_this.notifyTimer = null;
return _this;
export default class DeferredSubject extends Subject {
constructor(timeout = 0) {
super();
this.timeout = timeout;
this.notifyTimer = null;
}

@@ -23,5 +19,4 @@ /**

*/
DeferredSubject.prototype.notify = function (payload) {
var _this = this;
clearTimeout(this.notifyTimer);
notify(payload) {
this.clearTimer();
this.lastPayload = payload;

@@ -31,8 +26,14 @@ // The resources for a specific location will be loaded all at once.

// so we dont call observers overly often, which could result in a waste of expensive calculations.
this.notifyTimer = setTimeout(function () {
_this.observers.forEach(function (observer) { return observer(_this.lastPayload); });
// reset timer
_this.notifyTimer = null;
this.notifyTimer = setTimeout(() => {
this.flush();
}, this.timeout);
};
}
clearTimer() {
clearTimeout(this.notifyTimer);
this.notifyTimer = null;
}
flush() {
this.clearTimer();
this.observers.forEach((observer) => observer(this.lastPayload));
}
/**

@@ -43,7 +44,6 @@ * @Override

*/
DeferredSubject.prototype.subscribe = function (observer) {
var _this = this;
subscribe(observer) {
this.observers.push(observer);
// no notify timer is running - otherwise just wait for the cycle to update the location observer
var noNotifyTimer = this.notifyTimer === null;
const noNotifyTimer = this.notifyTimer === null;
if (this.lastPayload !== undefined && noNotifyTimer) {

@@ -53,8 +53,6 @@ observer(this.lastPayload);

return {
unsubscribe: function () { return _this.unsubscribe(observer); },
unsubscribe: () => this.unsubscribe(observer),
};
};
return DeferredSubject;
}(Subject));
export default DeferredSubject;
}
}
//# sourceMappingURL=DeferredSubject.js.map

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

import { __extends } from "tslib";
import Subject from './Subject';

@@ -9,12 +8,9 @@ /**

*/
var ReplaySubject = /** @class */ (function (_super) {
__extends(ReplaySubject, _super);
function ReplaySubject(replaySize) {
if (replaySize === void 0) { replaySize = 10; }
var _this = _super.call(this) || this;
_this.lastPayloads = [];
_this.replaySize = Math.abs(replaySize);
return _this;
export default class ReplaySubject extends Subject {
constructor(replaySize = 10) {
super();
this.lastPayloads = [];
this.replaySize = Math.abs(replaySize);
}
ReplaySubject.prototype.addPayload = function (payload) {
addPayload(payload) {
this.lastPayloads.push(payload);

@@ -24,3 +20,3 @@ if (this.lastPayloads.length > this.replaySize) {

}
};
}
/**

@@ -30,6 +26,6 @@ * @Override

*/
ReplaySubject.prototype.notify = function (payload) {
notify(payload) {
this.addPayload(payload);
_super.prototype.notify.call(this, payload);
};
super.notify(payload);
}
/**

@@ -40,11 +36,12 @@ * @Override

*/
ReplaySubject.prototype.subscribe = function (observer) {
this.lastPayloads.forEach(function (payload) {
subscribe(observer) {
this.lastPayloads.forEach((payload) => {
observer(payload);
});
return _super.prototype.subscribe.call(this, observer);
};
return ReplaySubject;
}(Subject));
export default ReplaySubject;
return super.subscribe(observer);
}
prune() {
this.lastPayloads.length = 0;
}
}
//# sourceMappingURL=ReplaySubject.js.map

@@ -7,4 +7,4 @@ /**

*/
var Subject = /** @class */ (function () {
function Subject() {
export default class Subject {
constructor() {
this.observers = [];

@@ -15,5 +15,5 @@ }

*/
Subject.prototype.notify = function (payload) {
this.observers.forEach(function (observer) { return observer(payload); });
};
notify(payload) {
this.observers.forEach((observer) => observer(payload));
}
/**

@@ -23,16 +23,15 @@ * Add an observer to the location subject. The observer will be notified each time there's a new list of

*/
Subject.prototype.subscribe = function (observer) {
var _this = this;
subscribe(observer) {
this.observers.push(observer);
return {
unsubscribe: function () { return _this.unsubscribe(observer); },
unsubscribe: () => this.unsubscribe(observer),
};
};
}
/**
* Remove an observer from the location subject.
*/
Subject.prototype.unsubscribe = function (observer) {
var observerIndex = this.observers.indexOf(observer);
unsubscribe(observer) {
const observerIndex = this.observers.indexOf(observer);
this.observers.splice(observerIndex, 1);
};
}
/**

@@ -42,11 +41,8 @@ * Converts a Subject into an Observable.

*/
Subject.prototype.asObservable = function () {
var _this = this;
asObservable() {
return {
subscribe: function (observer) { return _this.subscribe(observer); },
subscribe: (observer) => this.subscribe(observer),
};
};
return Subject;
}());
export default Subject;
}
}
//# sourceMappingURL=Subject.js.map
/// <reference types="node" />
import Subject, { Observer, Subscription } from './Subject';
import type { Observer, Subscription } from './Subject';
import Subject from './Subject';
export declare type Tick = null | number | NodeJS.Timer;

@@ -20,2 +21,4 @@ /**

notify(payload: T): void;
protected clearTimer(): void;
protected flush(): void;
/**

@@ -22,0 +25,0 @@ * @Override

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

import Subject, { Observer, Subscription } from './Subject';
import type { Observer, Subscription } from './Subject';
import Subject from './Subject';
/**

@@ -24,3 +25,4 @@ * Subject for a single location and its observers

subscribe(observer: Observer<T>): Subscription;
prune(): void;
}
//# sourceMappingURL=ReplaySubject.d.ts.map

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

import Subject, { Observer, Subscription } from './Subject';
import type { Observer, Subscription } from './Subject';
import Subject from './Subject';

@@ -14,3 +15,3 @@ export type Tick = null | number | NodeJS.Timer;

private lastPayload: T;
private lastPayload!: T;

@@ -25,4 +26,4 @@ constructor(private timeout: number = 0) {

*/
public notify(payload: T) {
clearTimeout(this.notifyTimer as number);
public override notify(payload: T) {
this.clearTimer();
this.lastPayload = payload;

@@ -34,9 +35,16 @@

this.notifyTimer = setTimeout(() => {
this.observers.forEach(observer => observer(this.lastPayload));
// reset timer
this.notifyTimer = null;
this.flush();
}, this.timeout);
}
protected clearTimer() {
clearTimeout(this.notifyTimer as number);
this.notifyTimer = null;
}
protected flush() {
this.clearTimer();
this.observers.forEach((observer) => observer(this.lastPayload));
}
/**

@@ -47,3 +55,3 @@ * @Override

*/
subscribe(observer: Observer<T>): Subscription {
override subscribe(observer: Observer<T>): Subscription {
this.observers.push(observer);

@@ -50,0 +58,0 @@

@@ -16,3 +16,3 @@ import ReplaySubject from './ReplaySubject';

subject.subscribe(payload => {
subject.subscribe((payload) => {
expect(payload).toBe(TEST_PAYLOAD);

@@ -28,3 +28,3 @@ });

ALL_PAYLOADS.forEach(payload => {
ALL_PAYLOADS.forEach((payload) => {
subject.notify(payload);

@@ -34,3 +34,3 @@ });

let count = 0;
subject.subscribe(payload => {
subject.subscribe((payload) => {
expect(payload).toBe(ALL_PAYLOADS[count]);

@@ -46,3 +46,3 @@ count += 1;

ALL_PAYLOADS.forEach(payload => {
ALL_PAYLOADS.forEach((payload) => {
subject.notify(payload);

@@ -52,3 +52,3 @@ });

let count = 5;
subject.subscribe(payload => {
subject.subscribe((payload) => {
expect(payload).toBe(ALL_PAYLOADS[count]);

@@ -55,0 +55,0 @@ count += 1;

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

import Subject, { Observer, Subscription } from './Subject';
import type { Observer, Subscription } from './Subject';
import Subject from './Subject';

@@ -30,3 +31,3 @@ /**

*/
public notify(payload: T) {
public override notify(payload: T) {
this.addPayload(payload);

@@ -41,4 +42,4 @@ super.notify(payload);

*/
subscribe(observer: Observer<T>): Subscription {
this.lastPayloads.forEach(payload => {
override subscribe(observer: Observer<T>): Subscription {
this.lastPayloads.forEach((payload) => {
observer(payload);

@@ -49,2 +50,6 @@ });

}
prune() {
this.lastPayloads.length = 0;
}
}

@@ -16,6 +16,6 @@ import Subject from './Subject';

subject.subscribe(payload => {
subject.subscribe((payload) => {
expect(payload).toBe(TEST_PAYLOAD);
});
subject.subscribe(payload => {
subject.subscribe((payload) => {
expect(payload).toBe(TEST_PAYLOAD);

@@ -51,3 +51,3 @@ });

subject.asObservable().subscribe(payload => {
subject.asObservable().subscribe((payload) => {
expect(payload).toBe(TEST_PAYLOAD);

@@ -65,3 +65,3 @@ });

subject.notify(DO_NOT_EXPECT_THIS_PAYLOAD);
subject.subscribe(payload => {
subject.subscribe((payload) => {
expect(payload).toBe(EXPECT_THIS_PAYLOAD);

@@ -68,0 +68,0 @@ });

@@ -24,3 +24,3 @@ export type Observer<T> = (data: T) => void;

public notify(payload: T) {
this.observers.forEach(observer => observer(payload));
this.observers.forEach((observer) => observer(payload));
}

@@ -27,0 +27,0 @@

{
"name": "@atlassian/clientside-extensions-base",
"version": "3.1.2-test9-85e70efb",
"version": "4.0.0-jakarta-m001",
"description": "Shared base components and utilities for Client-side extensions",

@@ -62,2 +62,3 @@ "license": "BSD-3-Clause",

"build:cjs": "tsc -p tsconfig.cjs.json",
"verify": "tsc --noEmit -p tsconfig.all.json",
"watch": "tsc --watch",

@@ -67,3 +68,9 @@ "test": "jest",

},
"gitHead": "85e70efbde55c09445ba190f07cac9938d63129f"
"dependencies": {
"tslib": "^2.2.0"
},
"engines": {
"node": ">=20.16.0"
},
"gitHead": "6cdaaa67ca52b745429b250585aae83fe244fe41"
}

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