@rvoh/psychic 1.5.2 → 1.5.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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 1.5.4
2
+
3
+ - fix issue when providing the `including` argument exclusively to an OpenAPI decorator's `requestBody`
4
+
5
+ ## 1.5.3
6
+
7
+ - add missing peer dependency for openapi-typescript, allow BIGINT type when generating openapi-typescript bigints
8
+
9
+ ## 1.5.2
10
+
11
+ - ensure that bigints are converted to number | string when generating openapi-typescript type files
12
+
1
13
  ## 1.5.1
2
14
 
3
15
  - fix issue with enum syncing related to multi-db engine support regression
@@ -26,14 +26,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.default = syncTypescriptOpenapiFiles;
29
+ exports.default = syncOpenapiTypescriptFiles;
30
30
  const fs = __importStar(require("node:fs/promises"));
31
31
  const path = __importStar(require("node:path"));
32
32
  const openapi_typescript_1 = __importStar(require("openapi-typescript"));
33
33
  const typescript_1 = __importDefault(require("typescript"));
34
34
  const psychicPath_js_1 = __importDefault(require("../../helpers/path/psychicPath.js"));
35
35
  const index_js_1 = __importDefault(require("../../psychic-app/index.js"));
36
- async function syncTypescriptOpenapiFiles() {
36
+ const BIGINT = typescript_1.default.factory.createKeywordTypeNode(typescript_1.default.SyntaxKind.BigIntKeyword);
37
+ async function syncOpenapiTypescriptFiles() {
37
38
  const psychicApp = index_js_1.default.getOrFail();
38
39
  const syncableKeys = Object.keys(psychicApp.openapi).filter(key => psychicApp.openapi[key]?.syncTypes);
39
40
  const targetDir = path.join((0, psychicPath_js_1.default)('types'), 'openapi');
@@ -49,8 +50,8 @@ async function syncTypescriptOpenapiFiles() {
49
50
  const isNullable = schemaObject.nullable ||
50
51
  (Array.isArray(schemaObject.type) && schemaObject.type.includes('null'));
51
52
  return isNullable
52
- ? typescript_1.default.factory.createUnionTypeNode([openapi_typescript_1.STRING, openapi_typescript_1.NUMBER, openapi_typescript_1.NULL])
53
- : typescript_1.default.factory.createUnionTypeNode([openapi_typescript_1.STRING, openapi_typescript_1.NUMBER]);
53
+ ? typescript_1.default.factory.createUnionTypeNode([openapi_typescript_1.STRING, openapi_typescript_1.NUMBER, BIGINT, openapi_typescript_1.NULL])
54
+ : typescript_1.default.factory.createUnionTypeNode([openapi_typescript_1.STRING, openapi_typescript_1.NUMBER, BIGINT]);
54
55
  }
55
56
  },
56
57
  });
@@ -39,7 +39,7 @@ const index_js_2 = __importDefault(require("../server/index.js"));
39
39
  const enumsFileStr_js_1 = __importDefault(require("./helpers/enumsFileStr.js"));
40
40
  const generateRouteTypes_js_1 = __importDefault(require("./helpers/generateRouteTypes.js"));
41
41
  const printRoutes_js_1 = __importDefault(require("./helpers/printRoutes.js"));
42
- const syncTypescriptOpenapiFiles_js_1 = __importDefault(require("./helpers/syncTypescriptOpenapiFiles.js"));
42
+ const syncOpenapiTypescriptFiles_js_1 = __importDefault(require("./helpers/syncOpenapiTypescriptFiles.js"));
43
43
  class PsychicBin {
44
44
  static async generateController(controllerName, actions) {
45
45
  await (0, controller_js_1.default)({
@@ -92,7 +92,7 @@ class PsychicBin {
92
92
  }
93
93
  static async syncTypescriptOpenapiFiles() {
94
94
  dream_1.DreamCLI.logger.logStartProgress(`syncing openapi types...`);
95
- await (0, syncTypescriptOpenapiFiles_js_1.default)();
95
+ await (0, syncOpenapiTypescriptFiles_js_1.default)();
96
96
  dream_1.DreamCLI.logger.logEndProgress();
97
97
  }
98
98
  static async syncOpenapiJson() {
@@ -400,6 +400,8 @@ class OpenapiEndpointRenderer {
400
400
  return true;
401
401
  if (body.only)
402
402
  return true;
403
+ if (body.including)
404
+ return true;
403
405
  if (body.for)
404
406
  return true;
405
407
  if (body.required && body.type !== 'object')
@@ -4,7 +4,8 @@ import openapiTS, { astToString, NULL, NUMBER, STRING } from 'openapi-typescript
4
4
  import ts from 'typescript';
5
5
  import psychicPath from '../../helpers/path/psychicPath.js';
6
6
  import PsychicApp from '../../psychic-app/index.js';
7
- export default async function syncTypescriptOpenapiFiles() {
7
+ const BIGINT = ts.factory.createKeywordTypeNode(ts.SyntaxKind.BigIntKeyword);
8
+ export default async function syncOpenapiTypescriptFiles() {
8
9
  const psychicApp = PsychicApp.getOrFail();
9
10
  const syncableKeys = Object.keys(psychicApp.openapi).filter(key => psychicApp.openapi[key]?.syncTypes);
10
11
  const targetDir = path.join(psychicPath('types'), 'openapi');
@@ -20,8 +21,8 @@ export default async function syncTypescriptOpenapiFiles() {
20
21
  const isNullable = schemaObject.nullable ||
21
22
  (Array.isArray(schemaObject.type) && schemaObject.type.includes('null'));
22
23
  return isNullable
23
- ? ts.factory.createUnionTypeNode([STRING, NUMBER, NULL])
24
- : ts.factory.createUnionTypeNode([STRING, NUMBER]);
24
+ ? ts.factory.createUnionTypeNode([STRING, NUMBER, BIGINT, NULL])
25
+ : ts.factory.createUnionTypeNode([STRING, NUMBER, BIGINT]);
25
26
  }
26
27
  },
27
28
  });
@@ -11,7 +11,7 @@ import PsychicServer from '../server/index.js';
11
11
  import enumsFileStr from './helpers/enumsFileStr.js';
12
12
  import generateRouteTypes from './helpers/generateRouteTypes.js';
13
13
  import printRoutes from './helpers/printRoutes.js';
14
- import syncTypescriptOpenapiFiles from './helpers/syncTypescriptOpenapiFiles.js';
14
+ import syncOpenapiTypescriptFiles from './helpers/syncOpenapiTypescriptFiles.js';
15
15
  export default class PsychicBin {
16
16
  static async generateController(controllerName, actions) {
17
17
  await generateController({
@@ -64,7 +64,7 @@ export default class PsychicBin {
64
64
  }
65
65
  static async syncTypescriptOpenapiFiles() {
66
66
  DreamCLI.logger.logStartProgress(`syncing openapi types...`);
67
- await syncTypescriptOpenapiFiles();
67
+ await syncOpenapiTypescriptFiles();
68
68
  DreamCLI.logger.logEndProgress();
69
69
  }
70
70
  static async syncOpenapiJson() {
@@ -394,6 +394,8 @@ export default class OpenapiEndpointRenderer {
394
394
  return true;
395
395
  if (body.only)
396
396
  return true;
397
+ if (body.including)
398
+ return true;
397
399
  if (body.for)
398
400
  return true;
399
401
  if (body.required && body.type !== 'object')
@@ -0,0 +1 @@
1
+ export default function syncOpenapiTypescriptFiles(): Promise<void>;
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.5.2",
5
+ "version": "1.5.4",
6
6
  "author": "RVOHealth",
7
7
  "repository": {
8
8
  "type": "git",
@@ -54,7 +54,8 @@
54
54
  "@rvoh/dream": "*",
55
55
  "@types/express": "*",
56
56
  "commander": "*",
57
- "express": "*"
57
+ "express": "*",
58
+ "openapi-typescript": "*"
58
59
  },
59
60
  "devDependencies": {
60
61
  "@eslint/js": "^9.19.0",
@@ -1 +0,0 @@
1
- export default function syncTypescriptOpenapiFiles(): Promise<void>;