joist-codegen 2.4.0-next.4 → 2.4.0-next.40

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.
Files changed (176) hide show
  1. package/build/EntityDbMetadata.cjs +21 -3
  2. package/build/EntityDbMetadata.cjs.map +1 -1
  3. package/build/EntityDbMetadata.d.cts +28 -25
  4. package/build/EntityDbMetadata.d.cts.map +1 -1
  5. package/build/EntityDbMetadata.d.mts +28 -25
  6. package/build/EntityDbMetadata.d.mts.map +1 -1
  7. package/build/EntityDbMetadata.js +21 -3
  8. package/build/EntityDbMetadata.js.map +1 -1
  9. package/build/assignTags.d.cts +1 -2
  10. package/build/assignTags.d.cts.map +1 -1
  11. package/build/assignTags.d.mts +1 -2
  12. package/build/assignTags.d.mts.map +1 -1
  13. package/build/codemods/Codemod.d.cts +1 -2
  14. package/build/codemods/Codemod.d.cts.map +1 -1
  15. package/build/codemods/Codemod.d.mts +1 -2
  16. package/build/codemods/Codemod.d.mts.map +1 -1
  17. package/build/codemods/JscodeshiftMod.d.cts +1 -2
  18. package/build/codemods/JscodeshiftMod.d.cts.map +1 -1
  19. package/build/codemods/JscodeshiftMod.d.mts +1 -2
  20. package/build/codemods/JscodeshiftMod.d.mts.map +1 -1
  21. package/build/codemods/codemod_0001-rename_has_async_property.d.cts +2 -2
  22. package/build/codemods/codemod_0001-rename_has_async_property.d.cts.map +1 -1
  23. package/build/codemods/codemod_0001-rename_has_async_property.d.mts +2 -2
  24. package/build/codemods/codemod_0001-rename_has_async_property.d.mts.map +1 -1
  25. package/build/codemods/codemod_0002-rename_async_query_fields.d.cts +2 -2
  26. package/build/codemods/codemod_0002-rename_async_query_fields.d.cts.map +1 -1
  27. package/build/codemods/codemod_0002-rename_async_query_fields.d.mts +2 -2
  28. package/build/codemods/codemod_0002-rename_async_query_fields.d.mts.map +1 -1
  29. package/build/codemods/codemod_0003-rename_find_paginated.d.cts +2 -2
  30. package/build/codemods/codemod_0003-rename_find_paginated.d.cts.map +1 -1
  31. package/build/codemods/codemod_0003-rename_find_paginated.d.mts +2 -2
  32. package/build/codemods/codemod_0003-rename_find_paginated.d.mts.map +1 -1
  33. package/build/codemods/index.d.cts +3 -4
  34. package/build/codemods/index.d.cts.map +1 -1
  35. package/build/codemods/index.d.mts +3 -4
  36. package/build/codemods/index.d.mts.map +1 -1
  37. package/build/config.cjs +1 -1
  38. package/build/config.cjs.map +1 -1
  39. package/build/config.d.cts +27 -27
  40. package/build/config.d.cts.map +1 -1
  41. package/build/config.d.mts +27 -27
  42. package/build/config.d.mts.map +1 -1
  43. package/build/config.js +1 -1
  44. package/build/config.js.map +1 -1
  45. package/build/docs/cache.cjs.map +1 -1
  46. package/build/docs/cache.d.cts +2 -3
  47. package/build/docs/cache.d.cts.map +1 -1
  48. package/build/docs/cache.d.mts +2 -3
  49. package/build/docs/cache.d.mts.map +1 -1
  50. package/build/docs/cache.js.map +1 -1
  51. package/build/docs/generate-metadata-docs.d.cts +1 -2
  52. package/build/docs/generate-metadata-docs.d.cts.map +1 -1
  53. package/build/docs/generate-metadata-docs.d.mts +1 -2
  54. package/build/docs/generate-metadata-docs.d.mts.map +1 -1
  55. package/build/docs/index.d.cts +3 -3
  56. package/build/docs/index.d.cts.map +1 -1
  57. package/build/docs/index.d.mts +3 -3
  58. package/build/docs/index.d.mts.map +1 -1
  59. package/build/docs/markdown.d.cts +8 -8
  60. package/build/docs/markdown.d.cts.map +1 -1
  61. package/build/docs/markdown.d.mts +8 -8
  62. package/build/docs/markdown.d.mts.map +1 -1
  63. package/build/docs/parsing.d.cts +9 -9
  64. package/build/docs/parsing.d.cts.map +1 -1
  65. package/build/docs/parsing.d.mts +9 -9
  66. package/build/docs/parsing.d.mts.map +1 -1
  67. package/build/findEntityScopes.d.cts +3 -4
  68. package/build/findEntityScopes.d.cts.map +1 -1
  69. package/build/findEntityScopes.d.mts +3 -4
  70. package/build/findEntityScopes.d.mts.map +1 -1
  71. package/build/foreignKeyOrdering.d.cts +1 -2
  72. package/build/foreignKeyOrdering.d.cts.map +1 -1
  73. package/build/foreignKeyOrdering.d.mts +1 -2
  74. package/build/foreignKeyOrdering.d.mts.map +1 -1
  75. package/build/generate.d.cts +3 -4
  76. package/build/generate.d.cts.map +1 -1
  77. package/build/generate.d.mts +3 -4
  78. package/build/generate.d.mts.map +1 -1
  79. package/build/generateEntitiesFile.d.cts +1 -2
  80. package/build/generateEntitiesFile.d.cts.map +1 -1
  81. package/build/generateEntitiesFile.d.mts +1 -2
  82. package/build/generateEntitiesFile.d.mts.map +1 -1
  83. package/build/generateEntityCodegenFile.cjs +5 -3
  84. package/build/generateEntityCodegenFile.cjs.map +1 -1
  85. package/build/generateEntityCodegenFile.d.cts +3 -4
  86. package/build/generateEntityCodegenFile.d.cts.map +1 -1
  87. package/build/generateEntityCodegenFile.d.mts +3 -4
  88. package/build/generateEntityCodegenFile.d.mts.map +1 -1
  89. package/build/generateEntityCodegenFile.js +5 -3
  90. package/build/generateEntityCodegenFile.js.map +1 -1
  91. package/build/generateEntityFile.d.cts +1 -2
  92. package/build/generateEntityFile.d.cts.map +1 -1
  93. package/build/generateEntityFile.d.mts +1 -2
  94. package/build/generateEntityFile.d.mts.map +1 -1
  95. package/build/generateEntityTestFile.d.cts +1 -2
  96. package/build/generateEntityTestFile.d.cts.map +1 -1
  97. package/build/generateEntityTestFile.d.mts +1 -2
  98. package/build/generateEntityTestFile.d.mts.map +1 -1
  99. package/build/generateEnumFile.d.cts +1 -2
  100. package/build/generateEnumFile.d.cts.map +1 -1
  101. package/build/generateEnumFile.d.mts +1 -2
  102. package/build/generateEnumFile.d.mts.map +1 -1
  103. package/build/generateFactoriesFiles.d.cts +1 -2
  104. package/build/generateFactoriesFiles.d.cts.map +1 -1
  105. package/build/generateFactoriesFiles.d.mts +1 -2
  106. package/build/generateFactoriesFiles.d.mts.map +1 -1
  107. package/build/generateFlushFunction.d.cts +3 -4
  108. package/build/generateFlushFunction.d.cts.map +1 -1
  109. package/build/generateFlushFunction.d.mts +3 -4
  110. package/build/generateFlushFunction.d.mts.map +1 -1
  111. package/build/generateMetadataFile.cjs +2 -1
  112. package/build/generateMetadataFile.cjs.map +1 -1
  113. package/build/generateMetadataFile.d.cts +2 -3
  114. package/build/generateMetadataFile.d.cts.map +1 -1
  115. package/build/generateMetadataFile.d.mts +2 -3
  116. package/build/generateMetadataFile.d.mts.map +1 -1
  117. package/build/generateMetadataFile.js +2 -1
  118. package/build/generateMetadataFile.js.map +1 -1
  119. package/build/generatePgEnumFile.d.cts +1 -2
  120. package/build/generatePgEnumFile.d.cts.map +1 -1
  121. package/build/generatePgEnumFile.d.mts +1 -2
  122. package/build/generatePgEnumFile.d.mts.map +1 -1
  123. package/build/index.d.cts +4 -4
  124. package/build/index.d.cts.map +1 -1
  125. package/build/index.d.mts +4 -4
  126. package/build/index.d.mts.map +1 -1
  127. package/build/inheritance.d.cts +3 -3
  128. package/build/inheritance.d.cts.map +1 -1
  129. package/build/inheritance.d.mts +3 -3
  130. package/build/inheritance.d.mts.map +1 -1
  131. package/build/installSkills.d.cts +1 -2
  132. package/build/installSkills.d.cts.map +1 -1
  133. package/build/installSkills.d.mts +1 -2
  134. package/build/installSkills.d.mts.map +1 -1
  135. package/build/keywords.d.cts +1 -2
  136. package/build/keywords.d.cts.map +1 -1
  137. package/build/keywords.d.mts +1 -2
  138. package/build/keywords.d.mts.map +1 -1
  139. package/build/loadMetadata.d.cts +7 -8
  140. package/build/loadMetadata.d.cts.map +1 -1
  141. package/build/loadMetadata.d.mts +7 -8
  142. package/build/loadMetadata.d.mts.map +1 -1
  143. package/build/logger.d.cts +3 -4
  144. package/build/logger.d.cts.map +1 -1
  145. package/build/logger.d.mts +3 -4
  146. package/build/logger.d.mts.map +1 -1
  147. package/build/pgMetadata.d.cts +13 -14
  148. package/build/pgMetadata.d.cts.map +1 -1
  149. package/build/pgMetadata.d.mts +13 -14
  150. package/build/pgMetadata.d.mts.map +1 -1
  151. package/build/scanEntityFiles.cjs +6 -1
  152. package/build/scanEntityFiles.cjs.map +1 -1
  153. package/build/scanEntityFiles.d.cts +2 -3
  154. package/build/scanEntityFiles.d.cts.map +1 -1
  155. package/build/scanEntityFiles.d.mts +2 -3
  156. package/build/scanEntityFiles.d.mts.map +1 -1
  157. package/build/scanEntityFiles.js +6 -1
  158. package/build/scanEntityFiles.js.map +1 -1
  159. package/build/sortForeignKeys.d.cts +1 -2
  160. package/build/sortForeignKeys.d.cts.map +1 -1
  161. package/build/sortForeignKeys.d.mts +1 -2
  162. package/build/sortForeignKeys.d.mts.map +1 -1
  163. package/build/symbols.d.cts +116 -117
  164. package/build/symbols.d.cts.map +1 -1
  165. package/build/symbols.d.mts +116 -117
  166. package/build/symbols.d.mts.map +1 -1
  167. package/build/tsdoc.d.cts +1 -2
  168. package/build/tsdoc.d.cts.map +1 -1
  169. package/build/tsdoc.d.mts +1 -2
  170. package/build/tsdoc.d.mts.map +1 -1
  171. package/build/utils.d.cts +21 -22
  172. package/build/utils.d.cts.map +1 -1
  173. package/build/utils.d.mts +21 -22
  174. package/build/utils.d.mts.map +1 -1
  175. package/package.json +9 -9
  176. package/skills/joist-test-factories/SKILL.md +93 -6
@@ -15,7 +15,7 @@ declare const fieldConfig: z.ZodObject<{
15
15
  hasDefault: z.ZodOptional<z.ZodBoolean>;
16
16
  lazy: z.ZodOptional<z.ZodBoolean>;
17
17
  }, z.core.$strict>;
18
- type FieldConfig = z.infer<typeof fieldConfig>;
18
+ export type FieldConfig = z.infer<typeof fieldConfig>;
19
19
  declare const relationConfig: z.ZodObject<{
20
20
  derived: z.ZodOptional<z.ZodLiteral<"async">>;
21
21
  polymorphic: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"notNull">, z.ZodLiteral<true>]>>;
@@ -28,7 +28,7 @@ declare const relationConfig: z.ZodObject<{
28
28
  notNull: z.ZodOptional<z.ZodBoolean>;
29
29
  hasDefault: z.ZodOptional<z.ZodBoolean>;
30
30
  }, z.core.$strict>;
31
- type RelationConfig = z.infer<typeof relationConfig>;
31
+ export type RelationConfig = z.infer<typeof relationConfig>;
32
32
  declare const entityConfig: z.ZodObject<{
33
33
  tag: z.ZodString;
34
34
  tableName: z.ZodOptional<z.ZodString>;
@@ -62,13 +62,13 @@ declare const entityConfig: z.ZodObject<{
62
62
  orderBy: z.ZodOptional<z.ZodString>;
63
63
  uniqueBy: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodArray<z.ZodString>>]>, z.ZodTransform<string[][], string | string[] | string[][]>>>;
64
64
  }, z.core.$strict>;
65
- type EntityConfig = z.infer<typeof entityConfig>;
65
+ export type EntityConfig = z.infer<typeof entityConfig>;
66
66
  declare const timestampConfig: z.ZodObject<{
67
67
  names: z.ZodArray<z.ZodString>;
68
68
  required: z.ZodOptional<z.ZodBoolean>;
69
69
  }, z.core.$strict>;
70
- type TimestampConfig = z.infer<typeof timestampConfig>;
71
- declare const config: z.ZodObject<{
70
+ export type TimestampConfig = z.infer<typeof timestampConfig>;
71
+ export declare const config: z.ZodObject<{
72
72
  databaseUrl: z.ZodOptional<z.ZodString>;
73
73
  contextType: z.ZodOptional<z.ZodString>;
74
74
  transactionType: z.ZodOptional<z.ZodString>;
@@ -138,44 +138,44 @@ declare const config: z.ZodObject<{
138
138
  codemodVersion: z.ZodDefault<z.ZodNumber>;
139
139
  schemas: z.ZodOptional<z.ZodArray<z.ZodString>>;
140
140
  }, z.core.$strict>;
141
- type Config = z.infer<typeof config> & {
141
+ export type Config = z.infer<typeof config> & {
142
142
  __tableToEntityName?: Record<string, string>;
143
143
  };
144
- declare const ormMaintainedFields: string[];
144
+ export declare const ormMaintainedFields: string[];
145
145
  /** Ensure the user doesn't have any typos in their config. */
146
- declare function warnInvalidConfigEntries(config: Config, db: DbMetadata): void;
147
- declare function isGetterField(config: Config, entity: Entity, fieldName: string): boolean;
148
- declare function isReactiveField(config: Config, entity: Entity, fieldName: string): boolean;
149
- declare function isReactiveReference(config: Config, entity: Entity, fieldName: string): boolean;
146
+ export declare function warnInvalidConfigEntries(config: Config, db: DbMetadata): void;
147
+ export declare function isGetterField(config: Config, entity: Entity, fieldName: string): boolean;
148
+ export declare function isReactiveField(config: Config, entity: Entity, fieldName: string): boolean;
149
+ export declare function isReactiveReference(config: Config, entity: Entity, fieldName: string): boolean;
150
150
  /** Returns true if this m2m relation is configured as a ReactiveManyToMany (derived: async). */
151
- declare function isReactiveManyToMany(config: Config, entity: Entity, fieldName: string): boolean;
152
- declare function isProtected(config: Config, entity: Entity, fieldName: string): boolean;
151
+ export declare function isReactiveManyToMany(config: Config, entity: Entity, fieldName: string): boolean;
152
+ export declare function isProtected(config: Config, entity: Entity, fieldName: string): boolean;
153
153
  /** Whether a column should be excluded from the default SELECT and exposed as a lazy-loaded `LazyField`. */
154
- declare function isLazyField(config: Config, entity: Entity, fieldName: string): boolean;
155
- declare function serdeConfig(config: Config, entity: Entity, fieldName: string): string | undefined;
156
- declare function superstructConfig(config: Config, entity: Entity, fieldName: string): string | undefined;
157
- declare function zodSchemaConfig(config: Config, entity: Entity, fieldName: string): string | undefined;
158
- declare function fieldTypeConfig(config: Config, entity: Entity, fieldName: string): string | undefined;
159
- declare function isLargeCollection(config: Config, entity: Entity, fieldName: string): boolean;
154
+ export declare function isLazyField(config: Config, entity: Entity, fieldName: string): boolean;
155
+ export declare function serdeConfig(config: Config, entity: Entity, fieldName: string): string | undefined;
156
+ export declare function superstructConfig(config: Config, entity: Entity, fieldName: string): string | undefined;
157
+ export declare function zodSchemaConfig(config: Config, entity: Entity, fieldName: string): string | undefined;
158
+ export declare function fieldTypeConfig(config: Config, entity: Entity, fieldName: string): string | undefined;
159
+ export declare function isLargeCollection(config: Config, entity: Entity, fieldName: string): boolean;
160
160
  /** Whether a collection should include (or exclude) soft-deleted entities from `.get`/`.load`. */
161
- declare function softDeletesConfig(config: Config, entity: Entity, fieldName: string): "include" | "exclude" | undefined;
162
- declare function isFieldIgnored(config: Config, entity: Entity, fieldName: string, notNull?: boolean, hasDefault?: boolean): boolean;
163
- declare function isFieldHasDefault(config: Config, entity: Entity, fieldName: string): boolean;
164
- declare function loadConfig(): Promise<Config>;
161
+ export declare function softDeletesConfig(config: Config, entity: Entity, fieldName: string): "include" | "exclude" | undefined;
162
+ export declare function isFieldIgnored(config: Config, entity: Entity, fieldName: string, notNull?: boolean, hasDefault?: boolean): boolean;
163
+ export declare function isFieldHasDefault(config: Config, entity: Entity, fieldName: string): boolean;
164
+ export declare function loadConfig(): Promise<Config>;
165
165
  /**
166
166
  * Writes the potentially-updated config entry back to `joist-config.json`.
167
167
  *
168
168
  * We format the output with prettier so it should both a) look nice and b) be deterministic,
169
169
  * such that no changes to the config show up as noops to the scm.
170
170
  */
171
- declare function writeConfig(config: Config): Promise<void>;
172
- declare function stripStiPlaceholders(config: Config, entities: EntityDbMetadata[]): void;
171
+ export declare function writeConfig(config: Config): Promise<void>;
172
+ export declare function stripStiPlaceholders(config: Config, entities: EntityDbMetadata[]): void;
173
173
  /** Applies defaults to the timestamp config. */
174
- declare function getTimestampConfig(config: Config): {
174
+ export declare function getTimestampConfig(config: Config): {
175
175
  updatedAtConf: Required<TimestampConfig>;
176
176
  createdAtConf: Required<TimestampConfig>;
177
177
  deletedAtConf: Required<TimestampConfig>;
178
178
  };
179
179
  //#endregion
180
- export { Config, EntityConfig, FieldConfig, RelationConfig, TimestampConfig, config, fieldTypeConfig, getTimestampConfig, isFieldHasDefault, isFieldIgnored, isGetterField, isLargeCollection, isLazyField, isProtected, isReactiveField, isReactiveManyToMany, isReactiveReference, loadConfig, ormMaintainedFields, serdeConfig, softDeletesConfig, stripStiPlaceholders, superstructConfig, warnInvalidConfigEntries, writeConfig, zodSchemaConfig };
180
+ export {};
181
181
  //# sourceMappingURL=config.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;cAiBM,aAAW,EAAA;;;;;;;;;;;;;GAmBN,EAAA,KAAA;KAE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QAAQ,QAAQ,QAAQ;wBAQ5C,cAAc,QAAQ;;;;;;;wBA2BtB,YAAY,QAAQ,SAAS;wBAYnC,qBAAqB,QAAQ,QAAQ,UAAU;;wBAY/C,mBAAmB,QAAQ;EACzC,eAAe,SAAS;EACxB,eAAe,SAAS;EACxB,eAAe,SAAS"}
package/build/config.js CHANGED
@@ -208,7 +208,7 @@ function warnInvalidConfigEntries(config, db) {
208
208
  for (const uniqueBy of entityConfig.uniqueBy || []) for (const name of uniqueBy) {
209
209
  const field = uniqueFields.find((f) => f.fieldName === name);
210
210
  if (!field) logger.warn(`Found uniqueBy for non-existent or non-queryable field ${entityName}.${name}`);
211
- else if (field.kind === "primitive" && (field.derived || field.isArray || field.customSerde)) logger.warn(`Found uniqueBy for unsupported primitive field ${entityName}.${name}`);
211
+ else if (field.kind === "primitive" && (field.derived || field.customSerde)) logger.warn(`Found uniqueBy for unsupported primitive field ${entityName}.${name}`);
212
212
  else if (field.kind === "enum" && (field.derived || field.isArray)) logger.warn(`Found uniqueBy for unsupported enum field ${entityName}.${name}`);
213
213
  }
214
214
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":["fs"],"sources":["../src/config.ts"],"sourcesContent":["import { existsSync, promises as fs, readFileSync } from \"fs\";\nimport { dirname, join } from \"path\";\n\nimport { createFromBuffer } from \"@dprint/formatter\";\nimport { getPath } from \"@dprint/json\";\nimport { groupBy } from \"joist-utils\";\nimport { type ParseError, parse } from \"jsonc-parser\";\nimport { z } from \"zod\";\n\nimport { getLatestCodemodVersion } from \"./codemods/index.ts\";\nimport { type DbMetadata, type Entity, type EntityDbMetadata } from \"./EntityDbMetadata.ts\";\nimport { getStiEntities } from \"./inheritance.ts\";\nimport { logger } from \"./logger.ts\";\nimport { fail, sortKeys, trueIfResolved } from \"./utils.ts\";\n\nconst jsonFormatter = createFromBuffer(readFileSync(getPath()));\n\nconst fieldConfig = z\n .object({\n // For getters & ReactiveFields\n derived: z.optional(z.union([z.literal(\"sync\"), z.literal(\"async\")])),\n protected: z.optional(z.boolean()),\n ignore: z.optional(z.boolean()),\n superstruct: z.optional(z.string()),\n zodSchema: z.optional(z.string()),\n type: z.optional(z.string()),\n serde: z.optional(z.string()),\n stiDiscriminator: z.optional(z.record(z.string(), z.string())),\n stiType: z.optional(z.union([z.string(), z.array(z.string())])),\n // Allow subclasses to mark fields as required\n notNull: z.optional(z.boolean()),\n // Allow overriding scanEntities default detection for fields with defaults added by helpers\n hasDefault: z.optional(z.boolean()),\n // Exclude a (large jsonb/text) column from the default SELECT and expose it as a lazy-loaded LazyField\n lazy: z.optional(z.boolean()),\n })\n .strict();\n\nexport type FieldConfig = z.infer<typeof fieldConfig>;\n\nconst relationConfig = z\n .object({\n // For ReactiveReferences\n derived: z.optional(z.literal(\"async\")),\n polymorphic: z.optional(z.union([z.literal(\"notNull\"), z.literal(true)])),\n large: z.optional(z.boolean()),\n orderBy: z.optional(z.string()),\n /**\n * Controls whether this collection's `.get`/`.load` hide soft-deleted entities.\n *\n * Defaults to `\"exclude\"` (soft-deleted entities are hidden); set to `\"include\"` to have\n * this specific o2m/m2m always return soft-deleted entities from `.get`/`.load`.\n */\n softDeletes: z.optional(z.union([z.literal(\"include\"), z.literal(\"exclude\")])),\n // Allow pushing m2o/m2m/o2o relations in a base type (Task) down to a subtype (TaskOld)\n stiType: z.optional(z.union([z.string(), z.array(z.string())])),\n /**\n * Allow specializing a base type relation (SmallPublisher.group: SmallPublisherGroup).\n *\n * Self-referential FKs also support `subType: \"self\"` that means each subtype will point\n * at its own subtype.\n */\n subType: z.optional(z.string()),\n /** Allow skipping self-referential fields getting a `...Recursive` relation. */\n skipRecursiveRelations: z.optional(z.boolean()),\n // Allow marking m2o FKs as required on subclasses\n notNull: z.optional(z.boolean()),\n // Allow overriding scanEntities default detection for fields with defaults added by helpers\n hasDefault: z.optional(z.boolean()),\n })\n .strict();\n\nexport type RelationConfig = z.infer<typeof relationConfig>;\n\nconst uniqueByConfig = z\n .union([z.string(), z.array(z.string()), z.array(z.array(z.string()))])\n .transform(normalizeUniqueByConfig);\n\nconst entityConfig = z\n .object({\n tag: z.string(),\n tableName: z.optional(z.string()),\n fields: z.optional(z.record(z.string(), fieldConfig)),\n relations: z.optional(z.record(z.string(), relationConfig)),\n /** Whether this entity should be abstract, e.g. for inheritance a subtype must be instantiated instead of this type. */\n abstract: z.optional(z.boolean()),\n orderBy: z.optional(z.string()),\n uniqueBy: z.optional(uniqueByConfig),\n })\n .strict();\n\nexport type EntityConfig = z.infer<typeof entityConfig>;\n\nconst timestampConfig = z\n .object({\n /** The names to check for this timestamp, i.e. `created_at` `created`, etc. */\n names: z.array(z.string()),\n /** Whether this timestamp column is required to consider a table an entity, defaults to `false`. */\n required: z.optional(z.boolean()),\n })\n .strict();\n\nexport type TimestampConfig = z.infer<typeof timestampConfig>;\n\nexport const config = z\n .object({\n /** The _build-time_ database URL for reading database metadata. */\n databaseUrl: z.optional(z.string()),\n /** Your application's request-level `Context` type. */\n contextType: z.optional(z.string()),\n /** Your application's database client's `Transaction` type. */\n transactionType: z.optional(z.string()),\n /**\n * Allows the user to specify the `updated_at` / `created_at` column names to look up, and if they're optional.\n *\n * We default to looking for `updated_at`, `updatedAt`, `created_at`, `createdAt`, and optional to true,\n * e.g. tables are not required to have both timestamp columns to be considered entities.\n *\n * These defaults are the most lenient, to facilitate running Joist against an existing schema and\n * seeing all of your entities, regardless of your previous conventions.\n */\n timestampColumns: z.optional(\n z.object({\n createdAt: z.optional(timestampConfig),\n updatedAt: z.optional(timestampConfig),\n deletedAt: z.optional(timestampConfig),\n }),\n ),\n /**\n * Allows the user to have codegen output `Temporal` types instead of the base JS `Date`\n *\n * Additionally, allows for specifying the default time zone for `Temporal` types when converting dates to/from\n * the database.\n */\n temporal: z.optional(z.union([z.boolean(), z.object({ timeZone: z.string() })])),\n /**\n * By default, we create a `flush_database` function for fast testing.\n *\n * However, if you don't want to use this, or you have your own bespoke function like we do\n * that is more application-aware, then you can disable Joist's out-of-the-box one.\n *\n * If you have more than one test database, you can set `createFlushFunction` to the array\n * of test database names, i.e. `mydb_test_1`, `mydb_test_2`, etc.\n */\n createFlushFunction: z.optional(z.union([z.boolean(), z.array(z.string())])),\n entitiesDirectory: z.string().default(\"./src/entities\"),\n codegenPlugins: z.optional(z.array(z.string())),\n entities: z.record(z.string(), entityConfig).default({}),\n ignoredTables: z.optional(z.array(z.string())),\n /** The type of entity `id` fields; defaults to `tagged-string`. */\n idType: z.optional(z.union([z.literal(\"tagged-string\"), z.literal(\"untagged-string\"), z.literal(\"number\")])),\n /** The separator between entity tags and ids; defaults to `:`, and `\"\"` disables the separator. */\n tagDelimiter: z.optional(z.string()),\n /** How we should support non-deferred foreign keys. */\n nonDeferredForeignKeys: z.optional(z.union([z.literal(\"error\"), z.literal(\"warn\"), z.literal(\"ignore\")])),\n /** Enables esm output. */\n esm: z.optional(z.boolean()),\n /** Controls the style of GraphQL pagination scaffolding. */\n paginationStyle: z.optional(z.union([z.literal(\"cursor\"), z.literal(\"limit\")])).default(\"cursor\"),\n /** Enables documentation syncing between .md files and JSDocs. */\n docs: z.optional(z.boolean()),\n /** Installs Joist's bundled Agent Skills into `.claude/skills` and `.agents/skills`; on by default, set `false` to disable. */\n skills: z.optional(z.boolean()),\n /** Output a metadata-docs.ts file with entity/field documentation available at runtime. */\n outputDocs: z.optional(z.boolean()),\n /** Auto-set by probing the project's `tsconfig.json` file. */\n allowImportingTsExtensions: z.optional(z.boolean()),\n /** The latest Joist codemod counter that has been applied to this project. */\n codemodVersion: z.number().int().min(0).default(0),\n\n /** A list of postgres schemas to use for finding tables */\n schemas: z.optional(z.array(z.string())),\n })\n .strict();\n\nexport type Config = z.infer<typeof config> & {\n // We don't persist this, and instead just use it as a cache\n __tableToEntityName?: Record<string, string>;\n};\n\nexport const ormMaintainedFields = [\"createdAt\", \"updatedAt\"];\n\n/** Ensure the user doesn't have any typos in their config. */\nexport function warnInvalidConfigEntries(config: Config, db: DbMetadata): void {\n const entitiesByName = groupBy(db.entities, (e) => e.name);\n for (const [entityName, entityConfig] of Object.entries(config.entities)) {\n const entities = entitiesByName[entityName];\n if (!entities) {\n logger.warn(`Found config for non-existent entity ${entityName}`);\n continue;\n }\n // We don't have keyBy...\n const [entity] = entities;\n\n // Check fields\n const fields = [...entity.primitives, ...entity.enums];\n for (const [name, config] of Object.entries(entityConfig.fields || {})) {\n if (config.ignore) continue;\n let field = fields.find((f) => f.fieldName === name);\n // STI types might be in the base type\n if (!field && entity.stiDiscriminatorField) {\n const stiEntities = getStiEntities(db.entities).get(entity.name)?.subTypes;\n field = stiEntities?.flatMap((st) => [...st.primitives, ...st.enums]).find((f) => f.fieldName === name);\n }\n if (!field) logger.warn(`Found config for non-existent field ${entityName}.${name}`);\n }\n\n // Check relations\n const relations = [\n ...entity.manyToOnes,\n ...entity.oneToManys,\n ...entity.manyToManys,\n ...entity.manyToManyEnums,\n ...entity.oneToOnes,\n ...entity.largeOneToManys,\n ...entity.largeManyToManys,\n ...entity.polymorphics,\n ];\n for (const [name, _] of Object.entries(entityConfig.relations || {})) {\n let relation = relations.find((r) => r.fieldName === name);\n // STI types might be in the subtypes\n if (!relation && entity.stiDiscriminatorField) {\n const stiEntities = getStiEntities(db.entities).get(entity.name)?.subTypes;\n relation = stiEntities\n ?.flatMap((entity) => [\n ...entity.manyToOnes,\n ...entity.oneToManys,\n ...entity.manyToManys,\n ...entity.oneToOnes,\n ...entity.largeOneToManys,\n ...entity.largeManyToManys,\n ...entity.polymorphics,\n ])\n ?.find((f) => f.fieldName === name);\n }\n // CTI subtype specializations (i.e. SmallPublisher.group: SmallPublisherGroup) need to look in the base type\n if (!relation && entity.baseType) {\n const baseType = entity.baseType;\n relation = [\n ...baseType.manyToOnes,\n ...baseType.oneToManys,\n ...baseType.manyToManys,\n ...baseType.oneToOnes,\n ...baseType.largeOneToManys,\n ...baseType.largeManyToManys,\n ...baseType.polymorphics,\n ].find((f) => f.fieldName === name);\n }\n\n if (!relation) logger.warn(`Found config for non-existent relation ${entityName}.${name}`);\n }\n\n const uniqueFields = [\n ...entity.primitives,\n ...entity.enums,\n ...entity.pgEnums,\n ...entity.manyToOnes,\n ...entity.polymorphics,\n ];\n for (const uniqueBy of entityConfig.uniqueBy || []) {\n for (const name of uniqueBy) {\n const field = uniqueFields.find((f) => f.fieldName === name);\n if (!field) {\n logger.warn(`Found uniqueBy for non-existent or non-queryable field ${entityName}.${name}`);\n } else if (field.kind === \"primitive\" && (field.derived || field.isArray || field.customSerde)) {\n logger.warn(`Found uniqueBy for unsupported primitive field ${entityName}.${name}`);\n } else if (field.kind === \"enum\" && (field.derived || field.isArray)) {\n logger.warn(`Found uniqueBy for unsupported enum field ${entityName}.${name}`);\n }\n }\n }\n }\n}\n\nexport function isGetterField(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.fields?.[fieldName]?.derived === \"sync\";\n}\n\nexport function isReactiveField(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.fields?.[fieldName]?.derived === \"async\";\n}\n\nexport function isReactiveReference(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.relations?.[fieldName]?.derived === \"async\";\n}\n\n/** Returns true if this m2m relation is configured as a ReactiveManyToMany (derived: async). */\nexport function isReactiveManyToMany(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.relations?.[fieldName]?.derived === \"async\";\n}\n\nexport function isProtected(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.fields?.[fieldName]?.protected === true;\n}\n\n/** Whether a column should be excluded from the default SELECT and exposed as a lazy-loaded `LazyField`. */\nexport function isLazyField(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.fields?.[fieldName]?.lazy === true;\n}\n\nexport function serdeConfig(config: Config, entity: Entity, fieldName: string): string | undefined {\n return config.entities[entity.name]?.fields?.[fieldName]?.serde;\n}\n\nexport function superstructConfig(config: Config, entity: Entity, fieldName: string): string | undefined {\n return config.entities[entity.name]?.fields?.[fieldName]?.superstruct;\n}\n\nexport function zodSchemaConfig(config: Config, entity: Entity, fieldName: string): string | undefined {\n return config.entities[entity.name]?.fields?.[fieldName]?.zodSchema;\n}\n\nexport function fieldTypeConfig(config: Config, entity: Entity, fieldName: string): string | undefined {\n return config.entities[entity.name]?.fields?.[fieldName]?.type;\n}\n\nexport function isLargeCollection(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.relations?.[fieldName]?.large === true;\n}\n\n/** Whether a collection should include (or exclude) soft-deleted entities from `.get`/`.load`. */\nexport function softDeletesConfig(\n config: Config,\n entity: Entity,\n fieldName: string,\n): \"include\" | \"exclude\" | undefined {\n return config.entities[entity.name]?.relations?.[fieldName]?.softDeletes;\n}\n\nexport function isFieldIgnored(\n config: Config,\n entity: Entity,\n fieldName: string,\n notNull: boolean = false,\n hasDefault: boolean = false,\n): boolean {\n const ignore = config.entities[entity.name]?.fields?.[fieldName]?.ignore === true;\n if (ignore && notNull && !hasDefault) {\n fail(\n `notNull field ${entity.name}.${fieldName} cannot be ignored. Alter the column to be optional or have a default value prior to ignoring it.`,\n );\n }\n return ignore;\n}\n\nexport function isFieldHasDefault(config: Config, entity: Entity, fieldName: string): boolean {\n const entityConfig = config.entities[entity.name] ?? {};\n const fieldConfig = entityConfig.fields?.[fieldName] ?? entityConfig.relations?.[fieldName] ?? {};\n return fieldConfig.hasDefault === true;\n}\n\nconst configPath = \"./joist-config.json\";\n\nexport async function loadConfig(): Promise<Config> {\n const exists = await trueIfResolved(fs.access(configPath));\n if (exists) {\n const content = await fs.readFile(configPath);\n const result = config.safeParse(stripLegacyConfigKeys(JSON.parse(content.toString())));\n if (!result.success) {\n throw new Error(\n `Invalid joist-config.json: ${result.error.issues\n .map((ze) => `${ze.path.map(String).join(\"/\")} ${ze.message}`)\n .join(\"\\n\")}`,\n );\n }\n result.data.allowImportingTsExtensions ??= projectIsUsingEsmWithImports();\n return result.data;\n }\n // Brand-new projects should not be prompted to run historical codemods.\n const initial = config.parse({ codemodVersion: getLatestCodemodVersion() });\n initial.allowImportingTsExtensions ??= projectIsUsingEsmWithImports();\n return initial;\n}\n\n/**\n * Writes the potentially-updated config entry back to `joist-config.json`.\n *\n * We format the output with prettier so it should both a) look nice and b) be deterministic,\n * such that no changes to the config show up as noops to the scm.\n */\nexport async function writeConfig(config: Config): Promise<void> {\n const sorted: Partial<Config> = sortKeys(config);\n delete sorted.__tableToEntityName;\n delete sorted.allowImportingTsExtensions;\n if (sorted.paginationStyle === \"cursor\") {\n delete sorted.paginationStyle;\n }\n const input = JSON.stringify(sorted);\n const content = jsonFormatter.formatText({ filePath: \"test.json\", fileText: input });\n await fs.writeFile(configPath, content);\n}\n\nexport function stripStiPlaceholders(config: Config, entities: EntityDbMetadata[]): void {\n // Defacto (with today's setup) the config of STI entities lives on the base entity,\n // so don't write confusing subtype-specific entries into the config file.\n // ...hopefully we don't have any code accidentally looking for the STI config...\n for (const entity of entities) {\n if (entity.inheritanceType === \"sti\" && entity.stiDiscriminatorValue) {\n delete config.entities[entity.name];\n }\n }\n}\n\n/** Applies defaults to the timestamp config. */\nexport function getTimestampConfig(config: Config): {\n updatedAtConf: Required<TimestampConfig>;\n createdAtConf: Required<TimestampConfig>;\n deletedAtConf: Required<TimestampConfig>;\n} {\n return {\n createdAtConf: {\n names: [\"created_at\", \"createdAt\"],\n required: false,\n ...config?.timestampColumns?.createdAt,\n },\n updatedAtConf: {\n names: [\"updated_at\", \"updatedAt\"],\n required: false,\n ...config?.timestampColumns?.updatedAt,\n },\n deletedAtConf: {\n names: [\"deleted_at\", \"deletedAt\"],\n required: false,\n ...config?.timestampColumns?.deletedAt,\n },\n };\n}\n\nfunction projectIsUsingEsmWithImports(): boolean {\n // Attempt to find the project's tsconfig.json in the current directory or up the directory hierarchy\n const configPath = findTsConfigFile(process.cwd());\n if (!configPath) {\n return false;\n }\n try {\n // Use jsonc-parser to parse the tsconfig.json file (not the old tsc readConfigFile which was\n // dropped in TypeScript 7), allowing for comments and trailing commas.\n const errors: ParseError[] = [];\n const parsed: unknown = parse(readFileSync(configPath, \"utf8\"), errors, { allowTrailingComma: true });\n if (errors.length > 0 || typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) return false;\n const compilerOptions = (parsed as Record<string, unknown>).compilerOptions;\n return (\n typeof compilerOptions === \"object\" &&\n compilerOptions !== null &&\n !Array.isArray(compilerOptions) &&\n (compilerOptions as Record<string, unknown>).allowImportingTsExtensions === true\n );\n } catch {\n return false;\n }\n}\n\n/** Normalizes `uniqueBy` config sugar into runtime identity candidates. */\nfunction normalizeUniqueByConfig(uniqueBy: string | string[] | string[][]): string[][] {\n if (typeof uniqueBy === \"string\") return [[uniqueBy]];\n if (uniqueBy.every((field) => typeof field === \"string\")) return [uniqueBy];\n return uniqueBy;\n}\n\nfunction stripLegacyConfigKeys(raw: unknown): unknown {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) {\n return raw;\n }\n // Accept old configs so the deprecated key disappears on the next write.\n const parsed = { ...(raw as Record<string, unknown>) };\n delete parsed.version;\n return parsed;\n}\n\n/** Finds the nearest `tsconfig.json` in `directory` or one of its ancestors. */\nfunction findTsConfigFile(directory: string): string | undefined {\n while (true) {\n const fileName = join(directory, \"tsconfig.json\");\n if (existsSync(fileName)) return fileName;\n const parent = dirname(directory);\n if (parent === directory) return undefined;\n directory = parent;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAM,gBAAgB,iBAAiB,aAAa,QAAQ,CAAC,CAAC;AAE9D,MAAM,cAAc,EACjB,OAAO;CAEN,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,QAAQ,MAAM,GAAG,EAAE,QAAQ,OAAO,CAAC,CAAC,CAAC;CACpE,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC;CACjC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC9B,aAAa,EAAE,SAAS,EAAE,OAAO,CAAC;CAClC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CACh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AAG,OAAO;EACjC,MAAM,SAAS,QAAQ,SAAS;EAChC,IAAI,WAAW,WAAW,OAAO,KAAA;EACjC,YAAY;CACd;AACF"}
1
+ {"version":3,"file":"config.js","names":["fs"],"sources":["../src/config.ts"],"sourcesContent":["import { existsSync, promises as fs, readFileSync } from \"fs\";\nimport { dirname, join } from \"path\";\n\nimport { createFromBuffer } from \"@dprint/formatter\";\nimport { getPath } from \"@dprint/json\";\nimport { groupBy } from \"joist-utils\";\nimport { type ParseError, parse } from \"jsonc-parser\";\nimport { z } from \"zod\";\n\nimport { getLatestCodemodVersion } from \"./codemods/index.ts\";\nimport { type DbMetadata, type Entity, type EntityDbMetadata } from \"./EntityDbMetadata.ts\";\nimport { getStiEntities } from \"./inheritance.ts\";\nimport { logger } from \"./logger.ts\";\nimport { fail, sortKeys, trueIfResolved } from \"./utils.ts\";\n\nconst jsonFormatter = createFromBuffer(readFileSync(getPath()));\n\nconst fieldConfig = z\n .object({\n // For getters & ReactiveFields\n derived: z.optional(z.union([z.literal(\"sync\"), z.literal(\"async\")])),\n protected: z.optional(z.boolean()),\n ignore: z.optional(z.boolean()),\n superstruct: z.optional(z.string()),\n zodSchema: z.optional(z.string()),\n type: z.optional(z.string()),\n serde: z.optional(z.string()),\n stiDiscriminator: z.optional(z.record(z.string(), z.string())),\n stiType: z.optional(z.union([z.string(), z.array(z.string())])),\n // Allow subclasses to mark fields as required\n notNull: z.optional(z.boolean()),\n // Allow overriding scanEntities default detection for fields with defaults added by helpers\n hasDefault: z.optional(z.boolean()),\n // Exclude a (large jsonb/text) column from the default SELECT and expose it as a lazy-loaded LazyField\n lazy: z.optional(z.boolean()),\n })\n .strict();\n\nexport type FieldConfig = z.infer<typeof fieldConfig>;\n\nconst relationConfig = z\n .object({\n // For ReactiveReferences\n derived: z.optional(z.literal(\"async\")),\n polymorphic: z.optional(z.union([z.literal(\"notNull\"), z.literal(true)])),\n large: z.optional(z.boolean()),\n orderBy: z.optional(z.string()),\n /**\n * Controls whether this collection's `.get`/`.load` hide soft-deleted entities.\n *\n * Defaults to `\"exclude\"` (soft-deleted entities are hidden); set to `\"include\"` to have\n * this specific o2m/m2m always return soft-deleted entities from `.get`/`.load`.\n */\n softDeletes: z.optional(z.union([z.literal(\"include\"), z.literal(\"exclude\")])),\n // Allow pushing m2o/m2m/o2o relations in a base type (Task) down to a subtype (TaskOld)\n stiType: z.optional(z.union([z.string(), z.array(z.string())])),\n /**\n * Allow specializing a base type relation (SmallPublisher.group: SmallPublisherGroup).\n *\n * Self-referential FKs also support `subType: \"self\"` that means each subtype will point\n * at its own subtype.\n */\n subType: z.optional(z.string()),\n /** Allow skipping self-referential fields getting a `...Recursive` relation. */\n skipRecursiveRelations: z.optional(z.boolean()),\n // Allow marking m2o FKs as required on subclasses\n notNull: z.optional(z.boolean()),\n // Allow overriding scanEntities default detection for fields with defaults added by helpers\n hasDefault: z.optional(z.boolean()),\n })\n .strict();\n\nexport type RelationConfig = z.infer<typeof relationConfig>;\n\nconst uniqueByConfig = z\n .union([z.string(), z.array(z.string()), z.array(z.array(z.string()))])\n .transform(normalizeUniqueByConfig);\n\nconst entityConfig = z\n .object({\n tag: z.string(),\n tableName: z.optional(z.string()),\n fields: z.optional(z.record(z.string(), fieldConfig)),\n relations: z.optional(z.record(z.string(), relationConfig)),\n /** Whether this entity should be abstract, e.g. for inheritance a subtype must be instantiated instead of this type. */\n abstract: z.optional(z.boolean()),\n orderBy: z.optional(z.string()),\n uniqueBy: z.optional(uniqueByConfig),\n })\n .strict();\n\nexport type EntityConfig = z.infer<typeof entityConfig>;\n\nconst timestampConfig = z\n .object({\n /** The names to check for this timestamp, i.e. `created_at` `created`, etc. */\n names: z.array(z.string()),\n /** Whether this timestamp column is required to consider a table an entity, defaults to `false`. */\n required: z.optional(z.boolean()),\n })\n .strict();\n\nexport type TimestampConfig = z.infer<typeof timestampConfig>;\n\nexport const config = z\n .object({\n /** The _build-time_ database URL for reading database metadata. */\n databaseUrl: z.optional(z.string()),\n /** Your application's request-level `Context` type. */\n contextType: z.optional(z.string()),\n /** Your application's database client's `Transaction` type. */\n transactionType: z.optional(z.string()),\n /**\n * Allows the user to specify the `updated_at` / `created_at` column names to look up, and if they're optional.\n *\n * We default to looking for `updated_at`, `updatedAt`, `created_at`, `createdAt`, and optional to true,\n * e.g. tables are not required to have both timestamp columns to be considered entities.\n *\n * These defaults are the most lenient, to facilitate running Joist against an existing schema and\n * seeing all of your entities, regardless of your previous conventions.\n */\n timestampColumns: z.optional(\n z.object({\n createdAt: z.optional(timestampConfig),\n updatedAt: z.optional(timestampConfig),\n deletedAt: z.optional(timestampConfig),\n }),\n ),\n /**\n * Allows the user to have codegen output `Temporal` types instead of the base JS `Date`\n *\n * Additionally, allows for specifying the default time zone for `Temporal` types when converting dates to/from\n * the database.\n */\n temporal: z.optional(z.union([z.boolean(), z.object({ timeZone: z.string() })])),\n /**\n * By default, we create a `flush_database` function for fast testing.\n *\n * However, if you don't want to use this, or you have your own bespoke function like we do\n * that is more application-aware, then you can disable Joist's out-of-the-box one.\n *\n * If you have more than one test database, you can set `createFlushFunction` to the array\n * of test database names, i.e. `mydb_test_1`, `mydb_test_2`, etc.\n */\n createFlushFunction: z.optional(z.union([z.boolean(), z.array(z.string())])),\n entitiesDirectory: z.string().default(\"./src/entities\"),\n codegenPlugins: z.optional(z.array(z.string())),\n entities: z.record(z.string(), entityConfig).default({}),\n ignoredTables: z.optional(z.array(z.string())),\n /** The type of entity `id` fields; defaults to `tagged-string`. */\n idType: z.optional(z.union([z.literal(\"tagged-string\"), z.literal(\"untagged-string\"), z.literal(\"number\")])),\n /** The separator between entity tags and ids; defaults to `:`, and `\"\"` disables the separator. */\n tagDelimiter: z.optional(z.string()),\n /** How we should support non-deferred foreign keys. */\n nonDeferredForeignKeys: z.optional(z.union([z.literal(\"error\"), z.literal(\"warn\"), z.literal(\"ignore\")])),\n /** Enables esm output. */\n esm: z.optional(z.boolean()),\n /** Controls the style of GraphQL pagination scaffolding. */\n paginationStyle: z.optional(z.union([z.literal(\"cursor\"), z.literal(\"limit\")])).default(\"cursor\"),\n /** Enables documentation syncing between .md files and JSDocs. */\n docs: z.optional(z.boolean()),\n /** Installs Joist's bundled Agent Skills into `.claude/skills` and `.agents/skills`; on by default, set `false` to disable. */\n skills: z.optional(z.boolean()),\n /** Output a metadata-docs.ts file with entity/field documentation available at runtime. */\n outputDocs: z.optional(z.boolean()),\n /** Auto-set by probing the project's `tsconfig.json` file. */\n allowImportingTsExtensions: z.optional(z.boolean()),\n /** The latest Joist codemod counter that has been applied to this project. */\n codemodVersion: z.number().int().min(0).default(0),\n\n /** A list of postgres schemas to use for finding tables */\n schemas: z.optional(z.array(z.string())),\n })\n .strict();\n\nexport type Config = z.infer<typeof config> & {\n // We don't persist this, and instead just use it as a cache\n __tableToEntityName?: Record<string, string>;\n};\n\nexport const ormMaintainedFields = [\"createdAt\", \"updatedAt\"];\n\n/** Ensure the user doesn't have any typos in their config. */\nexport function warnInvalidConfigEntries(config: Config, db: DbMetadata): void {\n const entitiesByName = groupBy(db.entities, (e) => e.name);\n for (const [entityName, entityConfig] of Object.entries(config.entities)) {\n const entities = entitiesByName[entityName];\n if (!entities) {\n logger.warn(`Found config for non-existent entity ${entityName}`);\n continue;\n }\n // We don't have keyBy...\n const [entity] = entities;\n\n // Check fields\n const fields = [...entity.primitives, ...entity.enums];\n for (const [name, config] of Object.entries(entityConfig.fields || {})) {\n if (config.ignore) continue;\n let field = fields.find((f) => f.fieldName === name);\n // STI types might be in the base type\n if (!field && entity.stiDiscriminatorField) {\n const stiEntities = getStiEntities(db.entities).get(entity.name)?.subTypes;\n field = stiEntities?.flatMap((st) => [...st.primitives, ...st.enums]).find((f) => f.fieldName === name);\n }\n if (!field) logger.warn(`Found config for non-existent field ${entityName}.${name}`);\n }\n\n // Check relations\n const relations = [\n ...entity.manyToOnes,\n ...entity.oneToManys,\n ...entity.manyToManys,\n ...entity.manyToManyEnums,\n ...entity.oneToOnes,\n ...entity.largeOneToManys,\n ...entity.largeManyToManys,\n ...entity.polymorphics,\n ];\n for (const [name, _] of Object.entries(entityConfig.relations || {})) {\n let relation = relations.find((r) => r.fieldName === name);\n // STI types might be in the subtypes\n if (!relation && entity.stiDiscriminatorField) {\n const stiEntities = getStiEntities(db.entities).get(entity.name)?.subTypes;\n relation = stiEntities\n ?.flatMap((entity) => [\n ...entity.manyToOnes,\n ...entity.oneToManys,\n ...entity.manyToManys,\n ...entity.oneToOnes,\n ...entity.largeOneToManys,\n ...entity.largeManyToManys,\n ...entity.polymorphics,\n ])\n ?.find((f) => f.fieldName === name);\n }\n // CTI subtype specializations (i.e. SmallPublisher.group: SmallPublisherGroup) need to look in the base type\n if (!relation && entity.baseType) {\n const baseType = entity.baseType;\n relation = [\n ...baseType.manyToOnes,\n ...baseType.oneToManys,\n ...baseType.manyToManys,\n ...baseType.oneToOnes,\n ...baseType.largeOneToManys,\n ...baseType.largeManyToManys,\n ...baseType.polymorphics,\n ].find((f) => f.fieldName === name);\n }\n\n if (!relation) logger.warn(`Found config for non-existent relation ${entityName}.${name}`);\n }\n\n const uniqueFields = [\n ...entity.primitives,\n ...entity.enums,\n ...entity.pgEnums,\n ...entity.manyToOnes,\n ...entity.polymorphics,\n ];\n for (const uniqueBy of entityConfig.uniqueBy || []) {\n for (const name of uniqueBy) {\n const field = uniqueFields.find((f) => f.fieldName === name);\n if (!field) {\n logger.warn(`Found uniqueBy for non-existent or non-queryable field ${entityName}.${name}`);\n } else if (field.kind === \"primitive\" && (field.derived || field.customSerde)) {\n logger.warn(`Found uniqueBy for unsupported primitive field ${entityName}.${name}`);\n } else if (field.kind === \"enum\" && (field.derived || field.isArray)) {\n logger.warn(`Found uniqueBy for unsupported enum field ${entityName}.${name}`);\n }\n }\n }\n }\n}\n\nexport function isGetterField(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.fields?.[fieldName]?.derived === \"sync\";\n}\n\nexport function isReactiveField(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.fields?.[fieldName]?.derived === \"async\";\n}\n\nexport function isReactiveReference(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.relations?.[fieldName]?.derived === \"async\";\n}\n\n/** Returns true if this m2m relation is configured as a ReactiveManyToMany (derived: async). */\nexport function isReactiveManyToMany(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.relations?.[fieldName]?.derived === \"async\";\n}\n\nexport function isProtected(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.fields?.[fieldName]?.protected === true;\n}\n\n/** Whether a column should be excluded from the default SELECT and exposed as a lazy-loaded `LazyField`. */\nexport function isLazyField(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.fields?.[fieldName]?.lazy === true;\n}\n\nexport function serdeConfig(config: Config, entity: Entity, fieldName: string): string | undefined {\n return config.entities[entity.name]?.fields?.[fieldName]?.serde;\n}\n\nexport function superstructConfig(config: Config, entity: Entity, fieldName: string): string | undefined {\n return config.entities[entity.name]?.fields?.[fieldName]?.superstruct;\n}\n\nexport function zodSchemaConfig(config: Config, entity: Entity, fieldName: string): string | undefined {\n return config.entities[entity.name]?.fields?.[fieldName]?.zodSchema;\n}\n\nexport function fieldTypeConfig(config: Config, entity: Entity, fieldName: string): string | undefined {\n return config.entities[entity.name]?.fields?.[fieldName]?.type;\n}\n\nexport function isLargeCollection(config: Config, entity: Entity, fieldName: string): boolean {\n return config.entities[entity.name]?.relations?.[fieldName]?.large === true;\n}\n\n/** Whether a collection should include (or exclude) soft-deleted entities from `.get`/`.load`. */\nexport function softDeletesConfig(\n config: Config,\n entity: Entity,\n fieldName: string,\n): \"include\" | \"exclude\" | undefined {\n return config.entities[entity.name]?.relations?.[fieldName]?.softDeletes;\n}\n\nexport function isFieldIgnored(\n config: Config,\n entity: Entity,\n fieldName: string,\n notNull: boolean = false,\n hasDefault: boolean = false,\n): boolean {\n const ignore = config.entities[entity.name]?.fields?.[fieldName]?.ignore === true;\n if (ignore && notNull && !hasDefault) {\n fail(\n `notNull field ${entity.name}.${fieldName} cannot be ignored. Alter the column to be optional or have a default value prior to ignoring it.`,\n );\n }\n return ignore;\n}\n\nexport function isFieldHasDefault(config: Config, entity: Entity, fieldName: string): boolean {\n const entityConfig = config.entities[entity.name] ?? {};\n const fieldConfig = entityConfig.fields?.[fieldName] ?? entityConfig.relations?.[fieldName] ?? {};\n return fieldConfig.hasDefault === true;\n}\n\nconst configPath = \"./joist-config.json\";\n\nexport async function loadConfig(): Promise<Config> {\n const exists = await trueIfResolved(fs.access(configPath));\n if (exists) {\n const content = await fs.readFile(configPath);\n const result = config.safeParse(stripLegacyConfigKeys(JSON.parse(content.toString())));\n if (!result.success) {\n throw new Error(\n `Invalid joist-config.json: ${result.error.issues\n .map((ze) => `${ze.path.map(String).join(\"/\")} ${ze.message}`)\n .join(\"\\n\")}`,\n );\n }\n result.data.allowImportingTsExtensions ??= projectIsUsingEsmWithImports();\n return result.data;\n }\n // Brand-new projects should not be prompted to run historical codemods.\n const initial = config.parse({ codemodVersion: getLatestCodemodVersion() });\n initial.allowImportingTsExtensions ??= projectIsUsingEsmWithImports();\n return initial;\n}\n\n/**\n * Writes the potentially-updated config entry back to `joist-config.json`.\n *\n * We format the output with prettier so it should both a) look nice and b) be deterministic,\n * such that no changes to the config show up as noops to the scm.\n */\nexport async function writeConfig(config: Config): Promise<void> {\n const sorted: Partial<Config> = sortKeys(config);\n delete sorted.__tableToEntityName;\n delete sorted.allowImportingTsExtensions;\n if (sorted.paginationStyle === \"cursor\") {\n delete sorted.paginationStyle;\n }\n const input = JSON.stringify(sorted);\n const content = jsonFormatter.formatText({ filePath: \"test.json\", fileText: input });\n await fs.writeFile(configPath, content);\n}\n\nexport function stripStiPlaceholders(config: Config, entities: EntityDbMetadata[]): void {\n // Defacto (with today's setup) the config of STI entities lives on the base entity,\n // so don't write confusing subtype-specific entries into the config file.\n // ...hopefully we don't have any code accidentally looking for the STI config...\n for (const entity of entities) {\n if (entity.inheritanceType === \"sti\" && entity.stiDiscriminatorValue) {\n delete config.entities[entity.name];\n }\n }\n}\n\n/** Applies defaults to the timestamp config. */\nexport function getTimestampConfig(config: Config): {\n updatedAtConf: Required<TimestampConfig>;\n createdAtConf: Required<TimestampConfig>;\n deletedAtConf: Required<TimestampConfig>;\n} {\n return {\n createdAtConf: {\n names: [\"created_at\", \"createdAt\"],\n required: false,\n ...config?.timestampColumns?.createdAt,\n },\n updatedAtConf: {\n names: [\"updated_at\", \"updatedAt\"],\n required: false,\n ...config?.timestampColumns?.updatedAt,\n },\n deletedAtConf: {\n names: [\"deleted_at\", \"deletedAt\"],\n required: false,\n ...config?.timestampColumns?.deletedAt,\n },\n };\n}\n\nfunction projectIsUsingEsmWithImports(): boolean {\n // Attempt to find the project's tsconfig.json in the current directory or up the directory hierarchy\n const configPath = findTsConfigFile(process.cwd());\n if (!configPath) {\n return false;\n }\n try {\n // Use jsonc-parser to parse the tsconfig.json file (not the old tsc readConfigFile which was\n // dropped in TypeScript 7), allowing for comments and trailing commas.\n const errors: ParseError[] = [];\n const parsed: unknown = parse(readFileSync(configPath, \"utf8\"), errors, { allowTrailingComma: true });\n if (errors.length > 0 || typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) return false;\n const compilerOptions = (parsed as Record<string, unknown>).compilerOptions;\n return (\n typeof compilerOptions === \"object\" &&\n compilerOptions !== null &&\n !Array.isArray(compilerOptions) &&\n (compilerOptions as Record<string, unknown>).allowImportingTsExtensions === true\n );\n } catch {\n return false;\n }\n}\n\n/** Normalizes `uniqueBy` config sugar into runtime identity candidates. */\nfunction normalizeUniqueByConfig(uniqueBy: string | string[] | string[][]): string[][] {\n if (typeof uniqueBy === \"string\") return [[uniqueBy]];\n if (uniqueBy.every((field) => typeof field === \"string\")) return [uniqueBy];\n return uniqueBy;\n}\n\nfunction stripLegacyConfigKeys(raw: unknown): unknown {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) {\n return raw;\n }\n // Accept old configs so the deprecated key disappears on the next write.\n const parsed = { ...(raw as Record<string, unknown>) };\n delete parsed.version;\n return parsed;\n}\n\n/** Finds the nearest `tsconfig.json` in `directory` or one of its ancestors. */\nfunction findTsConfigFile(directory: string): string | undefined {\n while (true) {\n const fileName = join(directory, \"tsconfig.json\");\n if (existsSync(fileName)) return fileName;\n const parent = dirname(directory);\n if (parent === directory) return undefined;\n directory = parent;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAM,gBAAgB,iBAAiB,aAAa,QAAQ,CAAC,CAAC;AAE9D,MAAM,cAAc,EACjB,OAAO;CAEN,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,QAAQ,MAAM,GAAG,EAAE,QAAQ,OAAO,CAAC,CAAC,CAAC;CACpE,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC;CACjC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;CAC9B,aAAa,EAAE,SAAS,EAAE,OAAO,CAAC;CAClC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC;CAC3B,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC;CAC5B,kBAAkB,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC;CAC7D,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CAE9D,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC;CAE/B,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC;CAElC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC;AAC9B,CAAC,CAAC,CACD,OAAO;AAIV,MAAM,iBAAiB,EACpB,OAAO;CAEN,SAAS,EAAE,SAAS,EAAE,QAAQ,OAAO,CAAC;CACtC,aAAa,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,QAAQ,SAAS,GAAG,EAAE,QAAQ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EACxG,MAAM,kBAAmB,OAAmC;EAC5D,OACE,OAAO,oBAAoB,YAC3B,oBAAoB,QACpB,CAAC,MAAM,QAAQ,eAAe,KAC7B,gBAA4C,+BAA+B;CAEhF,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,SAAS,wBAAwB,UAAsD;CACrF,IAAI,OAAO,aAAa,UAAU,OAAO,CAAC,CAAC,QAAQ,CAAC;CACpD,IAAI,SAAS,OAAO,UAAU,OAAO,UAAU,QAAQ,GAAG,OAAO,CAAC,QAAQ;CAC1E,OAAO;AACT;AAEA,SAAS,sBAAsB,KAAuB;CACpD,IAAI,CAAC,OAAO,OAAO,QAAQ,YAAY,MAAM,QAAQ,GAAG,GACtD,OAAO;CAGT,MAAM,SAAS,EAAE,GAAI,IAAgC;CACrD,OAAO,OAAO;CACd,OAAO;AACT;;AAGA,SAAS,iBAAiB,WAAuC;CAC/D,OAAO,MAAM;EACX,MAAM,WAAW,KAAK,WAAW,eAAe;EAChD,IAAI,WAAW,QAAQ,GAAG,OAAO;EACjC,MAAM,SAAS,QAAQ,SAAS;EAChC,IAAI,WAAW,WAAW,OAAO,KAAA;EACjC,YAAY;CACd;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"cache.cjs","names":["join","tmpdir","#cachePath","#entries","createHash"],"sources":["../../src/docs/cache.ts"],"sourcesContent":["import { createHash } from \"crypto\";\nimport { promises as fs } from \"fs\";\nimport { tmpdir } from \"os\";\nimport { join } from \"path\";\n\nconst CACHE_VERSION = 1;\nconst CACHE_DIR = join(tmpdir(), \"joist-codegen-cache\");\n\n/** A tuple of .ts and .md mtimes for an entity, used for caching. */\ninterface CacheEntry {\n tsMtime: number;\n mdMtime: number; // -1 when .md doesn't exist\n}\n\n/** The shape of the JSON file we write to disk for caching per-entity file modification times. */\ninterface CacheFile {\n version: number;\n entities: Record<string, CacheEntry>;\n}\n\n/** A simple mtime-based cache for docs syncing, to skip processing when neither .ts nor .md has changed. */\nexport class DocsCache {\n #entries: Record<string, CacheEntry>;\n #cachePath: string;\n\n private constructor(cachePath: string, entries: Record<string, CacheEntry>) {\n this.#cachePath = cachePath;\n this.#entries = entries;\n }\n\n static async load(): Promise<DocsCache> {\n const cachePath = getCachePath();\n try {\n const raw = JSON.parse(await fs.readFile(cachePath, \"utf-8\")) as CacheFile;\n if (raw.version === CACHE_VERSION) {\n return new DocsCache(cachePath, raw.entities);\n }\n } catch {\n // Missing or corrupt — start fresh\n }\n return new DocsCache(cachePath, {});\n }\n\n /** Returns true if both file mtimes match the cached values (i.e. skip processing). */\n isUpToDate(entityName: string, tsMtime: number, mdMtime: number): boolean {\n const cached = this.#entries[entityName];\n return !!cached && cached.tsMtime === Math.floor(tsMtime) && cached.mdMtime === Math.floor(mdMtime);\n }\n\n /** Record the current mtimes for an entity after processing it. */\n update(entityName: string, tsMtime: number, mdMtime: number): void {\n this.#entries[entityName] = { tsMtime: Math.floor(tsMtime), mdMtime: Math.floor(mdMtime) };\n }\n\n async save(): Promise<void> {\n const data: CacheFile = { version: CACHE_VERSION, entities: this.#entries };\n await fs.mkdir(CACHE_DIR, { recursive: true });\n await fs.writeFile(this.#cachePath, JSON.stringify(data), \"utf-8\");\n }\n}\n\n/** Stat a file and return its mtimeMs, or -1 if it doesn't exist. */\nexport async function getMtime(filePath: string): Promise<number> {\n try {\n return (await fs.stat(filePath)).mtimeMs;\n } catch {\n return -1;\n }\n}\n\nfunction getCachePath(): string {\n const hash = createHash(\"sha256\").update(process.cwd()).digest(\"hex\").slice(0, 16);\n return join(CACHE_DIR, `${hash}.json`);\n}\n"],"mappings":";;;;;;AAKA,MAAM,gBAAgB;AACtB,MAAM,aAAA,GAAYA,KAAAA,KAAAA,EAAAA,GAAKC,GAAAA,OAAAA,CAAO,GAAG,qBAAqB;;AAetD,IAAa,YAAb,MAAa,UAAU;CACrB;CACA;CAEA,YAAoB,WAAmB,SAAqC;EAC1E,KAAKC,aAAa;EAClB,KAAKC,WAAW;CAClB;CAEA,aAAa,OAA2B;EACtC,MAAM,YAAY,aAAa;EAC/B,IAAI;GACF,MAAM,MAAM,KAAK,MAAM,MAAM,GAAA,SAAG,SAAS,WAAW,OAAO,CAAC;GAC5D,IAAI,IAAI,YAAY,eAClB,OAAO,IAAI,UAAU,WAAW,IAAI,QAAQ;EAEhD,QAAQ,CAER;EACA,OAAO,IAAI,UAAU,WAAW,CAAC,CAAC;CACpC;;CAGA,WAAW,YAAoB,SAAiB,SAA0B;EACxE,MAAM,SAAS,KAAKA,SAAS;EAC7B,OAAO,CAAC,CAAC,UAAU,OAAO,YAAY,KAAK,MAAM,OAAO,KAAK,OAAO,YAAY,KAAK,MAAM,OAAO;CACpG;;CAGA,OAAO,YAAoB,SAAiB,SAAuB;EACjE,KAAKA,SAAS,cAAc;GAAE,SAAS,KAAK,MAAM,OAAO;GAAG,SAAS,KAAK,MAAM,OAAO;EAAE;CAC3F;CAEA,MAAM,OAAsB;EAC1B,MAAM,OAAkB;GAAE,SAAS;GAAe,UAAU,KAAKA;EAAS;EAC1E,MAAM,GAAA,SAAG,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;EAC7C,MAAM,GAAA,SAAG,UAAU,KAAKD,YAAY,KAAK,UAAU,IAAI,GAAG,OAAO;CACnE;AACF;;AAGA,eAAsB,SAAS,UAAmC;CAChE,IAAI;EACF,QAAQ,MAAM,GAAA,SAAG,KAAK,QAAQ,EAAA,CAAG;CACnC,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,eAAuB;CAC9B,MAAM,QAAA,GAAOE,OAAAA,WAAAA,CAAW,QAAQ,CAAC,CAAC,OAAO,QAAQ,IAAI,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;CACjF,QAAA,GAAOJ,KAAAA,KAAAA,CAAK,WAAW,GAAG,KAAK,MAAM;AACvC"}
1
+ {"version":3,"file":"cache.cjs","names":["join","tmpdir","createHash"],"sources":["../../src/docs/cache.ts"],"sourcesContent":["import { createHash } from \"crypto\";\nimport { promises as fs } from \"fs\";\nimport { tmpdir } from \"os\";\nimport { join } from \"path\";\n\nconst CACHE_VERSION = 1;\nconst CACHE_DIR = join(tmpdir(), \"joist-codegen-cache\");\n\n/** A tuple of .ts and .md mtimes for an entity, used for caching. */\ninterface CacheEntry {\n tsMtime: number;\n mdMtime: number; // -1 when .md doesn't exist\n}\n\n/** The shape of the JSON file we write to disk for caching per-entity file modification times. */\ninterface CacheFile {\n version: number;\n entities: Record<string, CacheEntry>;\n}\n\n/** A simple mtime-based cache for docs syncing, to skip processing when neither .ts nor .md has changed. */\nexport class DocsCache {\n #entries: Record<string, CacheEntry>;\n #cachePath: string;\n\n private constructor(cachePath: string, entries: Record<string, CacheEntry>) {\n this.#cachePath = cachePath;\n this.#entries = entries;\n }\n\n static async load(): Promise<DocsCache> {\n const cachePath = getCachePath();\n try {\n const raw = JSON.parse(await fs.readFile(cachePath, \"utf-8\")) as CacheFile;\n if (raw.version === CACHE_VERSION) {\n return new DocsCache(cachePath, raw.entities);\n }\n } catch {\n // Missing or corrupt — start fresh\n }\n return new DocsCache(cachePath, {});\n }\n\n /** Returns true if both file mtimes match the cached values (i.e. skip processing). */\n isUpToDate(entityName: string, tsMtime: number, mdMtime: number): boolean {\n const cached = this.#entries[entityName];\n return !!cached && cached.tsMtime === Math.floor(tsMtime) && cached.mdMtime === Math.floor(mdMtime);\n }\n\n /** Record the current mtimes for an entity after processing it. */\n update(entityName: string, tsMtime: number, mdMtime: number): void {\n this.#entries[entityName] = { tsMtime: Math.floor(tsMtime), mdMtime: Math.floor(mdMtime) };\n }\n\n async save(): Promise<void> {\n const data: CacheFile = { version: CACHE_VERSION, entities: this.#entries };\n await fs.mkdir(CACHE_DIR, { recursive: true });\n await fs.writeFile(this.#cachePath, JSON.stringify(data), \"utf-8\");\n }\n}\n\n/** Stat a file and return its mtimeMs, or -1 if it doesn't exist. */\nexport async function getMtime(filePath: string): Promise<number> {\n try {\n return (await fs.stat(filePath)).mtimeMs;\n } catch {\n return -1;\n }\n}\n\nfunction getCachePath(): string {\n const hash = createHash(\"sha256\").update(process.cwd()).digest(\"hex\").slice(0, 16);\n return join(CACHE_DIR, `${hash}.json`);\n}\n"],"mappings":";;;;;;AAKA,MAAM,gBAAgB;AACtB,MAAM,aAAA,GAAYA,KAAAA,KAAAA,EAAAA,GAAKC,GAAAA,OAAAA,CAAO,GAAG,qBAAqB;;AAetD,IAAa,YAAb,MAAa,UAAU;CACrB;CACA;CAEA,YAAoB,WAAmB,SAAqC;EAC1E,KAAK,aAAa;EAClB,KAAK,WAAW;CAClB;CAEA,aAAa,OAA2B;EACtC,MAAM,YAAY,aAAa;EAC/B,IAAI;GACF,MAAM,MAAM,KAAK,MAAM,MAAM,GAAA,SAAG,SAAS,WAAW,OAAO,CAAC;GAC5D,IAAI,IAAI,YAAY,eAClB,OAAO,IAAI,UAAU,WAAW,IAAI,QAAQ;EAEhD,QAAQ,CAER;EACA,OAAO,IAAI,UAAU,WAAW,CAAC,CAAC;CACpC;;CAGA,WAAW,YAAoB,SAAiB,SAA0B;EACxE,MAAM,SAAS,KAAK,SAAS;EAC7B,OAAO,CAAC,CAAC,UAAU,OAAO,YAAY,KAAK,MAAM,OAAO,KAAK,OAAO,YAAY,KAAK,MAAM,OAAO;CACpG;;CAGA,OAAO,YAAoB,SAAiB,SAAuB;EACjE,KAAK,SAAS,cAAc;GAAE,SAAS,KAAK,MAAM,OAAO;GAAG,SAAS,KAAK,MAAM,OAAO;EAAE;CAC3F;CAEA,MAAM,OAAsB;EAC1B,MAAM,OAAkB;GAAE,SAAS;GAAe,UAAU,KAAK;EAAS;EAC1E,MAAM,GAAA,SAAG,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;EAC7C,MAAM,GAAA,SAAG,UAAU,KAAK,YAAY,KAAK,UAAU,IAAI,GAAG,OAAO;CACnE;AACF;;AAGA,eAAsB,SAAS,UAAmC;CAChE,IAAI;EACF,QAAQ,MAAM,GAAA,SAAG,KAAK,QAAQ,EAAA,CAAG;CACnC,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,eAAuB;CAC9B,MAAM,QAAA,GAAOC,OAAAA,WAAAA,CAAW,QAAQ,CAAC,CAAC,OAAO,QAAQ,IAAI,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;CACjF,QAAA,GAAOF,KAAAA,KAAAA,CAAK,WAAW,GAAG,KAAK,MAAM;AACvC"}
@@ -1,6 +1,6 @@
1
1
  //#region src/docs/cache.d.ts
2
2
  /** A simple mtime-based cache for docs syncing, to skip processing when neither .ts nor .md has changed. */
3
- declare class DocsCache {
3
+ export declare class DocsCache {
4
4
  #private;
5
5
  private constructor();
6
6
  static load(): Promise<DocsCache>;
@@ -11,7 +11,6 @@ declare class DocsCache {
11
11
  save(): Promise<void>;
12
12
  }
13
13
  /** Stat a file and return its mtimeMs, or -1 if it doesn't exist. */
14
- declare function getMtime(filePath: string): Promise<number>;
14
+ export declare function getMtime(filePath: string): Promise<number>;
15
15
  //#endregion
16
- export { DocsCache, getMtime };
17
16
  //# sourceMappingURL=cache.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.cts","names":[],"sources":["../../src/docs/cache.ts"],"mappings":";;cAqBa;;UAIJ;SAKM,QAAQ,QAAQ;;EAc7B,WAAW,oBAAoB,iBAAiB;;EAMhD,OAAO,oBAAoB,iBAAiB;EAItC,QAAQ;;;iBAQM,SAAS,mBAAmB"}
1
+ {"version":3,"file":"cache.d.cts","names":[],"sources":["../../src/docs/cache.ts"],"mappings":";;qBAqBa;;UAIJ;SAKM,QAAQ,QAAQ;;EAc7B,WAAW,oBAAoB,iBAAiB;;EAMhD,OAAO,oBAAoB,iBAAiB;EAItC,QAAQ;;;wBAQM,SAAS,mBAAmB"}
@@ -1,6 +1,6 @@
1
1
  //#region src/docs/cache.d.ts
2
2
  /** A simple mtime-based cache for docs syncing, to skip processing when neither .ts nor .md has changed. */
3
- declare class DocsCache {
3
+ export declare class DocsCache {
4
4
  #private;
5
5
  private constructor();
6
6
  static load(): Promise<DocsCache>;
@@ -11,7 +11,6 @@ declare class DocsCache {
11
11
  save(): Promise<void>;
12
12
  }
13
13
  /** Stat a file and return its mtimeMs, or -1 if it doesn't exist. */
14
- declare function getMtime(filePath: string): Promise<number>;
14
+ export declare function getMtime(filePath: string): Promise<number>;
15
15
  //#endregion
16
- export { DocsCache, getMtime };
17
16
  //# sourceMappingURL=cache.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.mts","names":[],"sources":["../../src/docs/cache.ts"],"mappings":";;cAqBa;;UAIJ;SAKM,QAAQ,QAAQ;;EAc7B,WAAW,oBAAoB,iBAAiB;;EAMhD,OAAO,oBAAoB,iBAAiB;EAItC,QAAQ;;;iBAQM,SAAS,mBAAmB"}
1
+ {"version":3,"file":"cache.d.mts","names":[],"sources":["../../src/docs/cache.ts"],"mappings":";;qBAqBa;;UAIJ;SAKM,QAAQ,QAAQ;;EAc7B,WAAW,oBAAoB,iBAAiB;;EAMhD,OAAO,oBAAoB,iBAAiB;EAItC,QAAQ;;;wBAQM,SAAS,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","names":["#cachePath","#entries","fs"],"sources":["../../src/docs/cache.ts"],"sourcesContent":["import { createHash } from \"crypto\";\nimport { promises as fs } from \"fs\";\nimport { tmpdir } from \"os\";\nimport { join } from \"path\";\n\nconst CACHE_VERSION = 1;\nconst CACHE_DIR = join(tmpdir(), \"joist-codegen-cache\");\n\n/** A tuple of .ts and .md mtimes for an entity, used for caching. */\ninterface CacheEntry {\n tsMtime: number;\n mdMtime: number; // -1 when .md doesn't exist\n}\n\n/** The shape of the JSON file we write to disk for caching per-entity file modification times. */\ninterface CacheFile {\n version: number;\n entities: Record<string, CacheEntry>;\n}\n\n/** A simple mtime-based cache for docs syncing, to skip processing when neither .ts nor .md has changed. */\nexport class DocsCache {\n #entries: Record<string, CacheEntry>;\n #cachePath: string;\n\n private constructor(cachePath: string, entries: Record<string, CacheEntry>) {\n this.#cachePath = cachePath;\n this.#entries = entries;\n }\n\n static async load(): Promise<DocsCache> {\n const cachePath = getCachePath();\n try {\n const raw = JSON.parse(await fs.readFile(cachePath, \"utf-8\")) as CacheFile;\n if (raw.version === CACHE_VERSION) {\n return new DocsCache(cachePath, raw.entities);\n }\n } catch {\n // Missing or corrupt — start fresh\n }\n return new DocsCache(cachePath, {});\n }\n\n /** Returns true if both file mtimes match the cached values (i.e. skip processing). */\n isUpToDate(entityName: string, tsMtime: number, mdMtime: number): boolean {\n const cached = this.#entries[entityName];\n return !!cached && cached.tsMtime === Math.floor(tsMtime) && cached.mdMtime === Math.floor(mdMtime);\n }\n\n /** Record the current mtimes for an entity after processing it. */\n update(entityName: string, tsMtime: number, mdMtime: number): void {\n this.#entries[entityName] = { tsMtime: Math.floor(tsMtime), mdMtime: Math.floor(mdMtime) };\n }\n\n async save(): Promise<void> {\n const data: CacheFile = { version: CACHE_VERSION, entities: this.#entries };\n await fs.mkdir(CACHE_DIR, { recursive: true });\n await fs.writeFile(this.#cachePath, JSON.stringify(data), \"utf-8\");\n }\n}\n\n/** Stat a file and return its mtimeMs, or -1 if it doesn't exist. */\nexport async function getMtime(filePath: string): Promise<number> {\n try {\n return (await fs.stat(filePath)).mtimeMs;\n } catch {\n return -1;\n }\n}\n\nfunction getCachePath(): string {\n const hash = createHash(\"sha256\").update(process.cwd()).digest(\"hex\").slice(0, 16);\n return join(CACHE_DIR, `${hash}.json`);\n}\n"],"mappings":";;;;;AAKA,MAAM,gBAAgB;AACtB,MAAM,YAAY,KAAK,OAAO,GAAG,qBAAqB;;AAetD,IAAa,YAAb,MAAa,UAAU;CACrB;CACA;CAEA,YAAoB,WAAmB,SAAqC;EAC1E,KAAKA,aAAa;EAClB,KAAKC,WAAW;CAClB;CAEA,aAAa,OAA2B;EACtC,MAAM,YAAY,aAAa;EAC/B,IAAI;GACF,MAAM,MAAM,KAAK,MAAM,MAAMC,SAAG,SAAS,WAAW,OAAO,CAAC;GAC5D,IAAI,IAAI,YAAY,eAClB,OAAO,IAAI,UAAU,WAAW,IAAI,QAAQ;EAEhD,QAAQ,CAER;EACA,OAAO,IAAI,UAAU,WAAW,CAAC,CAAC;CACpC;;CAGA,WAAW,YAAoB,SAAiB,SAA0B;EACxE,MAAM,SAAS,KAAKD,SAAS;EAC7B,OAAO,CAAC,CAAC,UAAU,OAAO,YAAY,KAAK,MAAM,OAAO,KAAK,OAAO,YAAY,KAAK,MAAM,OAAO;CACpG;;CAGA,OAAO,YAAoB,SAAiB,SAAuB;EACjE,KAAKA,SAAS,cAAc;GAAE,SAAS,KAAK,MAAM,OAAO;GAAG,SAAS,KAAK,MAAM,OAAO;EAAE;CAC3F;CAEA,MAAM,OAAsB;EAC1B,MAAM,OAAkB;GAAE,SAAS;GAAe,UAAU,KAAKA;EAAS;EAC1E,MAAMC,SAAG,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;EAC7C,MAAMA,SAAG,UAAU,KAAKF,YAAY,KAAK,UAAU,IAAI,GAAG,OAAO;CACnE;AACF;;AAGA,eAAsB,SAAS,UAAmC;CAChE,IAAI;EACF,QAAQ,MAAME,SAAG,KAAK,QAAQ,EAAA,CAAG;CACnC,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,eAAuB;CAC9B,MAAM,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,QAAQ,IAAI,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;CACjF,OAAO,KAAK,WAAW,GAAG,KAAK,MAAM;AACvC"}
1
+ {"version":3,"file":"cache.js","names":["fs"],"sources":["../../src/docs/cache.ts"],"sourcesContent":["import { createHash } from \"crypto\";\nimport { promises as fs } from \"fs\";\nimport { tmpdir } from \"os\";\nimport { join } from \"path\";\n\nconst CACHE_VERSION = 1;\nconst CACHE_DIR = join(tmpdir(), \"joist-codegen-cache\");\n\n/** A tuple of .ts and .md mtimes for an entity, used for caching. */\ninterface CacheEntry {\n tsMtime: number;\n mdMtime: number; // -1 when .md doesn't exist\n}\n\n/** The shape of the JSON file we write to disk for caching per-entity file modification times. */\ninterface CacheFile {\n version: number;\n entities: Record<string, CacheEntry>;\n}\n\n/** A simple mtime-based cache for docs syncing, to skip processing when neither .ts nor .md has changed. */\nexport class DocsCache {\n #entries: Record<string, CacheEntry>;\n #cachePath: string;\n\n private constructor(cachePath: string, entries: Record<string, CacheEntry>) {\n this.#cachePath = cachePath;\n this.#entries = entries;\n }\n\n static async load(): Promise<DocsCache> {\n const cachePath = getCachePath();\n try {\n const raw = JSON.parse(await fs.readFile(cachePath, \"utf-8\")) as CacheFile;\n if (raw.version === CACHE_VERSION) {\n return new DocsCache(cachePath, raw.entities);\n }\n } catch {\n // Missing or corrupt — start fresh\n }\n return new DocsCache(cachePath, {});\n }\n\n /** Returns true if both file mtimes match the cached values (i.e. skip processing). */\n isUpToDate(entityName: string, tsMtime: number, mdMtime: number): boolean {\n const cached = this.#entries[entityName];\n return !!cached && cached.tsMtime === Math.floor(tsMtime) && cached.mdMtime === Math.floor(mdMtime);\n }\n\n /** Record the current mtimes for an entity after processing it. */\n update(entityName: string, tsMtime: number, mdMtime: number): void {\n this.#entries[entityName] = { tsMtime: Math.floor(tsMtime), mdMtime: Math.floor(mdMtime) };\n }\n\n async save(): Promise<void> {\n const data: CacheFile = { version: CACHE_VERSION, entities: this.#entries };\n await fs.mkdir(CACHE_DIR, { recursive: true });\n await fs.writeFile(this.#cachePath, JSON.stringify(data), \"utf-8\");\n }\n}\n\n/** Stat a file and return its mtimeMs, or -1 if it doesn't exist. */\nexport async function getMtime(filePath: string): Promise<number> {\n try {\n return (await fs.stat(filePath)).mtimeMs;\n } catch {\n return -1;\n }\n}\n\nfunction getCachePath(): string {\n const hash = createHash(\"sha256\").update(process.cwd()).digest(\"hex\").slice(0, 16);\n return join(CACHE_DIR, `${hash}.json`);\n}\n"],"mappings":";;;;;AAKA,MAAM,gBAAgB;AACtB,MAAM,YAAY,KAAK,OAAO,GAA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{ ParsedDoc } from "./markdown.cjs";
3
3
  import { CodegenFile } from "ts-poet";
4
4
  //#region src/docs/generate-metadata-docs.d.ts
5
5
  /** Creates the `metadata-docs.ts` runtime artifact to access docs. */
6
- declare function generateMetadataDocsFile(dbMeta: DbMetadata, docsByEntity: Record<string, ParsedDoc>): CodegenFile;
6
+ export declare function generateMetadataDocsFile(dbMeta: DbMetadata, docsByEntity: Record<string, ParsedDoc>): CodegenFile;
7
7
  //#endregion
8
- export { generateMetadataDocsFile };
9
8
  //# sourceMappingURL=generate-metadata-docs.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-metadata-docs.d.cts","names":[],"sources":["../../src/docs/generate-metadata-docs.ts"],"mappings":";;;;;iBAMgB,yBAAyB,QAAQ,YAAY,cAAc,eAAe,aAAa"}
1
+ {"version":3,"file":"generate-metadata-docs.d.cts","names":[],"sources":["../../src/docs/generate-metadata-docs.ts"],"mappings":";;;;;wBAMgB,yBAAyB,QAAQ,YAAY,cAAc,eAAe,aAAa"}
@@ -3,7 +3,6 @@ import { ParsedDoc } from "./markdown.mjs";
3
3
  import { CodegenFile } from "ts-poet";
4
4
  //#region src/docs/generate-metadata-docs.d.ts
5
5
  /** Creates the `metadata-docs.ts` runtime artifact to access docs. */
6
- declare function generateMetadataDocsFile(dbMeta: DbMetadata, docsByEntity: Record<string, ParsedDoc>): CodegenFile;
6
+ export declare function generateMetadataDocsFile(dbMeta: DbMetadata, docsByEntity: Record<string, ParsedDoc>): CodegenFile;
7
7
  //#endregion
8
- export { generateMetadataDocsFile };
9
8
  //# sourceMappingURL=generate-metadata-docs.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-metadata-docs.d.mts","names":[],"sources":["../../src/docs/generate-metadata-docs.ts"],"mappings":";;;;;iBAMgB,yBAAyB,QAAQ,YAAY,cAAc,eAAe,aAAa"}
1
+ {"version":3,"file":"generate-metadata-docs.d.mts","names":[],"sources":["../../src/docs/generate-metadata-docs.ts"],"mappings":";;;;;wBAMgB,yBAAyB,QAAQ,YAAY,cAAc,eAAe,aAAa"}
@@ -3,14 +3,14 @@ import { generateMetadataDocsFile } from "./generate-metadata-docs.cjs";
3
3
  import { buildJSDocBlock, generatedTag } from "./parsing.cjs";
4
4
  //#region src/docs/index.d.ts
5
5
  /** Loads each entity's parsed `.md` doc, i.e. for injecting into codegen JSDocs & runtime metadata. */
6
- declare function loadEntityDocs(entitiesDir: string, entityNames: string[]): Promise<Record<string, ParsedDoc>>;
6
+ export declare function loadEntityDocs(entitiesDir: string, entityNames: string[]): Promise<Record<string, ParsedDoc>>;
7
7
  /**
8
8
  * Run the full docs sync pipeline with mtime-based caching:
9
9
  * 1. backfill .md from .ts JSDocs
10
10
  * 2. sync .md back into .ts JSDocs
11
11
  * 3. save the cache
12
12
  */
13
- declare function syncDocs(entitiesDir: string, entityNames: string[]): Promise<void>;
13
+ export declare function syncDocs(entitiesDir: string, entityNames: string[]): Promise<void>;
14
14
  //#endregion
15
- export { type ParsedDoc, buildJSDocBlock, generateMetadataDocsFile, generatedTag, loadEntityDocs, syncDocs };
15
+ export { type ParsedDoc, buildJSDocBlock, generateMetadataDocsFile, generatedTag };
16
16
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/docs/index.ts"],"mappings":";;;;;iBAWsB,eAAe,qBAAqB,wBAAwB,QAAQ,eAAe;;;;;;;iBAiBnF,SAAS,qBAAqB,wBAAwB"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/docs/index.ts"],"mappings":";;;;;wBAWsB,eAAe,qBAAqB,wBAAwB,QAAQ,eAAe;;;;;;;wBAiBnF,SAAS,qBAAqB,wBAAwB"}
@@ -3,14 +3,14 @@ import { generateMetadataDocsFile } from "./generate-metadata-docs.mjs";
3
3
  import { buildJSDocBlock, generatedTag } from "./parsing.mjs";
4
4
  //#region src/docs/index.d.ts
5
5
  /** Loads each entity's parsed `.md` doc, i.e. for injecting into codegen JSDocs & runtime metadata. */
6
- declare function loadEntityDocs(entitiesDir: string, entityNames: string[]): Promise<Record<string, ParsedDoc>>;
6
+ export declare function loadEntityDocs(entitiesDir: string, entityNames: string[]): Promise<Record<string, ParsedDoc>>;
7
7
  /**
8
8
  * Run the full docs sync pipeline with mtime-based caching:
9
9
  * 1. backfill .md from .ts JSDocs
10
10
  * 2. sync .md back into .ts JSDocs
11
11
  * 3. save the cache
12
12
  */
13
- declare function syncDocs(entitiesDir: string, entityNames: string[]): Promise<void>;
13
+ export declare function syncDocs(entitiesDir: string, entityNames: string[]): Promise<void>;
14
14
  //#endregion
15
- export { type ParsedDoc, buildJSDocBlock, generateMetadataDocsFile, generatedTag, loadEntityDocs, syncDocs };
15
+ export { type ParsedDoc, buildJSDocBlock, generateMetadataDocsFile, generatedTag };
16
16
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/docs/index.ts"],"mappings":";;;;;iBAWsB,eAAe,qBAAqB,wBAAwB,QAAQ,eAAe;;;;;;;iBAiBnF,SAAS,qBAAqB,wBAAwB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/docs/index.ts"],"mappings":";;;;;wBAWsB,eAAe,qBAAqB,wBAAwB,QAAQ,eAAe;;;;;;;wBAiBnF,SAAS,qBAAqB,wBAAwB"}
@@ -1,20 +1,20 @@
1
1
  //#region src/docs/markdown.d.ts
2
- interface ParsedDoc {
2
+ export interface ParsedDoc {
3
3
  overview: string;
4
4
  fields: Record<string, string>;
5
5
  }
6
6
  /** Read and parse a .md file if it exists, returning undefined if it doesn't. */
7
- declare function maybeReadMarkdownFile(filePath: string): Promise<ParsedDoc | undefined>;
7
+ export declare function maybeReadMarkdownFile(filePath: string): Promise<ParsedDoc | undefined>;
8
8
  /** Reads a basic `overview` and per-field docs out of md content. */
9
- declare function parseMarkdownContent(content: string): ParsedDoc;
9
+ export declare function parseMarkdownContent(content: string): ParsedDoc;
10
10
  /** Create a new .md file from scratch (used only for initial backfill when no .md exists). */
11
- declare function writeMarkdownDoc(filePath: string, overview: string, fields?: Record<string, string>): Promise<void>;
11
+ export declare function writeMarkdownDoc(filePath: string, overview: string, fields?: Record<string, string>): Promise<void>;
12
12
  /**
13
13
  * Update an existing .md file, merging in new/changed content without stomping user content.
14
14
  * If the file doesn't exist, creates it from scratch.
15
15
  */
16
- declare function updateMarkdownDoc(filePath: string, overview: string | undefined, fields: Record<string, string>): Promise<void>;
17
- declare function getMarkdownFilePath(entitiesDir: string, entityName: string): string;
16
+ export declare function updateMarkdownDoc(filePath: string, overview: string | undefined, fields: Record<string, string>): Promise<void>;
17
+ export declare function getMarkdownFilePath(entitiesDir: string, entityName: string): string;
18
18
  /**
19
19
  * Merge updates into an existing .md file, preserving all user content.
20
20
  *
@@ -24,9 +24,9 @@ declare function getMarkdownFilePath(entitiesDir: string, entityName: string): s
24
24
  * - All other content (custom sections, tables, etc.) is preserved verbatim
25
25
  */
26
26
  declare function mergeMarkdownContent(existing: string, overview: string | undefined, fields: Record<string, string>): string;
27
- declare const testing: {
27
+ export declare const testing: {
28
28
  mergeMarkdownContent: typeof mergeMarkdownContent;
29
29
  };
30
30
  //#endregion
31
- export { ParsedDoc, getMarkdownFilePath, maybeReadMarkdownFile, parseMarkdownContent, testing, updateMarkdownDoc, writeMarkdownDoc };
31
+ export {};
32
32
  //# sourceMappingURL=markdown.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.cts","names":[],"sources":["../../src/docs/markdown.ts"],"mappings":";UAKiB;EACf;EACA,QAAQ;;;iBAIY,sBAAsB,mBAAmB,QAAQ;;iBAUvD,qBAAqB,kBAAkB;;iBAiDjC,iBACpB,kBACA,kBACA,SAAS,yBACR;;;;;iBAgCmB,kBACpB,kBACA,8BACA,QAAQ,yBACP;iBAkBa,oBAAoB,qBAAqB;;;;;;;;;iBAqBhD,qBAAqB,kBAAkB,8BAA8B,QAAQ;cA+EzE;+BAAA"}
1
+ {"version":3,"file":"markdown.d.cts","names":[],"sources":["../../src/docs/markdown.ts"],"mappings":";iBAKiB;EACf;EACA,QAAQ;;;wBAIY,sBAAsB,mBAAmB,QAAQ;;wBAUvD,qBAAqB,kBAAkB;;wBAiDjC,iBACpB,kBACA,kBACA,SAAS,yBACR;;;;;wBAgCmB,kBACpB,kBACA,8BACA,QAAQ,yBACP;wBAkBa,oBAAoB,qBAAqB;;;;;;;;;iBAqBhD,qBAAqB,kBAAkB,8BAA8B,QAAQ;qBA+EzE;+BAAA"}
@@ -1,20 +1,20 @@
1
1
  //#region src/docs/markdown.d.ts
2
- interface ParsedDoc {
2
+ export interface ParsedDoc {
3
3
  overview: string;
4
4
  fields: Record<string, string>;
5
5
  }
6
6
  /** Read and parse a .md file if it exists, returning undefined if it doesn't. */
7
- declare function maybeReadMarkdownFile(filePath: string): Promise<ParsedDoc | undefined>;
7
+ export declare function maybeReadMarkdownFile(filePath: string): Promise<ParsedDoc | undefined>;
8
8
  /** Reads a basic `overview` and per-field docs out of md content. */
9
- declare function parseMarkdownContent(content: string): ParsedDoc;
9
+ export declare function parseMarkdownContent(content: string): ParsedDoc;
10
10
  /** Create a new .md file from scratch (used only for initial backfill when no .md exists). */
11
- declare function writeMarkdownDoc(filePath: string, overview: string, fields?: Record<string, string>): Promise<void>;
11
+ export declare function writeMarkdownDoc(filePath: string, overview: string, fields?: Record<string, string>): Promise<void>;
12
12
  /**
13
13
  * Update an existing .md file, merging in new/changed content without stomping user content.
14
14
  * If the file doesn't exist, creates it from scratch.
15
15
  */
16
- declare function updateMarkdownDoc(filePath: string, overview: string | undefined, fields: Record<string, string>): Promise<void>;
17
- declare function getMarkdownFilePath(entitiesDir: string, entityName: string): string;
16
+ export declare function updateMarkdownDoc(filePath: string, overview: string | undefined, fields: Record<string, string>): Promise<void>;
17
+ export declare function getMarkdownFilePath(entitiesDir: string, entityName: string): string;
18
18
  /**
19
19
  * Merge updates into an existing .md file, preserving all user content.
20
20
  *
@@ -24,9 +24,9 @@ declare function getMarkdownFilePath(entitiesDir: string, entityName: string): s
24
24
  * - All other content (custom sections, tables, etc.) is preserved verbatim
25
25
  */
26
26
  declare function mergeMarkdownContent(existing: string, overview: string | undefined, fields: Record<string, string>): string;
27
- declare const testing: {
27
+ export declare const testing: {
28
28
  mergeMarkdownContent: typeof mergeMarkdownContent;
29
29
  };
30
30
  //#endregion
31
- export { ParsedDoc, getMarkdownFilePath, maybeReadMarkdownFile, parseMarkdownContent, testing, updateMarkdownDoc, writeMarkdownDoc };
31
+ export {};
32
32
  //# sourceMappingURL=markdown.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.mts","names":[],"sources":["../../src/docs/markdown.ts"],"mappings":";UAKiB;EACf;EACA,QAAQ;;;iBAIY,sBAAsB,mBAAmB,QAAQ;;iBAUvD,qBAAqB,kBAAkB;;iBAiDjC,iBACpB,kBACA,kBACA,SAAS,yBACR;;;;;iBAgCmB,kBACpB,kBACA,8BACA,QAAQ,yBACP;iBAkBa,oBAAoB,qBAAqB;;;;;;;;;iBAqBhD,qBAAqB,kBAAkB,8BAA8B,QAAQ;cA+EzE;+BAAA"}
1
+ {"version":3,"file":"markdown.d.mts","names":[],"sources":["../../src/docs/markdown.ts"],"mappings":";iBAKiB;EACf;EACA,QAAQ;;;wBAIY,sBAAsB,mBAAmB,QAAQ;;wBAUvD,qBAAqB,kBAAkB;;wBAiDjC,iBACpB,kBACA,kBACA,SAAS,yBACR;;;;;wBAgCmB,kBACpB,kBACA,8BACA,QAAQ,yBACP;wBAkBa,oBAAoB,qBAAqB;;;;;;;;;iBAqBhD,qBAAqB,kBAAkB,8BAA8B,QAAQ;qBA+EzE;+BAAA"}
@@ -11,20 +11,20 @@ type Commented = ASTNode & {
11
11
  end?: number;
12
12
  loc?: namedTypes.SourceLocation | null;
13
13
  };
14
- type MemberKind = "property" | "getter" | "setter" | "method";
15
- interface MemberInfo {
14
+ export type MemberKind = "property" | "getter" | "setter" | "method";
15
+ export interface MemberInfo {
16
16
  kind: MemberKind;
17
17
  name: string;
18
18
  doc: string | undefined;
19
19
  node: Commented;
20
20
  }
21
- interface SourceEdit {
21
+ export interface SourceEdit {
22
22
  start: number;
23
23
  end: number;
24
24
  text: string;
25
25
  }
26
26
  /** Parse an entity .ts file and extract class + member JSDoc. */
27
- declare function parseEntityJSDocs(source: string): {
27
+ export declare function parseEntityJSDocs(source: string): {
28
28
  classDoc: string | undefined;
29
29
  classNode: Commented | undefined;
30
30
  members: MemberInfo[];
@@ -36,13 +36,13 @@ declare function parseEntityJSDocs(source: string): {
36
36
  * (This is bizarre, but this `SourceEdit` + `applyEdits` leaves all existing formatting
37
37
  * alone better than doing a `node.toSource()` or other AST-based updates. :grimmacing:)
38
38
  */
39
- declare function buildJSDocEdit(node: Commented, text: string): SourceEdit;
39
+ export declare function buildJSDocEdit(node: Commented, text: string): SourceEdit;
40
40
  /** Apply edits to source by splicing in reverse order. */
41
- declare function applyEdits(source: string, edits: SourceEdit[]): string;
41
+ export declare function applyEdits(source: string, edits: SourceEdit[]): string;
42
42
  /** Build a JSDoc block comment string from plain text. */
43
- declare function buildJSDocBlock(text: string, indent: number): string;
43
+ export declare function buildJSDocBlock(text: string, indent: number): string;
44
44
  /** The `@generated Entity.md` marker, i.e. so readers know a JSDoc is sourced from (and edited in) the `.md`. */
45
- declare function generatedTag(entityName: string): string;
45
+ export declare function generatedTag(entityName: string): string;
46
46
  //#endregion
47
- export { MemberInfo, MemberKind, SourceEdit, applyEdits, buildJSDocBlock, buildJSDocEdit, generatedTag, parseEntityJSDocs };
47
+ export {};
48
48
  //# sourceMappingURL=parsing.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parsing.d.cts","names":[],"sources":["../../src/docs/parsing.ts"],"mappings":";;;KAKK,eAAe,WAAW,eAAe,WAAW,cAAc,WAAW,QAAQ,WAAW;EACnG;EACA;;KAGG,YAAY;EACf,WAAW;EACX;EACA;EACA,MAAM,WAAW;;KAGP;UAEK;EACf,MAAM;EACN;EACA;EACA,MAAM;;UAGS;EACf;EACA;EACA;;;iBAIc,kBAAkB;;;;;;;;;;;;iBAuDlB,eAAe,MAAM,WAAW,eAAe;;iBAW/C,WAAW,gBAAgB,OAAO;;iBAUlC,gBAAgB,cAAc;;iBAQ9B,aAAa"}
1
+ {"version":3,"file":"parsing.d.cts","names":[],"sources":["../../src/docs/parsing.ts"],"mappings":";;;KAKK,eAAe,WAAW,eAAe,WAAW,cAAc,WAAW,QAAQ,WAAW;EACnG;EACA;;KAGG,YAAY;EACf,WAAW;EACX;EACA;EACA,MAAM,WAAW;;YAGP;iBAEK;EACf,MAAM;EACN;EACA;EACA,MAAM;;iBAGS;EACf;EACA;EACA;;;wBAIc,kBAAkB;;;;;;;;;;;;wBAuDlB,eAAe,MAAM,WAAW,eAAe;;wBAW/C,WAAW,gBAAgB,OAAO;;wBAUlC,gBAAgB,cAAc;;wBAQ9B,aAAa"}