hcloud-sdk 22.2.2 → 22.3.0

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/changelog.md CHANGED
@@ -1,5 +1,9 @@
1
- ## [22.2.2](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.2.1...v22.2.2) (2026-07-16)
1
+ ## [22.3.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.2.3...v22.3.0) (2026-07-23)
2
2
 
3
- ### Bug Fixes
3
+ ### Features
4
4
 
5
- * remove QUERY HttpMethod ([f784478](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/f7844788ab3cd274a3fa69ade77eba656068a452))
5
+ * **agent:** add cache management methods ([da44ee3](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/da44ee3b051c22c3aa632f92617a4f8bed260118))
6
+
7
+ ### Performance Improvements
8
+
9
+ * extend StreamCacheMetadata and High5ExecutionPackage interfaces ([adf2425](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/adf2425c2da8e51a7cfc99b3f6cade0c8289d91a))
@@ -0,0 +1,15 @@
1
+ export interface StreamCacheMetadata {
2
+ streamId: string;
3
+ orgName: string;
4
+ spaceName: string;
5
+ eventName: string;
6
+ streamName: string;
7
+ hash: string;
8
+ hits: number;
9
+ createdAt: number;
10
+ remainingTtl: number;
11
+ lastExecution?: number;
12
+ }
13
+ export interface StreamCacheWipeResult {
14
+ deleted: number;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -57,6 +57,8 @@ export interface High5ExecutionPackage {
57
57
  info: StreamInfo;
58
58
  debug: boolean;
59
59
  executionId: string;
60
+ streamName: string;
61
+ eventName: string;
60
62
  }
61
63
  type StreamInfo = {
62
64
  target: string;
@@ -1,9 +1,9 @@
1
1
  import { ReducedUser } from ".";
2
2
  export declare enum MessageSource {
3
- GLOBAL = 0,
4
- COSMO = 1,
5
- HIGH5 = 2,
6
- IDP = 3
3
+ GLOBAL = "GLOBAL",
4
+ COSMO = "COSMO",
5
+ HIGH5 = "HIGH5",
6
+ IDP = "IDP"
7
7
  }
8
8
  export declare enum MessageType {
9
9
  COSMO_ASSET_READY = "ASSET_READY",
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RecipientType = exports.MessageType = exports.MessageSource = void 0;
4
4
  var MessageSource;
5
5
  (function (MessageSource) {
6
- MessageSource[MessageSource["GLOBAL"] = 0] = "GLOBAL";
7
- MessageSource[MessageSource["COSMO"] = 1] = "COSMO";
8
- MessageSource[MessageSource["HIGH5"] = 2] = "HIGH5";
9
- MessageSource[MessageSource["IDP"] = 3] = "IDP";
6
+ MessageSource["GLOBAL"] = "GLOBAL";
7
+ MessageSource["COSMO"] = "COSMO";
8
+ MessageSource["HIGH5"] = "HIGH5";
9
+ MessageSource["IDP"] = "IDP";
10
10
  })(MessageSource || (exports.MessageSource = MessageSource = {}));
11
11
  var MessageType;
12
12
  (function (MessageType) {
@@ -0,0 +1,38 @@
1
+ import Base, { MaybeRaw } from "../../../Base";
2
+ import { StreamCacheMetadata, StreamCacheWipeResult } from "../../../interfaces/agent/cache";
3
+ export declare class AgentCache extends Base {
4
+ /**
5
+ * Retrieves metadata for all currently cached stream definitions.
6
+ * The cached design content is not exposed.
7
+ * @returns Array of cached stream metadata
8
+ */
9
+ listStreamCache<R extends boolean = false>(raw?: {
10
+ raw: R;
11
+ }): Promise<MaybeRaw<R, StreamCacheMetadata[]>>;
12
+ /**
13
+ * Retrieves metadata for a single cached stream entry by stream ID.
14
+ * The cached design content is not exposed.
15
+ * @param streamId - ID of the stream
16
+ * @returns Cached stream metadata
17
+ */
18
+ getStreamCache<R extends boolean = false>(streamId: string, raw?: {
19
+ raw: R;
20
+ }): Promise<MaybeRaw<R, StreamCacheMetadata>>;
21
+ /**
22
+ * Deletes a single cached stream entry by stream ID.
23
+ * Does not interrupt currently running executions.
24
+ * @param streamId - ID of the stream cache entry to delete
25
+ */
26
+ deleteStreamCache<R extends boolean = false>(streamId: string, raw?: {
27
+ raw: R;
28
+ }): Promise<MaybeRaw<R, void>>;
29
+ /**
30
+ * Deletes all cached stream entries.
31
+ * Does not interrupt currently running executions, future executions will rebuild the cache naturally.
32
+ * @returns Number of deleted cache entries
33
+ */
34
+ clearCache<R extends boolean = false>(raw?: {
35
+ raw: R;
36
+ }): Promise<MaybeRaw<R, StreamCacheWipeResult>>;
37
+ protected getEndpoint(endpoint: string): string;
38
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AgentCache = void 0;
16
+ const Base_1 = __importDefault(require("../../../Base"));
17
+ class AgentCache extends Base_1.default {
18
+ /**
19
+ * Retrieves metadata for all currently cached stream definitions.
20
+ * The cached design content is not exposed.
21
+ * @returns Array of cached stream metadata
22
+ */
23
+ listStreamCache(raw) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const resp = yield this.axios.get(this.getEndpoint(`/v1/cache`));
26
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
27
+ });
28
+ }
29
+ /**
30
+ * Retrieves metadata for a single cached stream entry by stream ID.
31
+ * The cached design content is not exposed.
32
+ * @param streamId - ID of the stream
33
+ * @returns Cached stream metadata
34
+ */
35
+ getStreamCache(streamId, raw) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const resp = yield this.axios.get(this.getEndpoint(`/v1/cache/${streamId}`));
38
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
39
+ });
40
+ }
41
+ /**
42
+ * Deletes a single cached stream entry by stream ID.
43
+ * Does not interrupt currently running executions.
44
+ * @param streamId - ID of the stream cache entry to delete
45
+ */
46
+ deleteStreamCache(streamId, raw) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const resp = yield this.axios.delete(this.getEndpoint(`/v1/cache/${streamId}`));
49
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
50
+ });
51
+ }
52
+ /**
53
+ * Deletes all cached stream entries.
54
+ * Does not interrupt currently running executions, future executions will rebuild the cache naturally.
55
+ * @returns Number of deleted cache entries
56
+ */
57
+ clearCache(raw) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const resp = yield this.axios.delete(this.getEndpoint(`/v1/cache`));
60
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
61
+ });
62
+ }
63
+ getEndpoint(endpoint) {
64
+ return `${this.options.server}/api/agent${endpoint}`;
65
+ }
66
+ }
67
+ exports.AgentCache = AgentCache;
@@ -1,6 +1,7 @@
1
1
  import Base from "../../Base";
2
2
  import { AgentBundle } from "./bundle";
3
3
  import { DevBundle } from "./bundle/dev";
4
+ import { AgentCache } from "./cache";
4
5
  import { AgentContext } from "./context";
5
6
  import { AgentInstaller } from "./installer";
6
7
  import { AgentLogging } from "./logging";
@@ -18,5 +19,7 @@ export default class Agent extends Base {
18
19
  private _logging?;
19
20
  get module(): AgentModule;
20
21
  private _module?;
22
+ get cache(): AgentCache;
23
+ private _cache?;
21
24
  protected getEndpoint(endpoint: string): string;
22
25
  }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Base_1 = __importDefault(require("../../Base"));
7
7
  const bundle_1 = require("./bundle");
8
8
  const dev_1 = require("./bundle/dev");
9
+ const cache_1 = require("./cache");
9
10
  const context_1 = require("./context");
10
11
  const installer_1 = require("./installer");
11
12
  const logging_1 = require("./logging");
@@ -47,6 +48,12 @@ class Agent extends Base_1.default {
47
48
  }
48
49
  return this._module;
49
50
  }
51
+ get cache() {
52
+ if (this._cache === undefined) {
53
+ this._cache = new cache_1.AgentCache(this.options, this.axios);
54
+ }
55
+ return this._cache;
56
+ }
50
57
  getEndpoint(endpoint) {
51
58
  return `${this.options.server}/api/agent${endpoint}`;
52
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hcloud-sdk",
3
- "version": "22.2.2",
3
+ "version": "22.3.0",
4
4
  "description": "hcloud platform sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",