hcloud-sdk 22.2.3 → 22.4.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 +4 -3
- package/lib/interfaces/agent/cache/index.d.ts +15 -0
- package/lib/interfaces/agent/cache/index.js +2 -0
- package/lib/interfaces/global/ErrorCodes.d.ts +5 -1
- package/lib/interfaces/global/ErrorCodes.js +6 -1
- package/lib/interfaces/high5/space/execution/index.d.ts +2 -0
- package/lib/service/agent/cache/index.d.ts +38 -0
- package/lib/service/agent/cache/index.js +67 -0
- package/lib/service/agent/index.d.ts +3 -0
- package/lib/service/agent/index.js +7 -0
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
## [22.
|
|
1
|
+
## [22.4.0](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/compare/v22.3.0...v22.4.0) (2026-07-23)
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### Features
|
|
4
4
|
|
|
5
|
-
*
|
|
5
|
+
* update error codes ([746b535](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/746b535126921eba8510df861baff12351276cfd))
|
|
6
|
+
* update error codes ([c15e73a](https://github.com/moovit-sp-gmbh/hcloud-sdk-js/commit/c15e73aaa020d13b5f2431f423b5304f657d506b))
|
|
@@ -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
|
+
}
|
|
@@ -507,7 +507,7 @@ export declare const ErrorCodes: readonly [{
|
|
|
507
507
|
readonly error: "stream.not.found";
|
|
508
508
|
readonly message: "Given stream not found";
|
|
509
509
|
}, {
|
|
510
|
-
readonly code: "002.014.
|
|
510
|
+
readonly code: "002.014.0002";
|
|
511
511
|
readonly error: "stream.invalid.order";
|
|
512
512
|
readonly message: "The stream order provided is invalid. It should be sequential, incremental by 1, starting from 1 and not exceeding total events stream count.";
|
|
513
513
|
}, {
|
|
@@ -854,6 +854,10 @@ export declare const ErrorCodes: readonly [{
|
|
|
854
854
|
readonly code: "005.001.0004";
|
|
855
855
|
readonly error: "insufficient.rights";
|
|
856
856
|
readonly message: "You have not enough rights to access/manipulate this resource";
|
|
857
|
+
}, {
|
|
858
|
+
readonly code: "005.014.0003";
|
|
859
|
+
readonly error: "stream.cache.not.found";
|
|
860
|
+
readonly message: "Stream cache entry not found";
|
|
857
861
|
}, {
|
|
858
862
|
readonly code: "005.023.0001";
|
|
859
863
|
readonly error: "search.invalid.filter";
|
|
@@ -639,7 +639,7 @@ exports.ErrorCodes = [
|
|
|
639
639
|
message: "Given stream not found"
|
|
640
640
|
},
|
|
641
641
|
{
|
|
642
|
-
code: "002.014.
|
|
642
|
+
code: "002.014.0002",
|
|
643
643
|
error: "stream.invalid.order",
|
|
644
644
|
message: "The stream order provided is invalid. It should be sequential, incremental by 1, starting from 1 and not exceeding total events stream count."
|
|
645
645
|
},
|
|
@@ -1073,6 +1073,11 @@ exports.ErrorCodes = [
|
|
|
1073
1073
|
error: "insufficient.rights",
|
|
1074
1074
|
message: "You have not enough rights to access/manipulate this resource"
|
|
1075
1075
|
},
|
|
1076
|
+
{
|
|
1077
|
+
code: "005.014.0003",
|
|
1078
|
+
error: "stream.cache.not.found",
|
|
1079
|
+
message: "Stream cache entry not found"
|
|
1080
|
+
},
|
|
1076
1081
|
{
|
|
1077
1082
|
code: "005.023.0001",
|
|
1078
1083
|
error: "search.invalid.filter",
|
|
@@ -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
|
}
|