@flink-app/management-actions-plugin 0.13.1 → 0.13.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.
@@ -1,4 +1,4 @@
1
- // Generated Sat Jan 10 2026 11:13:33 GMT+0100 (Central European Standard Time)
1
+ // Generated Sat Jan 10 2026 11:36:47 GMT+0100 (Central European Standard Time)
2
2
  import { autoRegisteredHandlers, HttpMethod } from "@flink-app/flink";
3
3
  import * as Get_0 from "../src/handlers/Get";
4
4
  import * as PostById_0 from "../src/handlers/PostById";
@@ -1,4 +1,4 @@
1
- // Generated Sat Jan 10 2026 11:13:33 GMT+0100 (Central European Standard Time)
1
+ // Generated Sat Jan 10 2026 11:36:48 GMT+0100 (Central European Standard Time)
2
2
  import { autoRegisteredJobs } from "@flink-app/flink";
3
3
  export const jobs = [];
4
4
  autoRegisteredJobs.push(...jobs);
@@ -1,4 +1,4 @@
1
- // Generated Sat Jan 10 2026 11:13:33 GMT+0100 (Central European Standard Time)
1
+ // Generated Sat Jan 10 2026 11:36:47 GMT+0100 (Central European Standard Time)
2
2
  import { autoRegisteredRepos } from "@flink-app/flink";
3
3
  export const repos = [];
4
4
  autoRegisteredRepos.push(...repos);
@@ -1 +1 @@
1
- // Generated Sat Jan 10 2026 11:13:33 GMT+0100 (Central European Standard Time)
1
+ // Generated Sat Jan 10 2026 11:36:48 GMT+0100 (Central European Standard Time)
package/.flink/start.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Generated Sat Jan 10 2026 11:13:33 GMT+0100 (Central European Standard Time)
1
+ // Generated Sat Jan 10 2026 11:36:48 GMT+0100 (Central European Standard Time)
2
2
  import "./generatedHandlers";
3
3
  import "./generatedRepos";
4
4
  import "./generatedJobs";
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @flink-app/management-actions-plugin
2
2
 
3
+ ## 0.13.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed invalid types and improve typescript error message during schema compilation
8
+ - Updated dependencies
9
+ - @flink-app/management-api-plugin@0.13.1
10
+ - @flink-app/flink@0.13.1
11
+
3
12
  ## 0.13.0
4
13
 
5
14
  ### Minor Changes
@@ -0,0 +1 @@
1
+ export declare const handlers: never[];
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handlers = void 0;
4
+ // Generated Sat Jan 10 2026 11:36:47 GMT+0100 (Central European Standard Time)
5
+ var flink_1 = require("@flink-app/flink");
6
+ exports.handlers = [];
7
+ flink_1.autoRegisteredHandlers.push.apply(flink_1.autoRegisteredHandlers, exports.handlers);
@@ -0,0 +1 @@
1
+ export declare const jobs: never[];
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jobs = void 0;
4
+ // Generated Sat Jan 10 2026 11:36:48 GMT+0100 (Central European Standard Time)
5
+ var flink_1 = require("@flink-app/flink");
6
+ exports.jobs = [];
7
+ flink_1.autoRegisteredJobs.push.apply(flink_1.autoRegisteredJobs, exports.jobs);
@@ -0,0 +1 @@
1
+ export declare const repos: never[];
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.repos = void 0;
4
+ // Generated Sat Jan 10 2026 11:36:47 GMT+0100 (Central European Standard Time)
5
+ var flink_1 = require("@flink-app/flink");
6
+ exports.repos = [];
7
+ flink_1.autoRegisteredRepos.push.apply(flink_1.autoRegisteredRepos, exports.repos);
File without changes
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ // Generated Sat Jan 10 2026 11:36:48 GMT+0100 (Central European Standard Time)
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$ref": "#/definitions/Schemas",
4
+ "definitions": {}
5
+ }
@@ -0,0 +1,6 @@
1
+ import "./generatedHandlers";
2
+ import "./generatedRepos";
3
+ import "./generatedJobs";
4
+ import "../src/index";
5
+ declare const _default: {};
6
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Generated Sat Jan 10 2026 11:36:48 GMT+0100 (Central European Standard Time)
4
+ require("./generatedHandlers");
5
+ require("./generatedRepos");
6
+ require("./generatedJobs");
7
+ require("../src/index");
8
+ exports.default = {}; // Export an empty object to make it a module
@@ -0,0 +1,5 @@
1
+ import { FlinkContext, Handler } from "@flink-app/flink";
2
+ import { ActionView } from "../schemas/Action";
3
+ declare const getHandler: Handler<FlinkContext, any, ActionView[]>;
4
+ export default getHandler;
5
+ export declare const __assumedHttpMethod = "get", __file = "Get.ts", __query: never[], __params: never[];
@@ -0,0 +1,69 @@
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 __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
40
+ var getHandler = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
41
+ var modules, module, actions, data;
42
+ var _c, _d;
43
+ var ctx = _b.ctx, req = _b.req, origin = _b.origin;
44
+ return __generator(this, function (_e) {
45
+ modules = ctx.plugins.managementApi.moduleList.modules;
46
+ module = modules.find(function (p) { return p.id == origin; });
47
+ if (((_c = module.data) === null || _c === void 0 ? void 0 : _c.actions) == null) {
48
+ return [2 /*return*/, {
49
+ data: [],
50
+ status: 200,
51
+ }];
52
+ }
53
+ actions = (_d = module.data) === null || _d === void 0 ? void 0 : _d.actions;
54
+ data = actions.map(function (a) {
55
+ var av = {
56
+ id: a.id,
57
+ description: a.description,
58
+ arguments: a.arguments,
59
+ };
60
+ return av;
61
+ });
62
+ return [2 /*return*/, {
63
+ data: data,
64
+ status: 200,
65
+ }];
66
+ });
67
+ }); };
68
+ exports.default = getHandler;
69
+ exports.__assumedHttpMethod = "get", exports.__file = "Get.ts", exports.__query = [], exports.__params = [];
@@ -0,0 +1,5 @@
1
+ import { FlinkContext, Handler } from "@flink-app/flink";
2
+ import { ActionArgumentsValues, ActionResponse } from "../schemas/Action";
3
+ declare const postHandler: Handler<FlinkContext, ActionArgumentsValues, ActionResponse>;
4
+ export default postHandler;
5
+ export declare const __assumedHttpMethod = "post", __file = "PostById.ts", __query: never[], __params: never[];
@@ -0,0 +1,93 @@
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 __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
40
+ var flink_1 = require("@flink-app/flink");
41
+ var Action_1 = require("../schemas/Action");
42
+ var postHandler = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
43
+ var modules, module, actions, action, i, arg, resp, ex_1;
44
+ var _c;
45
+ var ctx = _b.ctx, req = _b.req, origin = _b.origin;
46
+ return __generator(this, function (_d) {
47
+ switch (_d.label) {
48
+ case 0:
49
+ modules = ctx.plugins.managementApi.moduleList.modules;
50
+ module = modules.find(function (p) { return p.id == origin; });
51
+ if (((_c = module.data) === null || _c === void 0 ? void 0 : _c.actions) == null) {
52
+ return [2 /*return*/, (0, flink_1.notFound)("Action not found")];
53
+ }
54
+ actions = module.data.actions;
55
+ action = actions.find(function (a) { return a.id == req.params.actionId; });
56
+ if (action == null) {
57
+ return [2 /*return*/, (0, flink_1.notFound)("Action not found")];
58
+ }
59
+ for (i in action.arguments) {
60
+ arg = action.arguments[i];
61
+ if (arg.required) {
62
+ if (req.body[arg.id] == null) {
63
+ return [2 /*return*/, (0, flink_1.badRequest)("".concat(arg.id, " is missing "))];
64
+ }
65
+ }
66
+ }
67
+ _d.label = 1;
68
+ case 1:
69
+ _d.trys.push([1, 3, , 4]);
70
+ return [4 /*yield*/, action.handler(ctx, req.body)];
71
+ case 2:
72
+ resp = _d.sent();
73
+ if (resp.status == Action_1.ActionReturnStatus.success) {
74
+ return [2 /*return*/, {
75
+ data: resp,
76
+ status: 200,
77
+ }];
78
+ }
79
+ else {
80
+ return [2 /*return*/, (0, flink_1.internalServerError)(resp.error)];
81
+ }
82
+ return [3 /*break*/, 4];
83
+ case 3:
84
+ ex_1 = _d.sent();
85
+ console.log("EXCEPTIOIN managementActionsPlugin:");
86
+ console.log(ex_1);
87
+ return [2 /*return*/, (0, flink_1.internalServerError)()];
88
+ case 4: return [2 /*return*/];
89
+ }
90
+ });
91
+ }); };
92
+ exports.default = postHandler;
93
+ exports.__assumedHttpMethod = "post", exports.__file = "PostById.ts", exports.__query = [], exports.__params = [];
@@ -0,0 +1,11 @@
1
+ import { ManagementApiModule } from "@flink-app/management-api-plugin";
2
+ import { Action } from "./schemas/Action";
3
+ export interface GetManagementModuleConfig {
4
+ pluginId?: string;
5
+ ui: boolean;
6
+ uiSettings?: {
7
+ title: string;
8
+ };
9
+ actions: Action[];
10
+ }
11
+ export declare const GetManagementModule: (config: GetManagementModuleConfig) => ManagementApiModule;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.GetManagementModule = void 0;
27
+ var management_api_plugin_1 = require("@flink-app/management-api-plugin");
28
+ var flink_1 = require("@flink-app/flink");
29
+ var postHandler = __importStar(require("./handlers/PostById"));
30
+ var getHandler = __importStar(require("./handlers/Get"));
31
+ var GetManagementModule = function (config) {
32
+ var _a;
33
+ if (config.pluginId == null)
34
+ config.pluginId = "managementActionsApi";
35
+ var endpoints = [];
36
+ endpoints.push({
37
+ routeProps: {
38
+ path: "/:actionId",
39
+ method: flink_1.HttpMethod.post,
40
+ origin: config.pluginId,
41
+ },
42
+ handler: postHandler,
43
+ });
44
+ endpoints.push({
45
+ routeProps: {
46
+ path: "",
47
+ method: flink_1.HttpMethod.get,
48
+ origin: config.pluginId,
49
+ },
50
+ handler: getHandler,
51
+ });
52
+ var features = [];
53
+ var module = {
54
+ id: config.pluginId || "action",
55
+ uiSettings: {
56
+ title: ((_a = config.uiSettings) === null || _a === void 0 ? void 0 : _a.title) || "Actions",
57
+ icon: "",
58
+ features: features,
59
+ },
60
+ ui: config.ui,
61
+ type: management_api_plugin_1.ManagementApiType.action,
62
+ endpoints: endpoints,
63
+ data: {
64
+ actions: config.actions,
65
+ },
66
+ };
67
+ return module;
68
+ };
69
+ exports.GetManagementModule = GetManagementModule;
@@ -0,0 +1,35 @@
1
+ import { FlinkContext } from "@flink-app/flink";
2
+ export interface Action {
3
+ id: string;
4
+ description?: string;
5
+ arguments: ActionArguments[];
6
+ handler(ctx: FlinkContext<any>, args: ActionArgumentsValues): Promise<ActionResponse>;
7
+ }
8
+ export interface ActionArgumentsValues {
9
+ [key: string]: any;
10
+ }
11
+ export interface ActionResponse {
12
+ status: ActionReturnStatus;
13
+ error?: string;
14
+ data?: {
15
+ [key: string]: any;
16
+ };
17
+ }
18
+ export declare enum ActionReturnStatus {
19
+ success = "SUCCESS",
20
+ error = "ERROR"
21
+ }
22
+ export interface ActionArguments {
23
+ id: string;
24
+ required: boolean;
25
+ type: ActionArugmentType;
26
+ default?: string;
27
+ }
28
+ export declare enum ActionArugmentType {
29
+ text = "TEXT"
30
+ }
31
+ export interface ActionView {
32
+ id: string;
33
+ description?: string;
34
+ arguments: ActionArguments[];
35
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionArugmentType = exports.ActionReturnStatus = void 0;
4
+ var ActionReturnStatus;
5
+ (function (ActionReturnStatus) {
6
+ ActionReturnStatus["success"] = "SUCCESS";
7
+ ActionReturnStatus["error"] = "ERROR";
8
+ })(ActionReturnStatus || (exports.ActionReturnStatus = ActionReturnStatus = {}));
9
+ var ActionArugmentType;
10
+ (function (ActionArugmentType) {
11
+ ActionArugmentType["text"] = "TEXT";
12
+ })(ActionArugmentType || (exports.ActionArugmentType = ActionArugmentType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flink-app/management-actions-plugin",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "description": "Flink plugin that makes it possible create actions that can be run trought the management-api",
5
5
  "author": "johan@frost.se",
6
6
  "publishConfig": {
@@ -11,8 +11,8 @@
11
11
  "main": "dist/index.js",
12
12
  "dependencies": {
13
13
  "node-color-log": "^5.3.1",
14
- "@flink-app/flink": "0.13.0",
15
- "@flink-app/management-api-plugin": "0.13.0"
14
+ "@flink-app/flink": "0.13.1",
15
+ "@flink-app/management-api-plugin": "0.13.1"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/node": "22.13.10",