@bigid/apps-infrastructure-node-js 1.187.0 → 1.191.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/lib/server.d.ts CHANGED
@@ -10,5 +10,6 @@ export type ServerInit = {
10
10
  configureController?: ConfigureProvider;
11
11
  serverPort?: number;
12
12
  additionalEndpoints?: (app: Express) => void;
13
+ expressBodyLimit?: string;
13
14
  };
14
- export declare const deployServer: ({ manifestController, iconsController, executionController, serverPort, configureController, additionalEndpoints, }: ServerInit) => void;
15
+ export declare const deployServer: ({ manifestController, iconsController, executionController, serverPort, configureController, additionalEndpoints, expressBodyLimit, }: ServerInit) => void;
package/lib/server.js CHANGED
@@ -1,4 +1,27 @@
1
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
+ };
2
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -14,15 +37,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
37
  Object.defineProperty(exports, "__esModule", { value: true });
15
38
  exports.deployServer = void 0;
16
39
  const express_1 = __importDefault(require("express"));
40
+ const bodyParser = __importStar(require("body-parser"));
17
41
  const utils_1 = require("./utils");
18
42
  const executionProvider_1 = require("./abstractProviders/executionProvider");
19
43
  const logsProvider_1 = require("./abstractProviders/logsProvider");
20
44
  const http_errors_1 = __importDefault(require("http-errors"));
21
45
  const configureProvider_1 = require("./abstractProviders/configureProvider");
22
46
  const app = (0, express_1.default)();
23
- const deployServer = ({ manifestController, iconsController, executionController, serverPort, configureController, additionalEndpoints, }) => {
47
+ const deployServer = ({ manifestController, iconsController, executionController, serverPort, configureController, additionalEndpoints, expressBodyLimit, }) => {
24
48
  app.use(express_1.default.json());
25
49
  app.use(express_1.default.urlencoded({ extended: false }));
50
+ app.use(bodyParser.json({ limit: expressBodyLimit || '5mb' }));
26
51
  app.get('/assets/icon', (req, res) => res.sendFile(iconsController.getIconPath()));
27
52
  app.get('/assets/sideBarIcon', (req, res) => res.sendFile(iconsController.getSideBarIconPath()));
28
53
  app.get('/manifest', manifestController.getManifest);
@@ -36,7 +36,7 @@ export declare const executeHttpPut: (executionContext: ExecutionContext, endpoi
36
36
  */
37
37
  export declare const executeHttpDelete: (executionContext: ExecutionContext, endpoint: string) => Promise<any>;
38
38
  export declare const executePost: (requestMethod: RequestMethod, baseUrl: string | undefined, bodyJson: Record<string, any>) => Promise<any>;
39
- export declare const uploadAttachment: (executionContext: ExecutionContext, filePathToUpload: string) => import("axios").AxiosPromise<any>;
39
+ export declare const uploadAttachment: (executionContext: ExecutionContext, filePathToUpload: string) => Promise<import("axios").AxiosResponse<any, any>>;
40
40
  export declare const getAppStorage: (executionContext: ExecutionContext) => Promise<any>;
41
41
  export declare const getValueFromAppStorage: (executionContext: ExecutionContext, key: string) => Promise<string>;
42
42
  export declare const deleteKeyFromAppStorage: (executionContext: ExecutionContext, key: string) => Promise<void>;
@@ -152,7 +152,7 @@ const getAppStorage = (executionContext) => (0, exports.executeHttpGet)(executio
152
152
  exports.getAppStorage = getAppStorage;
153
153
  const getValueFromAppStorage = (executionContext, key) => __awaiter(void 0, void 0, void 0, function* () {
154
154
  const { data } = yield (0, exports.executeHttpGet)(executionContext, `tpa/${executionContext.tpaId}/storage/key/${key}`);
155
- return data === 'Key not found' ? null : data.value;
155
+ return data === 'Key not found' ? null : data === null || data === void 0 ? void 0 : data.value;
156
156
  });
157
157
  exports.getValueFromAppStorage = getValueFromAppStorage;
158
158
  const deleteKeyFromAppStorage = (executionContext, key) => __awaiter(void 0, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigid/apps-infrastructure-node-js",
3
- "version": "1.187.0",
3
+ "version": "1.191.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -27,15 +27,15 @@
27
27
  "eslint-plugin-no-only-tests": "2.4.0",
28
28
  "eslint-plugin-prettier": "^3.1.4",
29
29
  "prettier": "^2.4.1",
30
+ "jsdoc": "4.0.2",
30
31
  "typescript": "^4.5.2"
31
32
  },
32
33
  "dependencies": {
33
- "axios": "0.24.0",
34
+ "axios": "1.6.0",
34
35
  "express": "4.17.3",
35
36
  "follow-redirects": "1.15.2",
36
37
  "form-data": "^4.0.0",
37
38
  "http-errors": "^1.8.1",
38
- "jsdoc": "4.0.2",
39
39
  "log4js": "^6.4.0",
40
40
  "mocha": "10.2.0",
41
41
  "node-schedule": "2.1.1",
package/src/server.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import express, { Express, NextFunction, Request, Response } from 'express';
2
+ import * as bodyParser from 'body-parser';
2
3
  import { ManifestProvider } from './abstractProviders';
3
4
  import { logInfo, logError } from './utils';
4
5
  import { IconsProviders } from './abstractProviders';
@@ -14,6 +15,7 @@ export type ServerInit = {
14
15
  configureController?: ConfigureProvider;
15
16
  serverPort?: number;
16
17
  additionalEndpoints?: (app: Express) => void;
18
+ expressBodyLimit?: string;
17
19
  };
18
20
 
19
21
  const app = express();
@@ -25,9 +27,11 @@ export const deployServer = ({
25
27
  serverPort,
26
28
  configureController,
27
29
  additionalEndpoints,
30
+ expressBodyLimit,
28
31
  }: ServerInit): void => {
29
32
  app.use(express.json());
30
33
  app.use(express.urlencoded({ extended: false }));
34
+ app.use(bodyParser.json({ limit: expressBodyLimit || '5mb' }));
31
35
 
32
36
  app.get('/assets/icon', (req, res) => res.sendFile(iconsController.getIconPath()));
33
37
  app.get('/assets/sideBarIcon', (req, res) => res.sendFile(iconsController.getSideBarIconPath()));
@@ -179,7 +179,7 @@ export const getAppStorage = (executionContext: ExecutionContext) =>
179
179
 
180
180
  export const getValueFromAppStorage = async (executionContext: ExecutionContext, key: string): Promise<string> => {
181
181
  const { data } = await executeHttpGet(executionContext, `tpa/${executionContext.tpaId}/storage/key/${key}`);
182
- return data === 'Key not found' ? null : data.value;
182
+ return data === 'Key not found' ? null : data?.value;
183
183
  };
184
184
 
185
185
  export const deleteKeyFromAppStorage = async (executionContext: ExecutionContext, key: string) => {