joist-codegen 2.3.0-next.9 → 2.3.0-next.91
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/build/EntityDbMetadata.cjs +642 -0
- package/build/EntityDbMetadata.cjs.map +1 -0
- package/build/EntityDbMetadata.d.cts +299 -0
- package/build/EntityDbMetadata.d.cts.map +1 -0
- package/build/EntityDbMetadata.d.mts +299 -0
- package/build/EntityDbMetadata.d.mts.map +1 -0
- package/build/EntityDbMetadata.js +519 -661
- package/build/EntityDbMetadata.js.map +1 -1
- package/build/_virtual/_rolldown/runtime.cjs +23 -0
- package/build/_virtual/_rolldown/runtime.js +5 -0
- package/build/assignTags.cjs +45 -0
- package/build/assignTags.cjs.map +1 -0
- package/build/{assignTags.d.ts → assignTags.d.cts} +8 -4
- package/build/assignTags.d.cts.map +1 -0
- package/build/assignTags.d.mts +16 -0
- package/build/assignTags.d.mts.map +1 -0
- package/build/assignTags.js +37 -59
- package/build/assignTags.js.map +1 -1
- package/build/codemods/Codemod.cjs +2 -0
- package/build/codemods/Codemod.d.cts +17 -0
- package/build/codemods/Codemod.d.cts.map +1 -0
- package/build/codemods/Codemod.d.mts +17 -0
- package/build/codemods/Codemod.d.mts.map +1 -0
- package/build/codemods/Codemod.js +2 -3
- package/build/codemods/JscodeshiftMod.cjs +42 -0
- package/build/codemods/JscodeshiftMod.cjs.map +1 -0
- package/build/codemods/JscodeshiftMod.d.cts +14 -0
- package/build/codemods/JscodeshiftMod.d.cts.map +1 -0
- package/build/codemods/JscodeshiftMod.d.mts +14 -0
- package/build/codemods/JscodeshiftMod.d.mts.map +1 -0
- package/build/codemods/JscodeshiftMod.js +33 -33
- package/build/codemods/JscodeshiftMod.js.map +1 -1
- package/build/codemods/codemod_0001-rename_has_async_property.cjs +30 -0
- package/build/codemods/codemod_0001-rename_has_async_property.cjs.map +1 -0
- package/build/codemods/codemod_0001-rename_has_async_property.d.cts +9 -0
- package/build/codemods/codemod_0001-rename_has_async_property.d.cts.map +1 -0
- package/build/codemods/codemod_0001-rename_has_async_property.d.mts +9 -0
- package/build/codemods/codemod_0001-rename_has_async_property.d.mts.map +1 -0
- package/build/codemods/codemod_0001-rename_has_async_property.js +21 -25
- package/build/codemods/codemod_0001-rename_has_async_property.js.map +1 -1
- package/build/codemods/codemod_0002-rename_async_query_fields.cjs +50 -0
- package/build/codemods/codemod_0002-rename_async_query_fields.cjs.map +1 -0
- package/build/codemods/codemod_0002-rename_async_query_fields.d.cts +9 -0
- package/build/codemods/codemod_0002-rename_async_query_fields.d.cts.map +1 -0
- package/build/codemods/codemod_0002-rename_async_query_fields.d.mts +9 -0
- package/build/codemods/codemod_0002-rename_async_query_fields.d.mts.map +1 -0
- package/build/codemods/codemod_0002-rename_async_query_fields.js +38 -52
- package/build/codemods/codemod_0002-rename_async_query_fields.js.map +1 -1
- package/build/codemods/codemod_0003-rename_find_paginated.cjs +25 -0
- package/build/codemods/codemod_0003-rename_find_paginated.cjs.map +1 -0
- package/build/codemods/codemod_0003-rename_find_paginated.d.cts +9 -0
- package/build/codemods/codemod_0003-rename_find_paginated.d.cts.map +1 -0
- package/build/codemods/codemod_0003-rename_find_paginated.d.mts +9 -0
- package/build/codemods/codemod_0003-rename_find_paginated.d.mts.map +1 -0
- package/build/codemods/codemod_0003-rename_find_paginated.js +17 -26
- package/build/codemods/codemod_0003-rename_find_paginated.js.map +1 -1
- package/build/codemods/index.cjs +49 -0
- package/build/codemods/index.cjs.map +1 -0
- package/build/codemods/index.d.cts +12 -0
- package/build/codemods/index.d.cts.map +1 -0
- package/build/codemods/index.d.mts +12 -0
- package/build/codemods/index.d.mts.map +1 -0
- package/build/codemods/index.js +34 -42
- package/build/codemods/index.js.map +1 -1
- package/build/config.cjs +377 -0
- package/build/config.cjs.map +1 -0
- package/build/config.d.cts +181 -0
- package/build/config.d.cts.map +1 -0
- package/build/config.d.mts +181 -0
- package/build/config.d.mts.map +1 -0
- package/build/config.js +309 -347
- package/build/config.js.map +1 -1
- package/build/docs/cache.cjs +62 -0
- package/build/docs/cache.cjs.map +1 -0
- package/build/docs/cache.d.cts +17 -0
- package/build/docs/cache.d.cts.map +1 -0
- package/build/docs/cache.d.mts +17 -0
- package/build/docs/cache.d.mts.map +1 -0
- package/build/docs/cache.js +52 -53
- package/build/docs/cache.js.map +1 -1
- package/build/docs/generate-metadata-docs.cjs +32 -0
- package/build/docs/generate-metadata-docs.cjs.map +1 -0
- package/build/docs/generate-metadata-docs.d.cts +9 -0
- package/build/docs/generate-metadata-docs.d.cts.map +1 -0
- package/build/docs/generate-metadata-docs.d.mts +9 -0
- package/build/docs/generate-metadata-docs.d.mts.map +1 -0
- package/build/docs/generate-metadata-docs.js +19 -24
- package/build/docs/generate-metadata-docs.js.map +1 -1
- package/build/docs/index.cjs +90 -0
- package/build/docs/index.cjs.map +1 -0
- package/build/docs/index.d.cts +16 -0
- package/build/docs/index.d.cts.map +1 -0
- package/build/docs/index.d.mts +16 -0
- package/build/docs/index.d.mts.map +1 -0
- package/build/docs/index.js +75 -80
- package/build/docs/index.js.map +1 -1
- package/build/docs/markdown.cjs +181 -0
- package/build/docs/markdown.cjs.map +1 -0
- package/build/docs/{markdown.d.ts → markdown.d.cts} +14 -12
- package/build/docs/markdown.d.cts.map +1 -0
- package/build/docs/markdown.d.mts +32 -0
- package/build/docs/markdown.d.mts.map +1 -0
- package/build/docs/markdown.js +152 -220
- package/build/docs/markdown.js.map +1 -1
- package/build/docs/parsing.cjs +117 -0
- package/build/docs/parsing.cjs.map +1 -0
- package/build/docs/parsing.d.cts +48 -0
- package/build/docs/parsing.d.cts.map +1 -0
- package/build/docs/parsing.d.mts +48 -0
- package/build/docs/parsing.d.mts.map +1 -0
- package/build/docs/parsing.js +89 -88
- package/build/docs/parsing.js.map +1 -1
- package/build/findEntityScopes.cjs +119 -0
- package/build/findEntityScopes.cjs.map +1 -0
- package/build/findEntityScopes.d.cts +14 -0
- package/build/findEntityScopes.d.cts.map +1 -0
- package/build/findEntityScopes.d.mts +14 -0
- package/build/findEntityScopes.d.mts.map +1 -0
- package/build/findEntityScopes.js +83 -111
- package/build/findEntityScopes.js.map +1 -1
- package/build/foreignKeyOrdering.cjs +52 -0
- package/build/foreignKeyOrdering.cjs.map +1 -0
- package/build/foreignKeyOrdering.d.cts +8 -0
- package/build/foreignKeyOrdering.d.cts.map +1 -0
- package/build/foreignKeyOrdering.d.mts +8 -0
- package/build/foreignKeyOrdering.d.mts.map +1 -0
- package/build/foreignKeyOrdering.js +46 -55
- package/build/foreignKeyOrdering.js.map +1 -1
- package/build/generate.cjs +128 -0
- package/build/generate.cjs.map +1 -0
- package/build/generate.d.cts +17 -0
- package/build/generate.d.cts.map +1 -0
- package/build/generate.d.mts +17 -0
- package/build/generate.d.mts.map +1 -0
- package/build/generate.js +111 -124
- package/build/generate.js.map +1 -1
- package/build/generateEntitiesFile.cjs +46 -0
- package/build/generateEntitiesFile.cjs.map +1 -0
- package/build/generateEntitiesFile.d.cts +11 -0
- package/build/generateEntitiesFile.d.cts.map +1 -0
- package/build/generateEntitiesFile.d.mts +11 -0
- package/build/generateEntitiesFile.d.mts.map +1 -0
- package/build/generateEntitiesFile.js +28 -25
- package/build/generateEntitiesFile.js.map +1 -1
- package/build/generateEntityCodegenFile.cjs +1010 -0
- package/build/generateEntityCodegenFile.cjs.map +1 -0
- package/build/generateEntityCodegenFile.d.cts +16 -0
- package/build/generateEntityCodegenFile.d.cts.map +1 -0
- package/build/generateEntityCodegenFile.d.mts +16 -0
- package/build/generateEntityCodegenFile.d.mts.map +1 -0
- package/build/generateEntityCodegenFile.js +793 -827
- package/build/generateEntityCodegenFile.js.map +1 -1
- package/build/generateEntityFile.cjs +23 -0
- package/build/generateEntityFile.cjs.map +1 -0
- package/build/generateEntityFile.d.cts +9 -0
- package/build/generateEntityFile.d.cts.map +1 -0
- package/build/generateEntityFile.d.mts +9 -0
- package/build/generateEntityFile.d.mts.map +1 -0
- package/build/generateEntityFile.js +11 -8
- package/build/generateEntityFile.js.map +1 -1
- package/build/generateEntityTestFile.cjs +25 -0
- package/build/generateEntityTestFile.cjs.map +1 -0
- package/build/generateEntityTestFile.d.cts +9 -0
- package/build/generateEntityTestFile.d.cts.map +1 -0
- package/build/generateEntityTestFile.d.mts +9 -0
- package/build/generateEntityTestFile.d.mts.map +1 -0
- package/build/generateEntityTestFile.js +10 -7
- package/build/generateEntityTestFile.js.map +1 -1
- package/build/generateEnumFile.cjs +73 -0
- package/build/generateEnumFile.cjs.map +1 -0
- package/build/generateEnumFile.d.cts +9 -0
- package/build/generateEnumFile.d.cts.map +1 -0
- package/build/generateEnumFile.d.mts +9 -0
- package/build/generateEnumFile.d.mts.map +1 -0
- package/build/generateEnumFile.js +33 -43
- package/build/generateEnumFile.js.map +1 -1
- package/build/generateFactoriesFiles.cjs +28 -0
- package/build/generateFactoriesFiles.cjs.map +1 -0
- package/build/generateFactoriesFiles.d.cts +7 -0
- package/build/generateFactoriesFiles.d.cts.map +1 -0
- package/build/generateFactoriesFiles.d.mts +7 -0
- package/build/generateFactoriesFiles.d.mts.map +1 -0
- package/build/generateFactoriesFiles.js +21 -16
- package/build/generateFactoriesFiles.js.map +1 -1
- package/build/generateFlushFunction.cjs +61 -0
- package/build/generateFlushFunction.cjs.map +1 -0
- package/build/{generateFlushFunction.d.ts → generateFlushFunction.d.cts} +8 -5
- package/build/generateFlushFunction.d.cts.map +1 -0
- package/build/generateFlushFunction.d.mts +23 -0
- package/build/generateFlushFunction.d.mts.map +1 -0
- package/build/generateFlushFunction.js +32 -78
- package/build/generateFlushFunction.js.map +1 -1
- package/build/generateMetadataFile.cjs +307 -0
- package/build/generateMetadataFile.cjs.map +1 -0
- package/build/generateMetadataFile.d.cts +10 -0
- package/build/generateMetadataFile.d.cts.map +1 -0
- package/build/generateMetadataFile.d.mts +10 -0
- package/build/generateMetadataFile.d.mts.map +1 -0
- package/build/generateMetadataFile.js +148 -156
- package/build/generateMetadataFile.js.map +1 -1
- package/build/generatePgEnumFile.cjs +21 -0
- package/build/generatePgEnumFile.cjs.map +1 -0
- package/build/generatePgEnumFile.d.cts +9 -0
- package/build/generatePgEnumFile.d.cts.map +1 -0
- package/build/generatePgEnumFile.d.mts +9 -0
- package/build/generatePgEnumFile.d.mts.map +1 -0
- package/build/generatePgEnumFile.js +12 -9
- package/build/generatePgEnumFile.js.map +1 -1
- package/build/index.cjs +135 -0
- package/build/index.cjs.map +1 -0
- package/build/index.d.cts +12 -0
- package/build/index.d.cts.map +1 -0
- package/build/index.d.mts +12 -0
- package/build/index.d.mts.map +1 -0
- package/build/index.js +108 -127
- package/build/index.js.map +1 -1
- package/build/inheritance.cjs +257 -0
- package/build/inheritance.cjs.map +1 -0
- package/build/inheritance.d.cts +13 -0
- package/build/inheritance.d.cts.map +1 -0
- package/build/inheritance.d.mts +13 -0
- package/build/inheritance.d.mts.map +1 -0
- package/build/inheritance.js +237 -247
- package/build/inheritance.js.map +1 -1
- package/build/installSkills.cjs +68 -0
- package/build/installSkills.cjs.map +1 -0
- package/build/installSkills.d.cts +16 -0
- package/build/installSkills.d.cts.map +1 -0
- package/build/installSkills.d.mts +16 -0
- package/build/installSkills.d.mts.map +1 -0
- package/build/installSkills.js +67 -0
- package/build/installSkills.js.map +1 -0
- package/build/keywords.cjs +7 -0
- package/build/keywords.cjs.map +1 -0
- package/build/keywords.d.cts +5 -0
- package/build/keywords.d.cts.map +1 -0
- package/build/keywords.d.mts +5 -0
- package/build/keywords.d.mts.map +1 -0
- package/build/keywords.js +5 -4
- package/build/keywords.js.map +1 -1
- package/build/loadMetadata.cjs +39 -0
- package/build/loadMetadata.cjs.map +1 -0
- package/build/loadMetadata.d.cts +31 -0
- package/build/loadMetadata.d.cts.map +1 -0
- package/build/loadMetadata.d.mts +31 -0
- package/build/loadMetadata.d.mts.map +1 -0
- package/build/loadMetadata.js +32 -39
- package/build/loadMetadata.js.map +1 -1
- package/build/logger.cjs +28 -0
- package/build/logger.cjs.map +1 -0
- package/build/logger.d.cts +13 -0
- package/build/logger.d.cts.map +1 -0
- package/build/logger.d.mts +13 -0
- package/build/logger.d.mts.map +1 -0
- package/build/logger.js +17 -16
- package/build/logger.js.map +1 -1
- package/build/scanEntityFiles.cjs +46 -0
- package/build/scanEntityFiles.cjs.map +1 -0
- package/build/scanEntityFiles.d.cts +8 -0
- package/build/scanEntityFiles.d.cts.map +1 -0
- package/build/scanEntityFiles.d.mts +8 -0
- package/build/scanEntityFiles.d.mts.map +1 -0
- package/build/scanEntityFiles.js +37 -42
- package/build/scanEntityFiles.js.map +1 -1
- package/build/sortForeignKeys.cjs +99 -0
- package/build/sortForeignKeys.cjs.map +1 -0
- package/build/{sortForeignKeys.d.ts → sortForeignKeys.d.cts} +8 -5
- package/build/sortForeignKeys.d.cts.map +1 -0
- package/build/sortForeignKeys.d.mts +35 -0
- package/build/sortForeignKeys.d.mts.map +1 -0
- package/build/sortForeignKeys.js +88 -117
- package/build/sortForeignKeys.js.map +1 -1
- package/build/symbols.cjs +238 -0
- package/build/symbols.cjs.map +1 -0
- package/build/symbols.d.cts +120 -0
- package/build/symbols.d.cts.map +1 -0
- package/build/symbols.d.mts +120 -0
- package/build/symbols.d.mts.map +1 -0
- package/build/symbols.js +121 -113
- package/build/symbols.js.map +1 -1
- package/build/tsdoc.cjs +22 -0
- package/build/tsdoc.cjs.map +1 -0
- package/build/tsdoc.d.cts +15 -0
- package/build/tsdoc.d.cts.map +1 -0
- package/build/tsdoc.d.mts +15 -0
- package/build/tsdoc.d.mts.map +1 -0
- package/build/tsdoc.js +18 -15
- package/build/tsdoc.js.map +1 -1
- package/build/utils.cjs +173 -0
- package/build/utils.cjs.map +1 -0
- package/build/utils.d.cts +34 -0
- package/build/utils.d.cts.map +1 -0
- package/build/utils.d.mts +34 -0
- package/build/utils.d.mts.map +1 -0
- package/build/utils.js +112 -166
- package/build/utils.js.map +1 -1
- package/build/write-json-schema.cjs +23 -0
- package/build/write-json-schema.cjs.map +1 -0
- package/build/write-json-schema.d.cts +1 -0
- package/build/write-json-schema.d.mts +1 -0
- package/build/write-json-schema.js +19 -13
- package/build/write-json-schema.js.map +1 -1
- package/package.json +37 -17
- package/skills/joist-docs/SKILL.md +142 -0
- package/skills/joist-em-basics/SKILL.md +114 -0
- package/skills/joist-partial-updates/SKILL.md +352 -0
- package/skills/joist-reactive-hints/SKILL.md +150 -0
- package/skills/joist-test-factories/SKILL.md +397 -0
- package/skills/joist-upsert/SKILL.md +95 -0
- package/build/EntityDbMetadata.d.ts +0 -269
- package/build/EntityDbMetadata.d.ts.map +0 -1
- package/build/EntityDbMetadata.test.d.ts +0 -2
- package/build/EntityDbMetadata.test.d.ts.map +0 -1
- package/build/EntityDbMetadata.test.js +0 -211
- package/build/EntityDbMetadata.test.js.map +0 -1
- package/build/assignTags.d.ts.map +0 -1
- package/build/codemods/Codemod.d.ts +0 -14
- package/build/codemods/Codemod.d.ts.map +0 -1
- package/build/codemods/Codemod.js.map +0 -1
- package/build/codemods/JscodeshiftMod.d.ts +0 -11
- package/build/codemods/JscodeshiftMod.d.ts.map +0 -1
- package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.d.ts +0 -2
- package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.d.ts.map +0 -1
- package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.js +0 -9
- package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.js.map +0 -1
- package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.d.ts +0 -2
- package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.d.ts.map +0 -1
- package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.js +0 -9
- package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.js.map +0 -1
- package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.d.ts +0 -2
- package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.d.ts.map +0 -1
- package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.js +0 -9
- package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.js.map +0 -1
- package/build/codemods/codemod_0001-rename_has_async_property.d.ts +0 -7
- package/build/codemods/codemod_0001-rename_has_async_property.d.ts.map +0 -1
- package/build/codemods/codemod_0002-rename_async_query_fields.d.ts +0 -7
- package/build/codemods/codemod_0002-rename_async_query_fields.d.ts.map +0 -1
- package/build/codemods/codemod_0003-rename_find_paginated.d.ts +0 -7
- package/build/codemods/codemod_0003-rename_find_paginated.d.ts.map +0 -1
- package/build/codemods/index.d.ts +0 -9
- package/build/codemods/index.d.ts.map +0 -1
- package/build/codemods/index.test.d.ts +0 -2
- package/build/codemods/index.test.d.ts.map +0 -1
- package/build/codemods/index.test.js +0 -24
- package/build/codemods/index.test.js.map +0 -1
- package/build/config.d.ts +0 -167
- package/build/config.d.ts.map +0 -1
- package/build/config.test.d.ts +0 -2
- package/build/config.test.d.ts.map +0 -1
- package/build/config.test.js +0 -78
- package/build/config.test.js.map +0 -1
- package/build/docs/cache.d.ts +0 -14
- package/build/docs/cache.d.ts.map +0 -1
- package/build/docs/cache.test.d.ts +0 -2
- package/build/docs/cache.test.d.ts.map +0 -1
- package/build/docs/cache.test.js +0 -47
- package/build/docs/cache.test.js.map +0 -1
- package/build/docs/generate-metadata-docs.d.ts +0 -6
- package/build/docs/generate-metadata-docs.d.ts.map +0 -1
- package/build/docs/index.d.ts +0 -9
- package/build/docs/index.d.ts.map +0 -1
- package/build/docs/index.test.d.ts +0 -2
- package/build/docs/index.test.d.ts.map +0 -1
- package/build/docs/index.test.js +0 -100
- package/build/docs/index.test.js.map +0 -1
- package/build/docs/markdown.d.ts.map +0 -1
- package/build/docs/markdown.test.d.ts +0 -2
- package/build/docs/markdown.test.d.ts.map +0 -1
- package/build/docs/markdown.test.js +0 -280
- package/build/docs/markdown.test.js.map +0 -1
- package/build/docs/parsing.d.ts +0 -42
- package/build/docs/parsing.d.ts.map +0 -1
- package/build/docs/parsing.test.d.ts +0 -2
- package/build/docs/parsing.test.d.ts.map +0 -1
- package/build/docs/parsing.test.js +0 -190
- package/build/docs/parsing.test.js.map +0 -1
- package/build/findEntityScopes.d.ts +0 -11
- package/build/findEntityScopes.d.ts.map +0 -1
- package/build/foreignKeyOrdering.d.ts +0 -3
- package/build/foreignKeyOrdering.d.ts.map +0 -1
- package/build/generate.d.ts +0 -12
- package/build/generate.d.ts.map +0 -1
- package/build/generateEntitiesFile.d.ts +0 -7
- package/build/generateEntitiesFile.d.ts.map +0 -1
- package/build/generateEntityCodegenFile.d.ts +0 -11
- package/build/generateEntityCodegenFile.d.ts.map +0 -1
- package/build/generateEntityFile.d.ts +0 -6
- package/build/generateEntityFile.d.ts.map +0 -1
- package/build/generateEntityTestFile.d.ts +0 -6
- package/build/generateEntityTestFile.d.ts.map +0 -1
- package/build/generateEnumFile.d.ts +0 -5
- package/build/generateEnumFile.d.ts.map +0 -1
- package/build/generateFactoriesFiles.d.ts +0 -4
- package/build/generateFactoriesFiles.d.ts.map +0 -1
- package/build/generateFlushFunction.d.ts.map +0 -1
- package/build/generateMetadataFile.d.ts +0 -5
- package/build/generateMetadataFile.d.ts.map +0 -1
- package/build/generatePgEnumFile.d.ts +0 -5
- package/build/generatePgEnumFile.d.ts.map +0 -1
- package/build/index.d.ts +0 -11
- package/build/index.d.ts.map +0 -1
- package/build/inheritance.d.ts +0 -10
- package/build/inheritance.d.ts.map +0 -1
- package/build/keywords.d.ts +0 -2
- package/build/keywords.d.ts.map +0 -1
- package/build/loadMetadata.d.ts +0 -26
- package/build/loadMetadata.d.ts.map +0 -1
- package/build/logger.d.ts +0 -10
- package/build/logger.d.ts.map +0 -1
- package/build/scanEntityFiles.d.ts +0 -5
- package/build/scanEntityFiles.d.ts.map +0 -1
- package/build/sortForeignKeys.d.ts.map +0 -1
- package/build/symbols.d.ts +0 -108
- package/build/symbols.d.ts.map +0 -1
- package/build/tsdoc.d.ts +0 -12
- package/build/tsdoc.d.ts.map +0 -1
- package/build/utils.d.ts +0 -31
- package/build/utils.d.ts.map +0 -1
- package/build/write-json-schema.d.ts +0 -2
- package/build/write-json-schema.d.ts.map +0 -1
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils = require("./utils.cjs");
|
|
3
|
+
require("./config.cjs");
|
|
4
|
+
const require_EntityDbMetadata = require("./EntityDbMetadata.cjs");
|
|
5
|
+
//#region src/inheritance.ts
|
|
6
|
+
/** Preserves physical storage metadata, then applies domain inheritance specialization. */
|
|
7
|
+
function applyInheritanceUpdates(config, db) {
|
|
8
|
+
const { entities, entitiesByName } = db;
|
|
9
|
+
for (const meta of entities) {
|
|
10
|
+
meta.physicalMetadata = {
|
|
11
|
+
...meta,
|
|
12
|
+
name: meta.name,
|
|
13
|
+
primitives: meta.primitives.map((field) => ({ ...field })),
|
|
14
|
+
enums: meta.enums.map((field) => ({ ...field })),
|
|
15
|
+
pgEnums: meta.pgEnums.map((field) => ({ ...field })),
|
|
16
|
+
manyToOnes: meta.manyToOnes.map((field) => ({ ...field })),
|
|
17
|
+
oneToManys: meta.oneToManys.map((field) => ({ ...field })),
|
|
18
|
+
largeOneToManys: meta.largeOneToManys.map((field) => ({ ...field })),
|
|
19
|
+
oneToOnes: meta.oneToOnes.map((field) => ({ ...field })),
|
|
20
|
+
manyToManys: meta.manyToManys.map((field) => ({ ...field })),
|
|
21
|
+
largeManyToManys: meta.largeManyToManys.map((field) => ({ ...field })),
|
|
22
|
+
polymorphics: meta.polymorphics.map((field) => ({
|
|
23
|
+
...field,
|
|
24
|
+
components: field.components.map((component) => ({ ...component }))
|
|
25
|
+
})),
|
|
26
|
+
nonDeferredFks: meta.nonDeferredFks,
|
|
27
|
+
nonDeferredManyToManyFks: meta.nonDeferredManyToManyFks
|
|
28
|
+
};
|
|
29
|
+
for (const timestamp of [
|
|
30
|
+
"createdAt",
|
|
31
|
+
"updatedAt",
|
|
32
|
+
"deletedAt"
|
|
33
|
+
]) meta.physicalMetadata[timestamp] = meta.physicalMetadata.primitives.find((field) => field.fieldName === meta[timestamp]?.fieldName);
|
|
34
|
+
}
|
|
35
|
+
setClassTableInheritance(entities, entitiesByName);
|
|
36
|
+
expandSingleTableInheritance(config, entitiesByName, entities);
|
|
37
|
+
rewriteSingleTableForeignKeys(config, entities);
|
|
38
|
+
setupSubTypeSpecialization(config, entities);
|
|
39
|
+
require_EntityDbMetadata.canonicalizeOtherEntities(db);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Looks for subtypes specializing a FK of their base type, and give them a specialized m2o.
|
|
43
|
+
*
|
|
44
|
+
* I.e. `SmallPublishers.group: SmallPublisherGroup`.
|
|
45
|
+
*
|
|
46
|
+
* This means the `publishers.group_id` FK will actually be in the `EntityDbMetadata` twice,
|
|
47
|
+
* once for the base and once for the child, which is unusual, but gets the types generated
|
|
48
|
+
* that we want, and then we fixup/dedupe them at runtime in `configure.ts` when creating
|
|
49
|
+
* `meta.allFields`.
|
|
50
|
+
*/
|
|
51
|
+
function setupSubTypeSpecialization(config, entities) {
|
|
52
|
+
for (const entity of entities) if (entity.baseType) {
|
|
53
|
+
const entityConfig = config.entities[entity.name];
|
|
54
|
+
const baseConfig = config.entities[entity.baseType.name];
|
|
55
|
+
for (const rel of [...entity.baseType.manyToOnes, ...entity.baseType.oneToManys]) {
|
|
56
|
+
const { notNull } = entityConfig?.relations?.[rel.fieldName] ?? {};
|
|
57
|
+
const subType = entityConfig?.relations?.[rel.fieldName]?.subType ?? baseConfig?.relations?.[rel.fieldName]?.subType ?? baseConfig?.relations?.[rel.otherFieldName]?.subType ?? (notNull ? rel.otherEntity.name : void 0);
|
|
58
|
+
if (!subType) {} else if (subType === "self" && rel.kind === "m2o") entity.manyToOnes.push({
|
|
59
|
+
...rel,
|
|
60
|
+
...notNull ? { notNull } : {},
|
|
61
|
+
otherEntity: require_EntityDbMetadata.makeEntity(entity.name)
|
|
62
|
+
});
|
|
63
|
+
else if (subType === "self" && rel.kind === "o2m") entity.oneToManys.push({
|
|
64
|
+
...rel,
|
|
65
|
+
...notNull ? { notNull } : {},
|
|
66
|
+
otherEntity: require_EntityDbMetadata.makeEntity(entity.name)
|
|
67
|
+
});
|
|
68
|
+
else if (rel.kind === "m2o") entity.manyToOnes.push({
|
|
69
|
+
...rel,
|
|
70
|
+
...notNull ? { notNull } : {},
|
|
71
|
+
otherEntity: require_EntityDbMetadata.makeEntity(subType)
|
|
72
|
+
});
|
|
73
|
+
else if (rel.kind === "o2m") entity.oneToManys.push({
|
|
74
|
+
...rel,
|
|
75
|
+
...notNull ? { notNull } : {},
|
|
76
|
+
otherEntity: require_EntityDbMetadata.makeEntity(subType)
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
for (const field of entity.baseType?.primitives ?? []) {
|
|
80
|
+
const { notNull } = entityConfig?.fields?.[field.fieldName] ?? {};
|
|
81
|
+
if (notNull) entity.primitives.push({
|
|
82
|
+
...field,
|
|
83
|
+
notNull
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Ensure CTI base types have their inheritanceType set.
|
|
90
|
+
*
|
|
91
|
+
* (We automatically set `inheritanceType` for STI tables when we see their config
|
|
92
|
+
* setup, see `expandSingleTableInheritance`.)
|
|
93
|
+
*/
|
|
94
|
+
function setClassTableInheritance(entities, entitiesByName) {
|
|
95
|
+
const ctiBaseNames = [];
|
|
96
|
+
for (const entity of entities) if (entity.baseClassName) {
|
|
97
|
+
ctiBaseNames.push(entity.baseClassName);
|
|
98
|
+
const base = entitiesByName[entity.baseClassName];
|
|
99
|
+
entity.baseType = base;
|
|
100
|
+
base.subTypes.push(entity);
|
|
101
|
+
}
|
|
102
|
+
for (const entity of entities) if (ctiBaseNames.includes(entity.name)) entity.inheritanceType = "cti";
|
|
103
|
+
}
|
|
104
|
+
/** Expands STI tables into multiple entities, so they get separate `SubTypeCodegen.ts` & `SubType.ts` files. */
|
|
105
|
+
function expandSingleTableInheritance(config, entitiesByName, entities) {
|
|
106
|
+
for (const entity of entities) {
|
|
107
|
+
const [fieldName, stiField] = Object.entries(config.entities[entity.name]?.fields || {}).find(([, f]) => !!f.stiDiscriminator) ?? [];
|
|
108
|
+
if (fieldName && stiField && stiField.stiDiscriminator) {
|
|
109
|
+
entity.inheritanceType = "sti";
|
|
110
|
+
const enumField = entity.enums.find((e) => e.fieldName === fieldName) ?? require_utils.fail(`No enum column found for ${entity.name}.${fieldName}, which is required to use singleTableInheritance`);
|
|
111
|
+
entity.stiDiscriminatorField = enumField.fieldName;
|
|
112
|
+
const subTypes = Object.entries(stiField.stiDiscriminator);
|
|
113
|
+
const allFields = [...Object.entries(config.entities[entity.name]?.fields ?? {}), ...Object.entries(config.entities[entity.name]?.relations ?? {})];
|
|
114
|
+
const availableCodes = subTypes.map(([code]) => code);
|
|
115
|
+
const availableNames = subTypes.map(([, name]) => name);
|
|
116
|
+
const available = [...availableCodes, ...availableNames];
|
|
117
|
+
for (const [name, f] of allFields) for (const stiType of stiTypesOf(f)) if (!available.includes(stiType)) require_utils.fail(`${name}.stiType '${stiType}' is invalid, expected one of ${available.join(", ")}`);
|
|
118
|
+
const requiredFieldNames = new Set([
|
|
119
|
+
...entity.primitives,
|
|
120
|
+
...entity.enums,
|
|
121
|
+
...entity.pgEnums,
|
|
122
|
+
...entity.manyToOnes
|
|
123
|
+
].filter((f) => f.notNull && f.columnDefault === null && !("columnGenerated" in f && f.columnGenerated)).map((f) => f.fieldName));
|
|
124
|
+
for (const [name, f] of allFields) {
|
|
125
|
+
const stiTypes = stiTypesOf(f);
|
|
126
|
+
const claimsEverySubtype = subTypes.every(([code, name]) => stiTypes.some((t) => t === code || t === name));
|
|
127
|
+
if (stiTypes.length > 0 && !claimsEverySubtype && requiredFieldNames.has(name)) require_utils.fail(`${entity.name}.${name} is notNull with no database default, so it cannot be pushed down to ${stiTypes.map((t) => `'${t}'`).join(", ")} -- the other subtypes would have no value to insert. Either give the column a default, make it nullable (stiType will still make it required on those subtypes), or leave the field on ${entity.name}.`);
|
|
128
|
+
}
|
|
129
|
+
const claimedFieldNames = new Set(allFields.filter(([, f]) => stiTypesOf(f).length > 0).map(([name]) => name));
|
|
130
|
+
for (const [enumCode, subTypeName] of subTypes) {
|
|
131
|
+
const subTypeFields = allFields.filter(([, f]) => stiTypesOf(f).some((t) => t === subTypeName || t === enumCode));
|
|
132
|
+
const subTypeFieldNames = subTypeFields.map(([name]) => name);
|
|
133
|
+
function maybeRequired(field) {
|
|
134
|
+
if ((subTypeFields.find(([name]) => name === field.fieldName)?.[1]).notNull) field.notNull = true;
|
|
135
|
+
return field;
|
|
136
|
+
}
|
|
137
|
+
const subEntity = {
|
|
138
|
+
name: subTypeName,
|
|
139
|
+
entity: require_EntityDbMetadata.makeEntity(subTypeName),
|
|
140
|
+
tableName: entity.tableName,
|
|
141
|
+
physicalMetadata: entity.physicalMetadata,
|
|
142
|
+
primaryKey: entity.primaryKey,
|
|
143
|
+
primitives: entity.primitives.filter((f) => subTypeFieldNames.includes(f.fieldName)).map(maybeRequired),
|
|
144
|
+
enums: entity.enums.filter((f) => subTypeFieldNames.includes(f.fieldName)).map(maybeRequired),
|
|
145
|
+
pgEnums: entity.pgEnums.filter((f) => subTypeFieldNames.includes(f.fieldName)).map(maybeRequired),
|
|
146
|
+
manyToOnes: entity.manyToOnes.filter((f) => subTypeFieldNames.includes(f.fieldName)).map(maybeRequired),
|
|
147
|
+
oneToManys: entity.oneToManys.filter((f) => subTypeFieldNames.includes(f.fieldName)),
|
|
148
|
+
largeOneToManys: entity.largeOneToManys.filter((f) => subTypeFieldNames.includes(f.fieldName)),
|
|
149
|
+
oneToOnes: entity.oneToOnes.filter((f) => subTypeFieldNames.includes(f.fieldName)),
|
|
150
|
+
manyToManys: entity.manyToManys.filter((f) => subTypeFieldNames.includes(f.fieldName)),
|
|
151
|
+
largeManyToManys: entity.largeManyToManys.filter((f) => subTypeFieldNames.includes(f.fieldName)),
|
|
152
|
+
manyToManyEnums: entity.manyToManyEnums.filter((f) => subTypeFieldNames.includes(f.fieldName)),
|
|
153
|
+
polymorphics: entity.polymorphics.filter((f) => subTypeFieldNames.includes(f.fieldName)),
|
|
154
|
+
tagName: entity.tagName,
|
|
155
|
+
createdAt: void 0,
|
|
156
|
+
updatedAt: void 0,
|
|
157
|
+
deletedAt: void 0,
|
|
158
|
+
baseClassName: entity.name,
|
|
159
|
+
baseType: entity,
|
|
160
|
+
subTypes: [],
|
|
161
|
+
inheritanceType: "sti",
|
|
162
|
+
stiDiscriminatorValue: (enumField.enumRows.find((r) => r.code === enumCode) ?? require_utils.fail(`No enum row found for ${entity.name}.${fieldName}.${enumCode}`)).id,
|
|
163
|
+
abstract: false,
|
|
164
|
+
nonDeferredFkOrder: entity.nonDeferredFkOrder,
|
|
165
|
+
get nonDeferredFks() {
|
|
166
|
+
return [...this.manyToOnes.filter((r) => !r.isDeferredAndDeferrable), ...this.polymorphics.flatMap((p) => p.components).filter((c) => !c.isDeferredAndDeferrable)];
|
|
167
|
+
},
|
|
168
|
+
get nonDeferredManyToManyFks() {
|
|
169
|
+
return this.manyToManys.filter((r) => !r.isDeferredAndDeferrable);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
entity.subTypes.push(subEntity);
|
|
173
|
+
entities.push(subEntity);
|
|
174
|
+
entitiesByName[subEntity.name] = subEntity;
|
|
175
|
+
}
|
|
176
|
+
const keep = (f) => !claimedFieldNames.has(f.fieldName);
|
|
177
|
+
entity.primitives = entity.primitives.filter(keep);
|
|
178
|
+
entity.enums = entity.enums.filter(keep);
|
|
179
|
+
entity.pgEnums = entity.pgEnums.filter(keep);
|
|
180
|
+
entity.manyToOnes = entity.manyToOnes.filter(keep);
|
|
181
|
+
entity.oneToManys = entity.oneToManys.filter(keep);
|
|
182
|
+
entity.largeOneToManys = entity.largeOneToManys.filter(keep);
|
|
183
|
+
entity.oneToOnes = entity.oneToOnes.filter(keep);
|
|
184
|
+
entity.manyToManys = entity.manyToManys.filter(keep);
|
|
185
|
+
entity.largeManyToManys = entity.largeManyToManys.filter(keep);
|
|
186
|
+
entity.manyToManyEnums = entity.manyToManyEnums.filter(keep);
|
|
187
|
+
entity.polymorphics = entity.polymorphics.filter(keep);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
let stiEntities;
|
|
192
|
+
function getStiEntities(entities) {
|
|
193
|
+
if (stiEntities) return stiEntities;
|
|
194
|
+
stiEntities = /* @__PURE__ */ new Map();
|
|
195
|
+
for (const entity of entities) if (entity.inheritanceType === "sti" && entity.stiDiscriminatorField) {
|
|
196
|
+
const base = entity;
|
|
197
|
+
const subTypes = entities.filter((s) => s.baseClassName === entity.name && s !== entity);
|
|
198
|
+
stiEntities.set(entity.name, {
|
|
199
|
+
base,
|
|
200
|
+
subTypes
|
|
201
|
+
});
|
|
202
|
+
for (const subType of subTypes) stiEntities.set(subType.name, {
|
|
203
|
+
base,
|
|
204
|
+
subTypes: []
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return stiEntities;
|
|
208
|
+
}
|
|
209
|
+
/** Finds FKs pointing to the base table and, if configured, rewrites them to point to the sub-tables. */
|
|
210
|
+
function rewriteSingleTableForeignKeys(config, entities) {
|
|
211
|
+
const stiEntities = getStiEntities(entities);
|
|
212
|
+
if (stiEntities.size === 0) return;
|
|
213
|
+
for (const entity of entities) {
|
|
214
|
+
for (const m2o of entity.manyToOnes) {
|
|
215
|
+
const target = stiEntities.get(m2o.otherEntity.name);
|
|
216
|
+
const base = target?.base.entity.name;
|
|
217
|
+
const [stiType, ...others] = stiTypesOf(base ? config.entities[base]?.relations?.[m2o.otherFieldName] : void 0);
|
|
218
|
+
if (target && stiType && others.length === 0) {
|
|
219
|
+
const { subTypes } = target;
|
|
220
|
+
m2o.otherEntity = (subTypes.find((s) => s.name === stiType) ?? require_utils.fail(`Could not find STI type '${stiType}' in ${subTypes.map((s) => s.name)}`)).entity;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
for (const poly of entity.polymorphics) for (const comp of poly.components) {
|
|
224
|
+
const target = stiEntities.get(comp.otherEntity.name);
|
|
225
|
+
const base = target?.base.entity.name;
|
|
226
|
+
const [stiType, ...others] = stiTypesOf(base ? config.entities[base]?.relations?.[comp.otherFieldName] : void 0);
|
|
227
|
+
if (target && stiType && others.length === 0) {
|
|
228
|
+
const { subTypes } = target;
|
|
229
|
+
comp.otherEntity = (subTypes.find((s) => s.name === stiType) ?? require_utils.fail(`Could not find STI type '${stiType}' in ${subTypes.map((s) => s.name)}`)).entity;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
for (const o2m of entity.oneToManys) {
|
|
233
|
+
const target = stiEntities.get(o2m.otherEntity.name);
|
|
234
|
+
if (target && target.base.inheritanceType === "sti") {
|
|
235
|
+
const otherField = target.subTypes.find((st) => !target.base.manyToOnes.some((m) => m.fieldName === o2m.otherFieldName) && st.manyToOnes.some((m) => m.fieldName === o2m.otherFieldName));
|
|
236
|
+
if (otherField) o2m.otherEntity = otherField.entity;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
for (const m2m of entity.manyToManys) {
|
|
240
|
+
const target = stiEntities.get(m2m.otherEntity.name);
|
|
241
|
+
if (target && target.base.inheritanceType === "sti") {
|
|
242
|
+
const otherField = target.subTypes.find((st) => !target.base.manyToManys.some((m) => m.fieldName === m2m.otherFieldName) && st.manyToManys.some((m) => m.fieldName === m2m.otherFieldName));
|
|
243
|
+
if (otherField) m2m.otherEntity = otherField.entity;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/** Normalizes a field/relation's `stiType`, which may name one subtype or several, to an array. */
|
|
249
|
+
function stiTypesOf(config) {
|
|
250
|
+
const stiType = config?.stiType;
|
|
251
|
+
return stiType === void 0 ? [] : typeof stiType === "string" ? [stiType] : stiType;
|
|
252
|
+
}
|
|
253
|
+
//#endregion
|
|
254
|
+
exports.applyInheritanceUpdates = applyInheritanceUpdates;
|
|
255
|
+
exports.getStiEntities = getStiEntities;
|
|
256
|
+
|
|
257
|
+
//# sourceMappingURL=inheritance.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritance.cjs","names":["makeEntity","fail"],"sources":["../src/inheritance.ts"],"sourcesContent":["import { type Config } from \"./config.ts\";\nimport {\n type DbMetadata,\n type EntityDbMetadata,\n type ManyToManyField,\n type ManyToOneField,\n type PolymorphicFieldComponent,\n canonicalizeOtherEntities,\n makeEntity,\n} from \"./EntityDbMetadata.ts\";\nimport { fail } from \"./utils.ts\";\n\n/** Preserves physical storage metadata, then applies domain inheritance specialization. */\nexport function applyInheritanceUpdates(config: Config, db: DbMetadata): void {\n const { entities, entitiesByName } = db;\n // Preserve storage domains before STI moves fields or rewrites relationship targets.\n for (const meta of entities) {\n meta.physicalMetadata = {\n ...meta,\n name: meta.name,\n primitives: meta.primitives.map((field) => ({ ...field })),\n enums: meta.enums.map((field) => ({ ...field })),\n pgEnums: meta.pgEnums.map((field) => ({ ...field })),\n manyToOnes: meta.manyToOnes.map((field) => ({ ...field })),\n oneToManys: meta.oneToManys.map((field) => ({ ...field })),\n largeOneToManys: meta.largeOneToManys.map((field) => ({ ...field })),\n oneToOnes: meta.oneToOnes.map((field) => ({ ...field })),\n manyToManys: meta.manyToManys.map((field) => ({ ...field })),\n largeManyToManys: meta.largeManyToManys.map((field) => ({ ...field })),\n polymorphics: meta.polymorphics.map((field) => ({\n ...field,\n components: field.components.map((component) => ({ ...component })),\n })),\n nonDeferredFks: meta.nonDeferredFks,\n nonDeferredManyToManyFks: meta.nonDeferredManyToManyFks,\n };\n for (const timestamp of [\"createdAt\", \"updatedAt\", \"deletedAt\"] as const) {\n meta.physicalMetadata[timestamp] = meta.physicalMetadata.primitives.find(\n (field) => field.fieldName === meta[timestamp]?.fieldName,\n );\n }\n }\n setClassTableInheritance(entities, entitiesByName);\n expandSingleTableInheritance(config, entitiesByName, entities);\n rewriteSingleTableForeignKeys(config, entities);\n setupSubTypeSpecialization(config, entities);\n // Now that all relations (incl. specialized ones) exist, collapse the duplicate `otherEntity` objects\n canonicalizeOtherEntities(db);\n}\n\n/**\n * Looks for subtypes specializing a FK of their base type, and give them a specialized m2o.\n *\n * I.e. `SmallPublishers.group: SmallPublisherGroup`.\n *\n * This means the `publishers.group_id` FK will actually be in the `EntityDbMetadata` twice,\n * once for the base and once for the child, which is unusual, but gets the types generated\n * that we want, and then we fixup/dedupe them at runtime in `configure.ts` when creating\n * `meta.allFields`.\n */\nfunction setupSubTypeSpecialization(config: Config, entities: EntityDbMetadata[]): void {\n for (const entity of entities) {\n if (entity.baseType) {\n const entityConfig = config.entities[entity.name];\n const baseConfig = config.entities[entity.baseType.name];\n // Look through the base's m2os & o2ms, looking for a config specialization\n for (const rel of [...entity.baseType.manyToOnes, ...entity.baseType.oneToManys]) {\n const { notNull } = entityConfig?.relations?.[rel.fieldName] ?? {};\n const subType =\n entityConfig?.relations?.[rel.fieldName]?.subType ??\n baseConfig?.relations?.[rel.fieldName]?.subType ??\n // Probe the otherFieldName for a `subType: \"self\"` on self-referential relations in STI tables\n baseConfig?.relations?.[rel.otherFieldName]?.subType ??\n // if we are only marking the relation as required and not specifying a subtype, then use the original type\n (notNull ? rel.otherEntity.name : undefined);\n\n if (!subType) {\n // continue...\n } else if (subType === \"self\" && rel.kind === \"m2o\") {\n // Specialize `TaskNew.copiedFrom: TaskNew` & `TaskOld.copiedFrom: TaskOld`\n entity.manyToOnes.push({ ...rel, ...(notNull ? { notNull } : {}), otherEntity: makeEntity(entity.name) });\n } else if (subType === \"self\" && rel.kind === \"o2m\") {\n // Specialize `TaskNew.copiedTo: TaskNew[]` & `TaskOld.copiedTo: TaskOld[]`\n entity.oneToManys.push({ ...rel, ...(notNull ? { notNull } : {}), otherEntity: makeEntity(entity.name) });\n } else if (rel.kind === \"m2o\") {\n // Specialize `SmallPublisher.group: SmallPublisherGroup`\n entity.manyToOnes.push({ ...rel, ...(notNull ? { notNull } : {}), otherEntity: makeEntity(subType) });\n } else if (rel.kind === \"o2m\") {\n // Specialize `SmallPublisherGroup.publishers: SmallPublisher`\n entity.oneToManys.push({ ...rel, ...(notNull ? { notNull } : {}), otherEntity: makeEntity(subType) });\n }\n }\n\n // Look through the base's primitives looking for a config specialization\n for (const field of entity.baseType?.primitives ?? []) {\n // the only specialization a primitive can have is nullability\n const { notNull } = entityConfig?.fields?.[field.fieldName] ?? {};\n if (notNull) {\n entity.primitives.push({ ...field, notNull });\n }\n }\n }\n }\n}\n\n/**\n * Ensure CTI base types have their inheritanceType set.\n *\n * (We automatically set `inheritanceType` for STI tables when we see their config\n * setup, see `expandSingleTableInheritance`.)\n */\nfunction setClassTableInheritance(\n entities: EntityDbMetadata[],\n entitiesByName: Record<string, EntityDbMetadata>,\n): void {\n const ctiBaseNames: string[] = [];\n for (const entity of entities) {\n if (entity.baseClassName) {\n ctiBaseNames.push(entity.baseClassName);\n const base = entitiesByName[entity.baseClassName];\n entity.baseType = base;\n base.subTypes.push(entity);\n }\n }\n for (const entity of entities) {\n if (ctiBaseNames.includes(entity.name)) entity.inheritanceType = \"cti\";\n }\n}\n\n/** Expands STI tables into multiple entities, so they get separate `SubTypeCodegen.ts` & `SubType.ts` files. */\nfunction expandSingleTableInheritance(\n config: Config,\n entitiesByName: Record<string, EntityDbMetadata>,\n entities: EntityDbMetadata[],\n): void {\n for (const entity of entities) {\n const [fieldName, stiField] =\n Object.entries(config.entities[entity.name]?.fields || {}).find(([, f]) => !!f.stiDiscriminator) ?? [];\n if (fieldName && stiField && stiField.stiDiscriminator) {\n entity.inheritanceType = \"sti\";\n\n // Ensure we have an enum field so that we can bake the STI discriminators into the metadata.ts file\n const enumField =\n entity.enums.find((e) => e.fieldName === fieldName) ??\n fail(`No enum column found for ${entity.name}.${fieldName}, which is required to use singleTableInheritance`);\n entity.stiDiscriminatorField = enumField.fieldName;\n\n // Find the available discriminators/subtypes, i.e. NEW => NewTask, OLD => OldTask, etc.\n const subTypes = Object.entries(stiField.stiDiscriminator);\n\n const allFields = [\n ...Object.entries(config.entities[entity.name]?.fields ?? {}),\n ...Object.entries(config.entities[entity.name]?.relations ?? {}),\n ];\n\n // Make sure there aren't any typos in `stiType`s\n const availableCodes = subTypes.map(([code]) => code);\n const availableNames = subTypes.map(([, name]) => name);\n const available = [...availableCodes, ...availableNames];\n for (const [name, f] of allFields) {\n for (const stiType of stiTypesOf(f)) {\n if (!available.includes(stiType)) {\n fail(`${name}.stiType '${stiType}' is invalid, expected one of ${available.join(\", \")}`);\n }\n }\n }\n\n // A `notNull` column with no database default cannot be pushed down to a subtype: the other\n // subtypes omit it from their INSERT (see `addInserts`), and the database has nothing to fall back\n // on. A `notNull` column *with* a default is fine -- the other subtypes simply get the default.\n const requiredFieldNames = new Set(\n [...entity.primitives, ...entity.enums, ...entity.pgEnums, ...entity.manyToOnes]\n .filter((f) => f.notNull && f.columnDefault === null && !(\"columnGenerated\" in f && f.columnGenerated))\n .map((f) => f.fieldName),\n );\n for (const [name, f] of allFields) {\n const stiTypes = stiTypesOf(f);\n // Claiming every subtype leaves no one without a value, so it's equivalent to staying on the base\n const claimsEverySubtype = subTypes.every(([code, name]) => stiTypes.some((t) => t === code || t === name));\n if (stiTypes.length > 0 && !claimsEverySubtype && requiredFieldNames.has(name)) {\n fail(\n `${entity.name}.${name} is notNull with no database default, so it cannot be pushed down to` +\n ` ${stiTypes.map((t) => `'${t}'`).join(\", \")} -- the other subtypes would have no value to` +\n ` insert. Either give the column a default, make it nullable (stiType will still make it` +\n ` required on those subtypes), or leave the field on ${entity.name}.`,\n );\n }\n }\n\n // Names claimed by any subtype; stripped from the base after the loop, not during it, so that a\n // field claimed by two subtypes is still on the base when the second iteration looks for it.\n const claimedFieldNames = new Set(allFields.filter(([, f]) => stiTypesOf(f).length > 0).map(([name]) => name));\n\n // Now split each subType out into its out entity\n for (const [enumCode, subTypeName] of subTypes) {\n // Find all the base entity's fields that belong to us\n const subTypeFields = allFields.filter(([, f]) =>\n stiTypesOf(f).some((t) => t === subTypeName || t === enumCode),\n );\n const subTypeFieldNames = subTypeFields.map(([name]) => name);\n\n // Make fields as required\n function maybeRequired<T extends { notNull: boolean; fieldName: string }>(field: T): T {\n const config = subTypeFields.find(([name]) => name === field.fieldName)?.[1]!;\n if (config.notNull) field.notNull = true;\n return field;\n }\n\n // Synthesize an entity for this STI sub-entity\n const subEntity: EntityDbMetadata = {\n name: subTypeName,\n entity: makeEntity(subTypeName),\n tableName: entity.tableName,\n physicalMetadata: entity.physicalMetadata,\n primaryKey: entity.primaryKey,\n primitives: entity.primitives.filter((f) => subTypeFieldNames.includes(f.fieldName)).map(maybeRequired),\n enums: entity.enums.filter((f) => subTypeFieldNames.includes(f.fieldName)).map(maybeRequired),\n pgEnums: entity.pgEnums.filter((f) => subTypeFieldNames.includes(f.fieldName)).map(maybeRequired),\n manyToOnes: entity.manyToOnes.filter((f) => subTypeFieldNames.includes(f.fieldName)).map(maybeRequired),\n oneToManys: entity.oneToManys.filter((f) => subTypeFieldNames.includes(f.fieldName)),\n largeOneToManys: entity.largeOneToManys.filter((f) => subTypeFieldNames.includes(f.fieldName)),\n oneToOnes: entity.oneToOnes.filter((f) => subTypeFieldNames.includes(f.fieldName)),\n manyToManys: entity.manyToManys.filter((f) => subTypeFieldNames.includes(f.fieldName)),\n largeManyToManys: entity.largeManyToManys.filter((f) => subTypeFieldNames.includes(f.fieldName)),\n manyToManyEnums: entity.manyToManyEnums.filter((f) => subTypeFieldNames.includes(f.fieldName)),\n polymorphics: entity.polymorphics.filter((f) => subTypeFieldNames.includes(f.fieldName)),\n tagName: entity.tagName,\n createdAt: undefined,\n updatedAt: undefined,\n deletedAt: undefined,\n baseClassName: entity.name,\n baseType: entity,\n subTypes: [],\n inheritanceType: \"sti\",\n stiDiscriminatorValue: (\n enumField.enumRows.find((r) => r.code === enumCode) ??\n fail(`No enum row found for ${entity.name}.${fieldName}.${enumCode}`)\n ).id,\n abstract: false,\n nonDeferredFkOrder: entity.nonDeferredFkOrder,\n get nonDeferredFks(): Array<ManyToOneField | PolymorphicFieldComponent> {\n return [\n ...this.manyToOnes.filter((r) => !r.isDeferredAndDeferrable),\n ...this.polymorphics.flatMap((p) => p.components).filter((c) => !c.isDeferredAndDeferrable),\n ];\n },\n get nonDeferredManyToManyFks(): Array<ManyToManyField> {\n return this.manyToManys.filter((r) => !r.isDeferredAndDeferrable);\n },\n };\n\n entity.subTypes.push(subEntity);\n\n entities.push(subEntity);\n entitiesByName[subEntity.name] = subEntity;\n }\n\n // Now strip the subclass fields from the base class\n const keep = <T extends { fieldName: string }>(f: T) => !claimedFieldNames.has(f.fieldName);\n entity.primitives = entity.primitives.filter(keep);\n entity.enums = entity.enums.filter(keep);\n entity.pgEnums = entity.pgEnums.filter(keep);\n entity.manyToOnes = entity.manyToOnes.filter(keep);\n entity.oneToManys = entity.oneToManys.filter(keep);\n entity.largeOneToManys = entity.largeOneToManys.filter(keep);\n entity.oneToOnes = entity.oneToOnes.filter(keep);\n entity.manyToManys = entity.manyToManys.filter(keep);\n entity.largeManyToManys = entity.largeManyToManys.filter(keep);\n entity.manyToManyEnums = entity.manyToManyEnums.filter(keep);\n entity.polymorphics = entity.polymorphics.filter(keep);\n }\n }\n}\n\ntype StiEntityMap = Map<string, { base: EntityDbMetadata; subTypes: EntityDbMetadata[] }>;\nlet stiEntities: StiEntityMap;\n\nexport function getStiEntities(entities: EntityDbMetadata[]): StiEntityMap {\n if (stiEntities) return stiEntities;\n stiEntities = new Map();\n for (const entity of entities) {\n if (entity.inheritanceType === \"sti\" && entity.stiDiscriminatorField) {\n const base = entity;\n const subTypes = entities.filter((s) => s.baseClassName === entity.name && s !== entity);\n stiEntities.set(entity.name, { base, subTypes });\n // Allow looking up by subType name\n for (const subType of subTypes) {\n stiEntities.set(subType.name, { base, subTypes: [] });\n }\n }\n }\n return stiEntities;\n}\n\n/** Finds FKs pointing to the base table and, if configured, rewrites them to point to the sub-tables. */\nfunction rewriteSingleTableForeignKeys(config: Config, entities: EntityDbMetadata[]): void {\n // See if we even have any STI tables\n const stiEntities = getStiEntities(entities);\n if (stiEntities.size === 0) return;\n // Scan for other entities/relations that point to the STI table\n for (const entity of entities) {\n // m2os -- Look for `entity.task_id` FKs pointing at `Task` and, if configured, rewrite them to point at `TaskOld`\n for (const m2o of entity.manyToOnes) {\n const target = stiEntities.get(m2o.otherEntity.name);\n const base = target?.base.entity.name;\n // See if the user has pushed `Task.entities` down to a subtype\n // Only a lone subtype can retype the FK; naming several means the FK can point at any of them,\n // which is just the base type, so leave it alone.\n const [stiType, ...others] = stiTypesOf(\n base ? config.entities[base]?.relations?.[m2o.otherFieldName] : undefined,\n );\n if (target && stiType && others.length === 0) {\n const { subTypes } = target;\n m2o.otherEntity = (\n subTypes.find((s) => s.name === stiType) ??\n fail(`Could not find STI type '${stiType}' in ${subTypes.map((s) => s.name)}`)\n ).entity;\n }\n }\n // polys -- Look for `entity.parent_task_id` FKs pointing at `Task` and, if configured, rewrite them to point at `TaskOld`\n for (const poly of entity.polymorphics) {\n for (const comp of poly.components) {\n const target = stiEntities.get(comp.otherEntity.name);\n const base = target?.base.entity.name;\n // See if the user has pushed `Task.entities` down to a subtype\n const [stiType, ...others] = stiTypesOf(\n base ? config.entities[base]?.relations?.[comp.otherFieldName] : undefined,\n );\n if (target && stiType && others.length === 0) {\n const { subTypes } = target;\n comp.otherEntity = (\n subTypes.find((s) => s.name === stiType) ??\n fail(`Could not find STI type '${stiType}' in ${subTypes.map((s) => s.name)}`)\n ).entity;\n }\n }\n }\n // o2ms -- Look for `entity.tasks` collections loading `task.entity_id`, but entity has been pushed down to `TaskOld`\n for (const o2m of entity.oneToManys) {\n const target = stiEntities.get(o2m.otherEntity.name);\n if (target && target.base.inheritanceType === \"sti\") {\n // Ensure the incoming FK is not in the base type, and find the 1st subtype (eventually N subtypes?)\n const otherField = target.subTypes.find(\n (st) =>\n !target.base.manyToOnes.some((m) => m.fieldName === o2m.otherFieldName) &&\n st.manyToOnes.some((m) => m.fieldName === o2m.otherFieldName),\n );\n if (otherField) {\n o2m.otherEntity = otherField.entity;\n }\n }\n }\n // m2ms -- Look for `entity.tasks` collections loading m2m rows, but `entity` has been pushed down to `TaskOld`\n for (const m2m of entity.manyToManys) {\n const target = stiEntities.get(m2m.otherEntity.name);\n if (target && target.base.inheritanceType === \"sti\") {\n // Ensure the incoming FK is not in the base type, and find the 1st subtype (eventually N subtypes?)\n const otherField = target.subTypes.find(\n (st) =>\n !target.base.manyToManys.some((m) => m.fieldName === m2m.otherFieldName) &&\n st.manyToManys.some((m) => m.fieldName === m2m.otherFieldName),\n );\n if (otherField) {\n m2m.otherEntity = otherField.entity;\n }\n }\n }\n }\n}\n\n/** Normalizes a field/relation's `stiType`, which may name one subtype or several, to an array. */\nfunction stiTypesOf(config: { stiType?: string | string[] } | undefined): string[] {\n const stiType = config?.stiType;\n return stiType === undefined ? [] : typeof stiType === \"string\" ? [stiType] : stiType;\n}\n"],"mappings":";;;;;;AAaA,SAAgB,wBAAwB,QAAgB,IAAsB;CAC5E,MAAM,EAAE,UAAU,mBAAmB;CAErC,KAAK,MAAM,QAAQ,UAAU;EAC3B,KAAK,mBAAmB;GACtB,GAAG;GACH,MAAM,KAAK;GACX,YAAY,KAAK,WAAW,KAAK,WAAW,EAAE,GAAG,MAAM,EAAE;GACzD,OAAO,KAAK,MAAM,KAAK,WAAW,EAAE,GAAG,MAAM,EAAE;GAC/C,SAAS,KAAK,QAAQ,KAAK,WAAW,EAAE,GAAG,MAAM,EAAE;GACnD,YAAY,KAAK,WAAW,KAAK,WAAW,EAAE,GAAG,MAAM,EAAE;GACzD,YAAY,KAAK,WAAW,KAAK,WAAW,EAAE,GAAG,MAAM,EAAE;GACzD,iBAAiB,KAAK,gBAAgB,KAAK,WAAW,EAAE,GAAG,MAAM,EAAE;GACnE,WAAW,KAAK,UAAU,KAAK,WAAW,EAAE,GAAG,MAAM,EAAE;GACvD,aAAa,KAAK,YAAY,KAAK,WAAW,EAAE,GAAG,MAAM,EAAE;GAC3D,kBAAkB,KAAK,iB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I,cAAc,CACjE;IACA,IAAI,YACF,IAAI,cAAc,WAAW;GAEjC;EACF;CACF;AACF;;AAGA,SAAS,WAAW,QAA+D;CACjF,MAAM,UAAU,QAAQ;CACxB,OAAO,YAAY,KAAA,IAAY,CAAC,IAAI,OAAO,YAAY,WAAW,CAAC,OAAO,IAAI;AAChF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Config } from "./config.cjs";
|
|
2
|
+
import { DbMetadata, EntityDbMetadata } from "./EntityDbMetadata.cjs";
|
|
3
|
+
//#region src/inheritance.d.ts
|
|
4
|
+
/** Preserves physical storage metadata, then applies domain inheritance specialization. */
|
|
5
|
+
declare function applyInheritanceUpdates(config: Config, db: DbMetadata): void;
|
|
6
|
+
type StiEntityMap = Map<string, {
|
|
7
|
+
base: EntityDbMetadata;
|
|
8
|
+
subTypes: EntityDbMetadata[];
|
|
9
|
+
}>;
|
|
10
|
+
declare function getStiEntities(entities: EntityDbMetadata[]): StiEntityMap;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { applyInheritanceUpdates, getStiEntities };
|
|
13
|
+
//# sourceMappingURL=inheritance.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritance.d.cts","names":[],"sources":["../src/inheritance.ts"],"mappings":";;;;iBAagB,wBAAwB,QAAQ,QAAQ,IAAI;KAqQvD,eAAe;EAAc,MAAM;EAAkB,UAAU;;iBAGpD,eAAe,UAAU,qBAAqB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Config } from "./config.mjs";
|
|
2
|
+
import { DbMetadata, EntityDbMetadata } from "./EntityDbMetadata.mjs";
|
|
3
|
+
//#region src/inheritance.d.ts
|
|
4
|
+
/** Preserves physical storage metadata, then applies domain inheritance specialization. */
|
|
5
|
+
declare function applyInheritanceUpdates(config: Config, db: DbMetadata): void;
|
|
6
|
+
type StiEntityMap = Map<string, {
|
|
7
|
+
base: EntityDbMetadata;
|
|
8
|
+
subTypes: EntityDbMetadata[];
|
|
9
|
+
}>;
|
|
10
|
+
declare function getStiEntities(entities: EntityDbMetadata[]): StiEntityMap;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { applyInheritanceUpdates, getStiEntities };
|
|
13
|
+
//# sourceMappingURL=inheritance.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritance.d.mts","names":[],"sources":["../src/inheritance.ts"],"mappings":";;;;iBAagB,wBAAwB,QAAQ,QAAQ,IAAI;KAqQvD,eAAe;EAAc,MAAM;EAAkB,UAAU;;iBAGpD,eAAe,UAAU,qBAAqB"}
|