joist-codegen 2.4.0-next.5 → 2.4.0-next.50

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 (184) 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 +8 -3
  38. package/build/config.cjs.map +1 -1
  39. package/build/config.d.cts +30 -27
  40. package/build/config.d.cts.map +1 -1
  41. package/build/config.d.mts +30 -27
  42. package/build/config.d.mts.map +1 -1
  43. package/build/config.js +8 -3
  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 +30 -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 +31 -2
  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.cjs +2 -0
  164. package/build/symbols.cjs.map +1 -1
  165. package/build/symbols.d.cts +117 -117
  166. package/build/symbols.d.cts.map +1 -1
  167. package/build/symbols.d.mts +117 -117
  168. package/build/symbols.d.mts.map +1 -1
  169. package/build/symbols.js +2 -1
  170. package/build/symbols.js.map +1 -1
  171. package/build/tsdoc.d.cts +1 -2
  172. package/build/tsdoc.d.cts.map +1 -1
  173. package/build/tsdoc.d.mts +1 -2
  174. package/build/tsdoc.d.mts.map +1 -1
  175. package/build/utils.cjs +1 -0
  176. package/build/utils.cjs.map +1 -1
  177. package/build/utils.d.cts +21 -22
  178. package/build/utils.d.cts.map +1 -1
  179. package/build/utils.d.mts +21 -22
  180. package/build/utils.d.mts.map +1 -1
  181. package/build/utils.js +1 -0
  182. package/build/utils.js.map +1 -1
  183. package/package.json +10 -10
  184. package/skills/joist-test-factories/SKILL.md +93 -6
@@ -2,12 +2,12 @@ import { Config } from "./config.mjs";
2
2
  import { DbMetadata, EntityDbMetadata } from "./EntityDbMetadata.mjs";
3
3
  //#region src/inheritance.d.ts
4
4
  /** Preserves physical storage metadata, then applies domain inheritance specialization. */
5
- declare function applyInheritanceUpdates(config: Config, db: DbMetadata): void;
5
+ export declare function applyInheritanceUpdates(config: Config, db: DbMetadata): void;
6
6
  type StiEntityMap = Map<string, {
7
7
  base: EntityDbMetadata;
8
8
  subTypes: EntityDbMetadata[];
9
9
  }>;
10
- declare function getStiEntities(entities: EntityDbMetadata[]): StiEntityMap;
10
+ export declare function getStiEntities(entities: EntityDbMetadata[]): StiEntityMap;
11
11
  //#endregion
12
- export { applyInheritanceUpdates, getStiEntities };
12
+ export {};
13
13
  //# sourceMappingURL=inheritance.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inheritance.d.mts","names":[],"sources":["../src/inheritance.ts"],"mappings":";;;;iBAagB,wBAAwB,QAAQ,QAAQ,IAAI;KAsQvD,eAAe;EAAc,MAAM;EAAkB,UAAU;;iBAGpD,eAAe,UAAU,qBAAqB"}
1
+ {"version":3,"file":"inheritance.d.mts","names":[],"sources":["../src/inheritance.ts"],"mappings":";;;;wBAagB,wBAAwB,QAAQ,QAAQ,IAAI;KAsQvD,eAAe;EAAc,MAAM;EAAkB,UAAU;;wBAGpD,eAAe,UAAU,qBAAqB"}
@@ -10,7 +10,6 @@
10
10
  * Logs only what actually changed: the added and removed skill names, staying
11
11
  * quiet when nothing changed.
12
12
  */
13
- declare function installSkills(rootDir?: string): Promise<void>;
13
+ export declare function installSkills(rootDir?: string): Promise<void>;
14
14
  //#endregion
15
- export { installSkills };
16
15
  //# sourceMappingURL=installSkills.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"installSkills.d.cts","names":[],"sources":["../src/installSkills.ts"],"mappings":";;;;;;;;;;;;iBA4BsB,cAAc,mBAAwB"}
1
+ {"version":3,"file":"installSkills.d.cts","names":[],"sources":["../src/installSkills.ts"],"mappings":";;;;;;;;;;;;wBA4BsB,cAAc,mBAAwB"}
@@ -10,7 +10,6 @@
10
10
  * Logs only what actually changed: the added and removed skill names, staying
11
11
  * quiet when nothing changed.
12
12
  */
13
- declare function installSkills(rootDir?: string): Promise<void>;
13
+ export declare function installSkills(rootDir?: string): Promise<void>;
14
14
  //#endregion
15
- export { installSkills };
16
15
  //# sourceMappingURL=installSkills.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"installSkills.d.mts","names":[],"sources":["../src/installSkills.ts"],"mappings":";;;;;;;;;;;;iBA4BsB,cAAc,mBAAwB"}
1
+ {"version":3,"file":"installSkills.d.mts","names":[],"sources":["../src/installSkills.ts"],"mappings":";;;;;;;;;;;;wBA4BsB,cAAc,mBAAwB"}
@@ -1,5 +1,4 @@
1
1
  //#region src/keywords.d.ts
2
- declare const keywords: string[];
2
+ export declare const keywords: string[];
3
3
  //#endregion
4
- export { keywords };
5
4
  //# sourceMappingURL=keywords.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keywords.d.cts","names":[],"sources":["../src/keywords.ts"],"mappings":";cAAa"}
1
+ {"version":3,"file":"keywords.d.cts","names":[],"sources":["../src/keywords.ts"],"mappings":";qBAAa"}
@@ -1,5 +1,4 @@
1
1
  //#region src/keywords.d.ts
2
- declare const keywords: string[];
2
+ export declare const keywords: string[];
3
3
  //#endregion
4
- export { keywords };
5
4
  //# sourceMappingURL=keywords.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keywords.d.mts","names":[],"sources":["../src/keywords.ts"],"mappings":";cAAa"}
1
+ {"version":3,"file":"keywords.d.mts","names":[],"sources":["../src/keywords.ts"],"mappings":";qBAAa"}
@@ -5,27 +5,26 @@ import { PrimitiveField } from "./EntityDbMetadata.cjs";
5
5
  import { Client } from "pg";
6
6
  //#region src/loadMetadata.d.ts
7
7
  /** A map from Enum table name to the rows currently in the table. */
8
- type EnumTableData = {
8
+ export type EnumTableData = {
9
9
  table: Table;
10
10
  idType: "integer" | "uuid";
11
11
  name: string;
12
12
  rows: EnumRow[];
13
13
  extraPrimitives: PrimitiveField[];
14
14
  };
15
- type PgEnumData = {
15
+ export type PgEnumData = {
16
16
  name: string;
17
17
  values: string[];
18
18
  };
19
- type EnumMetadata = Record<string, EnumTableData>;
20
- type PgEnumMetadata = Record<string, PgEnumData>;
21
- type EnumRow = {
19
+ export type EnumMetadata = Record<string, EnumTableData>;
20
+ export type PgEnumMetadata = Record<string, PgEnumData>;
21
+ export type EnumRow = {
22
22
  id: number;
23
23
  code: string;
24
24
  name: string;
25
25
  [key: string]: any;
26
26
  };
27
- declare function loadEnumMetadata(db: Db, client: Client, config: Config): Promise<EnumMetadata>;
28
- declare function loadPgEnumMetadata(db: Db, client: Client, config: Config): Promise<PgEnumMetadata>;
27
+ export declare function loadEnumMetadata(db: Db, client: Client, config: Config): Promise<EnumMetadata>;
28
+ export declare function loadPgEnumMetadata(db: Db, client: Client, config: Config): Promise<PgEnumMetadata>;
29
29
  //#endregion
30
- export { EnumMetadata, EnumRow, EnumTableData, PgEnumData, PgEnumMetadata, loadEnumMetadata, loadPgEnumMetadata };
31
30
  //# sourceMappingURL=loadMetadata.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadMetadata.d.cts","names":[],"sources":["../src/loadMetadata.ts"],"mappings":";;;;;;;KAQY;EACV,OAAO;EACP;EAEA;EACA,MAAM;EACN,iBAAiB;;KAGP;EACV;EACA;;KAGU,eAAe,eAAe;KAC9B,iBAAiB,eAAe;KAEhC;EAAY;EAAY;EAAc;GAAe;;iBAE3C,iBAAiB,IAAI,IAAI,QAAQ,QAAQ,QAAQ,SAAS,QAAQ;iBAwBlE,mBAAmB,IAAI,IAAI,QAAQ,QAAQ,QAAQ,SAAS,QAAQ"}
1
+ {"version":3,"file":"loadMetadata.d.cts","names":[],"sources":["../src/loadMetadata.ts"],"mappings":";;;;;;;YAQY;EACV,OAAO;EACP;EAEA;EACA,MAAM;EACN,iBAAiB;;YAGP;EACV;EACA;;YAGU,eAAe,eAAe;YAC9B,iBAAiB,eAAe;YAEhC;EAAY;EAAY;EAAc;GAAe;;wBAE3C,iBAAiB,IAAI,IAAI,QAAQ,QAAQ,QAAQ,SAAS,QAAQ;wBAwBlE,mBAAmB,IAAI,IAAI,QAAQ,QAAQ,QAAQ,SAAS,QAAQ"}
@@ -5,27 +5,26 @@ import { PrimitiveField } from "./EntityDbMetadata.mjs";
5
5
  import { Client } from "pg";
6
6
  //#region src/loadMetadata.d.ts
7
7
  /** A map from Enum table name to the rows currently in the table. */
8
- type EnumTableData = {
8
+ export type EnumTableData = {
9
9
  table: Table;
10
10
  idType: "integer" | "uuid";
11
11
  name: string;
12
12
  rows: EnumRow[];
13
13
  extraPrimitives: PrimitiveField[];
14
14
  };
15
- type PgEnumData = {
15
+ export type PgEnumData = {
16
16
  name: string;
17
17
  values: string[];
18
18
  };
19
- type EnumMetadata = Record<string, EnumTableData>;
20
- type PgEnumMetadata = Record<string, PgEnumData>;
21
- type EnumRow = {
19
+ export type EnumMetadata = Record<string, EnumTableData>;
20
+ export type PgEnumMetadata = Record<string, PgEnumData>;
21
+ export type EnumRow = {
22
22
  id: number;
23
23
  code: string;
24
24
  name: string;
25
25
  [key: string]: any;
26
26
  };
27
- declare function loadEnumMetadata(db: Db, client: Client, config: Config): Promise<EnumMetadata>;
28
- declare function loadPgEnumMetadata(db: Db, client: Client, config: Config): Promise<PgEnumMetadata>;
27
+ export declare function loadEnumMetadata(db: Db, client: Client, config: Config): Promise<EnumMetadata>;
28
+ export declare function loadPgEnumMetadata(db: Db, client: Client, config: Config): Promise<PgEnumMetadata>;
29
29
  //#endregion
30
- export { EnumMetadata, EnumRow, EnumTableData, PgEnumData, PgEnumMetadata, loadEnumMetadata, loadPgEnumMetadata };
31
30
  //# sourceMappingURL=loadMetadata.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadMetadata.d.mts","names":[],"sources":["../src/loadMetadata.ts"],"mappings":";;;;;;;KAQY;EACV,OAAO;EACP;EAEA;EACA,MAAM;EACN,iBAAiB;;KAGP;EACV;EACA;;KAGU,eAAe,eAAe;KAC9B,iBAAiB,eAAe;KAEhC;EAAY;EAAY;EAAc;GAAe;;iBAE3C,iBAAiB,IAAI,IAAI,QAAQ,QAAQ,QAAQ,SAAS,QAAQ;iBAwBlE,mBAAmB,IAAI,IAAI,QAAQ,QAAQ,QAAQ,SAAS,QAAQ"}
1
+ {"version":3,"file":"loadMetadata.d.mts","names":[],"sources":["../src/loadMetadata.ts"],"mappings":";;;;;;;YAQY;EACV,OAAO;EACP;EAEA;EACA,MAAM;EACN,iBAAiB;;YAGP;EACV;EACA;;YAGU,eAAe,eAAe;YAC9B,iBAAiB,eAAe;YAEhC;EAAY;EAAY;EAAc;GAAe;;wBAE3C,iBAAiB,IAAI,IAAI,QAAQ,QAAQ,QAAQ,SAAS,QAAQ;wBAwBlE,mBAAmB,IAAI,IAAI,QAAQ,QAAQ,QAAQ,SAAS,QAAQ"}
@@ -1,13 +1,12 @@
1
1
  //#region src/logger.d.ts
2
- declare const LOG_LEVELS: {
2
+ export declare const LOG_LEVELS: {
3
3
  warn: number;
4
4
  error: number;
5
5
  };
6
- declare let loggerMaxWarningLevelHit: number;
7
- declare const logger: {
6
+ export declare let loggerMaxWarningLevelHit: number;
7
+ export declare const logger: {
8
8
  warn(...args: Parameters<(typeof console)["warn"]>): void;
9
9
  error(...args: Parameters<(typeof console)["error"]>): void;
10
10
  };
11
11
  //#endregion
12
- export { LOG_LEVELS, logger, loggerMaxWarningLevelHit };
13
12
  //# sourceMappingURL=logger.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.cts","names":[],"sources":["../src/logger.ts"],"mappings":";cAAa;EACX;EACA;;YAGS;cAEE;EACX,QAAI,MAAU,mBAAmB;EAIjC,SAAK,MAAU,mBAAmB"}
1
+ {"version":3,"file":"logger.d.cts","names":[],"sources":["../src/logger.ts"],"mappings":";qBAAa;EACX;EACA;;mBAGS;qBAEE;EACX,QAAI,MAAU,mBAAmB;EAIjC,SAAK,MAAU,mBAAmB"}
@@ -1,13 +1,12 @@
1
1
  //#region src/logger.d.ts
2
- declare const LOG_LEVELS: {
2
+ export declare const LOG_LEVELS: {
3
3
  warn: number;
4
4
  error: number;
5
5
  };
6
- declare let loggerMaxWarningLevelHit: number;
7
- declare const logger: {
6
+ export declare let loggerMaxWarningLevelHit: number;
7
+ export declare const logger: {
8
8
  warn(...args: Parameters<(typeof console)["warn"]>): void;
9
9
  error(...args: Parameters<(typeof console)["error"]>): void;
10
10
  };
11
11
  //#endregion
12
- export { LOG_LEVELS, logger, loggerMaxWarningLevelHit };
13
12
  //# sourceMappingURL=logger.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.mts","names":[],"sources":["../src/logger.ts"],"mappings":";cAAa;EACX;EACA;;YAGS;cAEE;EACX,QAAI,MAAU,mBAAmB;EAIjC,SAAK,MAAU,mBAAmB"}
1
+ {"version":3,"file":"logger.d.mts","names":[],"sources":["../src/logger.ts"],"mappings":";qBAAa;EACX;EACA;;mBAGS;qBAEE;EACX,QAAI,MAAU,mBAAmB;EAIjC,SAAK,MAAU,mBAAmB"}
@@ -1,7 +1,7 @@
1
1
  import { Client } from "pg";
2
2
  //#region src/pgMetadata.d.ts
3
3
  /** The small part of PostgreSQL's catalog model used by Joist codegen. */
4
- declare class Items<T extends {
4
+ export declare class Items<T extends {
5
5
  name: string;
6
6
  }> extends Array<T> {
7
7
  private byName?;
@@ -10,17 +10,17 @@ declare class Items<T extends {
10
10
  /** Keep the name index current if more catalog rows arrive after a lookup. */
11
11
  push(...items: T[]): number;
12
12
  }
13
- type Action = "NO ACTION" | "RESTRICT" | "CASCADE" | "SET NULL" | "SET DEFAULT";
14
- type JSONData = string | number | boolean | null | JSONData[] | {
13
+ export type Action = "NO ACTION" | "RESTRICT" | "CASCADE" | "SET NULL" | "SET DEFAULT";
14
+ export type JSONData = string | number | boolean | null | JSONData[] | {
15
15
  [key: string]: JSONData;
16
16
  };
17
- declare class EnumType {
17
+ export declare class EnumType {
18
18
  name: string;
19
19
  values: string[];
20
20
  readonly shortName?: string;
21
21
  constructor(name: string, values: string[]);
22
22
  }
23
- declare class Column {
23
+ export declare class Column {
24
24
  name: string;
25
25
  type: {
26
26
  name: string;
@@ -42,14 +42,14 @@ declare class Column {
42
42
  get default(): string | null;
43
43
  get commentData(): JSONData | undefined;
44
44
  }
45
- declare class Index {
45
+ export declare class Index {
46
46
  name: string;
47
47
  columns: Column[];
48
48
  isUnique: boolean;
49
49
  isPartial: boolean;
50
50
  constructor(name: string, columns: Column[], isUnique: boolean, isPartial: boolean);
51
51
  }
52
- declare class ForeignKey {
52
+ export declare class ForeignKey {
53
53
  name: string;
54
54
  table: Table;
55
55
  referencedTable: Table;
@@ -59,7 +59,7 @@ declare class ForeignKey {
59
59
  onDelete: Action;
60
60
  constructor(name: string, table: Table, referencedTable: Table, columns: Column[], isDeferred: boolean, isDeferrable: boolean, onDelete: Action);
61
61
  }
62
- declare class M2ORelation {
62
+ export declare class M2ORelation {
63
63
  foreignKey: ForeignKey;
64
64
  readonly type = "m2o";
65
65
  constructor(foreignKey: ForeignKey);
@@ -68,7 +68,7 @@ declare class M2ORelation {
68
68
  /** Uses the old short relation name so M2O metadata keeps its factory evaluation order. */
69
69
  get name(): string;
70
70
  }
71
- declare class O2MRelation {
71
+ export declare class O2MRelation {
72
72
  foreignKey: ForeignKey;
73
73
  readonly type = "o2m";
74
74
  constructor(foreignKey: ForeignKey);
@@ -77,7 +77,7 @@ declare class O2MRelation {
77
77
  /** Keeps inverse relations in the same short-name order as pg-structure. */
78
78
  get name(): string;
79
79
  }
80
- declare class M2MRelation {
80
+ export declare class M2MRelation {
81
81
  foreignKey: ForeignKey;
82
82
  targetForeignKey: ForeignKey;
83
83
  readonly type = "m2m";
@@ -88,7 +88,7 @@ declare class M2MRelation {
88
88
  /** Adds the join-table qualifier when more than one join path reaches the same target. */
89
89
  get name(): string;
90
90
  }
91
- declare class Table {
91
+ export declare class Table {
92
92
  name: string;
93
93
  schema: {
94
94
  name: string;
@@ -111,7 +111,7 @@ declare class Table {
111
111
  get o2mRelations(): O2MRelation[];
112
112
  get m2mRelations(): M2MRelation[];
113
113
  }
114
- type Db = {
114
+ export type Db = {
115
115
  tables: Items<Table>;
116
116
  types: EnumType[];
117
117
  };
@@ -122,7 +122,6 @@ type Db = {
122
122
  * objects used by entity fields. For example, books.author_id and authors.id are joined through
123
123
  * the foreign key, while a trigger calling cyanaudit in another schema is irrelevant to codegen.
124
124
  */
125
- declare function loadPgMetadata(client: Client): Promise<Db>;
125
+ export declare function loadPgMetadata(client: Client): Promise<Db>;
126
126
  //#endregion
127
- export { Action, Column, Db, EnumType, ForeignKey, Index, Items, JSONData, M2MRelation, M2ORelation, O2MRelation, Table, loadPgMetadata };
128
127
  //# sourceMappingURL=pgMetadata.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pgMetadata.d.cts","names":[],"sources":["../src/pgMetadata.ts"],"mappings":";;;cAIa,MAAM;EAAY;WAAwB,MAAM;UACnD;;EAGR,IAAI,eAAe;;EAUnB,QAAQ,OAAO;;KAOL;KACA,8CAA8C;GAAgB,cAAc;;cAE3E;EAGF;EACA;WAHA;EACT,YACS,cACA;;cAIE;EAMF;EACA;IAAQ;IAAc;MAAuB;EAC7C;EACA;EACA;EACA;EACA;WAXA,aAAa;WACb,eAAe;EACxB;EAEA,YACS,cACA;IAAQ;IAAc;MAAuB,UAC7C,kBACA,6BACA,sBACA,wBACA;MAGL;MAIA;MAIA,eAAe;;cAMR;EAEF;EACA,SAAS;EACT;EACA;EAJT,YACS,cACA,SAAS,UACT,mBACA;;cAIE;EAEF;EACA,OAAO;EACP,iBAAiB;EACjB,SAAS;EACT;EACA;EACA,UAAU;EAPnB,YACS,cACA,OAAO,OACP,iBAAiB,OACjB,SAAS,UACT,qBACA,uBACA,UAAU;;cAIR;EAGQ,YAAY;WAFtB;EAET,YAAmB,YAAY;MAE3B,eAAe;MAIf,eAAe;;MAKf;;cAWO;EAGQ,YAAY;WAFtB;EAET,YAAmB,YAAY;MAE3B,eAAe;MAIf,eAAe;;MAKf;;cAiBO;EAIF,YAAY;EACZ,kBAAkB;WAJlB;EAET,YACS,YAAY,YACZ,kBAAkB;MAGvB,eAAe;MAIf,eAAe;MAIf,aAAa;;MAKb;;cAmBO;EASF;EACA;IAAU;;WATV,SAAO,MAAA;WACP,SAAO,MAAA;WACP,aAAa;WACb,mBAAmB;WACnB;IAAqB,SAAS;IAAU,OAAO;;EACxD;IAAe,SAAS;;EAExB,YACS,cACA;IAAU;;MAGf,gBAAgB;MAIhB,gBAAgB;MAMhB,gBAAgB;;KAOV;EAAO,QAAQ,MAAM;EAAQ,OAAO;;;;;;;;;iBAS1B,eAAe,QAAQ,SAAS,QAAQ"}
1
+ {"version":3,"file":"pgMetadata.d.cts","names":[],"sources":["../src/pgMetadata.ts"],"mappings":";;;qBAIa,MAAM;EAAY;WAAwB,MAAM;UACnD;;EAGR,IAAI,eAAe;;EAUnB,QAAQ,OAAO;;YAOL;YACA,8CAA8C;GAAgB,cAAc;;qBAE3E;EAGF;EACA;WAHA;EACT,YACS,cACA;;qBAIE;EAMF;EACA;IAAQ;IAAc;MAAuB;EAC7C;EACA;EACA;EACA;EACA;WAXA,aAAa;WACb,eAAe;EACxB;EAEA,YACS,cACA;IAAQ;IAAc;MAAuB,UAC7C,kBACA,6BACA,sBACA,wBACA;MAGL;MAIA;MAIA,eAAe;;qBAMR;EAEF;EACA,SAAS;EACT;EACA;EAJT,YACS,cACA,SAAS,UACT,mBACA;;qBAIE;EAEF;EACA,OAAO;EACP,iBAAiB;EACjB,SAAS;EACT;EACA;EACA,UAAU;EAPnB,YACS,cACA,OAAO,OACP,iBAAiB,OACjB,SAAS,UACT,qBACA,uBACA,UAAU;;qBAIR;EAGQ,YAAY;WAFtB;EAET,YAAmB,YAAY;MAE3B,eAAe;MAIf,eAAe;;MAKf;;qBAWO;EAGQ,YAAY;WAFtB;EAET,YAAmB,YAAY;MAE3B,eAAe;MAIf,eAAe;;MAKf;;qBAiBO;EAIF,YAAY;EACZ,kBAAkB;WAJlB;EAET,YACS,YAAY,YACZ,kBAAkB;MAGvB,eAAe;MAIf,eAAe;MAIf,aAAa;;MAKb;;qBAmBO;EASF;EACA;IAAU;;WATV,SAAO,MAAA;WACP,SAAO,MAAA;WACP,aAAa;WACb,mBAAmB;WACnB;IAAqB,SAAS;IAAU,OAAO;;EACxD;IAAe,SAAS;;EAExB,YACS,cACA;IAAU;;MAGf,gBAAgB;MAIhB,gBAAgB;MAMhB,gBAAgB;;YAOV;EAAO,QAAQ,MAAM;EAAQ,OAAO;;;;;;;;;wBAS1B,eAAe,QAAQ,SAAS,QAAQ"}
@@ -1,7 +1,7 @@
1
1
  import { Client } from "pg";
2
2
  //#region src/pgMetadata.d.ts
3
3
  /** The small part of PostgreSQL's catalog model used by Joist codegen. */
4
- declare class Items<T extends {
4
+ export declare class Items<T extends {
5
5
  name: string;
6
6
  }> extends Array<T> {
7
7
  private byName?;
@@ -10,17 +10,17 @@ declare class Items<T extends {
10
10
  /** Keep the name index current if more catalog rows arrive after a lookup. */
11
11
  push(...items: T[]): number;
12
12
  }
13
- type Action = "NO ACTION" | "RESTRICT" | "CASCADE" | "SET NULL" | "SET DEFAULT";
14
- type JSONData = string | number | boolean | null | JSONData[] | {
13
+ export type Action = "NO ACTION" | "RESTRICT" | "CASCADE" | "SET NULL" | "SET DEFAULT";
14
+ export type JSONData = string | number | boolean | null | JSONData[] | {
15
15
  [key: string]: JSONData;
16
16
  };
17
- declare class EnumType {
17
+ export declare class EnumType {
18
18
  name: string;
19
19
  values: string[];
20
20
  readonly shortName?: string;
21
21
  constructor(name: string, values: string[]);
22
22
  }
23
- declare class Column {
23
+ export declare class Column {
24
24
  name: string;
25
25
  type: {
26
26
  name: string;
@@ -42,14 +42,14 @@ declare class Column {
42
42
  get default(): string | null;
43
43
  get commentData(): JSONData | undefined;
44
44
  }
45
- declare class Index {
45
+ export declare class Index {
46
46
  name: string;
47
47
  columns: Column[];
48
48
  isUnique: boolean;
49
49
  isPartial: boolean;
50
50
  constructor(name: string, columns: Column[], isUnique: boolean, isPartial: boolean);
51
51
  }
52
- declare class ForeignKey {
52
+ export declare class ForeignKey {
53
53
  name: string;
54
54
  table: Table;
55
55
  referencedTable: Table;
@@ -59,7 +59,7 @@ declare class ForeignKey {
59
59
  onDelete: Action;
60
60
  constructor(name: string, table: Table, referencedTable: Table, columns: Column[], isDeferred: boolean, isDeferrable: boolean, onDelete: Action);
61
61
  }
62
- declare class M2ORelation {
62
+ export declare class M2ORelation {
63
63
  foreignKey: ForeignKey;
64
64
  readonly type = "m2o";
65
65
  constructor(foreignKey: ForeignKey);
@@ -68,7 +68,7 @@ declare class M2ORelation {
68
68
  /** Uses the old short relation name so M2O metadata keeps its factory evaluation order. */
69
69
  get name(): string;
70
70
  }
71
- declare class O2MRelation {
71
+ export declare class O2MRelation {
72
72
  foreignKey: ForeignKey;
73
73
  readonly type = "o2m";
74
74
  constructor(foreignKey: ForeignKey);
@@ -77,7 +77,7 @@ declare class O2MRelation {
77
77
  /** Keeps inverse relations in the same short-name order as pg-structure. */
78
78
  get name(): string;
79
79
  }
80
- declare class M2MRelation {
80
+ export declare class M2MRelation {
81
81
  foreignKey: ForeignKey;
82
82
  targetForeignKey: ForeignKey;
83
83
  readonly type = "m2m";
@@ -88,7 +88,7 @@ declare class M2MRelation {
88
88
  /** Adds the join-table qualifier when more than one join path reaches the same target. */
89
89
  get name(): string;
90
90
  }
91
- declare class Table {
91
+ export declare class Table {
92
92
  name: string;
93
93
  schema: {
94
94
  name: string;
@@ -111,7 +111,7 @@ declare class Table {
111
111
  get o2mRelations(): O2MRelation[];
112
112
  get m2mRelations(): M2MRelation[];
113
113
  }
114
- type Db = {
114
+ export type Db = {
115
115
  tables: Items<Table>;
116
116
  types: EnumType[];
117
117
  };
@@ -122,7 +122,6 @@ type Db = {
122
122
  * objects used by entity fields. For example, books.author_id and authors.id are joined through
123
123
  * the foreign key, while a trigger calling cyanaudit in another schema is irrelevant to codegen.
124
124
  */
125
- declare function loadPgMetadata(client: Client): Promise<Db>;
125
+ export declare function loadPgMetadata(client: Client): Promise<Db>;
126
126
  //#endregion
127
- export { Action, Column, Db, EnumType, ForeignKey, Index, Items, JSONData, M2MRelation, M2ORelation, O2MRelation, Table, loadPgMetadata };
128
127
  //# sourceMappingURL=pgMetadata.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pgMetadata.d.mts","names":[],"sources":["../src/pgMetadata.ts"],"mappings":";;;cAIa,MAAM;EAAY;WAAwB,MAAM;UACnD;;EAGR,IAAI,eAAe;;EAUnB,QAAQ,OAAO;;KAOL;KACA,8CAA8C;GAAgB,cAAc;;cAE3E;EAGF;EACA;WAHA;EACT,YACS,cACA;;cAIE;EAMF;EACA;IAAQ;IAAc;MAAuB;EAC7C;EACA;EACA;EACA;EACA;WAXA,aAAa;WACb,eAAe;EACxB;EAEA,YACS,cACA;IAAQ;IAAc;MAAuB,UAC7C,kBACA,6BACA,sBACA,wBACA;MAGL;MAIA;MAIA,eAAe;;cAMR;EAEF;EACA,SAAS;EACT;EACA;EAJT,YACS,cACA,SAAS,UACT,mBACA;;cAIE;EAEF;EACA,OAAO;EACP,iBAAiB;EACjB,SAAS;EACT;EACA;EACA,UAAU;EAPnB,YACS,cACA,OAAO,OACP,iBAAiB,OACjB,SAAS,UACT,qBACA,uBACA,UAAU;;cAIR;EAGQ,YAAY;WAFtB;EAET,YAAmB,YAAY;MAE3B,eAAe;MAIf,eAAe;;MAKf;;cAWO;EAGQ,YAAY;WAFtB;EAET,YAAmB,YAAY;MAE3B,eAAe;MAIf,eAAe;;MAKf;;cAiBO;EAIF,YAAY;EACZ,kBAAkB;WAJlB;EAET,YACS,YAAY,YACZ,kBAAkB;MAGvB,eAAe;MAIf,eAAe;MAIf,aAAa;;MAKb;;cAmBO;EASF;EACA;IAAU;;WATV,SAAO,MAAA;WACP,SAAO,MAAA;WACP,aAAa;WACb,mBAAmB;WACnB;IAAqB,SAAS;IAAU,OAAO;;EACxD;IAAe,SAAS;;EAExB,YACS,cACA;IAAU;;MAGf,gBAAgB;MAIhB,gBAAgB;MAMhB,gBAAgB;;KAOV;EAAO,QAAQ,MAAM;EAAQ,OAAO;;;;;;;;;iBAS1B,eAAe,QAAQ,SAAS,QAAQ"}
1
+ {"version":3,"file":"pgMetadata.d.mts","names":[],"sources":["../src/pgMetadata.ts"],"mappings":";;;qBAIa,MAAM;EAAY;WAAwB,MAAM;UACnD;;EAGR,IAAI,eAAe;;EAUnB,QAAQ,OAAO;;YAOL;YACA,8CAA8C;GAAgB,cAAc;;qBAE3E;EAGF;EACA;WAHA;EACT,YACS,cACA;;qBAIE;EAMF;EACA;IAAQ;IAAc;MAAuB;EAC7C;EACA;EACA;EACA;EACA;WAXA,aAAa;WACb,eAAe;EACxB;EAEA,YACS,cACA;IAAQ;IAAc;MAAuB,UAC7C,kBACA,6BACA,sBACA,wBACA;MAGL;MAIA;MAIA,eAAe;;qBAMR;EAEF;EACA,SAAS;EACT;EACA;EAJT,YACS,cACA,SAAS,UACT,mBACA;;qBAIE;EAEF;EACA,OAAO;EACP,iBAAiB;EACjB,SAAS;EACT;EACA;EACA,UAAU;EAPnB,YACS,cACA,OAAO,OACP,iBAAiB,OACjB,SAAS,UACT,qBACA,uBACA,UAAU;;qBAIR;EAGQ,YAAY;WAFtB;EAET,YAAmB,YAAY;MAE3B,eAAe;MAIf,eAAe;;MAKf;;qBAWO;EAGQ,YAAY;WAFtB;EAET,YAAmB,YAAY;MAE3B,eAAe;MAIf,eAAe;;MAKf;;qBAiBO;EAIF,YAAY;EACZ,kBAAkB;WAJlB;EAET,YACS,YAAY,YACZ,kBAAkB;MAGvB,eAAe;MAIf,eAAe;MAIf,aAAa;;MAKb;;qBAmBO;EASF;EACA;IAAU;;WATV,SAAO,MAAA;WACP,SAAO,MAAA;WACP,aAAa;WACb,mBAAmB;WACnB;IAAqB,SAAS;IAAU,OAAO;;EACxD;IAAe,SAAS;;EAExB,YACS,cACA;IAAU;;MAGf,gBAAgB;MAIhB,gBAAgB;MAMhB,gBAAgB;;YAOV;EAAO,QAAQ,MAAM;EAAQ,OAAO;;;;;;;;;wBAS1B,eAAe,QAAQ,SAAS,QAAQ"}
@@ -5,7 +5,8 @@ let path = require("path");
5
5
  let fs_promises = require("fs/promises");
6
6
  //#region src/scanEntityFiles.ts
7
7
  const regex = /config\.setDefault\([\s\n]*["'](\w+)["']/g;
8
- /** Scans the entity files themselves for usage hints (like `setDefault` calls) to drive our codegen output. */
8
+ const transitionsRegex = /config\.(?:setTransitions|addTransitionRule|addTransitionReaction)\(\s*(?:(?:["'][^"']*["']|\w+)\s*,\s*(?=["']))?["'](\w+)["']/g;
9
+ /** Scans the entity files themselves for usage hints (like `setDefault` or `setTransitions` calls) to drive our codegen output. */
9
10
  async function scanEntityFiles(config, dbMeta) {
10
11
  await Promise.all(dbMeta.entities.map(async (entity) => {
11
12
  try {
@@ -15,6 +16,10 @@ async function scanEntityFiles(config, dbMeta) {
15
16
  const field = defaultableFields.find((f) => f.fieldName === match[1]);
16
17
  if (field) field.hasConfigDefault = true;
17
18
  }
19
+ for (const match of tsCode.matchAll(transitionsRegex)) {
20
+ const field = defaultableFields.find((f) => f.fieldName === match[1]);
21
+ if (field?.kind === "enum") field.hasTransitions = true;
22
+ }
18
23
  } catch (e) {}
19
24
  }));
20
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scanEntityFiles.cjs","names":["readFile","join"],"sources":["../src/scanEntityFiles.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport { join } from \"path\";\n\nimport { type Config } from \"./config.ts\";\nimport {\n type DbMetadata,\n type EntityDbMetadata,\n type EnumField,\n type ManyToOneField,\n type PgEnumField,\n type PolymorphicField,\n type PrimitiveField,\n} from \"./EntityDbMetadata.ts\";\n\n// Erg, we need a regex in case the fieldName arg is wrapped onto a new line... :-/\nconst regex = /config\\.setDefault\\([\\s\\n]*[\"'](\\w+)[\"']/g;\n\n/** Scans the entity files themselves for usage hints (like `setDefault` calls) to drive our codegen output. */\nexport async function scanEntityFiles(config: Config, dbMeta: DbMetadata): Promise<void> {\n await Promise.all(\n dbMeta.entities.map(async (entity) => {\n try {\n // load the entity.ts file (as a promise with fs/promises)\n const tsCode = (await readFile(join(config.entitiesDirectory, `${entity.name}.ts`))).toString();\n const defaultableFields = recursiveDefaultableFields(dbMeta, entity);\n for (const match of tsCode.matchAll(regex)) {\n const field = defaultableFields.find((f) => f.fieldName === match[1]);\n if (field) {\n field.hasConfigDefault = true;\n }\n }\n } catch (e) {\n // Ignore file not existing yet\n }\n }),\n );\n}\n\n/**\n * Traverse the entity inheritance tree to find all fields that can have defaults set on them.\n *\n * I.e. a column defined in a base CTI table like `publishers.foo_bar` having a `config.setDefault` in\n * `SmallPublisher` and/or `LargePublisher`, or the same scenario for an STI table like `tasks.foo_bar`\n * with `TaskNew` and/or `TaskOld`.\n *\n * NOTE: I suspect here could be some edge cases here that will need to be ironed out, but should work\n * for simple inheritance structures. In particular, there may be unexpected side effects if a base\n * class field has a default set in one subtype, but not another.\n */\nfunction recursiveDefaultableFields(\n dbMeta: DbMetadata,\n entity: EntityDbMetadata | undefined,\n): Array<PrimitiveField | EnumField | PgEnumField | ManyToOneField | PolymorphicField> {\n if (!entity) return [];\n return [\n ...entity.primitives,\n ...entity.enums,\n ...entity.pgEnums,\n ...entity.manyToOnes,\n ...entity.polymorphics,\n ...(entity.baseClassName ? recursiveDefaultableFields(dbMeta, dbMeta.entitiesByName[entity.baseClassName]) : []),\n ];\n}\n"],"mappings":";;;;;;AAeA,MAAM,QAAQ;;AAGd,eAAsB,gBAAgB,QAAgB,QAAmC;CACvF,MAAM,QAAQ,IACZ,OAAO,SAAS,IAAI,OAAO,WAAW;EACpC,IAAI;GAEF,MAAM,UAAU,OAAA,GAAMA,YAAAA,SAAAA,EAAAA,GAASC,KAAAA,KAAAA,CAAK,OAAO,mBAAmB,GAAG,OAAO,KAAK,IAAI,CAAC,EAAA,CAAG,SAAS;GAC9F,MAAM,oBAAoB,2BAA2B,QAAQ,MAAM;GACnE,KAAK,MAAM,SAAS,OAAO,SAAS,KAAK,GAAG;IAC1C,MAAM,QAAQ,kBAAkB,MAAM,MAAM,EAAE,cAAc,MAAM,EAAE;IACpE,IAAI,OACF,MAAM,mBAAmB;GAE7B;EACF,SAAS,GAAG,CAEZ;CACF,CAAC,CACH;AACF;;;;;;;;;;;;AAaA,SAAS,2BACP,QACA,QACqF;CACrF,IAAI,CAAC,QAAQ,OAAO,CAAC;CACrB,OAAO;EACL,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAI,OAAO,gBAAgB,2BAA2B,QAAQ,OAAO,eAAe,OAAO,cAAc,IAAI,CAAC;CAChH;AACF"}
1
+ {"version":3,"file":"scanEntityFiles.cjs","names":["readFile","join"],"sources":["../src/scanEntityFiles.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport { join } from \"path\";\n\nimport { type Config } from \"./config.ts\";\nimport {\n type DbMetadata,\n type EntityDbMetadata,\n type EnumField,\n type ManyToOneField,\n type PgEnumField,\n type PolymorphicField,\n type PrimitiveField,\n} from \"./EntityDbMetadata.ts\";\n\n// Erg, we need a regex in case the fieldName arg is wrapped onto a new line... :-/\nconst regex = /config\\.setDefault\\([\\s\\n]*[\"'](\\w+)[\"']/g;\n// Any transition method marks the field; addTransitionReaction may have a name before the field argument.\nconst transitionsRegex =\n /config\\.(?:setTransitions|addTransitionRule|addTransitionReaction)\\(\\s*(?:(?:[\"'][^\"']*[\"']|\\w+)\\s*,\\s*(?=[\"']))?[\"'](\\w+)[\"']/g;\n\n/** Scans the entity files themselves for usage hints (like `setDefault` or `setTransitions` calls) to drive our codegen output. */\nexport async function scanEntityFiles(config: Config, dbMeta: DbMetadata): Promise<void> {\n await Promise.all(\n dbMeta.entities.map(async (entity) => {\n try {\n // load the entity.ts file (as a promise with fs/promises)\n const tsCode = (await readFile(join(config.entitiesDirectory, `${entity.name}.ts`))).toString();\n const defaultableFields = recursiveDefaultableFields(dbMeta, entity);\n for (const match of tsCode.matchAll(regex)) {\n const field = defaultableFields.find((f) => f.fieldName === match[1]);\n if (field) {\n field.hasConfigDefault = true;\n }\n }\n // Transition fields get `withStatus` factory opts and accessor names, i.e. `Draft`\n for (const match of tsCode.matchAll(transitionsRegex)) {\n const field = defaultableFields.find((f) => f.fieldName === match[1]);\n if (field?.kind === \"enum\") {\n field.hasTransitions = true;\n }\n }\n } catch (e) {\n // Ignore file not existing yet\n }\n }),\n );\n}\n\n/**\n * Traverse the entity inheritance tree to find all fields that can have defaults set on them.\n *\n * I.e. a column defined in a base CTI table like `publishers.foo_bar` having a `config.setDefault` in\n * `SmallPublisher` and/or `LargePublisher`, or the same scenario for an STI table like `tasks.foo_bar`\n * with `TaskNew` and/or `TaskOld`.\n *\n * NOTE: I suspect here could be some edge cases here that will need to be ironed out, but should work\n * for simple inheritance structures. In particular, there may be unexpected side effects if a base\n * class field has a default set in one subtype, but not another.\n */\nfunction recursiveDefaultableFields(\n dbMeta: DbMetadata,\n entity: EntityDbMetadata | undefined,\n): Array<PrimitiveField | EnumField | PgEnumField | ManyToOneField | PolymorphicField> {\n if (!entity) return [];\n return [\n ...entity.primitives,\n ...entity.enums,\n ...entity.pgEnums,\n ...entity.manyToOnes,\n ...entity.polymorphics,\n ...(entity.baseClassName ? recursiveDefaultableFields(dbMeta, dbMeta.entitiesByName[entity.baseClassName]) : []),\n ];\n}\n"],"mappings":";;;;;;AAeA,MAAM,QAAQ;AAEd,MAAM,mBACJ;;AAGF,eAAsB,gBAAgB,QAAgB,QAAmC;CACvF,MAAM,QAAQ,IACZ,OAAO,SAAS,IAAI,OAAO,WAAW;EACpC,IAAI;GAEF,MAAM,UAAU,OAAA,GAAMA,YAAAA,SAAAA,EAAAA,GAASC,KAAAA,KAAAA,CAAK,OAAO,mBAAmB,GAAG,OAAO,KAAK,IAAI,CAAC,EAAA,CAAG,SAAS;GAC9F,MAAM,oBAAoB,2BAA2B,QAAQ,MAAM;GACnE,KAAK,MAAM,SAAS,OAAO,SAAS,KAAK,GAAG;IAC1C,MAAM,QAAQ,kBAAkB,MAAM,MAAM,EAAE,cAAc,MAAM,EAAE;IACpE,IAAI,OACF,MAAM,mBAAmB;GAE7B;GAEA,KAAK,MAAM,SAAS,OAAO,SAAS,gBAAgB,GAAG;IACrD,MAAM,QAAQ,kBAAkB,MAAM,MAAM,EAAE,cAAc,MAAM,EAAE;IACpE,IAAI,OAAO,SAAS,QAClB,MAAM,iBAAiB;GAE3B;EACF,SAAS,GAAG,CAEZ;CACF,CAAC,CACH;AACF;;;;;;;;;;;;AAaA,SAAS,2BACP,QACA,QACqF;CACrF,IAAI,CAAC,QAAQ,OAAO,CAAC;CACrB,OAAO;EACL,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAI,OAAO,gBAAgB,2BAA2B,QAAQ,OAAO,eAAe,OAAO,cAAc,IAAI,CAAC;CAChH;AACF"}
@@ -1,8 +1,7 @@
1
1
  import { Config } from "./config.cjs";
2
2
  import { DbMetadata } from "./EntityDbMetadata.cjs";
3
3
  //#region src/scanEntityFiles.d.ts
4
- /** Scans the entity files themselves for usage hints (like `setDefault` calls) to drive our codegen output. */
5
- declare function scanEntityFiles(config: Config, dbMeta: DbMetadata): Promise<void>;
4
+ /** Scans the entity files themselves for usage hints (like `setDefault` or `setTransitions` calls) to drive our codegen output. */
5
+ export declare function scanEntityFiles(config: Config, dbMeta: DbMetadata): Promise<void>;
6
6
  //#endregion
7
- export { scanEntityFiles };
8
7
  //# sourceMappingURL=scanEntityFiles.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scanEntityFiles.d.cts","names":[],"sources":["../src/scanEntityFiles.ts"],"mappings":";;;;iBAkBsB,gBAAgB,QAAQ,QAAQ,QAAQ,aAAa"}
1
+ {"version":3,"file":"scanEntityFiles.d.cts","names":[],"sources":["../src/scanEntityFiles.ts"],"mappings":";;;;wBAqBsB,gBAAgB,QAAQ,QAAQ,QAAQ,aAAa"}
@@ -1,8 +1,7 @@
1
1
  import { Config } from "./config.mjs";
2
2
  import { DbMetadata } from "./EntityDbMetadata.mjs";
3
3
  //#region src/scanEntityFiles.d.ts
4
- /** Scans the entity files themselves for usage hints (like `setDefault` calls) to drive our codegen output. */
5
- declare function scanEntityFiles(config: Config, dbMeta: DbMetadata): Promise<void>;
4
+ /** Scans the entity files themselves for usage hints (like `setDefault` or `setTransitions` calls) to drive our codegen output. */
5
+ export declare function scanEntityFiles(config: Config, dbMeta: DbMetadata): Promise<void>;
6
6
  //#endregion
7
- export { scanEntityFiles };
8
7
  //# sourceMappingURL=scanEntityFiles.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scanEntityFiles.d.mts","names":[],"sources":["../src/scanEntityFiles.ts"],"mappings":";;;;iBAkBsB,gBAAgB,QAAQ,QAAQ,QAAQ,aAAa"}
1
+ {"version":3,"file":"scanEntityFiles.d.mts","names":[],"sources":["../src/scanEntityFiles.ts"],"mappings":";;;;wBAqBsB,gBAAgB,QAAQ,QAAQ,QAAQ,aAAa"}
@@ -4,7 +4,8 @@ import { join } from "path";
4
4
  import { readFile } from "fs/promises";
5
5
  //#region src/scanEntityFiles.ts
6
6
  const regex = /config\.setDefault\([\s\n]*["'](\w+)["']/g;
7
- /** Scans the entity files themselves for usage hints (like `setDefault` calls) to drive our codegen output. */
7
+ const transitionsRegex = /config\.(?:setTransitions|addTransitionRule|addTransitionReaction)\(\s*(?:(?:["'][^"']*["']|\w+)\s*,\s*(?=["']))?["'](\w+)["']/g;
8
+ /** Scans the entity files themselves for usage hints (like `setDefault` or `setTransitions` calls) to drive our codegen output. */
8
9
  async function scanEntityFiles(config, dbMeta) {
9
10
  await Promise.all(dbMeta.entities.map(async (entity) => {
10
11
  try {
@@ -14,6 +15,10 @@ async function scanEntityFiles(config, dbMeta) {
14
15
  const field = defaultableFields.find((f) => f.fieldName === match[1]);
15
16
  if (field) field.hasConfigDefault = true;
16
17
  }
18
+ for (const match of tsCode.matchAll(transitionsRegex)) {
19
+ const field = defaultableFields.find((f) => f.fieldName === match[1]);
20
+ if (field?.kind === "enum") field.hasTransitions = true;
21
+ }
17
22
  } catch (e) {}
18
23
  }));
19
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scanEntityFiles.js","names":[],"sources":["../src/scanEntityFiles.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport { join } from \"path\";\n\nimport { type Config } from \"./config.ts\";\nimport {\n type DbMetadata,\n type EntityDbMetadata,\n type EnumField,\n type ManyToOneField,\n type PgEnumField,\n type PolymorphicField,\n type PrimitiveField,\n} from \"./EntityDbMetadata.ts\";\n\n// Erg, we need a regex in case the fieldName arg is wrapped onto a new line... :-/\nconst regex = /config\\.setDefault\\([\\s\\n]*[\"'](\\w+)[\"']/g;\n\n/** Scans the entity files themselves for usage hints (like `setDefault` calls) to drive our codegen output. */\nexport async function scanEntityFiles(config: Config, dbMeta: DbMetadata): Promise<void> {\n await Promise.all(\n dbMeta.entities.map(async (entity) => {\n try {\n // load the entity.ts file (as a promise with fs/promises)\n const tsCode = (await readFile(join(config.entitiesDirectory, `${entity.name}.ts`))).toString();\n const defaultableFields = recursiveDefaultableFields(dbMeta, entity);\n for (const match of tsCode.matchAll(regex)) {\n const field = defaultableFields.find((f) => f.fieldName === match[1]);\n if (field) {\n field.hasConfigDefault = true;\n }\n }\n } catch (e) {\n // Ignore file not existing yet\n }\n }),\n );\n}\n\n/**\n * Traverse the entity inheritance tree to find all fields that can have defaults set on them.\n *\n * I.e. a column defined in a base CTI table like `publishers.foo_bar` having a `config.setDefault` in\n * `SmallPublisher` and/or `LargePublisher`, or the same scenario for an STI table like `tasks.foo_bar`\n * with `TaskNew` and/or `TaskOld`.\n *\n * NOTE: I suspect here could be some edge cases here that will need to be ironed out, but should work\n * for simple inheritance structures. In particular, there may be unexpected side effects if a base\n * class field has a default set in one subtype, but not another.\n */\nfunction recursiveDefaultableFields(\n dbMeta: DbMetadata,\n entity: EntityDbMetadata | undefined,\n): Array<PrimitiveField | EnumField | PgEnumField | ManyToOneField | PolymorphicField> {\n if (!entity) return [];\n return [\n ...entity.primitives,\n ...entity.enums,\n ...entity.pgEnums,\n ...entity.manyToOnes,\n ...entity.polymorphics,\n ...(entity.baseClassName ? recursiveDefaultableFields(dbMeta, dbMeta.entitiesByName[entity.baseClassName]) : []),\n ];\n}\n"],"mappings":";;;;;AAeA,MAAM,QAAQ;;AAGd,eAAsB,gBAAgB,QAAgB,QAAmC;CACvF,MAAM,QAAQ,IACZ,OAAO,SAAS,IAAI,OAAO,WAAW;EACpC,IAAI;GAEF,MAAM,UAAU,MAAM,SAAS,KAAK,OAAO,mBAAmB,GAAG,OAAO,KAAK,IAAI,CAAC,EAAA,CAAG,SAAS;GAC9F,MAAM,oBAAoB,2BAA2B,QAAQ,MAAM;GACnE,KAAK,MAAM,SAAS,OAAO,SAAS,KAAK,GAAG;IAC1C,MAAM,QAAQ,kBAAkB,MAAM,MAAM,EAAE,cAAc,MAAM,EAAE;IACpE,IAAI,OACF,MAAM,mBAAmB;GAE7B;EACF,SAAS,GAAG,CAEZ;CACF,CAAC,CACH;AACF;;;;;;;;;;;;AAaA,SAAS,2BACP,QACA,QACqF;CACrF,IAAI,CAAC,QAAQ,OAAO,CAAC;CACrB,OAAO;EACL,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAI,OAAO,gBAAgB,2BAA2B,QAAQ,OAAO,eAAe,OAAO,cAAc,IAAI,CAAC;CAChH;AACF"}
1
+ {"version":3,"file":"scanEntityFiles.js","names":[],"sources":["../src/scanEntityFiles.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport { join } from \"path\";\n\nimport { type Config } from \"./config.ts\";\nimport {\n type DbMetadata,\n type EntityDbMetadata,\n type EnumField,\n type ManyToOneField,\n type PgEnumField,\n type PolymorphicField,\n type PrimitiveField,\n} from \"./EntityDbMetadata.ts\";\n\n// Erg, we need a regex in case the fieldName arg is wrapped onto a new line... :-/\nconst regex = /config\\.setDefault\\([\\s\\n]*[\"'](\\w+)[\"']/g;\n// Any transition method marks the field; addTransitionReaction may have a name before the field argument.\nconst transitionsRegex =\n /config\\.(?:setTransitions|addTransitionRule|addTransitionReaction)\\(\\s*(?:(?:[\"'][^\"']*[\"']|\\w+)\\s*,\\s*(?=[\"']))?[\"'](\\w+)[\"']/g;\n\n/** Scans the entity files themselves for usage hints (like `setDefault` or `setTransitions` calls) to drive our codegen output. */\nexport async function scanEntityFiles(config: Config, dbMeta: DbMetadata): Promise<void> {\n await Promise.all(\n dbMeta.entities.map(async (entity) => {\n try {\n // load the entity.ts file (as a promise with fs/promises)\n const tsCode = (await readFile(join(config.entitiesDirectory, `${entity.name}.ts`))).toString();\n const defaultableFields = recursiveDefaultableFields(dbMeta, entity);\n for (const match of tsCode.matchAll(regex)) {\n const field = defaultableFields.find((f) => f.fieldName === match[1]);\n if (field) {\n field.hasConfigDefault = true;\n }\n }\n // Transition fields get `withStatus` factory opts and accessor names, i.e. `Draft`\n for (const match of tsCode.matchAll(transitionsRegex)) {\n const field = defaultableFields.find((f) => f.fieldName === match[1]);\n if (field?.kind === \"enum\") {\n field.hasTransitions = true;\n }\n }\n } catch (e) {\n // Ignore file not existing yet\n }\n }),\n );\n}\n\n/**\n * Traverse the entity inheritance tree to find all fields that can have defaults set on them.\n *\n * I.e. a column defined in a base CTI table like `publishers.foo_bar` having a `config.setDefault` in\n * `SmallPublisher` and/or `LargePublisher`, or the same scenario for an STI table like `tasks.foo_bar`\n * with `TaskNew` and/or `TaskOld`.\n *\n * NOTE: I suspect here could be some edge cases here that will need to be ironed out, but should work\n * for simple inheritance structures. In particular, there may be unexpected side effects if a base\n * class field has a default set in one subtype, but not another.\n */\nfunction recursiveDefaultableFields(\n dbMeta: DbMetadata,\n entity: EntityDbMetadata | undefined,\n): Array<PrimitiveField | EnumField | PgEnumField | ManyToOneField | PolymorphicField> {\n if (!entity) return [];\n return [\n ...entity.primitives,\n ...entity.enums,\n ...entity.pgEnums,\n ...entity.manyToOnes,\n ...entity.polymorphics,\n ...(entity.baseClassName ? recursiveDefaultableFields(dbMeta, dbMeta.entitiesByName[entity.baseClassName]) : []),\n ];\n}\n"],"mappings":";;;;;AAeA,MAAM,QAAQ;AAEd,MAAM,mBACJ;;AAGF,eAAsB,gBAAgB,QAAgB,QAAmC;CACvF,MAAM,QAAQ,IACZ,OAAO,SAAS,IAAI,OAAO,WAAW;EACpC,IAAI;GAEF,MAAM,UAAU,MAAM,SAAS,KAAK,OAAO,mBAAmB,GAAG,OAAO,KAAK,IAAI,CAAC,EAAA,CAAG,SAAS;GAC9F,MAAM,oBAAoB,2BAA2B,QAAQ,MAAM;GACnE,KAAK,MAAM,SAAS,OAAO,SAAS,KAAK,GAAG;IAC1C,MAAM,QAAQ,kBAAkB,MAAM,MAAM,EAAE,cAAc,MAAM,EAAE;IACpE,IAAI,OACF,MAAM,mBAAmB;GAE7B;GAEA,KAAK,MAAM,SAAS,OAAO,SAAS,gBAAgB,GAAG;IACrD,MAAM,QAAQ,kBAAkB,MAAM,MAAM,EAAE,cAAc,MAAM,EAAE;IACpE,IAAI,OAAO,SAAS,QAClB,MAAM,iBAAiB;GAE3B;EACF,SAAS,GAAG,CAEZ;CACF,CAAC,CACH;AACF;;;;;;;;;;;;AAaA,SAAS,2BACP,QACA,QACqF;CACrF,IAAI,CAAC,QAAQ,OAAO,CAAC;CACrB,OAAO;EACL,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAG,OAAO;EACV,GAAI,OAAO,gBAAgB,2BAA2B,QAAQ,OAAO,eAAe,OAAO,cAAc,IAAI,CAAC;CAChH;AACF"}
@@ -26,10 +26,9 @@ import { EntityDbMetadata } from "./EntityDbMetadata.cjs";
26
26
  * two arrays of all soft-cycle (nullable, fixup-able) and hard-cycle (not-nullable, blocking)
27
27
  * keys.
28
28
  */
29
- declare function sortByNonDeferredForeignKeys(entities: EntityDbMetadata[]): {
29
+ export declare function sortByNonDeferredForeignKeys(entities: EntityDbMetadata[]): {
30
30
  nullableCycles: string[];
31
31
  notNullCycles: string[];
32
32
  };
33
33
  //#endregion
34
- export { sortByNonDeferredForeignKeys };
35
34
  //# sourceMappingURL=sortForeignKeys.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sortForeignKeys.d.cts","names":[],"sources":["../src/sortForeignKeys.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BgB,6BAA6B,UAAU;EACrD;EACA"}
1
+ {"version":3,"file":"sortForeignKeys.d.cts","names":[],"sources":["../src/sortForeignKeys.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA4BgB,6BAA6B,UAAU;EACrD;EACA"}
@@ -26,10 +26,9 @@ import { EntityDbMetadata } from "./EntityDbMetadata.mjs";
26
26
  * two arrays of all soft-cycle (nullable, fixup-able) and hard-cycle (not-nullable, blocking)
27
27
  * keys.
28
28
  */
29
- declare function sortByNonDeferredForeignKeys(entities: EntityDbMetadata[]): {
29
+ export declare function sortByNonDeferredForeignKeys(entities: EntityDbMetadata[]): {
30
30
  nullableCycles: string[];
31
31
  notNullCycles: string[];
32
32
  };
33
33
  //#endregion
34
- export { sortByNonDeferredForeignKeys };
35
34
  //# sourceMappingURL=sortForeignKeys.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sortForeignKeys.d.mts","names":[],"sources":["../src/sortForeignKeys.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BgB,6BAA6B,UAAU;EACrD;EACA"}
1
+ {"version":3,"file":"sortForeignKeys.d.mts","names":[],"sources":["../src/sortForeignKeys.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA4BgB,6BAA6B,UAAU;EACrD;EACA"}
package/build/symbols.cjs CHANGED
@@ -43,6 +43,7 @@ const PlainTimeSerde = (0, ts_poet.imp)("PlainTimeSerde@joist-orm");
43
43
  const PlainDateTimeSerde = (0, ts_poet.imp)("PlainDateTimeSerde@joist-orm");
44
44
  const ZonedDateTimeSerde = (0, ts_poet.imp)("ZonedDateTimeSerde@joist-orm");
45
45
  const JsonSerde = (0, ts_poet.imp)("JsonSerde@joist-orm");
46
+ const VectorSerde = (0, ts_poet.imp)("VectorSerde@joist-orm");
46
47
  const SuperstructSerde = (0, ts_poet.imp)("SuperstructSerde@joist-orm");
47
48
  const TaggedId = (0, ts_poet.imp)("t:TaggedId@joist-orm");
48
49
  const ZodSerde = (0, ts_poet.imp)("ZodSerde@joist-orm");
@@ -192,6 +193,7 @@ exports.TaggedId = TaggedId;
192
193
  exports.ToJsonHint = ToJsonHint;
193
194
  exports.ValueFilter = ValueFilter;
194
195
  exports.ValueGraphQLFilter = ValueGraphQLFilter;
196
+ exports.VectorSerde = VectorSerde;
195
197
  exports.Zod = Zod;
196
198
  exports.ZodSerde = ZodSerde;
197
199
  exports.ZonedDateTimeSerde = ZonedDateTimeSerde;