@rvoh/psychic 1.11.0-beta.1 → 1.11.1

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.
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const colorize_js_1 = __importDefault(require("./colorize.js"));
7
7
  class PsychicLogos {
8
- static babyAster() {
8
+ static asciiLogo() {
9
9
  const g = (str) => (0, colorize_js_1.default)(str, { color: 'green' });
10
10
  return `
11
11
  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PsychicRouter = exports.PsychicApp = exports.PsychicImporter = exports.MissingControllerActionPairingInRoutes = exports.ParamValidationErrors = exports.ParamValidationError = exports.sanitizeString = exports.pathifyNestedObject = exports.cookieMaxAgeFromCookieOpts = exports.generateResource = exports.generateController = exports.HttpStatusUnsupportedMediaType = exports.HttpStatusUnprocessableContent = exports.HttpStatusUnavailableForLegalReasons = exports.HttpStatusUnauthorized = exports.HttpStatusTooManyRequests = exports.HttpStatusServiceUnavailable = exports.HttpStatusRequestHeaderFieldsTooLarge = exports.HttpStatusProxyAuthenticationRequired = exports.HttpStatusPreconditionRequired = exports.HttpStatusPreconditionFailed = exports.HttpStatusPaymentRequired = exports.HttpStatusNotImplemented = exports.HttpStatusNotFound = exports.HttpStatusNotExtended = exports.HttpStatusNotAcceptable = exports.HttpStatusMisdirectedRequest = exports.HttpStatusMethodNotAllowed = exports.HttpStatusLocked = exports.HttpStatusInternalServerError = exports.HttpStatusInsufficientStorage = exports.HttpStatusImATeapot = exports.HttpStatusGone = exports.HttpStatusGatewayTimeout = exports.HttpStatusForbidden = exports.HttpStatusFailedDependency = exports.HttpStatusExpectationFailed = exports.HttpStatusContentTooLarge = exports.HttpStatusConflict = exports.HttpStatusBadRequest = exports.HttpStatusBadGateway = exports.I18nProvider = exports.envLoader = exports.PsychicDevtools = exports.PsychicController = exports.OpenAPI = exports.BeforeAction = exports.PsychicCLI = exports.PsychicBin = exports.pluralize = void 0;
7
- exports.PsychicSession = exports.Params = exports.PsychicServer = exports.getPsychicHttpInstance = void 0;
6
+ exports.PsychicImporter = exports.MissingControllerActionPairingInRoutes = exports.ParamValidationErrors = exports.ParamValidationError = exports.PsychicLogos = exports.colorize = exports.sanitizeString = exports.pathifyNestedObject = exports.cookieMaxAgeFromCookieOpts = exports.generateResource = exports.generateController = exports.HttpStatusUnsupportedMediaType = exports.HttpStatusUnprocessableContent = exports.HttpStatusUnavailableForLegalReasons = exports.HttpStatusUnauthorized = exports.HttpStatusTooManyRequests = exports.HttpStatusServiceUnavailable = exports.HttpStatusRequestHeaderFieldsTooLarge = exports.HttpStatusProxyAuthenticationRequired = exports.HttpStatusPreconditionRequired = exports.HttpStatusPreconditionFailed = exports.HttpStatusPaymentRequired = exports.HttpStatusNotImplemented = exports.HttpStatusNotFound = exports.HttpStatusNotExtended = exports.HttpStatusNotAcceptable = exports.HttpStatusMisdirectedRequest = exports.HttpStatusMethodNotAllowed = exports.HttpStatusLocked = exports.HttpStatusInternalServerError = exports.HttpStatusInsufficientStorage = exports.HttpStatusImATeapot = exports.HttpStatusGone = exports.HttpStatusGatewayTimeout = exports.HttpStatusForbidden = exports.HttpStatusFailedDependency = exports.HttpStatusExpectationFailed = exports.HttpStatusContentTooLarge = exports.HttpStatusConflict = exports.HttpStatusBadRequest = exports.HttpStatusBadGateway = exports.I18nProvider = exports.envLoader = exports.PsychicDevtools = exports.PsychicController = exports.OpenAPI = exports.BeforeAction = exports.PsychicCLI = exports.PsychicBin = exports.pluralize = void 0;
7
+ exports.PsychicSession = exports.Params = exports.PsychicServer = exports.getPsychicHttpInstance = exports.PsychicRouter = exports.PsychicApp = void 0;
8
8
  const pluralize_esm_1 = __importDefault(require("pluralize-esm"));
9
9
  exports.pluralize = pluralize_esm_1.default;
10
10
  var index_js_1 = require("./bin/index.js");
@@ -92,6 +92,10 @@ var pathifyNestedObject_js_1 = require("./helpers/pathifyNestedObject.js");
92
92
  Object.defineProperty(exports, "pathifyNestedObject", { enumerable: true, get: function () { return __importDefault(pathifyNestedObject_js_1).default; } });
93
93
  var sanitizeString_js_1 = require("./helpers/sanitizeString.js");
94
94
  Object.defineProperty(exports, "sanitizeString", { enumerable: true, get: function () { return __importDefault(sanitizeString_js_1).default; } });
95
+ var colorize_js_1 = require("./cli/helpers/colorize.js");
96
+ Object.defineProperty(exports, "colorize", { enumerable: true, get: function () { return __importDefault(colorize_js_1).default; } });
97
+ var PsychicLogos_js_1 = require("./cli/helpers/PsychicLogos.js");
98
+ Object.defineProperty(exports, "PsychicLogos", { enumerable: true, get: function () { return __importDefault(PsychicLogos_js_1).default; } });
95
99
  var ParamValidationError_js_1 = require("./error/controller/ParamValidationError.js");
96
100
  Object.defineProperty(exports, "ParamValidationError", { enumerable: true, get: function () { return __importDefault(ParamValidationError_js_1).default; } });
97
101
  var ParamValidationErrors_js_1 = require("./error/controller/ParamValidationErrors.js");
@@ -41,6 +41,7 @@ const index_js_1 = __importDefault(require("../psychic-app/index.js"));
41
41
  const helpers_js_1 = require("../router/helpers.js");
42
42
  const route_manager_js_1 = __importDefault(require("./route-manager.js"));
43
43
  const types_js_1 = require("./types.js");
44
+ const ERROR_LOGGING_DEPTH = 6;
44
45
  class PsychicRouter {
45
46
  app;
46
47
  currentNamespaces = [];
@@ -297,7 +298,7 @@ suggested fix: "${(0, helpers_js_1.convertRouteParams)(path)}"
297
298
  index_js_1.default.log(node_util_1.default.inspect({
298
299
  type: 'validator',
299
300
  errors: err.errors || {},
300
- }));
301
+ }, { depth: ERROR_LOGGING_DEPTH }));
301
302
  }
302
303
  /**
303
304
  * See comment at top of this method for philosophy of 400
@@ -310,7 +311,7 @@ suggested fix: "${(0, helpers_js_1.convertRouteParams)(path)}"
310
311
  type: 'openapi',
311
312
  errors: err.errors,
312
313
  target: err.target,
313
- }));
314
+ }, { depth: ERROR_LOGGING_DEPTH }));
314
315
  }
315
316
  /**
316
317
  * See comment at top of this method for philosophy of 400
@@ -324,7 +325,7 @@ suggested fix: "${(0, helpers_js_1.convertRouteParams)(path)}"
324
325
  errors: {
325
326
  [err.paramName]: err.errorMessages,
326
327
  },
327
- }));
328
+ }, { depth: ERROR_LOGGING_DEPTH }));
328
329
  }
329
330
  /**
330
331
  * See comment at top of this method for philosophy of 400
@@ -336,7 +337,7 @@ suggested fix: "${(0, helpers_js_1.convertRouteParams)(path)}"
336
337
  index_js_1.default.log(node_util_1.default.inspect({
337
338
  type: 'validator',
338
339
  errors: err.errors,
339
- }));
340
+ }, { depth: ERROR_LOGGING_DEPTH }));
340
341
  }
341
342
  /**
342
343
  * See comment at top of this method for philosophy of 400
@@ -33,9 +33,9 @@ const fs = __importStar(require("node:fs"));
33
33
  const http = __importStar(require("node:http"));
34
34
  const https = __importStar(require("node:https"));
35
35
  const colorize_js_1 = __importDefault(require("../../cli/helpers/colorize.js"));
36
+ const PsychicLogos_js_1 = __importDefault(require("../../cli/helpers/PsychicLogos.js"));
36
37
  const EnvInternal_js_1 = __importDefault(require("../../helpers/EnvInternal.js"));
37
38
  const index_js_1 = __importDefault(require("../../psychic-app/index.js"));
38
- const PsychicLogos_js_1 = __importDefault(require("../../cli/helpers/PsychicLogos.js"));
39
39
  async function startPsychicServer({ app, port, sslCredentials, }) {
40
40
  return await new Promise(accept => {
41
41
  const httpOrHttps = createPsychicHttpInstance(app, sslCredentials);
@@ -58,7 +58,7 @@ function createPsychicHttpInstance(app, sslCredentials) {
58
58
  }
59
59
  function welcomeMessage({ port }) {
60
60
  if (EnvInternal_js_1.default.isDevelopment) {
61
- dream_1.DreamCLI.logger.log((0, colorize_js_1.default)(PsychicLogos_js_1.default.babyAster(), { color: 'greenBright' }), {
61
+ dream_1.DreamCLI.logger.log((0, colorize_js_1.default)(PsychicLogos_js_1.default.asciiLogo(), { color: 'greenBright' }), {
62
62
  logPrefix: '',
63
63
  });
64
64
  dream_1.DreamCLI.logger.log('', { logPrefix: '' });
@@ -30,11 +30,11 @@ const dream_1 = require("@rvoh/dream");
30
30
  const cookieParser = __importStar(require("cookie-parser"));
31
31
  const cors = __importStar(require("cors"));
32
32
  const express = __importStar(require("express"));
33
+ const logIfDevelopment_js_1 = __importDefault(require("../controller/helpers/logIfDevelopment.js"));
33
34
  const EnvInternal_js_1 = __importDefault(require("../helpers/EnvInternal.js"));
34
35
  const index_js_1 = __importDefault(require("../psychic-app/index.js"));
35
36
  const index_js_2 = __importDefault(require("../router/index.js"));
36
37
  const startPsychicServer_js_1 = __importStar(require("./helpers/startPsychicServer.js"));
37
- const logIfDevelopment_js_1 = __importDefault(require("../controller/helpers/logIfDevelopment.js"));
38
38
  // const debugEnabled = debuglog('psychic').enabled
39
39
  class PsychicServer {
40
40
  static async startPsychicServer(opts) {
@@ -1,6 +1,6 @@
1
1
  import colorize from './colorize.js';
2
2
  export default class PsychicLogos {
3
- static babyAster() {
3
+ static asciiLogo() {
4
4
  const g = (str) => colorize(str, { color: 'green' });
5
5
  return `
6
6
  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
@@ -42,6 +42,8 @@ export { default as generateResource } from './generate/resource.js';
42
42
  export { default as cookieMaxAgeFromCookieOpts } from './helpers/cookieMaxAgeFromCookieOpts.js';
43
43
  export { default as pathifyNestedObject } from './helpers/pathifyNestedObject.js';
44
44
  export { default as sanitizeString } from './helpers/sanitizeString.js';
45
+ export { default as colorize } from './cli/helpers/colorize.js';
46
+ export { default as PsychicLogos } from './cli/helpers/PsychicLogos.js';
45
47
  export { default as ParamValidationError } from './error/controller/ParamValidationError.js';
46
48
  export { default as ParamValidationErrors } from './error/controller/ParamValidationErrors.js';
47
49
  export { MissingControllerActionPairingInRoutes, } from './openapi-renderer/endpoint.js';
@@ -12,6 +12,7 @@ import PsychicApp from '../psychic-app/index.js';
12
12
  import { applyResourceAction, applyResourcesAction, convertRouteParams, lookupControllerOrFail, routePath, } from '../router/helpers.js';
13
13
  import RouteManager from './route-manager.js';
14
14
  import { ResourceMethods, ResourcesMethods, } from './types.js';
15
+ const ERROR_LOGGING_DEPTH = 6;
15
16
  export default class PsychicRouter {
16
17
  app;
17
18
  currentNamespaces = [];
@@ -268,7 +269,7 @@ suggested fix: "${convertRouteParams(path)}"
268
269
  PsychicApp.log(util.inspect({
269
270
  type: 'validator',
270
271
  errors: err.errors || {},
271
- }));
272
+ }, { depth: ERROR_LOGGING_DEPTH }));
272
273
  }
273
274
  /**
274
275
  * See comment at top of this method for philosophy of 400
@@ -281,7 +282,7 @@ suggested fix: "${convertRouteParams(path)}"
281
282
  type: 'openapi',
282
283
  errors: err.errors,
283
284
  target: err.target,
284
- }));
285
+ }, { depth: ERROR_LOGGING_DEPTH }));
285
286
  }
286
287
  /**
287
288
  * See comment at top of this method for philosophy of 400
@@ -295,7 +296,7 @@ suggested fix: "${convertRouteParams(path)}"
295
296
  errors: {
296
297
  [err.paramName]: err.errorMessages,
297
298
  },
298
- }));
299
+ }, { depth: ERROR_LOGGING_DEPTH }));
299
300
  }
300
301
  /**
301
302
  * See comment at top of this method for philosophy of 400
@@ -307,7 +308,7 @@ suggested fix: "${convertRouteParams(path)}"
307
308
  PsychicApp.log(util.inspect({
308
309
  type: 'validator',
309
310
  errors: err.errors,
310
- }));
311
+ }, { depth: ERROR_LOGGING_DEPTH }));
311
312
  }
312
313
  /**
313
314
  * See comment at top of this method for philosophy of 400
@@ -3,9 +3,9 @@ import * as fs from 'node:fs';
3
3
  import * as http from 'node:http';
4
4
  import * as https from 'node:https';
5
5
  import colorize from '../../cli/helpers/colorize.js';
6
+ import PsychicLogos from '../../cli/helpers/PsychicLogos.js';
6
7
  import EnvInternal from '../../helpers/EnvInternal.js';
7
8
  import PsychicApp from '../../psychic-app/index.js';
8
- import PsychicLogos from '../../cli/helpers/PsychicLogos.js';
9
9
  export default async function startPsychicServer({ app, port, sslCredentials, }) {
10
10
  return await new Promise(accept => {
11
11
  const httpOrHttps = createPsychicHttpInstance(app, sslCredentials);
@@ -28,7 +28,7 @@ export function createPsychicHttpInstance(app, sslCredentials) {
28
28
  }
29
29
  function welcomeMessage({ port }) {
30
30
  if (EnvInternal.isDevelopment) {
31
- DreamCLI.logger.log(colorize(PsychicLogos.babyAster(), { color: 'greenBright' }), {
31
+ DreamCLI.logger.log(colorize(PsychicLogos.asciiLogo(), { color: 'greenBright' }), {
32
32
  logPrefix: '',
33
33
  });
34
34
  DreamCLI.logger.log('', { logPrefix: '' });
@@ -2,11 +2,11 @@ import { closeAllDbConnections } from '@rvoh/dream';
2
2
  import * as cookieParser from 'cookie-parser';
3
3
  import * as cors from 'cors';
4
4
  import * as express from 'express';
5
+ import logIfDevelopment from '../controller/helpers/logIfDevelopment.js';
5
6
  import EnvInternal from '../helpers/EnvInternal.js';
6
7
  import PsychicApp from '../psychic-app/index.js';
7
8
  import PsychicRouter from '../router/index.js';
8
9
  import startPsychicServer, { createPsychicHttpInstance, } from './helpers/startPsychicServer.js';
9
- import logIfDevelopment from '../controller/helpers/logIfDevelopment.js';
10
10
  // const debugEnabled = debuglog('psychic').enabled
11
11
  export default class PsychicServer {
12
12
  static async startPsychicServer(opts) {
@@ -1,3 +1,3 @@
1
1
  export default class PsychicLogos {
2
- static babyAster(): string;
2
+ static asciiLogo(): string;
3
3
  }
@@ -51,6 +51,8 @@ export { default as generateResource } from './generate/resource.js';
51
51
  export { default as cookieMaxAgeFromCookieOpts } from './helpers/cookieMaxAgeFromCookieOpts.js';
52
52
  export { default as pathifyNestedObject } from './helpers/pathifyNestedObject.js';
53
53
  export { default as sanitizeString } from './helpers/sanitizeString.js';
54
+ export { default as colorize } from './cli/helpers/colorize.js';
55
+ export { default as PsychicLogos } from './cli/helpers/PsychicLogos.js';
54
56
  export { default as ParamValidationError } from './error/controller/ParamValidationError.js';
55
57
  export { default as ParamValidationErrors } from './error/controller/ParamValidationErrors.js';
56
58
  export { MissingControllerActionPairingInRoutes, type OpenapiContent, type OpenapiEndpointRendererOpts, type OpenapiEndpointResponse, type OpenapiHeaderOption, type OpenapiHeaders, type OpenapiHeaderType, type OpenapiMethodBody, type OpenapiParameterResponse, type OpenapiPathParams, type OpenapiQueryOption, type OpenapiResponses, type OpenapiSchema, type OpenapiPathParamOption as OpenapiUriOption, } from './openapi-renderer/endpoint.js';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "name": "@rvoh/psychic",
4
4
  "description": "Typescript web framework",
5
- "version": "1.11.0-beta.1",
5
+ "version": "1.11.1",
6
6
  "author": "RVOHealth",
7
7
  "repository": {
8
8
  "type": "git",
@@ -62,7 +62,7 @@
62
62
  "devDependencies": {
63
63
  "@eslint/js": "^9.19.0",
64
64
  "@jest-mock/express": "^3.0.0",
65
- "@rvoh/dream": "^1.10.0-beta.1",
65
+ "@rvoh/dream": "^1.10.0",
66
66
  "@rvoh/dream-spec-helpers": "^1.2.1",
67
67
  "@rvoh/psychic-spec-helpers": "^1.1.3",
68
68
  "@types/express": "^5.0.1",