quidproquo-dev-server 0.0.232 → 0.0.234

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.
@@ -3,4 +3,4 @@ export interface QPQConfigAdvancedDevServerSettings extends QPQConfigAdvancedSet
3
3
  onlyDeploySafe?: boolean;
4
4
  vpcList?: string[];
5
5
  }
6
- export declare const defineDevServerConfig: (buildPath: string, advancedSettings?: QPQConfigAdvancedDevServerSettings) => QPQConfig;
6
+ export declare const defineDevServerConfig: (advancedSettings?: QPQConfigAdvancedDevServerSettings) => QPQConfig;
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.defineDevServerConfig = void 0;
7
- const path_1 = __importDefault(require("path"));
8
7
  const quidproquo_webserver_1 = require("quidproquo-webserver");
9
- const defineDevServerConfig = (buildPath, advancedSettings) => {
8
+ const path_1 = __importDefault(require("path"));
9
+ const defineDevServerConfig = (advancedSettings) => {
10
10
  var _a;
11
11
  const onlyDeploySafe = (_a = advancedSettings === null || advancedSettings === void 0 ? void 0 : advancedSettings.onlyDeploySafe) !== null && _a !== void 0 ? _a : true;
12
12
  const vpcList = (advancedSettings === null || advancedSettings === void 0 ? void 0 : advancedSettings.vpcList) || [];
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable no-void */
3
- /* eslint-disable @typescript-eslint/no-unused-vars */
4
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -12,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
12
10
  };
13
11
  Object.defineProperty(exports, "__esModule", { value: true });
14
12
  exports.getEventGetStorySessionActionProcessor = void 0;
15
- const quidproquo_core_1 = require("quidproquo-core");
16
13
  const quidproquo_actionprocessor_awslambda_1 = require("quidproquo-actionprocessor-awslambda");
14
+ const quidproquo_core_1 = require("quidproquo-core");
17
15
  const quidproquo_webserver_1 = require("quidproquo-webserver");
18
16
  const getProcessGetStorySession = (qpqConfig) => {
19
17
  return ({ matchStoryResult, qpqEventRecord }, session) => __awaiter(void 0, void 0, void 0, function* () {
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getEventMatchStoryActionProcessor = void 0;
13
- /* eslint-disable @typescript-eslint/no-explicit-any */
14
13
  const quidproquo_actionprocessor_awslambda_1 = require("quidproquo-actionprocessor-awslambda");
15
14
  const quidproquo_core_1 = require("quidproquo-core");
16
15
  const quidproquo_webserver_1 = require("quidproquo-webserver");
@@ -20,8 +19,7 @@ const getProcessMatchStory = (qpqConfig) => {
20
19
  // Sort the routes by string length
21
20
  // Note: We may need to filter variable routes out {} as the variables are length independent
22
21
  const sortedRoutes = routes
23
- .filter((r) => r.method === qpqEventRecord.method ||
24
- qpqEventRecord.method === 'OPTIONS')
22
+ .filter((r) => r.method === qpqEventRecord.method || qpqEventRecord.method === 'OPTIONS')
25
23
  .sort((a, b) => {
26
24
  if (a.path.length < b.path.length)
27
25
  return -1;
@@ -40,9 +40,7 @@ const getProcessTransformResponseResult = (qpqConfig) =>
40
40
  const [record] = qpqEventRecordResponses;
41
41
  const [expressEvent] = eventParams;
42
42
  // If we have an error, we need to transform it to a response, otherwise we can just use the record as is
43
- const successRecord = record.success
44
- ? record.result
45
- : getResponseFromErrorResult(record.error);
43
+ const successRecord = record.success ? record.result : getResponseFromErrorResult(record.error);
46
44
  const recordHeaders = successRecord.headers || {};
47
45
  const headers = Object.assign(Object.assign({}, quidproquo_webserver_1.qpqWebServerUtils.getCorsHeaders(qpqConfig, {}, expressEvent.headers)), recordHeaders);
48
46
  return (0, quidproquo_core_1.actionResult)({
@@ -10,13 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.route = void 0;
13
- const crypto_1 = require("crypto");
14
- const quidproquo_core_1 = require("quidproquo-core");
15
- const quidproquo_webserver_1 = require("quidproquo-webserver");
16
13
  const quidproquo_actionprocessor_awslambda_1 = require("quidproquo-actionprocessor-awslambda");
17
14
  const quidproquo_actionprocessor_node_1 = require("quidproquo-actionprocessor-node");
18
- const getActionProcessor_1 = require("../getActionProcessor");
15
+ const quidproquo_core_1 = require("quidproquo-core");
16
+ const quidproquo_webserver_1 = require("quidproquo-webserver");
17
+ const crypto_1 = require("crypto");
19
18
  const actionProcessor_1 = require("../actionProcessor");
19
+ const getActionProcessor_1 = require("../getActionProcessor");
20
20
  // TODO: Make this a util or something based on server time or something..
21
21
  const getDateNow = () => new Date().toISOString();
22
22
  const ErrorTypeHttpResponseMap = {
@@ -1,2 +1,2 @@
1
- export * from './main';
2
1
  export * from './config';
2
+ export * from './main';
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./main"), exports);
18
17
  __exportStar(require("./config"), exports);
18
+ __exportStar(require("./main"), exports);
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -14,15 +13,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
13
  };
15
14
  Object.defineProperty(exports, "__esModule", { value: true });
16
15
  exports.startDevServer = void 0;
17
- /* eslint-disable no-console */
16
+ const quidproquo_core_1 = require("quidproquo-core");
17
+ const quidproquo_webserver_1 = require("quidproquo-webserver");
18
18
  const body_parser_1 = __importDefault(require("body-parser"));
19
19
  const express_1 = __importDefault(require("express"));
20
20
  const multer_1 = __importDefault(require("multer"));
21
21
  const path_1 = __importDefault(require("path"));
22
- const quidproquo_core_1 = require("quidproquo-core");
23
- const quidproquo_webserver_1 = require("quidproquo-webserver");
24
- const implementations_1 = require("./implementations");
25
22
  const allServiceConfig_1 = require("./allServiceConfig");
23
+ const implementations_1 = require("./implementations");
26
24
  const getServiceBaseDomain = (qpqConfig, devServerConfig) => quidproquo_webserver_1.qpqWebServerUtils.getDomainRoot(`${devServerConfig.serverDomain}:${devServerConfig.serverPort}`, quidproquo_core_1.qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig), quidproquo_core_1.qpqCoreUtils.getApplicationModuleFeature(qpqConfig));
27
25
  const getApiDomainsFromConfig = (qpqConfig, devServerConfig) => {
28
26
  const baseDomain = getServiceBaseDomain(qpqConfig, devServerConfig);
@@ -1,4 +1,4 @@
1
- import { ErrorTypeEnum, GraphDatabaseActionType, askThrowError, getProcessCustomImplementation, qpqCoreUtils, } from 'quidproquo-core';
1
+ import { askThrowError, ErrorTypeEnum, getProcessCustomImplementation, GraphDatabaseActionType, qpqCoreUtils, } from 'quidproquo-core';
2
2
  import { askServiceFunctionExecute } from 'quidproquo-webserver';
3
3
  import { randomUUID } from 'crypto';
4
4
  const getGraphDatabaseExecuteOpenCypherStory = (qpqConfig) => {
@@ -3,4 +3,4 @@ export interface QPQConfigAdvancedDevServerSettings extends QPQConfigAdvancedSet
3
3
  onlyDeploySafe?: boolean;
4
4
  vpcList?: string[];
5
5
  }
6
- export declare const defineDevServerConfig: (buildPath: string, advancedSettings?: QPQConfigAdvancedDevServerSettings) => QPQConfig;
6
+ export declare const defineDevServerConfig: (advancedSettings?: QPQConfigAdvancedDevServerSettings) => QPQConfig;
@@ -1,6 +1,6 @@
1
- import path from 'path';
2
1
  import { defineServiceFunction } from 'quidproquo-webserver';
3
- export const defineDevServerConfig = (buildPath, advancedSettings) => {
2
+ import path from 'path';
3
+ export const defineDevServerConfig = (advancedSettings) => {
4
4
  const onlyDeploySafe = advancedSettings?.onlyDeploySafe ?? true;
5
5
  const vpcList = advancedSettings?.vpcList || [];
6
6
  const pathToRuntime = path.join(__dirname, '../../entry/serviceFunction/runCypherQuery');
@@ -1,7 +1,5 @@
1
- /* eslint-disable no-void */
2
- /* eslint-disable @typescript-eslint/no-unused-vars */
3
- import { actionResult, EventActionType, } from 'quidproquo-core';
4
1
  import { decodeAccessToken } from 'quidproquo-actionprocessor-awslambda';
2
+ import { actionResult, EventActionType, } from 'quidproquo-core';
5
3
  import { qpqWebServerUtils } from 'quidproquo-webserver';
6
4
  const getProcessGetStorySession = (qpqConfig) => {
7
5
  return async ({ matchStoryResult, qpqEventRecord }, session) => {
@@ -1,15 +1,13 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  import { awsLambdaUtils } from 'quidproquo-actionprocessor-awslambda';
3
2
  import { actionResult, actionResultError, ErrorTypeEnum, EventActionType, } from 'quidproquo-core';
4
- import { qpqWebServerUtils, } from 'quidproquo-webserver';
3
+ import { qpqWebServerUtils } from 'quidproquo-webserver';
5
4
  const getProcessMatchStory = (qpqConfig) => {
6
5
  const routes = qpqWebServerUtils.getAllRoutes(qpqConfig);
7
6
  return async ({ qpqEventRecord }) => {
8
7
  // Sort the routes by string length
9
8
  // Note: We may need to filter variable routes out {} as the variables are length independent
10
9
  const sortedRoutes = routes
11
- .filter((r) => r.method === qpqEventRecord.method ||
12
- qpqEventRecord.method === 'OPTIONS')
10
+ .filter((r) => r.method === qpqEventRecord.method || qpqEventRecord.method === 'OPTIONS')
13
11
  .sort((a, b) => {
14
12
  if (a.path.length < b.path.length)
15
13
  return -1;
@@ -28,9 +28,7 @@ async ({ eventParams, qpqEventRecordResponses }) => {
28
28
  const [record] = qpqEventRecordResponses;
29
29
  const [expressEvent] = eventParams;
30
30
  // If we have an error, we need to transform it to a response, otherwise we can just use the record as is
31
- const successRecord = record.success
32
- ? record.result
33
- : getResponseFromErrorResult(record.error);
31
+ const successRecord = record.success ? record.result : getResponseFromErrorResult(record.error);
34
32
  const recordHeaders = successRecord.headers || {};
35
33
  const headers = {
36
34
  ...qpqWebServerUtils.getCorsHeaders(qpqConfig, {}, expressEvent.headers),
@@ -1,10 +1,10 @@
1
- import { randomUUID } from 'crypto';
2
- import { askProcessEvent, createRuntime, ErrorTypeEnum, qpqCoreUtils, QpqRuntimeType } from 'quidproquo-core';
3
- import { qpqWebServerUtils } from 'quidproquo-webserver';
4
1
  import { getAwsActionProcessors, getLogger } from 'quidproquo-actionprocessor-awslambda';
5
2
  import { getCustomActionActionProcessor } from 'quidproquo-actionprocessor-node';
6
- import { getExpressApiEventEventProcessor } from '../getActionProcessor';
3
+ import { askProcessEvent, createRuntime, ErrorTypeEnum, qpqCoreUtils, QpqRuntimeType } from 'quidproquo-core';
4
+ import { qpqWebServerUtils } from 'quidproquo-webserver';
5
+ import { randomUUID } from 'crypto';
7
6
  import { getGraphDatabaseActionProcessor } from '../actionProcessor';
7
+ import { getExpressApiEventEventProcessor } from '../getActionProcessor';
8
8
  // TODO: Make this a util or something based on server time or something..
9
9
  const getDateNow = () => new Date().toISOString();
10
10
  const ErrorTypeHttpResponseMap = {
@@ -1,2 +1,2 @@
1
- export * from './main';
2
1
  export * from './config';
2
+ export * from './main';
package/lib/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from './main';
2
1
  export * from './config';
2
+ export * from './main';
package/lib/esm/main.js CHANGED
@@ -1,13 +1,11 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable no-console */
1
+ import { askProcessEvent, qpqCoreUtils, qpqExecuteLog, QpqRuntimeType } from 'quidproquo-core';
2
+ import { qpqWebServerUtils } from 'quidproquo-webserver';
3
3
  import bodyParser from 'body-parser';
4
4
  import express from 'express';
5
5
  import multer from 'multer';
6
6
  import path from 'path';
7
- import { askProcessEvent, qpqCoreUtils, qpqExecuteLog, QpqRuntimeType } from 'quidproquo-core';
8
- import { qpqWebServerUtils } from 'quidproquo-webserver';
9
- import { route } from './implementations';
10
7
  import { getAllServiceConfigs } from './allServiceConfig';
8
+ import { route } from './implementations';
11
9
  const getServiceBaseDomain = (qpqConfig, devServerConfig) => qpqWebServerUtils.getDomainRoot(`${devServerConfig.serverDomain}:${devServerConfig.serverPort}`, qpqCoreUtils.getApplicationModuleEnvironment(qpqConfig), qpqCoreUtils.getApplicationModuleFeature(qpqConfig));
12
10
  const getApiDomainsFromConfig = (qpqConfig, devServerConfig) => {
13
11
  const baseDomain = getServiceBaseDomain(qpqConfig, devServerConfig);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-dev-server",
3
- "version": "0.0.232",
3
+ "version": "0.0.234",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -15,7 +15,10 @@
15
15
  "build": "npm run clean && npm run build:esm && npm run build:cjs",
16
16
  "watch": "tsc -p tsconfig.commonjs.json -w",
17
17
  "build:cjs": "tsc -p tsconfig.commonjs.json",
18
- "build:esm": "tsc -p tsconfig.esm.json"
18
+ "build:esm": "tsc -p tsconfig.esm.json",
19
+ "lint": "npx eslint .",
20
+ "lint:fix": "npx eslint . --fix",
21
+ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,scss,md}\""
19
22
  },
20
23
  "repository": {
21
24
  "type": "git",
@@ -30,14 +33,14 @@
30
33
  "homepage": "https://github.com/joe-coady/quidproquo#readme",
31
34
  "dependencies": {
32
35
  "multer": "^1.4.5-lts.1",
33
- "quidproquo-core": "0.0.232",
34
- "quidproquo-webserver": "0.0.232",
35
- "quidproquo-actionprocessor-awslambda": "0.0.232",
36
- "quidproquo-actionprocessor-node": "0.0.232"
36
+ "quidproquo-core": "0.0.234",
37
+ "quidproquo-webserver": "0.0.234",
38
+ "quidproquo-actionprocessor-awslambda": "0.0.234",
39
+ "quidproquo-actionprocessor-node": "0.0.234"
37
40
  },
38
41
  "devDependencies": {
39
42
  "@types/multer": "^1.4.12",
40
- "quidproquo-tsconfig": "0.0.232",
43
+ "quidproquo-tsconfig": "0.0.234",
41
44
  "typescript": "^4.9.3"
42
45
  }
43
46
  }