pepr 0.1.39 → 0.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "engines": {
10
10
  "node": ">=18.0.0"
11
11
  },
12
- "version": "0.1.39",
12
+ "version": "0.1.40",
13
13
  "main": "dist/index.js",
14
14
  "types": "dist/index.d.ts",
15
15
  "pepr": {
@@ -4,6 +4,7 @@ export declare class Controller {
4
4
  private readonly config;
5
5
  private readonly capabilities;
6
6
  private readonly app;
7
+ private running;
7
8
  constructor(config: ModuleConfig, capabilities: Capability[]);
8
9
  /** Start the webhook server */
9
10
  startServer: (port: number) => void;
@@ -20,11 +20,17 @@ class Controller {
20
20
  this.config = config;
21
21
  this.capabilities = capabilities;
22
22
  this.app = (0, express_1.default)();
23
+ this.running = false;
23
24
  /** Start the webhook server */
24
25
  this.startServer = (port) => {
26
+ if (this.running) {
27
+ throw new Error("Cannot start Pepr module: Pepr module was not instantiated with deferStart=true");
28
+ }
25
29
  // Create HTTPS server
26
30
  https_1.default.createServer(options, this.app).listen(port, () => {
27
31
  console.log(`Server listening on port ${port}`);
32
+ // Track that the server is running
33
+ this.running = true;
28
34
  });
29
35
  };
30
36
  this.logger = (req, res, next) => {
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
4
+ var __importDefault = (this && this.__importDefault) || function (mod) {
5
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6
+ };
4
7
  Object.defineProperty(exports, "__esModule", { value: true });
5
8
  exports.PeprModule = void 0;
6
- const index_1 = require("index");
9
+ const ramda_1 = __importDefault(require("ramda"));
7
10
  const controller_1 = require("./controller");
8
11
  const alwaysIgnore = {
9
12
  namespaces: ["kube-system", "pepr-system"],
@@ -19,7 +22,7 @@ class PeprModule {
19
22
  */
20
23
  constructor({ description, pepr }, capabilities = [], _deferStart = false) {
21
24
  this._deferStart = _deferStart;
22
- const config = index_1.utils.mergeDeepWith(index_1.utils.concat, pepr, alwaysIgnore);
25
+ const config = ramda_1.default.mergeDeepWith(ramda_1.default.concat, pepr, alwaysIgnore);
23
26
  config.description = description;
24
27
  this._controller = new controller_1.Controller(config, capabilities);
25
28
  if (!_deferStart) {
@@ -33,9 +36,6 @@ class PeprModule {
33
36
  * @param port
34
37
  */
35
38
  start(port = 3000) {
36
- if (!this._deferStart) {
37
- throw new Error("Cannot start Pepr module: Pepr module was not instantiated with deferStart=true");
38
- }
39
39
  this._controller.startServer(port);
40
40
  }
41
41
  }
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
4
+ var __importDefault = (this && this.__importDefault) || function (mod) {
5
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6
+ };
4
7
  Object.defineProperty(exports, "__esModule", { value: true });
5
8
  exports.RequestWrapper = void 0;
6
- const index_1 = require("index");
9
+ const ramda_1 = __importDefault(require("ramda"));
7
10
  /**
8
11
  * The RequestWrapper class provides methods to modify Kubernetes objects in the context
9
12
  * of a mutating webhook request.
@@ -39,7 +42,7 @@ class RequestWrapper {
39
42
  */
40
43
  constructor(input) {
41
44
  // Deep clone the object to prevent mutation of the original object
42
- this.Raw = index_1.utils.clone(input.object);
45
+ this.Raw = ramda_1.default.clone(input.object);
43
46
  // Store the input
44
47
  this._input = input;
45
48
  }
@@ -49,7 +52,7 @@ class RequestWrapper {
49
52
  * @param obj - The object to merge with the current resource.
50
53
  */
51
54
  Merge(obj) {
52
- this.Raw = index_1.utils.mergeDeepRight(this.Raw, obj);
55
+ this.Raw = ramda_1.default.mergeDeepRight(this.Raw, obj);
53
56
  }
54
57
  /**
55
58
  * Updates a label on the Kubernetes resource.
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "engines": {
10
10
  "node": ">=18.0.0"
11
11
  },
12
- "version": "0.1.39",
12
+ "version": "0.1.40",
13
13
  "main": "dist/index.js",
14
14
  "types": "dist/index.d.ts",
15
15
  "pepr": {