@rvoh/psychic 0.28.2 → 0.28.4
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/dist/cjs/src/bin/helpers/enumsFileStr.js +6 -3
- package/dist/cjs/src/bin/helpers/generateRouteTypes.js +29 -3
- package/dist/cjs/src/bin/helpers/printRoutes.js +5 -2
- package/dist/cjs/src/bin/index.js +37 -11
- package/dist/cjs/src/cli/helpers/TypesBuilder.js +29 -3
- package/dist/cjs/src/cli/index.js +4 -1
- package/dist/cjs/src/controller/decorators.js +4 -1
- package/dist/cjs/src/controller/index.js +59 -33
- package/dist/cjs/src/devtools/helpers/launchDevServer.js +5 -2
- package/dist/cjs/src/encrypt/internal-encrypt.js +5 -2
- package/dist/cjs/src/env/Loader.js +28 -2
- package/dist/cjs/src/error/db/failed-to-connect.js +4 -1
- package/dist/cjs/src/error/db/missing-options.js +4 -1
- package/dist/cjs/src/error/http/BadGateway.js +4 -1
- package/dist/cjs/src/error/http/BadRequest.js +4 -1
- package/dist/cjs/src/error/http/Conflict.js +4 -1
- package/dist/cjs/src/error/http/ContentTooLarge.js +4 -1
- package/dist/cjs/src/error/http/ExpectationFailed.js +4 -1
- package/dist/cjs/src/error/http/FailedDependency.js +4 -1
- package/dist/cjs/src/error/http/Forbidden.js +4 -1
- package/dist/cjs/src/error/http/GatewayTimeout.js +4 -1
- package/dist/cjs/src/error/http/Gone.js +4 -1
- package/dist/cjs/src/error/http/ImATeapot.js +4 -1
- package/dist/cjs/src/error/http/InsufficientStorage.js +4 -1
- package/dist/cjs/src/error/http/InternalServerError.js +4 -1
- package/dist/cjs/src/error/http/Locked.js +4 -1
- package/dist/cjs/src/error/http/MethodNotAllowed.js +4 -1
- package/dist/cjs/src/error/http/MisdirectedRequest.js +4 -1
- package/dist/cjs/src/error/http/NotAcceptable.js +4 -1
- package/dist/cjs/src/error/http/NotExtended.js +4 -1
- package/dist/cjs/src/error/http/NotFound.js +4 -1
- package/dist/cjs/src/error/http/NotImplemented.js +4 -1
- package/dist/cjs/src/error/http/PaymentRequired.js +4 -1
- package/dist/cjs/src/error/http/PreconditionFailed.js +4 -1
- package/dist/cjs/src/error/http/PreconditionRequired.js +4 -1
- package/dist/cjs/src/error/http/ProxyAuthenticationRequired.js +4 -1
- package/dist/cjs/src/error/http/RequestHeaderFieldsTooLarge.js +4 -1
- package/dist/cjs/src/error/http/ServiceUnavailable.js +4 -1
- package/dist/cjs/src/error/http/TooManyRequests.js +4 -1
- package/dist/cjs/src/error/http/Unauthorized.js +4 -1
- package/dist/cjs/src/error/http/UnavailableForLegalReasons.js +4 -1
- package/dist/cjs/src/error/http/UnprocessableContent.js +4 -1
- package/dist/cjs/src/error/http/UnsupportedMediaType.js +4 -1
- package/dist/cjs/src/error/http/router/index.js +4 -1
- package/dist/cjs/src/error/http/router/missing-controller-method.js +4 -1
- package/dist/cjs/src/error/http/router/missing-controller.js +4 -1
- package/dist/cjs/src/error/psychic-application/init-missing-package-manager.js +2 -2
- package/dist/cjs/src/generate/controller.js +34 -8
- package/dist/cjs/src/generate/helpers/addResourceToRoutes.js +31 -5
- package/dist/cjs/src/generate/helpers/generateControllerContent.js +5 -2
- package/dist/cjs/src/generate/helpers/generateResourceControllerSpecContent.js +5 -2
- package/dist/cjs/src/generate/resource.js +6 -3
- package/dist/cjs/src/helpers/autogeneratedFileDisclaimer.js +1 -1
- package/dist/cjs/src/helpers/error/httpErrorClasses.js +33 -30
- package/dist/cjs/src/helpers/importFileWithDefault.js +24 -1
- package/dist/cjs/src/helpers/importFileWithNamedExport.js +24 -1
- package/dist/cjs/src/helpers/loadEnv.js +28 -2
- package/dist/cjs/src/helpers/openapiJsonPath.js +29 -3
- package/dist/cjs/src/helpers/path/psychicFileAndDirPaths.js +28 -2
- package/dist/cjs/src/helpers/path/psychicPath.js +4 -1
- package/dist/cjs/src/helpers/path/relativePsychicPath.js +5 -2
- package/dist/cjs/src/index.js +50 -47
- package/dist/cjs/src/openapi-renderer/app.js +32 -6
- package/dist/cjs/src/openapi-renderer/body-segment.js +5 -2
- package/dist/cjs/src/openapi-renderer/endpoint.js +7 -4
- package/dist/cjs/src/openapi-renderer/serializer.js +8 -5
- package/dist/cjs/src/psychic-application/helpers/import/importControllers.js +6 -3
- package/dist/cjs/src/psychic-application/helpers/import/importServices.js +5 -2
- package/dist/cjs/src/psychic-application/helpers/loadAppEnv.js +28 -2
- package/dist/cjs/src/psychic-application/index.js +36 -10
- package/dist/cjs/src/router/helpers.js +7 -4
- package/dist/cjs/src/router/index.js +8 -5
- package/dist/cjs/src/server/helpers/startPsychicServer.js +31 -5
- package/dist/cjs/src/server/index.js +37 -12
- package/dist/cjs/src/server/params.js +4 -1
- package/dist/cjs/src/session/index.js +7 -4
- package/dist/esm/src/bin/helpers/generateRouteTypes.js +2 -2
- package/dist/esm/src/bin/index.js +2 -2
- package/dist/esm/src/cli/helpers/TypesBuilder.js +2 -2
- package/dist/esm/src/error/psychic-application/init-missing-package-manager.js +2 -2
- package/dist/esm/src/generate/controller.js +1 -1
- package/dist/esm/src/generate/helpers/addResourceToRoutes.js +2 -2
- package/dist/esm/src/helpers/autogeneratedFileDisclaimer.js +2 -2
- package/dist/esm/src/helpers/openapiJsonPath.js +1 -1
- package/dist/esm/src/helpers/path/psychicFileAndDirPaths.js +1 -1
- package/dist/esm/src/openapi-renderer/app.js +1 -1
- package/dist/esm/src/psychic-application/index.js +3 -3
- package/dist/esm/src/server/helpers/startPsychicServer.js +3 -3
- package/dist/esm/src/server/index.js +3 -4
- package/dist/types/src/psychic-application/index.d.ts +1 -1
- package/dist/types/src/router/index.d.ts +5 -5
- package/dist/types/src/server/helpers/startPsychicServer.d.ts +6 -6
- package/dist/types/src/server/index.d.ts +4 -4
- package/package.json +8 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DreamBin, DreamCLI } from '@rvoh/dream';
|
|
2
|
-
import * as fs from 'fs/promises';
|
|
3
|
-
import * as path from 'path';
|
|
2
|
+
import * as fs from 'node:fs/promises';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
4
|
import TypesBuilder from '../cli/helpers/TypesBuilder.js';
|
|
5
5
|
import generateController from '../generate/controller.js';
|
|
6
6
|
import generateResource from '../generate/resource.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DreamApplication } from '@rvoh/dream';
|
|
2
|
-
import * as fs from 'fs/promises';
|
|
3
|
-
import * as path from 'path';
|
|
2
|
+
import * as fs from 'node:fs/promises';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
4
|
import PsychicApplication from '../../psychic-application/index.js';
|
|
5
5
|
export default class TypesBuilder {
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -9,8 +9,8 @@ must set packageManager when initializing a new PsychicApplication.
|
|
|
9
9
|
within conf/app.ts, you must have a call to "#set('packageManager', '<YOUR_CHOSEN_PACKAGE_MANAGER>')", i.e.
|
|
10
10
|
|
|
11
11
|
// conf/app.ts
|
|
12
|
-
export default async (
|
|
13
|
-
|
|
12
|
+
export default async (psy: PsychicApplication) => {
|
|
13
|
+
psy.set('packageManager', 'yarn')
|
|
14
14
|
}
|
|
15
15
|
`;
|
|
16
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hyphenize, standardizeFullyQualifiedModelName } from '@rvoh/dream';
|
|
2
|
-
import * as fs from 'fs/promises';
|
|
3
2
|
import { existsSync } from 'node:fs';
|
|
3
|
+
import * as fs from 'node:fs/promises';
|
|
4
4
|
import UnexpectedUndefined from '../error/UnexpectedUndefined.js';
|
|
5
5
|
import EnvInternal from '../helpers/EnvInternal.js';
|
|
6
6
|
import psychicFileAndDirPaths from '../helpers/path/psychicFileAndDirPaths.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as fs from 'fs/promises';
|
|
2
|
-
import * as path from 'path';
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
3
|
import UnexpectedUndefined from '../../error/UnexpectedUndefined.js';
|
|
4
4
|
import psychicPath from '../../helpers/path/psychicPath.js';
|
|
5
5
|
import PsychicApplication from '../../psychic-application/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DreamLogos } from '@rvoh/dream';
|
|
2
2
|
export default function autogeneratedFileDisclaimer(startComment = '\n/*', endComment = '\n*/') {
|
|
3
3
|
return `\
|
|
4
4
|
${startComment}
|
|
@@ -13,7 +13,7 @@ ${startComment}
|
|
|
13
13
|
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
${
|
|
16
|
+
${DreamLogos.monochrome()}
|
|
17
17
|
|
|
18
18
|
This file was automatically generated by my cat, Aster.
|
|
19
19
|
He does not want you mucking about with his files,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
1
|
+
import * as path from 'node:path';
|
|
2
2
|
import UnexpectedUndefined from '../error/UnexpectedUndefined.js';
|
|
3
3
|
import PsychicApplication from '../psychic-application/index.js';
|
|
4
4
|
export default function openapiJsonPath(openapiName = 'default') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compact } from '@rvoh/dream';
|
|
2
|
-
import * as fs from 'fs/promises';
|
|
3
2
|
import { groupBy } from 'lodash-es';
|
|
3
|
+
import * as fs from 'node:fs/promises';
|
|
4
4
|
import UnexpectedUndefined from '../error/UnexpectedUndefined.js';
|
|
5
5
|
import EnvInternal from '../helpers/EnvInternal.js';
|
|
6
6
|
import openapiJsonPath from '../helpers/openapiJsonPath.js';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { DreamApplication, Encrypt, } from '@rvoh/dream';
|
|
2
2
|
import PsychicApplicationInitMissingApiRoot from '../error/psychic-application/init-missing-api-root.js';
|
|
3
3
|
import PsychicApplicationInitMissingCallToLoadControllers from '../error/psychic-application/init-missing-call-to-load-controllers.js';
|
|
4
|
+
import PsychicApplicationInitMissingPackageManager from '../error/psychic-application/init-missing-package-manager.js';
|
|
4
5
|
import PsychicApplicationInitMissingRoutesCallback from '../error/psychic-application/init-missing-routes-callback.js';
|
|
5
6
|
import cookieMaxAgeFromCookieOpts from '../helpers/cookieMaxAgeFromCookieOpts.js';
|
|
6
7
|
import EnvInternal from '../helpers/EnvInternal.js';
|
|
8
|
+
import pascalizeFileName from '../helpers/pascalizeFileName.js';
|
|
7
9
|
import { cachePsychicApplication, getCachedPsychicApplicationOrFail } from './cache.js';
|
|
8
10
|
import importControllers, { getControllersOrFail } from './helpers/import/importControllers.js';
|
|
9
|
-
import lookupClassByGlobalName from './helpers/lookupClassByGlobalName.js';
|
|
10
|
-
import PsychicApplicationInitMissingPackageManager from '../error/psychic-application/init-missing-package-manager.js';
|
|
11
11
|
import importServices, { getServicesOrFail } from './helpers/import/importServices.js';
|
|
12
|
-
import
|
|
12
|
+
import lookupClassByGlobalName from './helpers/lookupClassByGlobalName.js';
|
|
13
13
|
export default class PsychicApplication {
|
|
14
14
|
static async init(cb, dreamCb, opts = {}) {
|
|
15
15
|
let psychicApp;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DreamCLI } from '@rvoh/dream';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as http from 'http';
|
|
4
|
-
import * as https from 'https';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import * as http from 'node:http';
|
|
4
|
+
import * as https from 'node:https';
|
|
5
5
|
import EnvInternal from '../../helpers/EnvInternal.js';
|
|
6
6
|
import PsychicServer from '../../server/index.js';
|
|
7
7
|
export default async function startPsychicServer({ app, port, sslCredentials, }) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { closeAllDbConnections,
|
|
1
|
+
import { closeAllDbConnections, DreamLogos } 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
5
|
import * as OpenApiValidator from 'express-openapi-validator';
|
|
6
|
-
import * as path from 'path';
|
|
6
|
+
import * as path from 'node:path';
|
|
7
7
|
import EnvInternal from '../helpers/EnvInternal.js';
|
|
8
8
|
import isOpenapiError from '../helpers/isOpenapiError.js';
|
|
9
9
|
import PsychicApplication from '../psychic-application/index.js';
|
|
@@ -17,7 +17,7 @@ export default class PsychicServer {
|
|
|
17
17
|
return createPsychicHttpInstance(app, sslCredentials);
|
|
18
18
|
}
|
|
19
19
|
static asciiLogo() {
|
|
20
|
-
return
|
|
20
|
+
return DreamLogos.colorful();
|
|
21
21
|
}
|
|
22
22
|
expressApp;
|
|
23
23
|
httpServer;
|
|
@@ -131,7 +131,6 @@ export default class PsychicServer {
|
|
|
131
131
|
}
|
|
132
132
|
buildApp() {
|
|
133
133
|
this.expressApp = express.default();
|
|
134
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
135
134
|
this.expressApp.use(cookieParser.default());
|
|
136
135
|
}
|
|
137
136
|
initializeCors() {
|
|
@@ -3,7 +3,7 @@ import * as bodyParser from 'body-parser';
|
|
|
3
3
|
import { CorsOptions } from 'cors';
|
|
4
4
|
import { Request, Response } from 'express';
|
|
5
5
|
import * as OpenApiValidator from 'express-openapi-validator';
|
|
6
|
-
import * as http from 'http';
|
|
6
|
+
import * as http from 'node:http';
|
|
7
7
|
import { OpenapiContent, OpenapiHeaders, OpenapiResponses, OpenapiSecurity, OpenapiSecuritySchemes, OpenapiServer } from '../openapi-renderer/endpoint.js';
|
|
8
8
|
import PsychicRouter from '../router/index.js';
|
|
9
9
|
import PsychicServer from '../server/index.js';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Express, Request, Response, Router } from 'express';
|
|
2
2
|
import PsychicController from '../controller/index.js';
|
|
3
3
|
import PsychicApplication from '../psychic-application/index.js';
|
|
4
4
|
import { NamespaceConfig, PsychicControllerActions } from '../router/helpers.js';
|
|
5
5
|
import RouteManager from './route-manager.js';
|
|
6
6
|
import { HttpMethod, ResourcesOptions } from './types.js';
|
|
7
7
|
export default class PsychicRouter {
|
|
8
|
-
app:
|
|
8
|
+
app: Express;
|
|
9
9
|
config: PsychicApplication;
|
|
10
10
|
currentNamespaces: NamespaceConfig[];
|
|
11
11
|
routeManager: RouteManager;
|
|
12
|
-
constructor(app:
|
|
13
|
-
get routingMechanism():
|
|
12
|
+
constructor(app: Express, config: PsychicApplication);
|
|
13
|
+
get routingMechanism(): Express | Router;
|
|
14
14
|
get routes(): import("./route-manager.js").RouteConfig[];
|
|
15
15
|
private get currentNamespacePaths();
|
|
16
16
|
commit(): void;
|
|
@@ -48,7 +48,7 @@ export default class PsychicRouter {
|
|
|
48
48
|
}
|
|
49
49
|
export declare class PsychicNestedRouter extends PsychicRouter {
|
|
50
50
|
router: Router;
|
|
51
|
-
constructor(app:
|
|
51
|
+
constructor(app: Express, config: PsychicApplication, routeManager: RouteManager, { namespaces, }?: {
|
|
52
52
|
namespaces?: NamespaceConfig[];
|
|
53
53
|
});
|
|
54
54
|
get routingMechanism(): Router;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as http from 'http';
|
|
3
|
-
import { Server } from 'http';
|
|
4
|
-
import * as https from 'https';
|
|
1
|
+
import { Express } from 'express';
|
|
2
|
+
import * as http from 'node:http';
|
|
3
|
+
import { Server } from 'node:http';
|
|
4
|
+
import * as https from 'node:https';
|
|
5
5
|
import { PsychicSslCredentials } from '../../psychic-application/index.js';
|
|
6
6
|
export interface StartPsychicServerOptions {
|
|
7
|
-
app:
|
|
7
|
+
app: Express;
|
|
8
8
|
port: number;
|
|
9
9
|
sslCredentials: PsychicSslCredentials | undefined;
|
|
10
10
|
}
|
|
11
11
|
export default function startPsychicServer({ app, port, sslCredentials, }: StartPsychicServerOptions): Promise<Server>;
|
|
12
|
-
export declare function createPsychicHttpInstance(app:
|
|
12
|
+
export declare function createPsychicHttpInstance(app: Express, sslCredentials: PsychicSslCredentials | undefined): http.Server<typeof http.IncomingMessage, typeof http.ServerResponse> | https.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Server } from 'http';
|
|
1
|
+
import { Express } from 'express';
|
|
2
|
+
import { Server } from 'node:http';
|
|
3
3
|
import PsychicApplication, { PsychicSslCredentials } from '../psychic-application/index.js';
|
|
4
4
|
import { StartPsychicServerOptions } from './helpers/startPsychicServer.js';
|
|
5
5
|
export default class PsychicServer {
|
|
6
6
|
static startPsychicServer(opts: StartPsychicServerOptions): Promise<Server>;
|
|
7
|
-
static createPsychicHttpInstance(app:
|
|
7
|
+
static createPsychicHttpInstance(app: Express, sslCredentials: PsychicSslCredentials | undefined): Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse> | import("https").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
8
8
|
static asciiLogo(): string;
|
|
9
|
-
expressApp:
|
|
9
|
+
expressApp: Express;
|
|
10
10
|
httpServer: Server;
|
|
11
11
|
private booted;
|
|
12
12
|
constructor();
|
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": "0.28.
|
|
5
|
+
"version": "0.28.4",
|
|
6
6
|
"author": "RVOHealth",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"prepack": "yarn build"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@types/cookie-parser": "^1.4.
|
|
42
|
+
"@types/cookie-parser": "^1.4.8",
|
|
43
43
|
"@types/cors": "^2.8.17",
|
|
44
44
|
"@types/lodash.groupby": "^4.6.9",
|
|
45
45
|
"commander": "^12.1.0",
|
|
@@ -62,18 +62,18 @@
|
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@eslint/js": "^9.19.0",
|
|
64
64
|
"@jest-mock/express": "^3.0.0",
|
|
65
|
-
"@rvoh/dream": "^0.
|
|
66
|
-
"@rvoh/dream-spec-helpers": "
|
|
67
|
-
"@rvoh/psychic-spec-helpers": "
|
|
68
|
-
"@types/express": "^
|
|
65
|
+
"@rvoh/dream": "^0.35.3",
|
|
66
|
+
"@rvoh/dream-spec-helpers": "^0.2.4",
|
|
67
|
+
"@rvoh/psychic-spec-helpers": "^0.4.3",
|
|
68
|
+
"@types/express": "^5.0.1",
|
|
69
69
|
"@types/lodash-es": "^4",
|
|
70
70
|
"@types/lodash.clonedeep": "^4.5.9",
|
|
71
71
|
"@types/lodash.sortby": "^4.7.9",
|
|
72
72
|
"@types/node": "^22.5.1",
|
|
73
73
|
"@types/pg": "^8.11.8",
|
|
74
|
-
"@types/supertest": "^6.0.
|
|
74
|
+
"@types/supertest": "^6.0.3",
|
|
75
75
|
"eslint": "^9.19.0",
|
|
76
|
-
"express": "^
|
|
76
|
+
"express": "^5.1.0",
|
|
77
77
|
"jsdom": "^26.0.0",
|
|
78
78
|
"kysely": "^0.27.4",
|
|
79
79
|
"kysely-codegen": "~0.17.0",
|