kubernetes-fluent-client 2.3.1 → 2.3.2

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.
@@ -31,6 +31,8 @@ export declare enum WatchEvent {
31
31
  }
32
32
  /** Configuration for the watch function. */
33
33
  export type WatchCfg = {
34
+ /** Whether to allow watch bookmarks. */
35
+ allowWatchBookmarks?: boolean;
34
36
  /** The resource version to start the watch at, this will be updated on each event. */
35
37
  resourceVersion?: string;
36
38
  /** The maximum number of times to retry the watch, the retry count is reset on success. Unlimited retries if not specified. */
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/fluent/watch.ts"],"names":[],"mappings":";;AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAc,MAAM,SAAS,CAAC;AAG3D,oBAAY,UAAU;IACpB,sCAAsC;IACtC,OAAO,YAAY;IACnB,2BAA2B;IAC3B,aAAa,kBAAkB;IAC/B,kDAAkD;IAClD,UAAU,eAAe;IACzB,0BAA0B;IAC1B,SAAS,cAAc;IACvB,8BAA8B;IAC9B,OAAO,YAAY;IACnB,sBAAsB;IACtB,KAAK,UAAU;IACf,uBAAuB;IACvB,MAAM,WAAW;IACjB,mCAAmC;IACnC,IAAI,SAAS;IACb,2BAA2B;IAC3B,QAAQ,aAAa;IACrB,iCAAiC;IACjC,gBAAgB,qBAAqB;IACrC,wCAAwC;IACxC,oBAAoB,yBAAyB;IAC7C,qCAAqC;IACrC,iBAAiB,sBAAsB;CACxC;AAED,4CAA4C;AAC5C,MAAM,MAAM,QAAQ,GAAG;IACrB,sFAAsF;IACtF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+HAA+H;IAC/H,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,aAAa,CAAC,EAAE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7C,qCAAqC;IACrC,iBAAiB,sBAAsB;CACxC;AAED,4CAA4C;AAC5C,MAAM,MAAM,QAAQ,GAAG;IACrB,wCAAwC;IACxC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,sFAAsF;IACtF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+HAA+H;IAC/H,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0GAA0G;IAC1G,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,iDAAiD;AACjD,qBAAa,OAAO,CAAC,CAAC,SAAS,YAAY;;IAyBzC;;;;;;;;;;;OAWG;gBACS,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAE,QAAa;IAiBzF;;;;OAIG;IACU,KAAK,IAAI,OAAO,CAAC,eAAe,CAAC;IAK9C,gGAAgG;IACzF,KAAK;IAMZ;;;;;OAKG;IACI,UAAU;IAWjB;;;;OAIG;IACH,IAAW,eAAe,IASkB,MAAM,GAAG,SAAS,CAP7D;IAED;;;;OAIG;IACH,IAAW,eAAe,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,EAE7D;IAED;;;;;;OAMG;IACH,IAAW,MAAM,IAAI,YAAY,CAEhC;CAyOF"}
@@ -159,7 +159,7 @@ class Watcher {
159
159
  url.searchParams.set("resourceVersion", this.#watchCfg.resourceVersion);
160
160
  }
161
161
  // Enable watch bookmarks
162
- url.searchParams.set("allowWatchBookmarks", "true");
162
+ url.searchParams.set("allowWatchBookmarks", this.#watchCfg.allowWatchBookmarks ? `${this.#watchCfg.allowWatchBookmarks}` : "true");
163
163
  // Add the abort signal to the request options
164
164
  opts.signal = this.#abortController.signal;
165
165
  return { opts, url };
@@ -281,6 +281,7 @@ class Watcher {
281
281
  this.#retryCount++;
282
282
  this.#events.emit(WatchEvent.RECONNECT, err, this.#retryCount);
283
283
  if (this.#pendingReconnect) {
284
+ // wait for the connection to be re-established
284
285
  this.#events.emit(WatchEvent.RECONNECT_PENDING);
285
286
  }
286
287
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kubernetes-fluent-client",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "A @kubernetes/client-node fluent API wrapper that leverages K8s Server Side Apply.",
5
5
  "bin": "./dist/cli.js",
6
6
  "main": "dist/index.js",
@@ -40,26 +40,26 @@
40
40
  "fast-json-patch": "3.1.1",
41
41
  "http-status-codes": "2.3.0",
42
42
  "node-fetch": "2.7.0",
43
- "quicktype-core": "23.0.115",
44
- "type-fest": "4.15.0",
43
+ "quicktype-core": "23.0.158",
44
+ "type-fest": "4.18.0",
45
45
  "yargs": "17.7.2"
46
46
  },
47
47
  "devDependencies": {
48
- "@commitlint/cli": "19.2.1",
49
- "@commitlint/config-conventional": "19.1.0",
48
+ "@commitlint/cli": "19.3.0",
49
+ "@commitlint/config-conventional": "19.2.2",
50
50
  "@jest/globals": "29.7.0",
51
51
  "@types/byline": "4.2.36",
52
52
  "@types/readable-stream": "4.0.11",
53
53
  "@types/yargs": "17.0.32",
54
- "@typescript-eslint/eslint-plugin": "7.5.0",
55
- "@typescript-eslint/parser": "7.5.0",
54
+ "@typescript-eslint/eslint-plugin": "7.8.0",
55
+ "@typescript-eslint/parser": "7.8.0",
56
56
  "eslint-plugin-jsdoc": "48.2.3",
57
57
  "jest": "29.7.0",
58
58
  "nock": "13.5.4",
59
59
  "prettier": "3.2.5",
60
- "semantic-release": "23.0.7",
60
+ "semantic-release": "23.0.8",
61
61
  "ts-jest": "29.1.2",
62
- "typescript": "5.4.4"
62
+ "typescript": "5.4.5"
63
63
  },
64
64
  "release": {
65
65
  "branches": [
@@ -39,6 +39,8 @@ export enum WatchEvent {
39
39
 
40
40
  /** Configuration for the watch function. */
41
41
  export type WatchCfg = {
42
+ /** Whether to allow watch bookmarks. */
43
+ allowWatchBookmarks?: boolean;
42
44
  /** The resource version to start the watch at, this will be updated on each event. */
43
45
  resourceVersion?: string;
44
46
  /** The maximum number of times to retry the watch, the retry count is reset on success. Unlimited retries if not specified. */
@@ -175,6 +177,7 @@ export class Watcher<T extends GenericClass> {
175
177
  #buildURL = async () => {
176
178
  // Build the path and query params for the resource, excluding the name
177
179
  const { opts, serverUrl } = await k8sCfg("GET");
180
+
178
181
  const url = pathBuilder(serverUrl, this.#model, this.#filters, true);
179
182
 
180
183
  // Enable the watch query param
@@ -191,7 +194,10 @@ export class Watcher<T extends GenericClass> {
191
194
  }
192
195
 
193
196
  // Enable watch bookmarks
194
- url.searchParams.set("allowWatchBookmarks", "true");
197
+ url.searchParams.set(
198
+ "allowWatchBookmarks",
199
+ this.#watchCfg.allowWatchBookmarks ? `${this.#watchCfg.allowWatchBookmarks}` : "true",
200
+ );
195
201
 
196
202
  // Add the abort signal to the request options
197
203
  opts.signal = this.#abortController.signal;
@@ -340,6 +346,7 @@ export class Watcher<T extends GenericClass> {
340
346
  this.#events.emit(WatchEvent.RECONNECT, err, this.#retryCount);
341
347
 
342
348
  if (this.#pendingReconnect) {
349
+ // wait for the connection to be re-established
343
350
  this.#events.emit(WatchEvent.RECONNECT_PENDING);
344
351
  } else {
345
352
  this.#pendingReconnect = true;