joist-codegen 2.3.0-next.6 → 2.3.0-next.60
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 +608 -0
- package/build/EntityDbMetadata.cjs.map +1 -0
- package/build/EntityDbMetadata.d.cts +274 -0
- package/build/EntityDbMetadata.d.cts.map +1 -0
- package/build/EntityDbMetadata.d.mts +274 -0
- package/build/EntityDbMetadata.d.mts.map +1 -0
- package/build/EntityDbMetadata.js +485 -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 +127 -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 +110 -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 +951 -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 +734 -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 +290 -0
- package/build/generateMetadataFile.cjs.map +1 -0
- package/build/generateMetadataFile.d.cts +8 -0
- package/build/generateMetadataFile.d.cts.map +1 -0
- package/build/generateMetadataFile.d.mts +8 -0
- package/build/generateMetadataFile.d.mts.map +1 -0
- package/build/generateMetadataFile.js +116 -140
- 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 +213 -0
- package/build/inheritance.cjs.map +1 -0
- package/build/inheritance.d.cts +12 -0
- package/build/inheritance.d.cts.map +1 -0
- package/build/inheritance.d.mts +12 -0
- package/build/inheritance.d.mts.map +1 -0
- package/build/inheritance.js +193 -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 +228 -0
- package/build/symbols.cjs.map +1 -0
- package/build/symbols.d.cts +115 -0
- package/build/symbols.d.cts.map +1 -0
- package/build/symbols.d.mts +115 -0
- package/build/symbols.d.mts.map +1 -0
- package/build/symbols.js +116 -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 +133 -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,49 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./Codemod.cjs");
|
|
3
|
+
const require_codemods_codemod_0001_rename_has_async_property = require("./codemod_0001-rename_has_async_property.cjs");
|
|
4
|
+
const require_codemods_codemod_0002_rename_async_query_fields = require("./codemod_0002-rename_async_query_fields.cjs");
|
|
5
|
+
const require_codemods_codemod_0003_rename_find_paginated = require("./codemod_0003-rename_find_paginated.cjs");
|
|
6
|
+
require("../config.cjs");
|
|
7
|
+
//#region src/codemods/index.ts
|
|
8
|
+
const codemods = [
|
|
9
|
+
require_codemods_codemod_0001_rename_has_async_property.codemod_0001_rename_has_async_property,
|
|
10
|
+
require_codemods_codemod_0002_rename_async_query_fields.codemod_0002_rename_async_query_fields,
|
|
11
|
+
require_codemods_codemod_0003_rename_find_paginated.codemod_0003_rename_find_paginated
|
|
12
|
+
];
|
|
13
|
+
/** Prompts for and runs pending codemods for the user's project. */
|
|
14
|
+
async function maybeRunTransforms(config) {
|
|
15
|
+
const { confirm } = await import("@inquirer/prompts");
|
|
16
|
+
const configCodemodVersion = config.codemodVersion;
|
|
17
|
+
const latestCodemodVersion = getLatestCodemodVersion();
|
|
18
|
+
if (configCodemodVersion >= latestCodemodVersion) return;
|
|
19
|
+
const mods = findApplicableCodemods(configCodemodVersion);
|
|
20
|
+
if (mods.length === 0) {
|
|
21
|
+
config.codemodVersion = latestCodemodVersion;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
console.log(`Your project is on Joist codemod version ${configCodemodVersion} and there ${mods.length === 1 ? "is" : "are"} ${mods.length} codemod${mods.length === 1 ? "" : "s"} to apply.`);
|
|
25
|
+
if (!await confirm({ message: `Would you like to run them?` })) {
|
|
26
|
+
config.codemodVersion = latestCodemodVersion;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
for (const mod of mods) {
|
|
30
|
+
if (!await confirm({ message: `Do you want to run ${mod.description}?` })) continue;
|
|
31
|
+
await mod.run(config);
|
|
32
|
+
}
|
|
33
|
+
console.log(`\n\n\nYou've been upgraded to Joist codemod version ${latestCodemodVersion}!`);
|
|
34
|
+
config.codemodVersion = latestCodemodVersion;
|
|
35
|
+
}
|
|
36
|
+
/** Returns the highest codemod counter known by this version of codegen. */
|
|
37
|
+
function getLatestCodemodVersion() {
|
|
38
|
+
return codemods[codemods.length - 1]?.codemodVersion ?? 0;
|
|
39
|
+
}
|
|
40
|
+
/** Returns codemods that have not yet been applied to the user's project. */
|
|
41
|
+
function findApplicableCodemods(codemodVersion) {
|
|
42
|
+
return codemods.filter((codemod) => codemod.codemodVersion > codemodVersion);
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
exports.findApplicableCodemods = findApplicableCodemods;
|
|
46
|
+
exports.getLatestCodemodVersion = getLatestCodemodVersion;
|
|
47
|
+
exports.maybeRunTransforms = maybeRunTransforms;
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["codemod_0001_rename_has_async_property","codemod_0002_rename_async_query_fields","codemod_0003_rename_find_paginated"],"sources":["../../src/codemods/index.ts"],"sourcesContent":["import { type Config } from \"../config.ts\";\nimport { type Codemod } from \"./Codemod.ts\";\nimport { codemod_0001_rename_has_async_property } from \"./codemod_0001-rename_has_async_property.ts\";\nimport { codemod_0002_rename_async_query_fields } from \"./codemod_0002-rename_async_query_fields.ts\";\nimport { codemod_0003_rename_find_paginated } from \"./codemod_0003-rename_find_paginated.ts\";\n\nconst codemods: Codemod[] = [\n codemod_0001_rename_has_async_property,\n codemod_0002_rename_async_query_fields,\n codemod_0003_rename_find_paginated,\n];\n\n/** Prompts for and runs pending codemods for the user's project. */\nexport async function maybeRunTransforms(config: Config): Promise<void> {\n const { confirm } = await import(\"@inquirer/prompts\");\n const configCodemodVersion = config.codemodVersion;\n const latestCodemodVersion = getLatestCodemodVersion();\n\n if (configCodemodVersion >= latestCodemodVersion) {\n return;\n }\n\n const mods = findApplicableCodemods(configCodemodVersion);\n if (mods.length === 0) {\n config.codemodVersion = latestCodemodVersion;\n return;\n }\n\n console.log(\n `Your project is on Joist codemod version ${configCodemodVersion} and there ${mods.length === 1 ? \"is\" : \"are\"} ${mods.length} codemod${mods.length === 1 ? \"\" : \"s\"} to apply.`,\n );\n\n const run = await confirm({\n message: `Would you like to run them?`,\n });\n\n if (!run) {\n config.codemodVersion = latestCodemodVersion;\n return;\n }\n\n for (const mod of mods) {\n const run = await confirm({\n message: `Do you want to run ${mod.description}?`,\n });\n if (!run) continue;\n await mod.run(config);\n }\n\n console.log(`\\n\\n\\nYou've been upgraded to Joist codemod version ${latestCodemodVersion}!`);\n\n config.codemodVersion = latestCodemodVersion;\n}\n\n/** Returns the highest codemod counter known by this version of codegen. */\nexport function getLatestCodemodVersion(): number {\n return codemods[codemods.length - 1]?.codemodVersion ?? 0;\n}\n\n/** Returns codemods that have not yet been applied to the user's project. */\nexport function findApplicableCodemods(codemodVersion: number): Codemod[] {\n return codemods.filter((codemod) => codemod.codemodVersion > codemodVersion);\n}\n"],"mappings":";;;;;;;AAMA,MAAM,WAAsB;CAC1BA,wDAAAA;CACAC,wDAAAA;CACAC,oDAAAA;AACF;;AAGA,eAAsB,mBAAmB,QAA+B;CACtE,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,uBAAuB,OAAO;CACpC,MAAM,uBAAuB,wBAAwB;CAErD,IAAI,wBAAwB,sBAC1B;CAGF,MAAM,OAAO,uBAAuB,oBAAoB;CACxD,IAAI,KAAK,WAAW,GAAG;EACrB,OAAO,iBAAiB;EACxB;CACF;CAEA,QAAQ,IACN,4CAA4C,qBAAqB,aAAa,KAAK,WAAW,IAAI,OAAO,MAAM,GAAG,KAAK,OAAO,UAAU,KAAK,WAAW,IAAI,KAAK,IAAI,WACvK;CAMA,IAAI,CAAC,MAJa,QAAQ,EACxB,SAAS,8BACX,CAAC,GAES;EACR,OAAO,iBAAiB;EACxB;CACF;CAEA,KAAK,MAAM,OAAO,MAAM;EAItB,IAAI,CAAC,MAHa,QAAQ,EACxB,SAAS,sBAAsB,IAAI,YAAY,GACjD,CAAC,GACS;EACV,MAAM,IAAI,IAAI,MAAM;CACtB;CAEA,QAAQ,IAAI,uDAAuD,qBAAqB,EAAE;CAE1F,OAAO,iBAAiB;AAC1B;;AAGA,SAAgB,0BAAkC;CAChD,OAAO,SAAS,SAAS,SAAS,EAAE,EAAE,kBAAkB;AAC1D;;AAGA,SAAgB,uBAAuB,gBAAmC;CACxE,OAAO,SAAS,QAAQ,YAAY,QAAQ,iBAAiB,cAAc;AAC7E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Config } from "../config.cjs";
|
|
2
|
+
import { Codemod } from "./Codemod.cjs";
|
|
3
|
+
//#region src/codemods/index.d.ts
|
|
4
|
+
/** Prompts for and runs pending codemods for the user's project. */
|
|
5
|
+
declare function maybeRunTransforms(config: Config): Promise<void>;
|
|
6
|
+
/** Returns the highest codemod counter known by this version of codegen. */
|
|
7
|
+
declare function getLatestCodemodVersion(): number;
|
|
8
|
+
/** Returns codemods that have not yet been applied to the user's project. */
|
|
9
|
+
declare function findApplicableCodemods(codemodVersion: number): Codemod[];
|
|
10
|
+
//#endregion
|
|
11
|
+
export { findApplicableCodemods, getLatestCodemodVersion, maybeRunTransforms };
|
|
12
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/codemods/index.ts"],"mappings":";;;;iBAasB,mBAAmB,QAAQ,SAAS;;iBA0C1C;;iBAKA,uBAAuB,yBAAyB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Config } from "../config.mjs";
|
|
2
|
+
import { Codemod } from "./Codemod.mjs";
|
|
3
|
+
//#region src/codemods/index.d.ts
|
|
4
|
+
/** Prompts for and runs pending codemods for the user's project. */
|
|
5
|
+
declare function maybeRunTransforms(config: Config): Promise<void>;
|
|
6
|
+
/** Returns the highest codemod counter known by this version of codegen. */
|
|
7
|
+
declare function getLatestCodemodVersion(): number;
|
|
8
|
+
/** Returns codemods that have not yet been applied to the user's project. */
|
|
9
|
+
declare function findApplicableCodemods(codemodVersion: number): Codemod[];
|
|
10
|
+
//#endregion
|
|
11
|
+
export { findApplicableCodemods, getLatestCodemodVersion, maybeRunTransforms };
|
|
12
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/codemods/index.ts"],"mappings":";;;;iBAasB,mBAAmB,QAAQ,SAAS;;iBA0C1C;;iBAKA,uBAAuB,yBAAyB"}
|
package/build/codemods/index.js
CHANGED
|
@@ -1,54 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const codemod_0002_rename_async_query_fields_1 = require("./codemod_0002-rename_async_query_fields");
|
|
8
|
-
const codemod_0003_rename_find_paginated_1 = require("./codemod_0003-rename_find_paginated");
|
|
1
|
+
import "./Codemod.js";
|
|
2
|
+
import { codemod_0001_rename_has_async_property } from "./codemod_0001-rename_has_async_property.js";
|
|
3
|
+
import { codemod_0002_rename_async_query_fields } from "./codemod_0002-rename_async_query_fields.js";
|
|
4
|
+
import { codemod_0003_rename_find_paginated } from "./codemod_0003-rename_find_paginated.js";
|
|
5
|
+
import "../config.js";
|
|
6
|
+
//#region src/codemods/index.ts
|
|
9
7
|
const codemods = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
codemod_0001_rename_has_async_property,
|
|
9
|
+
codemod_0002_rename_async_query_fields,
|
|
10
|
+
codemod_0003_rename_find_paginated
|
|
13
11
|
];
|
|
14
12
|
/** Prompts for and runs pending codemods for the user's project. */
|
|
15
13
|
async function maybeRunTransforms(config) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const run = await confirm({
|
|
37
|
-
message: `Do you want to run ${mod.description}?`,
|
|
38
|
-
});
|
|
39
|
-
if (!run)
|
|
40
|
-
continue;
|
|
41
|
-
await mod.run(config);
|
|
42
|
-
}
|
|
43
|
-
console.log(`\n\n\nYou've been upgraded to Joist codemod version ${latestCodemodVersion}!`);
|
|
44
|
-
config.codemodVersion = latestCodemodVersion;
|
|
14
|
+
const { confirm } = await import("@inquirer/prompts");
|
|
15
|
+
const configCodemodVersion = config.codemodVersion;
|
|
16
|
+
const latestCodemodVersion = getLatestCodemodVersion();
|
|
17
|
+
if (configCodemodVersion >= latestCodemodVersion) return;
|
|
18
|
+
const mods = findApplicableCodemods(configCodemodVersion);
|
|
19
|
+
if (mods.length === 0) {
|
|
20
|
+
config.codemodVersion = latestCodemodVersion;
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
console.log(`Your project is on Joist codemod version ${configCodemodVersion} and there ${mods.length === 1 ? "is" : "are"} ${mods.length} codemod${mods.length === 1 ? "" : "s"} to apply.`);
|
|
24
|
+
if (!await confirm({ message: `Would you like to run them?` })) {
|
|
25
|
+
config.codemodVersion = latestCodemodVersion;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
for (const mod of mods) {
|
|
29
|
+
if (!await confirm({ message: `Do you want to run ${mod.description}?` })) continue;
|
|
30
|
+
await mod.run(config);
|
|
31
|
+
}
|
|
32
|
+
console.log(`\n\n\nYou've been upgraded to Joist codemod version ${latestCodemodVersion}!`);
|
|
33
|
+
config.codemodVersion = latestCodemodVersion;
|
|
45
34
|
}
|
|
46
35
|
/** Returns the highest codemod counter known by this version of codegen. */
|
|
47
36
|
function getLatestCodemodVersion() {
|
|
48
|
-
|
|
37
|
+
return codemods[codemods.length - 1]?.codemodVersion ?? 0;
|
|
49
38
|
}
|
|
50
39
|
/** Returns codemods that have not yet been applied to the user's project. */
|
|
51
40
|
function findApplicableCodemods(codemodVersion) {
|
|
52
|
-
|
|
41
|
+
return codemods.filter((codemod) => codemod.codemodVersion > codemodVersion);
|
|
53
42
|
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { findApplicableCodemods, getLatestCodemodVersion, maybeRunTransforms };
|
|
45
|
+
|
|
54
46
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/codemods/index.ts"],"sourcesContent":["import { type Config } from \"../config.ts\";\nimport { type Codemod } from \"./Codemod.ts\";\nimport { codemod_0001_rename_has_async_property } from \"./codemod_0001-rename_has_async_property.ts\";\nimport { codemod_0002_rename_async_query_fields } from \"./codemod_0002-rename_async_query_fields.ts\";\nimport { codemod_0003_rename_find_paginated } from \"./codemod_0003-rename_find_paginated.ts\";\n\nconst codemods: Codemod[] = [\n codemod_0001_rename_has_async_property,\n codemod_0002_rename_async_query_fields,\n codemod_0003_rename_find_paginated,\n];\n\n/** Prompts for and runs pending codemods for the user's project. */\nexport async function maybeRunTransforms(config: Config): Promise<void> {\n const { confirm } = await import(\"@inquirer/prompts\");\n const configCodemodVersion = config.codemodVersion;\n const latestCodemodVersion = getLatestCodemodVersion();\n\n if (configCodemodVersion >= latestCodemodVersion) {\n return;\n }\n\n const mods = findApplicableCodemods(configCodemodVersion);\n if (mods.length === 0) {\n config.codemodVersion = latestCodemodVersion;\n return;\n }\n\n console.log(\n `Your project is on Joist codemod version ${configCodemodVersion} and there ${mods.length === 1 ? \"is\" : \"are\"} ${mods.length} codemod${mods.length === 1 ? \"\" : \"s\"} to apply.`,\n );\n\n const run = await confirm({\n message: `Would you like to run them?`,\n });\n\n if (!run) {\n config.codemodVersion = latestCodemodVersion;\n return;\n }\n\n for (const mod of mods) {\n const run = await confirm({\n message: `Do you want to run ${mod.description}?`,\n });\n if (!run) continue;\n await mod.run(config);\n }\n\n console.log(`\\n\\n\\nYou've been upgraded to Joist codemod version ${latestCodemodVersion}!`);\n\n config.codemodVersion = latestCodemodVersion;\n}\n\n/** Returns the highest codemod counter known by this version of codegen. */\nexport function getLatestCodemodVersion(): number {\n return codemods[codemods.length - 1]?.codemodVersion ?? 0;\n}\n\n/** Returns codemods that have not yet been applied to the user's project. */\nexport function findApplicableCodemods(codemodVersion: number): Codemod[] {\n return codemods.filter((codemod) => codemod.codemodVersion > codemodVersion);\n}\n"],"mappings":";;;;;;AAMA,MAAM,WAAsB;CAC1B;CACA;CACA;AACF;;AAGA,eAAsB,mBAAmB,QAA+B;CACtE,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,uBAAuB,OAAO;CACpC,MAAM,uBAAuB,wBAAwB;CAErD,IAAI,wBAAwB,sBAC1B;CAGF,MAAM,OAAO,uBAAuB,oBAAoB;CACxD,IAAI,KAAK,WAAW,GAAG;EACrB,OAAO,iBAAiB;EACxB;CACF;CAEA,QAAQ,IACN,4CAA4C,qBAAqB,aAAa,KAAK,WAAW,IAAI,OAAO,MAAM,GAAG,KAAK,OAAO,UAAU,KAAK,WAAW,IAAI,KAAK,IAAI,WACvK;CAMA,IAAI,CAAC,MAJa,QAAQ,EACxB,SAAS,8BACX,CAAC,GAES;EACR,OAAO,iBAAiB;EACxB;CACF;CAEA,KAAK,MAAM,OAAO,MAAM;EAItB,IAAI,CAAC,MAHa,QAAQ,EACxB,SAAS,sBAAsB,IAAI,YAAY,GACjD,CAAC,GACS;EACV,MAAM,IAAI,IAAI,MAAM;CACtB;CAEA,QAAQ,IAAI,uDAAuD,qBAAqB,EAAE;CAE1F,OAAO,iBAAiB;AAC1B;;AAGA,SAAgB,0BAAkC;CAChD,OAAO,SAAS,SAAS,SAAS,EAAE,EAAE,kBAAkB;AAC1D;;AAGA,SAAgB,uBAAuB,gBAAmC;CACxE,OAAO,SAAS,QAAQ,YAAY,QAAQ,iBAAiB,cAAc;AAC7E"}
|
package/build/config.cjs
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_codemods_index = require("./codemods/index.cjs");
|
|
3
|
+
const require_utils = require("./utils.cjs");
|
|
4
|
+
const require_inheritance = require("./inheritance.cjs");
|
|
5
|
+
const require_logger = require("./logger.cjs");
|
|
6
|
+
require("./EntityDbMetadata.cjs");
|
|
7
|
+
let joist_utils = require("joist-utils");
|
|
8
|
+
let fs = require("fs");
|
|
9
|
+
let path = require("path");
|
|
10
|
+
let _dprint_formatter = require("@dprint/formatter");
|
|
11
|
+
let _dprint_json = require("@dprint/json");
|
|
12
|
+
let jsonc_parser = require("jsonc-parser");
|
|
13
|
+
let zod = require("zod");
|
|
14
|
+
//#region src/config.ts
|
|
15
|
+
const jsonFormatter = (0, _dprint_formatter.createFromBuffer)((0, fs.readFileSync)((0, _dprint_json.getPath)()));
|
|
16
|
+
const fieldConfig = zod.z.object({
|
|
17
|
+
derived: zod.z.optional(zod.z.union([zod.z.literal("sync"), zod.z.literal("async")])),
|
|
18
|
+
protected: zod.z.optional(zod.z.boolean()),
|
|
19
|
+
ignore: zod.z.optional(zod.z.boolean()),
|
|
20
|
+
superstruct: zod.z.optional(zod.z.string()),
|
|
21
|
+
zodSchema: zod.z.optional(zod.z.string()),
|
|
22
|
+
type: zod.z.optional(zod.z.string()),
|
|
23
|
+
serde: zod.z.optional(zod.z.string()),
|
|
24
|
+
stiDiscriminator: zod.z.optional(zod.z.record(zod.z.string(), zod.z.string())),
|
|
25
|
+
stiType: zod.z.optional(zod.z.string()),
|
|
26
|
+
notNull: zod.z.optional(zod.z.boolean()),
|
|
27
|
+
hasDefault: zod.z.optional(zod.z.boolean()),
|
|
28
|
+
lazy: zod.z.optional(zod.z.boolean())
|
|
29
|
+
}).strict();
|
|
30
|
+
const relationConfig = zod.z.object({
|
|
31
|
+
derived: zod.z.optional(zod.z.literal("async")),
|
|
32
|
+
polymorphic: zod.z.optional(zod.z.union([zod.z.literal("notNull"), zod.z.literal(true)])),
|
|
33
|
+
large: zod.z.optional(zod.z.boolean()),
|
|
34
|
+
orderBy: zod.z.optional(zod.z.string()),
|
|
35
|
+
/**
|
|
36
|
+
* Controls whether this collection's `.get`/`.load` hide soft-deleted entities.
|
|
37
|
+
*
|
|
38
|
+
* Defaults to `"exclude"` (soft-deleted entities are hidden); set to `"include"` to have
|
|
39
|
+
* this specific o2m/m2m always return soft-deleted entities from `.get`/`.load`.
|
|
40
|
+
*/
|
|
41
|
+
softDeletes: zod.z.optional(zod.z.union([zod.z.literal("include"), zod.z.literal("exclude")])),
|
|
42
|
+
stiType: zod.z.optional(zod.z.string()),
|
|
43
|
+
/**
|
|
44
|
+
* Allow specializing a base type relation (SmallPublisher.group: SmallPublisherGroup).
|
|
45
|
+
*
|
|
46
|
+
* Self-referential FKs also support `subType: "self"` that means each subtype will point
|
|
47
|
+
* at its own subtype.
|
|
48
|
+
*/
|
|
49
|
+
subType: zod.z.optional(zod.z.string()),
|
|
50
|
+
/** Allow skipping self-referential fields getting a `...Recursive` relation. */
|
|
51
|
+
skipRecursiveRelations: zod.z.optional(zod.z.boolean()),
|
|
52
|
+
notNull: zod.z.optional(zod.z.boolean()),
|
|
53
|
+
hasDefault: zod.z.optional(zod.z.boolean())
|
|
54
|
+
}).strict();
|
|
55
|
+
const uniqueByConfig = zod.z.union([
|
|
56
|
+
zod.z.string(),
|
|
57
|
+
zod.z.array(zod.z.string()),
|
|
58
|
+
zod.z.array(zod.z.array(zod.z.string()))
|
|
59
|
+
]).transform(normalizeUniqueByConfig);
|
|
60
|
+
const entityConfig = zod.z.object({
|
|
61
|
+
tag: zod.z.string(),
|
|
62
|
+
tableName: zod.z.optional(zod.z.string()),
|
|
63
|
+
fields: zod.z.optional(zod.z.record(zod.z.string(), fieldConfig)),
|
|
64
|
+
relations: zod.z.optional(zod.z.record(zod.z.string(), relationConfig)),
|
|
65
|
+
/** Whether this entity should be abstract, e.g. for inheritance a subtype must be instantiated instead of this type. */
|
|
66
|
+
abstract: zod.z.optional(zod.z.boolean()),
|
|
67
|
+
orderBy: zod.z.optional(zod.z.string()),
|
|
68
|
+
uniqueBy: zod.z.optional(uniqueByConfig)
|
|
69
|
+
}).strict();
|
|
70
|
+
const timestampConfig = zod.z.object({
|
|
71
|
+
/** The names to check for this timestamp, i.e. `created_at` `created`, etc. */
|
|
72
|
+
names: zod.z.array(zod.z.string()),
|
|
73
|
+
/** Whether this timestamp column is required to consider a table an entity, defaults to `false`. */
|
|
74
|
+
required: zod.z.optional(zod.z.boolean())
|
|
75
|
+
}).strict();
|
|
76
|
+
const config = zod.z.object({
|
|
77
|
+
/** The _build-time_ database URL for reading database metadata. */
|
|
78
|
+
databaseUrl: zod.z.optional(zod.z.string()),
|
|
79
|
+
/** Your application's request-level `Context` type. */
|
|
80
|
+
contextType: zod.z.optional(zod.z.string()),
|
|
81
|
+
/** Your application's database client's `Transaction` type. */
|
|
82
|
+
transactionType: zod.z.optional(zod.z.string()),
|
|
83
|
+
/**
|
|
84
|
+
* Allows the user to specify the `updated_at` / `created_at` column names to look up, and if they're optional.
|
|
85
|
+
*
|
|
86
|
+
* We default to looking for `updated_at`, `updatedAt`, `created_at`, `createdAt`, and optional to true,
|
|
87
|
+
* e.g. tables are not required to have both timestamp columns to be considered entities.
|
|
88
|
+
*
|
|
89
|
+
* These defaults are the most lenient, to facilitate running Joist against an existing schema and
|
|
90
|
+
* seeing all of your entities, regardless of your previous conventions.
|
|
91
|
+
*/
|
|
92
|
+
timestampColumns: zod.z.optional(zod.z.object({
|
|
93
|
+
createdAt: zod.z.optional(timestampConfig),
|
|
94
|
+
updatedAt: zod.z.optional(timestampConfig),
|
|
95
|
+
deletedAt: zod.z.optional(timestampConfig)
|
|
96
|
+
})),
|
|
97
|
+
/**
|
|
98
|
+
* Allows the user to have codegen output `Temporal` types instead of the base JS `Date`
|
|
99
|
+
*
|
|
100
|
+
* Additionally, allows for specifying the default time zone for `Temporal` types when converting dates to/from
|
|
101
|
+
* the database.
|
|
102
|
+
*/
|
|
103
|
+
temporal: zod.z.optional(zod.z.union([zod.z.boolean(), zod.z.object({ timeZone: zod.z.string() })])),
|
|
104
|
+
/**
|
|
105
|
+
* By default, we create a `flush_database` function for fast testing.
|
|
106
|
+
*
|
|
107
|
+
* However, if you don't want to use this, or you have your own bespoke function like we do
|
|
108
|
+
* that is more application-aware, then you can disable Joist's out-of-the-box one.
|
|
109
|
+
*
|
|
110
|
+
* If you have more than one test database, you can set `createFlushFunction` to the array
|
|
111
|
+
* of test database names, i.e. `mydb_test_1`, `mydb_test_2`, etc.
|
|
112
|
+
*/
|
|
113
|
+
createFlushFunction: zod.z.optional(zod.z.union([zod.z.boolean(), zod.z.array(zod.z.string())])),
|
|
114
|
+
entitiesDirectory: zod.z.string().default("./src/entities"),
|
|
115
|
+
codegenPlugins: zod.z.optional(zod.z.array(zod.z.string())),
|
|
116
|
+
entities: zod.z.record(zod.z.string(), entityConfig).default({}),
|
|
117
|
+
ignoredTables: zod.z.optional(zod.z.array(zod.z.string())),
|
|
118
|
+
/** The type of entity `id` fields; defaults to `tagged-string`. */
|
|
119
|
+
idType: zod.z.optional(zod.z.union([
|
|
120
|
+
zod.z.literal("tagged-string"),
|
|
121
|
+
zod.z.literal("untagged-string"),
|
|
122
|
+
zod.z.literal("number")
|
|
123
|
+
])),
|
|
124
|
+
/** The separator between entity tags and ids; defaults to `:`, and `""` disables the separator. */
|
|
125
|
+
tagDelimiter: zod.z.optional(zod.z.string()),
|
|
126
|
+
/** How we should support non-deferred foreign keys. */
|
|
127
|
+
nonDeferredForeignKeys: zod.z.optional(zod.z.union([
|
|
128
|
+
zod.z.literal("error"),
|
|
129
|
+
zod.z.literal("warn"),
|
|
130
|
+
zod.z.literal("ignore")
|
|
131
|
+
])),
|
|
132
|
+
/** Enables esm output. */
|
|
133
|
+
esm: zod.z.optional(zod.z.boolean()),
|
|
134
|
+
/** Controls the style of GraphQL pagination scaffolding. */
|
|
135
|
+
paginationStyle: zod.z.optional(zod.z.union([zod.z.literal("cursor"), zod.z.literal("limit")])).default("cursor"),
|
|
136
|
+
/** Enables documentation syncing between .md files and JSDocs. */
|
|
137
|
+
docs: zod.z.optional(zod.z.boolean()),
|
|
138
|
+
/** Installs Joist's bundled Agent Skills into `.claude/skills` and `.agents/skills`; on by default, set `false` to disable. */
|
|
139
|
+
skills: zod.z.optional(zod.z.boolean()),
|
|
140
|
+
/** Output a metadata-docs.ts file with entity/field documentation available at runtime. */
|
|
141
|
+
outputDocs: zod.z.optional(zod.z.boolean()),
|
|
142
|
+
/** Auto-set by probing the project's `tsconfig.json` file. */
|
|
143
|
+
allowImportingTsExtensions: zod.z.optional(zod.z.boolean()),
|
|
144
|
+
/** The latest Joist codemod counter that has been applied to this project. */
|
|
145
|
+
codemodVersion: zod.z.number().int().min(0).default(0),
|
|
146
|
+
/** A list of postgres schemas to use for finding tables */
|
|
147
|
+
schemas: zod.z.optional(zod.z.array(zod.z.string()))
|
|
148
|
+
}).strict();
|
|
149
|
+
const ormMaintainedFields = ["createdAt", "updatedAt"];
|
|
150
|
+
/** Ensure the user doesn't have any typos in their config. */
|
|
151
|
+
function warnInvalidConfigEntries(config, db) {
|
|
152
|
+
const entitiesByName = (0, joist_utils.groupBy)(db.entities, (e) => e.name);
|
|
153
|
+
for (const [entityName, entityConfig] of Object.entries(config.entities)) {
|
|
154
|
+
const entities = entitiesByName[entityName];
|
|
155
|
+
if (!entities) {
|
|
156
|
+
require_logger.logger.warn(`Found config for non-existent entity ${entityName}`);
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
const [entity] = entities;
|
|
160
|
+
const fields = [...entity.primitives, ...entity.enums];
|
|
161
|
+
for (const [name, config] of Object.entries(entityConfig.fields || {})) {
|
|
162
|
+
if (config.ignore) continue;
|
|
163
|
+
let field = fields.find((f) => f.fieldName === name);
|
|
164
|
+
if (!field && entity.stiDiscriminatorField) field = (require_inheritance.getStiEntities(db.entities).get(entity.name)?.subTypes)?.flatMap((st) => [...st.primitives, ...st.enums]).find((f) => f.fieldName === name);
|
|
165
|
+
if (!field) require_logger.logger.warn(`Found config for non-existent field ${entityName}.${name}`);
|
|
166
|
+
}
|
|
167
|
+
const relations = [
|
|
168
|
+
...entity.manyToOnes,
|
|
169
|
+
...entity.oneToManys,
|
|
170
|
+
...entity.manyToManys,
|
|
171
|
+
...entity.manyToManyEnums,
|
|
172
|
+
...entity.oneToOnes,
|
|
173
|
+
...entity.largeOneToManys,
|
|
174
|
+
...entity.largeManyToManys,
|
|
175
|
+
...entity.polymorphics
|
|
176
|
+
];
|
|
177
|
+
for (const [name, _] of Object.entries(entityConfig.relations || {})) {
|
|
178
|
+
let relation = relations.find((r) => r.fieldName === name);
|
|
179
|
+
if (!relation && entity.stiDiscriminatorField) relation = (require_inheritance.getStiEntities(db.entities).get(entity.name)?.subTypes)?.flatMap((entity) => [
|
|
180
|
+
...entity.manyToOnes,
|
|
181
|
+
...entity.oneToManys,
|
|
182
|
+
...entity.manyToManys,
|
|
183
|
+
...entity.oneToOnes,
|
|
184
|
+
...entity.largeOneToManys,
|
|
185
|
+
...entity.largeManyToManys,
|
|
186
|
+
...entity.polymorphics
|
|
187
|
+
])?.find((f) => f.fieldName === name);
|
|
188
|
+
if (!relation && entity.baseType) {
|
|
189
|
+
const baseType = entity.baseType;
|
|
190
|
+
relation = [
|
|
191
|
+
...baseType.manyToOnes,
|
|
192
|
+
...baseType.oneToManys,
|
|
193
|
+
...baseType.manyToManys,
|
|
194
|
+
...baseType.oneToOnes,
|
|
195
|
+
...baseType.largeOneToManys,
|
|
196
|
+
...baseType.largeManyToManys,
|
|
197
|
+
...baseType.polymorphics
|
|
198
|
+
].find((f) => f.fieldName === name);
|
|
199
|
+
}
|
|
200
|
+
if (!relation) require_logger.logger.warn(`Found config for non-existent relation ${entityName}.${name}`);
|
|
201
|
+
}
|
|
202
|
+
const uniqueFields = [
|
|
203
|
+
...entity.primitives,
|
|
204
|
+
...entity.enums,
|
|
205
|
+
...entity.pgEnums,
|
|
206
|
+
...entity.manyToOnes,
|
|
207
|
+
...entity.polymorphics
|
|
208
|
+
];
|
|
209
|
+
for (const uniqueBy of entityConfig.uniqueBy || []) for (const name of uniqueBy) {
|
|
210
|
+
const field = uniqueFields.find((f) => f.fieldName === name);
|
|
211
|
+
if (!field) require_logger.logger.warn(`Found uniqueBy for non-existent or non-queryable field ${entityName}.${name}`);
|
|
212
|
+
else if (field.kind === "primitive" && (field.derived || field.isArray || field.customSerde)) require_logger.logger.warn(`Found uniqueBy for unsupported primitive field ${entityName}.${name}`);
|
|
213
|
+
else if (field.kind === "enum" && (field.derived || field.isArray)) require_logger.logger.warn(`Found uniqueBy for unsupported enum field ${entityName}.${name}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function isGetterField(config, entity, fieldName) {
|
|
218
|
+
return config.entities[entity.name]?.fields?.[fieldName]?.derived === "sync";
|
|
219
|
+
}
|
|
220
|
+
function isReactiveField(config, entity, fieldName) {
|
|
221
|
+
return config.entities[entity.name]?.fields?.[fieldName]?.derived === "async";
|
|
222
|
+
}
|
|
223
|
+
function isReactiveReference(config, entity, fieldName) {
|
|
224
|
+
return config.entities[entity.name]?.relations?.[fieldName]?.derived === "async";
|
|
225
|
+
}
|
|
226
|
+
/** Returns true if this m2m relation is configured as a ReactiveManyToMany (derived: async). */
|
|
227
|
+
function isReactiveManyToMany(config, entity, fieldName) {
|
|
228
|
+
return config.entities[entity.name]?.relations?.[fieldName]?.derived === "async";
|
|
229
|
+
}
|
|
230
|
+
function isProtected(config, entity, fieldName) {
|
|
231
|
+
return config.entities[entity.name]?.fields?.[fieldName]?.protected === true;
|
|
232
|
+
}
|
|
233
|
+
/** Whether a column should be excluded from the default SELECT and exposed as a lazy-loaded `LazyField`. */
|
|
234
|
+
function isLazyField(config, entity, fieldName) {
|
|
235
|
+
return config.entities[entity.name]?.fields?.[fieldName]?.lazy === true;
|
|
236
|
+
}
|
|
237
|
+
function serdeConfig(config, entity, fieldName) {
|
|
238
|
+
return config.entities[entity.name]?.fields?.[fieldName]?.serde;
|
|
239
|
+
}
|
|
240
|
+
function superstructConfig(config, entity, fieldName) {
|
|
241
|
+
return config.entities[entity.name]?.fields?.[fieldName]?.superstruct;
|
|
242
|
+
}
|
|
243
|
+
function zodSchemaConfig(config, entity, fieldName) {
|
|
244
|
+
return config.entities[entity.name]?.fields?.[fieldName]?.zodSchema;
|
|
245
|
+
}
|
|
246
|
+
function fieldTypeConfig(config, entity, fieldName) {
|
|
247
|
+
return config.entities[entity.name]?.fields?.[fieldName]?.type;
|
|
248
|
+
}
|
|
249
|
+
function isLargeCollection(config, entity, fieldName) {
|
|
250
|
+
return config.entities[entity.name]?.relations?.[fieldName]?.large === true;
|
|
251
|
+
}
|
|
252
|
+
/** Whether a collection should include (or exclude) soft-deleted entities from `.get`/`.load`. */
|
|
253
|
+
function softDeletesConfig(config, entity, fieldName) {
|
|
254
|
+
return config.entities[entity.name]?.relations?.[fieldName]?.softDeletes;
|
|
255
|
+
}
|
|
256
|
+
function isFieldIgnored(config, entity, fieldName, notNull = false, hasDefault = false) {
|
|
257
|
+
const ignore = config.entities[entity.name]?.fields?.[fieldName]?.ignore === true;
|
|
258
|
+
if (ignore && notNull && !hasDefault) require_utils.fail(`notNull field ${entity.name}.${fieldName} cannot be ignored. Alter the column to be optional or have a default value prior to ignoring it.`);
|
|
259
|
+
return ignore;
|
|
260
|
+
}
|
|
261
|
+
function isFieldHasDefault(config, entity, fieldName) {
|
|
262
|
+
const entityConfig = config.entities[entity.name] ?? {};
|
|
263
|
+
return (entityConfig.fields?.[fieldName] ?? entityConfig.relations?.[fieldName] ?? {}).hasDefault === true;
|
|
264
|
+
}
|
|
265
|
+
const configPath = "./joist-config.json";
|
|
266
|
+
async function loadConfig() {
|
|
267
|
+
if (await require_utils.trueIfResolved(fs.promises.access(configPath))) {
|
|
268
|
+
const content = await fs.promises.readFile(configPath);
|
|
269
|
+
const result = config.safeParse(stripLegacyConfigKeys(JSON.parse(content.toString())));
|
|
270
|
+
if (!result.success) throw new Error(`Invalid joist-config.json: ${result.error.issues.map((ze) => `${ze.path.map(String).join("/")} ${ze.message}`).join("\n")}`);
|
|
271
|
+
result.data.allowImportingTsExtensions ??= projectIsUsingEsmWithImports();
|
|
272
|
+
return result.data;
|
|
273
|
+
}
|
|
274
|
+
const initial = config.parse({ codemodVersion: require_codemods_index.getLatestCodemodVersion() });
|
|
275
|
+
initial.allowImportingTsExtensions ??= projectIsUsingEsmWithImports();
|
|
276
|
+
return initial;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Writes the potentially-updated config entry back to `joist-config.json`.
|
|
280
|
+
*
|
|
281
|
+
* We format the output with prettier so it should both a) look nice and b) be deterministic,
|
|
282
|
+
* such that no changes to the config show up as noops to the scm.
|
|
283
|
+
*/
|
|
284
|
+
async function writeConfig(config) {
|
|
285
|
+
const sorted = require_utils.sortKeys(config);
|
|
286
|
+
delete sorted.__tableToEntityName;
|
|
287
|
+
delete sorted.allowImportingTsExtensions;
|
|
288
|
+
if (sorted.paginationStyle === "cursor") delete sorted.paginationStyle;
|
|
289
|
+
const input = JSON.stringify(sorted);
|
|
290
|
+
const content = jsonFormatter.formatText({
|
|
291
|
+
filePath: "test.json",
|
|
292
|
+
fileText: input
|
|
293
|
+
});
|
|
294
|
+
await fs.promises.writeFile(configPath, content);
|
|
295
|
+
}
|
|
296
|
+
function stripStiPlaceholders(config, entities) {
|
|
297
|
+
for (const entity of entities) if (entity.inheritanceType === "sti" && entity.stiDiscriminatorValue) delete config.entities[entity.name];
|
|
298
|
+
}
|
|
299
|
+
/** Applies defaults to the timestamp config. */
|
|
300
|
+
function getTimestampConfig(config) {
|
|
301
|
+
return {
|
|
302
|
+
createdAtConf: {
|
|
303
|
+
names: ["created_at", "createdAt"],
|
|
304
|
+
required: false,
|
|
305
|
+
...config?.timestampColumns?.createdAt
|
|
306
|
+
},
|
|
307
|
+
updatedAtConf: {
|
|
308
|
+
names: ["updated_at", "updatedAt"],
|
|
309
|
+
required: false,
|
|
310
|
+
...config?.timestampColumns?.updatedAt
|
|
311
|
+
},
|
|
312
|
+
deletedAtConf: {
|
|
313
|
+
names: ["deleted_at", "deletedAt"],
|
|
314
|
+
required: false,
|
|
315
|
+
...config?.timestampColumns?.deletedAt
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function projectIsUsingEsmWithImports() {
|
|
320
|
+
const configPath = findTsConfigFile(process.cwd());
|
|
321
|
+
if (!configPath) return false;
|
|
322
|
+
try {
|
|
323
|
+
const errors = [];
|
|
324
|
+
const parsed = (0, jsonc_parser.parse)((0, fs.readFileSync)(configPath, "utf8"), errors, { allowTrailingComma: true });
|
|
325
|
+
if (errors.length > 0 || typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return false;
|
|
326
|
+
const compilerOptions = parsed.compilerOptions;
|
|
327
|
+
return typeof compilerOptions === "object" && compilerOptions !== null && !Array.isArray(compilerOptions) && compilerOptions.allowImportingTsExtensions === true;
|
|
328
|
+
} catch {
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
/** Normalizes `uniqueBy` config sugar into runtime identity candidates. */
|
|
333
|
+
function normalizeUniqueByConfig(uniqueBy) {
|
|
334
|
+
if (typeof uniqueBy === "string") return [[uniqueBy]];
|
|
335
|
+
if (uniqueBy.every((field) => typeof field === "string")) return [uniqueBy];
|
|
336
|
+
return uniqueBy;
|
|
337
|
+
}
|
|
338
|
+
function stripLegacyConfigKeys(raw) {
|
|
339
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
340
|
+
const parsed = { ...raw };
|
|
341
|
+
delete parsed.version;
|
|
342
|
+
return parsed;
|
|
343
|
+
}
|
|
344
|
+
/** Finds the nearest `tsconfig.json` in `directory` or one of its ancestors. */
|
|
345
|
+
function findTsConfigFile(directory) {
|
|
346
|
+
while (true) {
|
|
347
|
+
const fileName = (0, path.join)(directory, "tsconfig.json");
|
|
348
|
+
if ((0, fs.existsSync)(fileName)) return fileName;
|
|
349
|
+
const parent = (0, path.dirname)(directory);
|
|
350
|
+
if (parent === directory) return void 0;
|
|
351
|
+
directory = parent;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
//#endregion
|
|
355
|
+
exports.config = config;
|
|
356
|
+
exports.fieldTypeConfig = fieldTypeConfig;
|
|
357
|
+
exports.getTimestampConfig = getTimestampConfig;
|
|
358
|
+
exports.isFieldHasDefault = isFieldHasDefault;
|
|
359
|
+
exports.isFieldIgnored = isFieldIgnored;
|
|
360
|
+
exports.isGetterField = isGetterField;
|
|
361
|
+
exports.isLargeCollection = isLargeCollection;
|
|
362
|
+
exports.isLazyField = isLazyField;
|
|
363
|
+
exports.isProtected = isProtected;
|
|
364
|
+
exports.isReactiveField = isReactiveField;
|
|
365
|
+
exports.isReactiveManyToMany = isReactiveManyToMany;
|
|
366
|
+
exports.isReactiveReference = isReactiveReference;
|
|
367
|
+
exports.loadConfig = loadConfig;
|
|
368
|
+
exports.ormMaintainedFields = ormMaintainedFields;
|
|
369
|
+
exports.serdeConfig = serdeConfig;
|
|
370
|
+
exports.softDeletesConfig = softDeletesConfig;
|
|
371
|
+
exports.stripStiPlaceholders = stripStiPlaceholders;
|
|
372
|
+
exports.superstructConfig = superstructConfig;
|
|
373
|
+
exports.warnInvalidConfigEntries = warnInvalidConfigEntries;
|
|
374
|
+
exports.writeConfig = writeConfig;
|
|
375
|
+
exports.zodSchemaConfig = zodSchemaConfig;
|
|
376
|
+
|
|
377
|
+
//# sourceMappingURL=config.cjs.map
|