@flink-app/management-actions-plugin 0.12.1-alpha.0 → 0.12.1-alpha.10

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.
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
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
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -36,34 +36,32 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- var getHandler = function (_a) {
40
- var ctx = _a.ctx, req = _a.req, origin = _a.origin;
41
- return __awaiter(void 0, void 0, void 0, function () {
42
- var modules, module, actions, data;
43
- var _b, _c;
44
- return __generator(this, function (_d) {
45
- modules = ctx.plugins.managementApi.moduleList.modules;
46
- module = modules.find(function (p) { return p.id == origin; });
47
- if (((_b = module.data) === null || _b === void 0 ? void 0 : _b.actions) == null) {
48
- return [2 /*return*/, {
49
- data: [],
50
- status: 200,
51
- }];
52
- }
53
- actions = (_c = module.data) === null || _c === void 0 ? void 0 : _c.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
- });
39
+ var getHandler = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
40
+ var modules, module, actions, data;
41
+ var _c, _d;
42
+ var ctx = _b.ctx, req = _b.req, origin = _b.origin;
43
+ return __generator(this, function (_e) {
44
+ modules = ctx.plugins.managementApi.moduleList.modules;
45
+ module = modules.find(function (p) { return p.id == origin; });
46
+ if (((_c = module.data) === null || _c === void 0 ? void 0 : _c.actions) == null) {
62
47
  return [2 /*return*/, {
63
- data: data,
48
+ data: [],
64
49
  status: 200,
65
50
  }];
51
+ }
52
+ actions = (_d = module.data) === null || _d === void 0 ? void 0 : _d.actions;
53
+ data = actions.map(function (a) {
54
+ var av = {
55
+ id: a.id,
56
+ description: a.description,
57
+ arguments: a.arguments,
58
+ };
59
+ return av;
66
60
  });
61
+ return [2 /*return*/, {
62
+ data: data,
63
+ status: 200,
64
+ }];
67
65
  });
68
- };
66
+ }); };
69
67
  exports.default = getHandler;
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
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
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -38,56 +38,54 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  var flink_1 = require("@flink-app/flink");
40
40
  var Action_1 = require("../schemas/Action");
41
- var postHandler = function (_a) {
42
- var ctx = _a.ctx, req = _a.req, origin = _a.origin;
43
- return __awaiter(void 0, void 0, void 0, function () {
44
- var modules, module, actions, action, i, arg, resp, ex_1;
45
- var _b;
46
- return __generator(this, function (_c) {
47
- switch (_c.label) {
48
- case 0:
49
- modules = ctx.plugins.managementApi.moduleList.modules;
50
- module = modules.find(function (p) { return p.id == origin; });
51
- if (((_b = module.data) === null || _b === void 0 ? void 0 : _b.actions) == null) {
52
- return [2 /*return*/, 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*/, 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*/, flink_1.badRequest(arg.id + " is missing ")];
64
- }
41
+ var postHandler = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var modules, module, actions, action, i, arg, resp, ex_1;
43
+ var _c;
44
+ var ctx = _b.ctx, req = _b.req, origin = _b.origin;
45
+ return __generator(this, function (_d) {
46
+ switch (_d.label) {
47
+ case 0:
48
+ modules = ctx.plugins.managementApi.moduleList.modules;
49
+ module = modules.find(function (p) { return p.id == origin; });
50
+ if (((_c = module.data) === null || _c === void 0 ? void 0 : _c.actions) == null) {
51
+ return [2 /*return*/, (0, flink_1.notFound)("Action not found")];
52
+ }
53
+ actions = module.data.actions;
54
+ action = actions.find(function (a) { return a.id == req.params.actionId; });
55
+ if (action == null) {
56
+ return [2 /*return*/, (0, flink_1.notFound)("Action not found")];
57
+ }
58
+ for (i in action.arguments) {
59
+ arg = action.arguments[i];
60
+ if (arg.required) {
61
+ if (req.body[arg.id] == null) {
62
+ return [2 /*return*/, (0, flink_1.badRequest)("".concat(arg.id, " is missing "))];
65
63
  }
66
64
  }
67
- _c.label = 1;
68
- case 1:
69
- _c.trys.push([1, 3, , 4]);
70
- return [4 /*yield*/, action.handler(ctx, req.body)];
71
- case 2:
72
- resp = _c.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*/, flink_1.internalServerError(resp.error)];
81
- }
82
- return [3 /*break*/, 4];
83
- case 3:
84
- ex_1 = _c.sent();
85
- console.log("EXCEPTIOIN managementActionsPlugin:");
86
- console.log(ex_1);
87
- return [2 /*return*/, flink_1.internalServerError()];
88
- case 4: return [2 /*return*/];
89
- }
90
- });
65
+ }
66
+ _d.label = 1;
67
+ case 1:
68
+ _d.trys.push([1, 3, , 4]);
69
+ return [4 /*yield*/, action.handler(ctx, req.body)];
70
+ case 2:
71
+ resp = _d.sent();
72
+ if (resp.status == Action_1.ActionReturnStatus.success) {
73
+ return [2 /*return*/, {
74
+ data: resp,
75
+ status: 200,
76
+ }];
77
+ }
78
+ else {
79
+ return [2 /*return*/, (0, flink_1.internalServerError)(resp.error)];
80
+ }
81
+ return [3 /*break*/, 4];
82
+ case 3:
83
+ ex_1 = _d.sent();
84
+ console.log("EXCEPTIOIN managementActionsPlugin:");
85
+ console.log(ex_1);
86
+ return [2 /*return*/, (0, flink_1.internalServerError)()];
87
+ case 4: return [2 /*return*/];
88
+ }
91
89
  });
92
- };
90
+ }); };
93
91
  exports.default = postHandler;
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -5,8 +5,8 @@ var ActionReturnStatus;
5
5
  (function (ActionReturnStatus) {
6
6
  ActionReturnStatus["success"] = "SUCCESS";
7
7
  ActionReturnStatus["error"] = "ERROR";
8
- })(ActionReturnStatus = exports.ActionReturnStatus || (exports.ActionReturnStatus = {}));
8
+ })(ActionReturnStatus || (exports.ActionReturnStatus = ActionReturnStatus = {}));
9
9
  var ActionArugmentType;
10
10
  (function (ActionArugmentType) {
11
11
  ActionArugmentType["text"] = "TEXT";
12
- })(ActionArugmentType = exports.ActionArugmentType || (exports.ActionArugmentType = {}));
12
+ })(ActionArugmentType || (exports.ActionArugmentType = ActionArugmentType = {}));
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@flink-app/management-actions-plugin",
3
- "version": "0.12.1-alpha.0",
3
+ "version": "0.12.1-alpha.10",
4
4
  "description": "Flink plugin that makes it possible create actions that can be run trought the management-api",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\"",
7
7
  "build": "flink build",
8
- "prepublish": "tsc"
8
+ "prepare": "tsc"
9
9
  },
10
10
  "author": "johan@frost.se",
11
11
  "publishConfig": {
@@ -15,16 +15,16 @@
15
15
  "types": "dist/src/index.d.ts",
16
16
  "main": "dist/src/index.js",
17
17
  "dependencies": {
18
- "@flink-app/management-api-plugin": "^0.12.1-alpha.0",
18
+ "@flink-app/management-api-plugin": "^0.12.1-alpha.10",
19
19
  "express": "^4.17.1",
20
20
  "node-color-log": "^5.3.1"
21
21
  },
22
22
  "devDependencies": {
23
- "@flink-app/flink": "^0.12.1-alpha.0",
23
+ "@flink-app/flink": "^0.12.1-alpha.10",
24
24
  "@types/express": "4.17.11",
25
- "@types/node": "^15.6.2",
25
+ "@types/node": "22.13.10",
26
26
  "ts-node": "^9.1.1",
27
- "typescript": "^4.2.4"
27
+ "typescript": "5.4.5"
28
28
  },
29
- "gitHead": "7f6e32aa896f5cade313f3c5133c756fc5391ce8"
29
+ "gitHead": "d4019c3af70673f27db4df55d56ba3728e75745e"
30
30
  }
@@ -1,8 +0,0 @@
1
- // Generated Wed Mar 19 2025 15:47:19 GMT+0100 (Central European Standard Time)
2
- import { autoRegisteredHandlers, HttpMethod } from "@flink-app/flink";
3
- import * as Get_0 from "../src/handlers/Get";
4
- import * as PostById_0 from "../src/handlers/PostById";
5
-
6
- export const handlers = [];
7
- autoRegisteredHandlers.push(...handlers);
8
-
@@ -1,5 +0,0 @@
1
- // Generated Wed Mar 19 2025 15:47:20 GMT+0100 (Central European Standard Time)
2
- import { autoRegisteredJobs } from "@flink-app/flink";
3
- export const jobs = [];
4
- autoRegisteredJobs.push(...jobs);
5
-
@@ -1,5 +0,0 @@
1
- // Generated Wed Mar 19 2025 15:47:19 GMT+0100 (Central European Standard Time)
2
- import { autoRegisteredRepos } from "@flink-app/flink";
3
- export const repos = [];
4
- autoRegisteredRepos.push(...repos);
5
-
@@ -1,84 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$ref": "#/definitions/Schemas",
4
- "definitions": {
5
- "Get_4_ResSchema": {
6
- "$schema": "http://json-schema.org/draft-07/schema#",
7
- "type": "array",
8
- "items": {
9
- "type": "object",
10
- "properties": {
11
- "id": {
12
- "type": "string"
13
- },
14
- "description": {
15
- "type": "string"
16
- },
17
- "arguments": {
18
- "type": "array",
19
- "items": {
20
- "type": "object",
21
- "properties": {
22
- "id": {
23
- "type": "string"
24
- },
25
- "required": {
26
- "type": "boolean"
27
- },
28
- "type": {
29
- "type": "string",
30
- "const": "TEXT"
31
- },
32
- "default": {
33
- "type": "string"
34
- }
35
- },
36
- "required": [
37
- "id",
38
- "required",
39
- "type"
40
- ],
41
- "additionalProperties": false
42
- }
43
- }
44
- },
45
- "required": [
46
- "id",
47
- "arguments"
48
- ],
49
- "additionalProperties": false
50
- },
51
- "definitions": {}
52
- },
53
- "PostById_4_ReqSchema": {
54
- "$schema": "http://json-schema.org/draft-07/schema#",
55
- "type": "object",
56
- "properties": {},
57
- "definitions": {}
58
- },
59
- "PostById_4_ResSchema": {
60
- "$schema": "http://json-schema.org/draft-07/schema#",
61
- "type": "object",
62
- "additionalProperties": false,
63
- "properties": {
64
- "status": {
65
- "type": "string",
66
- "enum": [
67
- "SUCCESS",
68
- "ERROR"
69
- ]
70
- },
71
- "error": {
72
- "type": "string"
73
- },
74
- "data": {
75
- "type": "object"
76
- }
77
- },
78
- "required": [
79
- "status"
80
- ],
81
- "definitions": {}
82
- }
83
- }
84
- }
@@ -1,8 +0,0 @@
1
- import { ActionView, ActionArgumentsValues, ActionResponse } from "../../src/schemas/Action";
2
-
3
- // Generated Wed Mar 19 2025 15:47:20 GMT+0100 (Central European Standard Time)
4
- export interface Get_4_ResSchema extends Array<ActionView> {}
5
-
6
- export interface PostById_4_ReqSchema extends ActionArgumentsValues {}
7
-
8
- export interface PostById_4_ResSchema extends ActionResponse {}
package/.flink/start.ts DELETED
@@ -1,5 +0,0 @@
1
- // Generated Wed Mar 19 2025 15:47:20 GMT+0100 (Central European Standard Time)
2
- import "./generatedHandlers";
3
- import "./generatedRepos";
4
- import "./generatedJobs";
5
- import "../src/index";