diff --git a/www/utils/packages/docs-generator/package.json b/www/utils/packages/docs-generator/package.json index 89625fc6a7..72db991aba 100644 --- a/www/utils/packages/docs-generator/package.json +++ b/www/utils/packages/docs-generator/package.json @@ -28,7 +28,7 @@ "pluralize": "^8.0.0", "prettier": "^3.2.4", "ts-node": "^10.9.1", - "typescript": "5.5", + "typescript": "^5.6.2", "utils": "*", "yaml": "^2.3.4" }, diff --git a/www/utils/packages/docs-generator/src/classes/generators/index.ts b/www/utils/packages/docs-generator/src/classes/generators/index.ts index e7b635b767..5182c60170 100644 --- a/www/utils/packages/docs-generator/src/classes/generators/index.ts +++ b/www/utils/packages/docs-generator/src/classes/generators/index.ts @@ -6,6 +6,7 @@ import { CommonCliOptions } from "../../types/index.js" import { existsSync, readdirSync, statSync } from "node:fs" import path from "node:path" import getBasePath from "../../utils/get-base-path.js" +import getMonorepoRoot from "../../utils/get-monorepo-root.js" export type Options = { paths: string[] @@ -50,7 +51,7 @@ abstract class AbstractGenerator { ) }) - this.program = ts.createProgram(files, {}) + this.program = ts.createProgram(files, this.getBaseCompilerOptions()) this.checker = this.program.getTypeChecker() @@ -90,6 +91,23 @@ abstract class AbstractGenerator { this.program = undefined this.checker = undefined } + + getBaseCompilerOptions(): ts.CompilerOptions { + const monorepoPath = getMonorepoRoot() + const tsconfigBasePath = path.join(monorepoPath, "_tsconfig.base.json") + + const configStr = ts.sys.readFile(tsconfigBasePath) + + if (!configStr) { + return {} + } + + return ts.parseJsonConfigFileContent( + JSON.parse(configStr), + ts.sys, + monorepoPath + ).options + } } export default AbstractGenerator diff --git a/www/utils/packages/docs-generator/src/classes/helpers/schema-factory.ts b/www/utils/packages/docs-generator/src/classes/helpers/schema-factory.ts index 26366c7167..2918c0ac2f 100644 --- a/www/utils/packages/docs-generator/src/classes/helpers/schema-factory.ts +++ b/www/utils/packages/docs-generator/src/classes/helpers/schema-factory.ts @@ -37,6 +37,34 @@ class SchemaFactory { BigNumberValue: { type: "number", }, + expand: { + type: "string", + title: "expand", + description: + "Comma-separated relations that should be expanded in the returned data.", + }, + fields: { + type: "string", + title: "fields", + description: + "Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. without prefix it will replace the entire default fields.", + }, + offset: { + type: "number", + title: "offset", + description: "The number of items to skip when retrieving a list.", + }, + limit: { + type: "number", + title: "limit", + description: "Limit the number of items returned in the list.", + }, + order: { + type: "string", + title: "order", + description: + "The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`.", + }, File: { type: "object", description: "A File to upload.", diff --git a/www/utils/packages/docs-generator/src/classes/helpers/types.ts b/www/utils/packages/docs-generator/src/classes/helpers/types.ts index 5ed8c7fc81..f128bfe764 100644 --- a/www/utils/packages/docs-generator/src/classes/helpers/types.ts +++ b/www/utils/packages/docs-generator/src/classes/helpers/types.ts @@ -35,7 +35,11 @@ export default class TypesHelper { } cleanUpTypes(types: ts.Type[]): ts.Type[] { - let cleanedUpTypes = this.removeStringRegExpTypeOverlaps(types) + let cleanedUpTypes = this.removeUndefinedNullTypes(types) + + cleanedUpTypes = this.removeExtraBoolean(cleanedUpTypes) + + cleanedUpTypes = this.removeStringRegExpTypeOverlaps(cleanedUpTypes) cleanedUpTypes = this.joinDateAndString(cleanedUpTypes) @@ -80,4 +84,28 @@ export default class TypesHelper { return dateType && hasStringType ? [dateType] : types } + + private removeUndefinedNullTypes(types: ts.Type[]): ts.Type[] { + return types.filter( + (type) => + type.flags !== ts.TypeFlags.Undefined && + type.flags !== ts.TypeFlags.Null + ) + } + + private removeExtraBoolean(types: ts.Type[]): ts.Type[] { + let found = false + return types.filter((tsType) => { + if (tsType.flags !== ts.TypeFlags.BooleanLiteral) { + return true + } + + if (!found) { + found = true + return true + } + + return false + }) + } } diff --git a/www/utils/packages/docs-generator/src/classes/kinds/oas.ts b/www/utils/packages/docs-generator/src/classes/kinds/oas.ts index 2904081311..cf77a6dfad 100644 --- a/www/utils/packages/docs-generator/src/classes/kinds/oas.ts +++ b/www/utils/packages/docs-generator/src/classes/kinds/oas.ts @@ -1356,7 +1356,9 @@ class OasKindGenerator extends FunctionKindGenerator { name: title, }), } - case "intrinsicName" in itemType && itemType.intrinsicName === "boolean": + case ("intrinsicName" in itemType && + itemType.intrinsicName === "boolean") || + itemType.flags === ts.TypeFlags.BooleanLiteral: return { type: "boolean", title: title || typeAsString, diff --git a/www/utils/packages/react-docs-generator/package.json b/www/utils/packages/react-docs-generator/package.json index 0910ddb325..b29e68b988 100644 --- a/www/utils/packages/react-docs-generator/package.json +++ b/www/utils/packages/react-docs-generator/package.json @@ -24,7 +24,7 @@ "ts-node": "^10.9.1", "typedoc": "^0.26.2", "typedoc-plugin-custom": "*", - "typescript": "5.5", + "typescript": "^5.6.2", "utils": "*" }, "devDependencies": { diff --git a/www/utils/packages/scripts/package.json b/www/utils/packages/scripts/package.json index 7360b09403..67297026df 100644 --- a/www/utils/packages/scripts/package.json +++ b/www/utils/packages/scripts/package.json @@ -23,7 +23,7 @@ "glob": "^10.3.10", "randomcolor": "^0.6.2", "ts-node": "^10.9.1", - "typescript": "5.5" + "typescript": "^5.6.2" }, "devDependencies": { "@types/node": "^20.12.10", diff --git a/www/utils/packages/typedoc-generate-references/package.json b/www/utils/packages/typedoc-generate-references/package.json index 8deef406e4..694e0f77a7 100644 --- a/www/utils/packages/typedoc-generate-references/package.json +++ b/www/utils/packages/typedoc-generate-references/package.json @@ -29,7 +29,7 @@ "typedoc-plugin-rename-defaults": "^0.7.0", "typedoc-plugin-workflows": "*", "types": "*", - "typescript": "5.5", + "typescript": "^5.6.2", "utils": "*", "yaml": "^2.3.4" }, diff --git a/www/utils/packages/typedoc-plugin-custom/package.json b/www/utils/packages/typedoc-plugin-custom/package.json index 31e4b485e6..930e927a7f 100644 --- a/www/utils/packages/typedoc-plugin-custom/package.json +++ b/www/utils/packages/typedoc-plugin-custom/package.json @@ -25,7 +25,7 @@ "@types/eslint": "^8.56.6", "@types/node": "^20.12.10", "types": "*", - "typescript": "5.5" + "typescript": "^5.6.2" }, "keywords": [ "typedocplugin", diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/package.json b/www/utils/packages/typedoc-plugin-markdown-medusa/package.json index 04fb2cb9fb..9ab9bff3da 100644 --- a/www/utils/packages/typedoc-plugin-markdown-medusa/package.json +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/package.json @@ -25,7 +25,7 @@ "copyfiles": "^2.4.1", "typedoc": "^0.26.2", "types": "*", - "typescript": "5.5" + "typescript": "^5.6.2" }, "keywords": [ "typedocplugin", diff --git a/www/utils/packages/typedoc-plugin-workflows/package.json b/www/utils/packages/typedoc-plugin-workflows/package.json index d8a96b568b..01a59297b8 100644 --- a/www/utils/packages/typedoc-plugin-workflows/package.json +++ b/www/utils/packages/typedoc-plugin-workflows/package.json @@ -25,7 +25,7 @@ "@types/eslint": "^8.56.6", "@types/node": "^20.12.10", "types": "*", - "typescript": "5.5" + "typescript": "^5.6.2" }, "keywords": [ "typedocplugin", diff --git a/www/utils/packages/types/package.json b/www/utils/packages/types/package.json index 2abbe67c34..29c3cf8f3c 100644 --- a/www/utils/packages/types/package.json +++ b/www/utils/packages/types/package.json @@ -14,7 +14,7 @@ "typedoc": "0.26.x" }, "devDependencies": { - "typescript": "5.5" + "typescript": "^5.6.2" }, "version": "0.0.0", "main": "./lib/index.js", diff --git a/www/utils/packages/utils/package.json b/www/utils/packages/utils/package.json index 0994106a97..15948d94e5 100644 --- a/www/utils/packages/utils/package.json +++ b/www/utils/packages/utils/package.json @@ -19,7 +19,7 @@ }, "devDependencies": { "@types/node": "^20.12.10", - "typescript": "5.5" + "typescript": "^5.6.2" }, "dependencies": { "octokit": "^3.1.2", diff --git a/www/utils/packages/workflows-diagrams-generator/package.json b/www/utils/packages/workflows-diagrams-generator/package.json index 78660ea2d6..c4486f92bd 100644 --- a/www/utils/packages/workflows-diagrams-generator/package.json +++ b/www/utils/packages/workflows-diagrams-generator/package.json @@ -21,7 +21,7 @@ "@mermaid-js/mermaid-cli": "^10.6.1", "commander": "^11.1.0", "ts-node": "^10.9.1", - "typescript": "5.5" + "typescript": "^5.6.2" }, "devDependencies": { "@types/node": "^20.12.10" diff --git a/www/utils/yarn.lock b/www/utils/yarn.lock index fd70ef7850..49e042fe27 100644 --- a/www/utils/yarn.lock +++ b/www/utils/yarn.lock @@ -2387,7 +2387,7 @@ __metadata: prettier: ^3.2.4 ts-node: ^10.9.1 types: "*" - typescript: 5.5 + typescript: ^5.6.2 utils: "*" yaml: ^2.3.4 languageName: unknown @@ -4651,7 +4651,7 @@ __metadata: ts-node: ^10.9.1 typedoc: ^0.26.2 typedoc-plugin-custom: "*" - typescript: 5.5 + typescript: ^5.6.2 utils: "*" peerDependencies: typedoc: 0.25.x @@ -4855,7 +4855,7 @@ __metadata: glob: ^10.3.10 randomcolor: ^0.6.2 ts-node: ^10.9.1 - typescript: 5.5 + typescript: ^5.6.2 languageName: unknown linkType: soft @@ -5369,7 +5369,7 @@ __metadata: typedoc-plugin-rename-defaults: ^0.7.0 typedoc-plugin-workflows: "*" types: "*" - typescript: 5.5 + typescript: ^5.6.2 utils: "*" yaml: ^2.3.4 peerDependencies: @@ -5387,7 +5387,7 @@ __metadata: glob: ^10.3.10 minimatch: ^10.0.1 types: "*" - typescript: 5.5 + typescript: ^5.6.2 utils: "*" yaml: ^2.3.3 peerDependencies: @@ -5404,7 +5404,7 @@ __metadata: handlebars: ^4.7.8 typedoc: ^0.26.2 types: "*" - typescript: 5.5 + typescript: ^5.6.2 utils: "*" peerDependencies: typedoc: 0.26.x @@ -5433,7 +5433,7 @@ __metadata: eslint: ^8.53.0 glob: ^10.3.10 types: "*" - typescript: 5.5 + typescript: ^5.6.2 utils: "*" yaml: ^2.3.3 peerDependencies: @@ -5462,29 +5462,29 @@ __metadata: version: 0.0.0-use.local resolution: "types@workspace:packages/types" dependencies: - typescript: 5.5 + typescript: ^5.6.2 peerDependencies: typedoc: 0.26.x languageName: unknown linkType: soft -"typescript@npm:5.5": - version: 5.5.2 - resolution: "typescript@npm:5.5.2" +"typescript@npm:^5.6.2": + version: 5.6.2 + resolution: "typescript@npm:5.6.2" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 8ca39b27b5f9bd7f32db795045933ab5247897660627251e8254180b792a395bf061ea7231947d5d7ffa5cb4cc771970fd4ef543275f9b559f08c9325cccfce3 + checksum: 3ed8297a8c7c56b7fec282532503d1ac795239d06e7c4966b42d4330c6cf433a170b53bcf93a130a7f14ccc5235de5560df4f1045eb7f3550b46ebed16d3c5e5 languageName: node linkType: hard -"typescript@patch:typescript@5.5#~builtin": - version: 5.5.2 - resolution: "typescript@patch:typescript@npm%3A5.5.2#~builtin::version=5.5.2&hash=7ad353" +"typescript@patch:typescript@^5.6.2#~builtin": + version: 5.6.2 + resolution: "typescript@patch:typescript@npm%3A5.6.2#~builtin::version=5.6.2&hash=7ad353" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 6721ac8933a70c252d7b640b345792e103d881811ff660355617c1836526dbb71c2044e2e77a8823fb3570b469f33276875a4cab6d3c4de4ae7d7ee1c3074ae4 + checksum: e6c1662e4852e22fe4bbdca471dca3e3edc74f6f1df043135c44a18a7902037023ccb0abdfb754595ca9028df8920f2f8492c00fc3cbb4309079aae8b7de71cd languageName: node linkType: hard @@ -5635,7 +5635,7 @@ __metadata: "@types/node": ^20.12.10 octokit: ^3.1.2 rimraf: ^5.0.5 - typescript: 5.5 + typescript: ^5.6.2 peerDependencies: typedoc: 0.26.x languageName: unknown @@ -5722,7 +5722,7 @@ __metadata: "@types/node": ^20.12.10 commander: ^11.1.0 ts-node: ^10.9.1 - typescript: 5.5 + typescript: ^5.6.2 bin: workflow-diagrams-generator: dist/index.js languageName: unknown