@rvoh/psychic 3.0.1 → 3.0.3
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/printControllerHierarchy.js +168 -0
- package/dist/cjs/src/bin/index.js +12 -13
- package/dist/cjs/src/cli/index.js +69 -5
- package/dist/cjs/src/generate/helpers/reduxBindings/writeInitializer.js +8 -8
- package/dist/cjs/src/generate/helpers/syncOpenapiTypescript/generateInitializer.js +3 -3
- package/dist/cjs/src/generate/helpers/zustandBindings/printFinalStepsMessage.js +47 -0
- package/dist/cjs/src/generate/helpers/zustandBindings/promptForOptions.js +61 -0
- package/dist/cjs/src/generate/helpers/zustandBindings/writeClientConfigFile.js +43 -0
- package/dist/cjs/src/generate/helpers/zustandBindings/writeInitializer.js +46 -0
- package/dist/cjs/src/generate/initializer/syncEnums.js +3 -3
- package/dist/cjs/src/generate/openapi/zustandBindings.js +27 -0
- package/dist/esm/src/bin/helpers/printControllerHierarchy.js +168 -0
- package/dist/esm/src/bin/index.js +12 -13
- package/dist/esm/src/cli/index.js +69 -5
- package/dist/esm/src/generate/helpers/reduxBindings/writeInitializer.js +8 -8
- package/dist/esm/src/generate/helpers/syncOpenapiTypescript/generateInitializer.js +3 -3
- package/dist/esm/src/generate/helpers/zustandBindings/printFinalStepsMessage.js +47 -0
- package/dist/esm/src/generate/helpers/zustandBindings/promptForOptions.js +61 -0
- package/dist/esm/src/generate/helpers/zustandBindings/writeClientConfigFile.js +43 -0
- package/dist/esm/src/generate/helpers/zustandBindings/writeInitializer.js +46 -0
- package/dist/esm/src/generate/initializer/syncEnums.js +3 -3
- package/dist/esm/src/generate/openapi/zustandBindings.js +27 -0
- package/dist/types/src/bin/helpers/printControllerHierarchy.d.ts +35 -0
- package/dist/types/src/bin/index.d.ts +2 -0
- package/dist/types/src/generate/helpers/zustandBindings/printFinalStepsMessage.d.ts +2 -0
- package/dist/types/src/generate/helpers/zustandBindings/promptForOptions.d.ts +2 -0
- package/dist/types/src/generate/helpers/zustandBindings/writeClientConfigFile.d.ts +3 -0
- package/dist/types/src/generate/helpers/zustandBindings/writeInitializer.d.ts +5 -0
- package/dist/types/src/generate/openapi/zustandBindings.d.ts +21 -0
- package/package.json +13 -16
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import PsychicController from '../../controller/index.js';
|
|
2
|
+
export default function printControllerHierarchy(controllersPath?: string): void;
|
|
3
|
+
export declare function resolveControllerClasses(controllersPath?: string): {
|
|
4
|
+
controllerClasses: (typeof PsychicController)[];
|
|
5
|
+
resolvedPath: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function controllerHierarchyLines(controllersPath?: string): string[];
|
|
8
|
+
export declare function controllerHierarchyViolations(controllersPath?: string): string[];
|
|
9
|
+
export declare function buildChildrenMap(controllerClasses: (typeof PsychicController)[]): Map<typeof PsychicController, (typeof PsychicController)[]>;
|
|
10
|
+
export declare function controllerTreeLine(displayedName: string, depth: number, displayColumn: number, baseIndent: number): string;
|
|
11
|
+
/**
|
|
12
|
+
* Computes the actual column where the name starts on screen,
|
|
13
|
+
* accounting for MIN_DASHES potentially pushing the name further right.
|
|
14
|
+
*/
|
|
15
|
+
export declare function actualDisplayColumn(displayColumn: number, depth: number, baseIndent: number): number;
|
|
16
|
+
export declare function sharedDirPrefix(a: string, b: string): string;
|
|
17
|
+
export declare function globalPrefixFromPath(path: string, defaultControllersPath: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the directory portion of a globalName.
|
|
20
|
+
* e.g. "controllers/Admin/AuthedController" -> "controllers/Admin/"
|
|
21
|
+
* "controllers/ApplicationController" -> "controllers/"
|
|
22
|
+
*/
|
|
23
|
+
export declare function globalNameDir(globalName: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the parent directory of a directory path.
|
|
26
|
+
* e.g. "controllers/Admin/" -> "controllers/"
|
|
27
|
+
* "controllers/" -> ""
|
|
28
|
+
*/
|
|
29
|
+
export declare function parentOfDir(dir: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Checks whether a child controller violates the hierarchy convention.
|
|
32
|
+
* A controller should extend a controller in the same directory or the parent directory.
|
|
33
|
+
* Returns a warning message string if violated, or null if OK.
|
|
34
|
+
*/
|
|
35
|
+
export declare function hierarchyViolation(childGlobalName: string, parentGlobalName: string, controllersPath: string): string | null;
|
|
@@ -10,6 +10,8 @@ export default class PsychicBin {
|
|
|
10
10
|
modelName?: string;
|
|
11
11
|
}): Promise<void>;
|
|
12
12
|
static printRoutes(): void;
|
|
13
|
+
static printControllerHierarchy(controllersPath?: string): void;
|
|
14
|
+
static controllerHierarchyViolations(controllersPath?: string): string[];
|
|
13
15
|
static sync({ bypassDreamSync, schemaOnly, }?: {
|
|
14
16
|
bypassDreamSync?: boolean;
|
|
15
17
|
schemaOnly?: boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*
|
|
4
|
+
* used by the psychic CLI to generate boilerplate
|
|
5
|
+
* that can be used to integrate a specific openapi.json
|
|
6
|
+
* file with a client using @hey-api/openapi-ts.
|
|
7
|
+
*
|
|
8
|
+
* * generates the client config file if it does not exist
|
|
9
|
+
* * generates an initializer, which taps into the sync hooks
|
|
10
|
+
* to automatically run the @hey-api/openapi-ts CLI util
|
|
11
|
+
* * prints a helpful message, instructing devs on the final
|
|
12
|
+
* steps for using the generated typed API functions
|
|
13
|
+
* within their client application.
|
|
14
|
+
*/
|
|
15
|
+
export default function generateOpenapiZustandBindings(options?: OpenapiZustandBindingsOptions): Promise<void>;
|
|
16
|
+
export interface OpenapiZustandBindingsOptions {
|
|
17
|
+
exportName?: string;
|
|
18
|
+
schemaFile?: string;
|
|
19
|
+
outputDir?: string;
|
|
20
|
+
clientConfigFile?: string;
|
|
21
|
+
}
|
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": "3.0.
|
|
5
|
+
"version": "3.0.3",
|
|
6
6
|
"author": "RVOHealth",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -76,15 +76,15 @@
|
|
|
76
76
|
"@koa/etag": "^5.0.2",
|
|
77
77
|
"@koa/router": "^15.3.0",
|
|
78
78
|
"@rvoh/dream": "^2.4.0",
|
|
79
|
-
"@types/
|
|
80
|
-
"@types/koa__router": "^12.0.5",
|
|
79
|
+
"@types/koa": "^3.0.1",
|
|
81
80
|
"@types/koa-bodyparser": "^4.3.12",
|
|
82
81
|
"@types/koa-conditional-get": "^2.0.3",
|
|
83
82
|
"@types/koa-etag": "^3.0.3",
|
|
84
|
-
"@types/
|
|
83
|
+
"@types/koa__cors": "^5.0.0",
|
|
84
|
+
"@types/koa__router": "^12.0.5",
|
|
85
|
+
"koa": "^3.1.2",
|
|
85
86
|
"koa-bodyparser": "^4.4.1",
|
|
86
87
|
"koa-conditional-get": "^3.0.0",
|
|
87
|
-
"koa": "^3.1.2",
|
|
88
88
|
"openapi-typescript": "^7.8.0"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
@@ -107,18 +107,18 @@
|
|
|
107
107
|
"@types/passport-local": "^1",
|
|
108
108
|
"@types/pg": "^8.11.8",
|
|
109
109
|
"@types/supertest": "^6.0.3",
|
|
110
|
-
"@typescript-eslint/parser": "^8.
|
|
110
|
+
"@typescript-eslint/parser": "^8.57.1",
|
|
111
111
|
"@typescript/analyze-trace": "^0.10.1",
|
|
112
112
|
"commander": "^14.0.3",
|
|
113
113
|
"dotenv": "^16.4.5",
|
|
114
|
-
"eslint": "^9.39.
|
|
114
|
+
"eslint": "^9.39.4",
|
|
115
115
|
"jsdom": "^26.1.0",
|
|
116
116
|
"koa": "^3.1.2",
|
|
117
117
|
"koa-bodyparser": "^4.4.1",
|
|
118
118
|
"koa-conditional-get": "^3.0.0",
|
|
119
119
|
"koa-passport": "^6.0.0",
|
|
120
120
|
"koa-session": "^7.0.2",
|
|
121
|
-
"kysely": "^0.28.
|
|
121
|
+
"kysely": "^0.28.13",
|
|
122
122
|
"kysely-codegen": "~0.19.0",
|
|
123
123
|
"luxon-jest-matchers": "^0.1.14",
|
|
124
124
|
"nodemon": "^3.1.11",
|
|
@@ -128,23 +128,20 @@
|
|
|
128
128
|
"pg": "^8.12.0",
|
|
129
129
|
"pluralize-esm": "^9.0.5",
|
|
130
130
|
"prettier": "^3.3.3",
|
|
131
|
-
"puppeteer": "^24.
|
|
132
|
-
"supertest": "^7.
|
|
131
|
+
"puppeteer": "^24.39.1",
|
|
132
|
+
"supertest": "^7.2.2",
|
|
133
133
|
"tslib": "^2.7.0",
|
|
134
134
|
"tsx": "^4.21.0",
|
|
135
135
|
"typedoc": "^0.28.17",
|
|
136
136
|
"typescript": "^5.9.3",
|
|
137
|
-
"typescript-eslint": "^8.
|
|
138
|
-
"vitest": "^4.0
|
|
137
|
+
"typescript-eslint": "^8.57.1",
|
|
138
|
+
"vitest": "^4.1.0",
|
|
139
139
|
"winston": "^3.14.2"
|
|
140
140
|
},
|
|
141
141
|
"packageManager": "pnpm@10.26.0+sha512.3b3f6c725ebe712506c0ab1ad4133cf86b1f4b687effce62a9b38b4d72e3954242e643190fc51fa1642949c735f403debd44f5cb0edd657abe63a8b6a7e1e402",
|
|
142
142
|
"pnpm": {
|
|
143
143
|
"overrides": {
|
|
144
|
-
"diff": ">=8.0.3"
|
|
145
|
-
"minimatch@3": "3.1.3",
|
|
146
|
-
"minimatch@5": "5.1.7",
|
|
147
|
-
"minimatch@9": "9.0.6"
|
|
144
|
+
"diff": ">=8.0.3"
|
|
148
145
|
}
|
|
149
146
|
}
|
|
150
147
|
}
|