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

@mittwald/kubernetes

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mittwald/kubernetes - npm Package Compare versions

Comparing version 3.3.5 to 3.4.0

23

cache/informer.js
"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 });

@@ -12,3 +21,3 @@ const store_1 = require("./store");

start() {
const handler = (event) => {
const handler = (event) => __awaiter(this, void 0, void 0, function* () {
const { type, object } = event;

@@ -19,14 +28,14 @@ switch (type) {

debug("added or updated object %o: %o", object.kind, `${object.metadata.namespace}/${object.metadata.name}`);
this.store.store(object);
yield this.store.store(object);
break;
case "DELETED":
debug("removed object %o: %s", object.kind, `${object.metadata.namespace}/${object.metadata.name}`);
this.store.pull(object);
yield this.store.pull(object);
break;
}
};
const opts = Object.assign({ skipAddEventsOnResync: true, onResync: (objs) => {
});
const opts = Object.assign({ skipAddEventsOnResync: true, onResync: (objs) => __awaiter(this, void 0, void 0, function* () {
debug("resynced %d objects", objs.length);
this.store.sync(objs);
} }, this.opts);
yield this.store.sync(objs);
}) }, this.opts);
const watchHandle = this.resource.listWatch(handler, undefined, opts);

@@ -33,0 +42,0 @@ return {

import { MetadataObject } from "../types/meta";
import { INamespacedResourceClient } from "../resource";
export interface Store<R extends MetadataObject> {
store(obj: R): void;
store(obj: R): Promise<void>;
get(namespace: string, name: string): Promise<R | undefined>;
pull(obj: R): void;
sync(objs: R[]): void;
pull(obj: R): Promise<void>;
sync(objs: R[]): Promise<void>;
}

@@ -24,11 +24,11 @@ export interface ObservableStore<R extends MetadataObject> extends Store<R> {

get(namespace: string, name: string): Promise<R | undefined>;
pull(obj: R): void;
store(obj: R): void;
sync(objs: R[]): void;
pull(obj: R): Promise<void>;
store(obj: R): Promise<void>;
sync(objs: R[]): Promise<void>;
}
export declare class InMemoryStore<R extends MetadataObject> implements Store<R> {
private objects;
store(obj: R): void;
pull(obj: R): void;
sync(objs: R[]): void;
store(obj: R): Promise<void>;
pull(obj: R): Promise<void>;
sync(objs: R[]): Promise<void>;
get(namespace: string, name: string): Promise<R | undefined>;

@@ -40,6 +40,6 @@ }

constructor(api: INamespacedResourceClient<R, any, any>);
store(obj: R): void;
sync(objs: R[]): void;
store(obj: R): Promise<void>;
sync(objs: R[]): Promise<void>;
get(namespace: string, name: string): Promise<R | undefined>;
pull(obj: R): void;
pull(obj: R): Promise<void>;
}

@@ -32,12 +32,18 @@ "use strict";

pull(obj) {
this.inner.pull(obj);
this.onRemoveHandlers.forEach(fn => fn(obj));
return __awaiter(this, void 0, void 0, function* () {
yield this.inner.pull(obj);
yield Promise.all(this.onRemoveHandlers.map(h => h(obj)));
});
}
store(obj) {
this.inner.store(obj);
this.onStoreHandlers.forEach(fn => fn(obj));
return __awaiter(this, void 0, void 0, function* () {
yield this.inner.store(obj);
yield Promise.all(this.onStoreHandlers.map(h => h(obj)));
});
}
sync(objs) {
this.inner.sync(objs);
this.onSyncedHandlers.forEach(fn => fn(objs));
return __awaiter(this, void 0, void 0, function* () {
yield this.inner.sync(objs);
yield Promise.all(this.onSyncedHandlers.map(h => h(objs)));
});
}

@@ -51,10 +57,16 @@ }

store(obj) {
this.objects.set(`${obj.metadata.namespace}/${obj.metadata.name}`, obj);
return __awaiter(this, void 0, void 0, function* () {
this.objects.set(`${obj.metadata.namespace}/${obj.metadata.name}`, obj);
});
}
pull(obj) {
this.objects.delete(`${obj.metadata.namespace}/${obj.metadata.name}`);
return __awaiter(this, void 0, void 0, function* () {
this.objects.delete(`${obj.metadata.namespace}/${obj.metadata.name}`);
});
}
sync(objs) {
this.objects = new Map();
objs.forEach(o => this.store(o));
return __awaiter(this, void 0, void 0, function* () {
this.objects = new Map();
yield Promise.all(objs.map(o => this.store(o)));
});
}

@@ -74,6 +86,10 @@ get(namespace, name) {

store(obj) {
// no-op
return __awaiter(this, void 0, void 0, function* () {
// no-op
});
}
sync(objs) {
// no-op
return __awaiter(this, void 0, void 0, function* () {
// no-op
});
}

@@ -102,3 +118,5 @@ get(namespace, name) {

pull(obj) {
// no-op
return __awaiter(this, void 0, void 0, function* () {
// no-op
});
}

@@ -105,0 +123,0 @@ }

"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());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -90,3 +99,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

return new Promise((res, rej) => {
const req = request_1.default(opts, (err, response, bodyString) => {
const req = request_1.default(opts, (err, response, bodyString) => __awaiter(this, void 0, void 0, function* () {
if (err) {

@@ -128,3 +137,3 @@ rej(err);

lastVersion = resourceVersion;
onUpdate(parsedLine);
yield onUpdate(parsedLine);
}

@@ -148,5 +157,5 @@ }

res({ resourceVersion: lastVersion });
});
}));
let buffer = "";
req.on("data", chunk => {
req.on("data", (chunk) => __awaiter(this, void 0, void 0, function* () {
if (chunk instanceof Buffer) {

@@ -164,3 +173,3 @@ chunk = chunk.toString("utf-8");

lastVersion = resourceVersion;
onUpdate(obj);
yield onUpdate(obj);
}

@@ -171,3 +180,3 @@ }

}
});
}));
});

@@ -174,0 +183,0 @@ }

@@ -64,3 +64,3 @@ {

},
"version": "3.3.5"
"version": "3.4.0"
}

@@ -123,6 +123,6 @@ "use strict";

const resync = () => this.client.get(this.baseURL, opts)
.then((list) => {
.then((list) => __awaiter(this, void 0, void 0, function* () {
resourceVersion = parseInt(list.metadata.resourceVersion, 10);
if (opts.onResync) {
opts.onResync(list.items || []);
yield opts.onResync(list.items || []);
}

@@ -132,6 +132,6 @@ if (!opts.skipAddEventsOnResync) {

const event = { type: "ADDED", object: i };
handler(event);
yield handler(event);
}
}
});
}));
const initialized = resync();

@@ -163,3 +163,3 @@ const done = initialized.then(() => __awaiter(this, void 0, void 0, function* () {

if (opts.onError) {
opts.onError(err);
yield opts.onError(err);
}

@@ -166,0 +166,0 @@ if (opts.abortAfterErrorCount && errorCount > opts.abortAfterErrorCount) {

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