@rvoh/dream 0.37.4 → 0.39.0

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 (270) hide show
  1. package/dist/cjs/src/Dream.js +15 -11
  2. package/dist/cjs/src/bin/helpers/sync.js +3 -3
  3. package/dist/cjs/src/bin/index.js +1 -1
  4. package/dist/cjs/src/cli/index.js +18 -14
  5. package/dist/cjs/src/db/DreamDbConnection.js +1 -1
  6. package/dist/cjs/src/decorators/field/association/BelongsTo.js +1 -1
  7. package/dist/cjs/src/decorators/field/association/HasMany.js +1 -1
  8. package/dist/cjs/src/decorators/field/association/HasOne.js +1 -1
  9. package/dist/cjs/src/dream/Query.js +1 -1
  10. package/dist/cjs/src/dream/internal/executeDatabaseQuery.js +1 -1
  11. package/dist/cjs/src/dream-app/cache.js +13 -0
  12. package/dist/cjs/src/{dream-application → dream-app}/helpers/DreamImporter.js +2 -2
  13. package/dist/cjs/src/{dream-application → dream-app}/helpers/importers/importSerializers.js +1 -1
  14. package/dist/cjs/src/{dream-application → dream-app}/index.js +20 -17
  15. package/dist/cjs/src/encrypt/InternalEncrypt.js +1 -1
  16. package/dist/cjs/src/errors/{dream-application/DreamApplicationInitMissingCallToLoadModels.js → dream-app/DreamAppInitMissingCallToLoadModels.js} +4 -4
  17. package/dist/cjs/src/errors/{dream-application/DreamApplicationInitMissingMissingProjectRoot.js → dream-app/DreamAppInitMissingMissingProjectRoot.js} +4 -4
  18. package/dist/cjs/src/errors/encrypt/MissingColumnEncryptionOpts.js +1 -1
  19. package/dist/cjs/src/errors/schema-builder/FailedToIdentifyAssociation.js +1 -1
  20. package/dist/cjs/src/helpers/cli/SchemaBuilder.js +3 -3
  21. package/dist/cjs/src/helpers/cli/generateDream.js +1 -1
  22. package/dist/cjs/src/helpers/cli/generateFactory.js +1 -1
  23. package/dist/cjs/src/helpers/cli/generateMigration.js +2 -2
  24. package/dist/cjs/src/helpers/cli/generateSerializer.js +1 -1
  25. package/dist/cjs/src/helpers/cli/generateUnitSpec.js +1 -1
  26. package/dist/cjs/src/helpers/db/createDb.js +1 -1
  27. package/dist/cjs/src/helpers/db/dropDb.js +6 -6
  28. package/dist/cjs/src/helpers/db/loadPgClient.js +1 -1
  29. package/dist/cjs/src/helpers/db/primaryKeyType.js +1 -1
  30. package/dist/cjs/src/helpers/db/runMigration.js +13 -13
  31. package/dist/cjs/src/helpers/getFiles.js +2 -2
  32. package/dist/cjs/src/helpers/inferSerializerFromDreamOrViewModel.js +1 -1
  33. package/dist/cjs/src/helpers/loadRepl.js +1 -1
  34. package/dist/cjs/src/helpers/path/dreamFileAndDirPaths.js +2 -2
  35. package/dist/cjs/src/helpers/path/dreamPath.js +1 -1
  36. package/dist/cjs/src/index.js +6 -6
  37. package/dist/cjs/src/serializer/index.js +2 -2
  38. package/dist/esm/src/Dream.js +15 -11
  39. package/dist/esm/src/bin/helpers/sync.js +4 -4
  40. package/dist/esm/src/bin/index.js +6 -6
  41. package/dist/esm/src/cli/index.js +18 -14
  42. package/dist/esm/src/db/DreamDbConnection.js +4 -4
  43. package/dist/esm/src/decorators/field/association/BelongsTo.js +1 -1
  44. package/dist/esm/src/decorators/field/association/HasMany.js +1 -1
  45. package/dist/esm/src/decorators/field/association/HasOne.js +1 -1
  46. package/dist/esm/src/dream/Query.js +1 -1
  47. package/dist/esm/src/dream/internal/executeDatabaseQuery.js +2 -2
  48. package/dist/esm/src/dream-app/cache.js +9 -0
  49. package/dist/esm/src/{dream-application → dream-app}/helpers/DreamImporter.js +2 -2
  50. package/dist/esm/src/{dream-application → dream-app}/helpers/importers/importSerializers.js +1 -1
  51. package/dist/esm/src/{dream-application → dream-app}/index.js +20 -17
  52. package/dist/esm/src/encrypt/InternalEncrypt.js +3 -3
  53. package/dist/esm/src/errors/{dream-application/DreamApplicationInitMissingCallToLoadModels.js → dream-app/DreamAppInitMissingCallToLoadModels.js} +3 -3
  54. package/dist/esm/src/errors/{dream-application/DreamApplicationInitMissingMissingProjectRoot.js → dream-app/DreamAppInitMissingMissingProjectRoot.js} +3 -3
  55. package/dist/esm/src/errors/encrypt/MissingColumnEncryptionOpts.js +1 -1
  56. package/dist/esm/src/errors/schema-builder/FailedToIdentifyAssociation.js +2 -2
  57. package/dist/esm/src/helpers/cli/SchemaBuilder.js +9 -9
  58. package/dist/esm/src/helpers/cli/generateDream.js +1 -1
  59. package/dist/esm/src/helpers/cli/generateFactory.js +1 -1
  60. package/dist/esm/src/helpers/cli/generateMigration.js +2 -2
  61. package/dist/esm/src/helpers/cli/generateSerializer.js +1 -1
  62. package/dist/esm/src/helpers/cli/generateUnitSpec.js +1 -1
  63. package/dist/esm/src/helpers/db/createDb.js +2 -2
  64. package/dist/esm/src/helpers/db/dropDb.js +4 -4
  65. package/dist/esm/src/helpers/db/loadPgClient.js +2 -2
  66. package/dist/esm/src/helpers/db/primaryKeyType.js +2 -2
  67. package/dist/esm/src/helpers/db/runMigration.js +8 -8
  68. package/dist/esm/src/helpers/getFiles.js +2 -2
  69. package/dist/esm/src/helpers/inferSerializerFromDreamOrViewModel.js +2 -2
  70. package/dist/esm/src/helpers/loadRepl.js +2 -2
  71. package/dist/esm/src/helpers/path/dreamFileAndDirPaths.js +3 -3
  72. package/dist/esm/src/helpers/path/dreamPath.js +2 -2
  73. package/dist/esm/src/index.js +4 -4
  74. package/dist/esm/src/serializer/index.js +3 -3
  75. package/dist/types/src/Dream.d.ts +15 -11
  76. package/dist/types/src/cli/index.d.ts +5 -5
  77. package/dist/types/src/dream/Query.d.ts +1 -1
  78. package/dist/types/src/dream-app/cache.d.ts +3 -0
  79. package/dist/types/src/{dream-application → dream-app}/index.d.ts +19 -18
  80. package/dist/types/src/errors/dream-app/DreamAppInitMissingCallToLoadModels.d.ts +3 -0
  81. package/dist/types/src/errors/dream-app/DreamAppInitMissingMissingProjectRoot.d.ts +3 -0
  82. package/dist/types/src/helpers/path/dreamPath.d.ts +1 -1
  83. package/dist/types/src/index.d.ts +4 -4
  84. package/docs/assets/navigation.js +1 -1
  85. package/docs/assets/search.js +1 -1
  86. package/docs/classes/Benchmark.html +2 -2
  87. package/docs/classes/CalendarDate.html +2 -2
  88. package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +3 -3
  89. package/docs/classes/Decorators.html +19 -19
  90. package/docs/classes/Dream.html +170 -163
  91. package/docs/classes/DreamApp.html +42 -0
  92. package/docs/classes/DreamBin.html +2 -2
  93. package/docs/classes/DreamCLI.html +4 -4
  94. package/docs/classes/DreamImporter.html +2 -2
  95. package/docs/classes/DreamLogos.html +2 -2
  96. package/docs/classes/DreamMigrationHelpers.html +7 -7
  97. package/docs/classes/DreamSerializer.html +2 -2
  98. package/docs/classes/DreamTransaction.html +2 -2
  99. package/docs/classes/Encrypt.html +2 -2
  100. package/docs/classes/Env.html +2 -2
  101. package/docs/classes/GlobalNameNotSet.html +3 -3
  102. package/docs/classes/NonLoadedAssociation.html +3 -3
  103. package/docs/classes/Query.html +51 -51
  104. package/docs/classes/Range.html +2 -2
  105. package/docs/classes/RecordNotFound.html +3 -3
  106. package/docs/classes/ValidationError.html +3 -3
  107. package/docs/functions/Attribute.html +1 -1
  108. package/docs/functions/RendersMany.html +1 -1
  109. package/docs/functions/RendersOne.html +1 -1
  110. package/docs/functions/ReplicaSafe.html +1 -1
  111. package/docs/functions/STI.html +1 -1
  112. package/docs/functions/SoftDelete.html +1 -1
  113. package/docs/functions/camelize.html +1 -1
  114. package/docs/functions/capitalize.html +1 -1
  115. package/docs/functions/closeAllDbConnections.html +1 -1
  116. package/docs/functions/compact.html +1 -1
  117. package/docs/functions/debug.html +1 -1
  118. package/docs/functions/dreamDbConnections.html +1 -1
  119. package/docs/functions/dreamPath.html +1 -1
  120. package/docs/functions/generateDream.html +1 -1
  121. package/docs/functions/globalClassNameFromFullyQualifiedModelName.html +1 -1
  122. package/docs/functions/hyphenize.html +1 -1
  123. package/docs/functions/inferSerializerFromDreamClassOrViewModelClass.html +1 -1
  124. package/docs/functions/inferSerializerFromDreamOrViewModel.html +1 -1
  125. package/docs/functions/isEmpty.html +1 -1
  126. package/docs/functions/loadRepl.html +1 -1
  127. package/docs/functions/lookupClassByGlobalName.html +1 -1
  128. package/docs/functions/pascalize.html +1 -1
  129. package/docs/functions/pgErrorType.html +1 -1
  130. package/docs/functions/range-1.html +1 -1
  131. package/docs/functions/relativeDreamPath.html +1 -1
  132. package/docs/functions/round.html +1 -1
  133. package/docs/functions/serializerNameFromFullyQualifiedModelName.html +1 -1
  134. package/docs/functions/sharedPathPrefix.html +1 -1
  135. package/docs/functions/snakeify.html +1 -1
  136. package/docs/functions/sort.html +1 -1
  137. package/docs/functions/sortBy.html +1 -1
  138. package/docs/functions/standardizeFullyQualifiedModelName.html +1 -1
  139. package/docs/functions/uncapitalize.html +1 -1
  140. package/docs/functions/uniq.html +1 -1
  141. package/docs/functions/untypedDb.html +1 -1
  142. package/docs/functions/validateColumn.html +1 -1
  143. package/docs/functions/validateTable.html +1 -1
  144. package/docs/interfaces/AttributeStatement.html +2 -2
  145. package/docs/interfaces/DecoratorContext.html +2 -2
  146. package/docs/interfaces/DreamAppInitOptions.html +2 -0
  147. package/docs/interfaces/DreamAppOpts.html +8 -0
  148. package/docs/interfaces/DreamSerializerAssociationStatement.html +2 -2
  149. package/docs/interfaces/EncryptOptions.html +2 -2
  150. package/docs/interfaces/OpenapiSchemaProperties.html +1 -1
  151. package/docs/interfaces/OpenapiSchemaPropertiesShorthand.html +1 -1
  152. package/docs/interfaces/OpenapiTypeFieldObject.html +1 -1
  153. package/docs/modules.html +3 -3
  154. package/docs/types/Camelized.html +1 -1
  155. package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
  156. package/docs/types/DateTime.html +1 -1
  157. package/docs/types/DbConnectionType.html +1 -1
  158. package/docs/types/DreamAssociationMetadata.html +1 -1
  159. package/docs/types/DreamAttributes.html +1 -1
  160. package/docs/types/DreamClassColumn.html +1 -1
  161. package/docs/types/DreamColumn.html +1 -1
  162. package/docs/types/DreamColumnNames.html +1 -1
  163. package/docs/types/DreamLogLevel.html +1 -1
  164. package/docs/types/DreamLogger.html +1 -1
  165. package/docs/types/DreamOrViewModelSerializerKey.html +1 -1
  166. package/docs/types/DreamParamSafeAttributes.html +1 -1
  167. package/docs/types/DreamParamSafeColumnNames.html +1 -1
  168. package/docs/types/DreamSerializerKey.html +1 -1
  169. package/docs/types/DreamSerializers.html +1 -1
  170. package/docs/types/DreamTableSchema.html +1 -1
  171. package/docs/types/DreamVirtualColumns.html +1 -1
  172. package/docs/types/EncryptAlgorithm.html +1 -1
  173. package/docs/types/Hyphenized.html +1 -1
  174. package/docs/types/IdType.html +1 -1
  175. package/docs/types/OpenapiAllTypes.html +1 -1
  176. package/docs/types/OpenapiFormats.html +1 -1
  177. package/docs/types/OpenapiNumberFormats.html +1 -1
  178. package/docs/types/OpenapiPrimitiveTypes.html +1 -1
  179. package/docs/types/OpenapiSchemaArray.html +1 -1
  180. package/docs/types/OpenapiSchemaArrayShorthand.html +1 -1
  181. package/docs/types/OpenapiSchemaBase.html +1 -1
  182. package/docs/types/OpenapiSchemaBody.html +1 -1
  183. package/docs/types/OpenapiSchemaBodyShorthand.html +1 -1
  184. package/docs/types/OpenapiSchemaCommonFields.html +1 -1
  185. package/docs/types/OpenapiSchemaExpressionAllOf.html +1 -1
  186. package/docs/types/OpenapiSchemaExpressionAnyOf.html +1 -1
  187. package/docs/types/OpenapiSchemaExpressionOneOf.html +1 -1
  188. package/docs/types/OpenapiSchemaExpressionRef.html +1 -1
  189. package/docs/types/OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
  190. package/docs/types/OpenapiSchemaInteger.html +1 -1
  191. package/docs/types/OpenapiSchemaNull.html +1 -1
  192. package/docs/types/OpenapiSchemaNumber.html +1 -1
  193. package/docs/types/OpenapiSchemaObject.html +1 -1
  194. package/docs/types/OpenapiSchemaObjectAllOf.html +1 -1
  195. package/docs/types/OpenapiSchemaObjectAllOfShorthand.html +1 -1
  196. package/docs/types/OpenapiSchemaObjectAnyOf.html +1 -1
  197. package/docs/types/OpenapiSchemaObjectAnyOfShorthand.html +1 -1
  198. package/docs/types/OpenapiSchemaObjectBase.html +1 -1
  199. package/docs/types/OpenapiSchemaObjectBaseShorthand.html +1 -1
  200. package/docs/types/OpenapiSchemaObjectOneOf.html +1 -1
  201. package/docs/types/OpenapiSchemaObjectOneOfShorthand.html +1 -1
  202. package/docs/types/OpenapiSchemaObjectShorthand.html +1 -1
  203. package/docs/types/OpenapiSchemaPrimitiveGeneric.html +1 -1
  204. package/docs/types/OpenapiSchemaShorthandExpressionAllOf.html +1 -1
  205. package/docs/types/OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
  206. package/docs/types/OpenapiSchemaShorthandExpressionOneOf.html +1 -1
  207. package/docs/types/OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
  208. package/docs/types/OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
  209. package/docs/types/OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
  210. package/docs/types/OpenapiSchemaString.html +1 -1
  211. package/docs/types/OpenapiShorthandAllTypes.html +1 -1
  212. package/docs/types/OpenapiShorthandPrimitiveTypes.html +1 -1
  213. package/docs/types/OpenapiTypeField.html +1 -1
  214. package/docs/types/Pascalized.html +1 -1
  215. package/docs/types/PrimaryKeyType.html +1 -1
  216. package/docs/types/RoundingPrecision.html +1 -1
  217. package/docs/types/SerializableClassOrSerializerCallback.html +1 -1
  218. package/docs/types/SerializableDreamClassOrViewModelClass.html +1 -1
  219. package/docs/types/SerializableDreamOrViewModel.html +1 -1
  220. package/docs/types/SerializableTypes.html +1 -1
  221. package/docs/types/Snakeified.html +1 -1
  222. package/docs/types/Timestamp.html +1 -1
  223. package/docs/types/UpdateableAssociationProperties.html +1 -1
  224. package/docs/types/UpdateableProperties.html +1 -1
  225. package/docs/types/ValidationType.html +1 -1
  226. package/docs/types/ViewModelSerializerKey.html +1 -1
  227. package/docs/types/WhereStatementForDream.html +1 -1
  228. package/docs/types/WhereStatementForDreamClass.html +1 -1
  229. package/docs/variables/DateTime-1.html +1 -1
  230. package/docs/variables/DreamConst.html +1 -1
  231. package/docs/variables/TRIGRAM_OPERATORS.html +1 -1
  232. package/docs/variables/openapiPrimitiveTypes-1.html +1 -1
  233. package/docs/variables/openapiShorthandPrimitiveTypes-1.html +1 -1
  234. package/docs/variables/ops.html +1 -1
  235. package/docs/variables/primaryKeyTypes.html +1 -1
  236. package/package.json +1 -1
  237. package/dist/cjs/src/dream-application/cache.js +0 -13
  238. package/dist/esm/src/dream-application/cache.js +0 -9
  239. package/dist/types/src/dream-application/cache.d.ts +0 -3
  240. package/dist/types/src/errors/dream-application/DreamApplicationInitMissingCallToLoadModels.d.ts +0 -3
  241. package/dist/types/src/errors/dream-application/DreamApplicationInitMissingMissingProjectRoot.d.ts +0 -3
  242. package/docs/classes/DreamApplication.html +0 -42
  243. package/docs/interfaces/DreamApplicationInitOptions.html +0 -2
  244. package/docs/interfaces/DreamApplicationOpts.html +0 -8
  245. /package/dist/cjs/src/{dream-application → dream-app}/helpers/globalModelKeyFromPath.js +0 -0
  246. /package/dist/cjs/src/{dream-application → dream-app}/helpers/globalSerializerKeyFromPath.js +0 -0
  247. /package/dist/cjs/src/{dream-application → dream-app}/helpers/importers/importModels.js +0 -0
  248. /package/dist/cjs/src/{dream-application → dream-app}/helpers/lookupClassByGlobalName.js +0 -0
  249. /package/dist/cjs/src/{dream-application → dream-app}/helpers/lookupModelByGlobalName.js +0 -0
  250. /package/dist/cjs/src/{dream-application → dream-app}/helpers/lookupModelByGlobalNameOrNames.js +0 -0
  251. /package/dist/cjs/src/errors/{dream-application → dream-app}/GlobalNameNotSet.js +0 -0
  252. /package/dist/cjs/src/errors/{dream-application → dream-app}/SerializerNameConflict.js +0 -0
  253. /package/dist/esm/src/{dream-application → dream-app}/helpers/globalModelKeyFromPath.js +0 -0
  254. /package/dist/esm/src/{dream-application → dream-app}/helpers/globalSerializerKeyFromPath.js +0 -0
  255. /package/dist/esm/src/{dream-application → dream-app}/helpers/importers/importModels.js +0 -0
  256. /package/dist/esm/src/{dream-application → dream-app}/helpers/lookupClassByGlobalName.js +0 -0
  257. /package/dist/esm/src/{dream-application → dream-app}/helpers/lookupModelByGlobalName.js +0 -0
  258. /package/dist/esm/src/{dream-application → dream-app}/helpers/lookupModelByGlobalNameOrNames.js +0 -0
  259. /package/dist/esm/src/errors/{dream-application → dream-app}/GlobalNameNotSet.js +0 -0
  260. /package/dist/esm/src/errors/{dream-application → dream-app}/SerializerNameConflict.js +0 -0
  261. /package/dist/types/src/{dream-application → dream-app}/helpers/DreamImporter.d.ts +0 -0
  262. /package/dist/types/src/{dream-application → dream-app}/helpers/globalModelKeyFromPath.d.ts +0 -0
  263. /package/dist/types/src/{dream-application → dream-app}/helpers/globalSerializerKeyFromPath.d.ts +0 -0
  264. /package/dist/types/src/{dream-application → dream-app}/helpers/importers/importModels.d.ts +0 -0
  265. /package/dist/types/src/{dream-application → dream-app}/helpers/importers/importSerializers.d.ts +0 -0
  266. /package/dist/types/src/{dream-application → dream-app}/helpers/lookupClassByGlobalName.d.ts +0 -0
  267. /package/dist/types/src/{dream-application → dream-app}/helpers/lookupModelByGlobalName.d.ts +0 -0
  268. /package/dist/types/src/{dream-application → dream-app}/helpers/lookupModelByGlobalNameOrNames.d.ts +0 -0
  269. /package/dist/types/src/errors/{dream-application → dream-app}/GlobalNameNotSet.d.ts +0 -0
  270. /package/dist/types/src/errors/{dream-application → dream-app}/SerializerNameConflict.d.ts +0 -0
@@ -36,7 +36,7 @@ const NonLoadedAssociation_js_1 = require("./errors/associations/NonLoadedAssoci
36
36
  const CannotCallUndestroyOnANonSoftDeleteModel_js_1 = require("./errors/CannotCallUndestroyOnANonSoftDeleteModel.js");
37
37
  const ConstructorOnlyForInternalUse_js_1 = require("./errors/ConstructorOnlyForInternalUse.js");
38
38
  const CreateOrFindByFailedToCreateAndFind_js_1 = require("./errors/CreateOrFindByFailedToCreateAndFind.js");
39
- const GlobalNameNotSet_js_1 = require("./errors/dream-application/GlobalNameNotSet.js");
39
+ const GlobalNameNotSet_js_1 = require("./errors/dream-app/GlobalNameNotSet.js");
40
40
  const DreamMissingRequiredOverride_js_1 = require("./errors/DreamMissingRequiredOverride.js");
41
41
  const MissingSerializersDefinition_js_1 = require("./errors/MissingSerializersDefinition.js");
42
42
  const NonExistentScopeProvidedToResort_js_1 = require("./errors/NonExistentScopeProvidedToResort.js");
@@ -415,7 +415,7 @@ class Dream {
415
415
  /**
416
416
  * @internal
417
417
  *
418
- * Used by DreamApplication during the load process
418
+ * Used by DreamApp during the load process
419
419
  * for models and serializers to assign
420
420
  * unique global names to each model based on the file
421
421
  * name of that model.
@@ -772,11 +772,14 @@ class Dream {
772
772
  }
773
773
  /**
774
774
  * Returns a new instance of Query scoped to the given
775
- * model class
775
+ * model class. Especially useful with {@link Query#toKysely}.
776
776
  *
777
777
  * ```ts
778
- * await User.query().all()
779
- * // [User{id: 1}, User{id: 2}, ...]
778
+ * await Balloon.query().toKysely('update').
779
+ * .set({
780
+ * multicolor: sql`array_remove(multicolor, ${colorToRemoveFromAllBalloons})`,
781
+ * })
782
+ * .execute()
780
783
  * ```
781
784
  *
782
785
  * @returns A new Query instance scoped to this Dream class
@@ -786,17 +789,18 @@ class Dream {
786
789
  return new Query_js_1.default(this.prototype);
787
790
  }
788
791
  /**
789
- * @internal
790
- *
791
792
  * Returns a new instance of Query scoped to the given
792
- * Dream instance
793
+ * model class. Especially useful with {@link Query#toKysely}.
793
794
  *
794
795
  * ```ts
795
- * await user = User.first()
796
- * await user.query()
796
+ * await balloon.query().toKysely('update')
797
+ * .set({
798
+ * multicolor: sql`array_append(multicolor, 'red')`,
799
+ * })
800
+ * .execute()
797
801
  * ```
798
802
  *
799
- * @returns A new Query instance scoped to this Dream instance
803
+ * @returns A new Query instance scoped to this Dream class
800
804
  *
801
805
  */
802
806
  query() {
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = writeSyncFile;
4
- const fs = require("fs/promises");
5
- const path = require("path");
4
+ const fs = require("node:fs/promises");
5
+ const path = require("node:path");
6
6
  const index_js_1 = require("../../cli/index.js");
7
7
  const colorize_js_1 = require("../../cli/logger/loggable/colorize.js");
8
- const index_js_2 = require("../../dream-application/index.js");
8
+ const index_js_2 = require("../../dream-app/index.js");
9
9
  const autoGeneratedFileDisclaimer_js_1 = require("../../helpers/cli/autoGeneratedFileDisclaimer.js");
10
10
  const compact_js_1 = require("../../helpers/compact.js");
11
11
  const EnvInternal_js_1 = require("../../helpers/EnvInternal.js");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const index_js_1 = require("../cli/index.js");
4
- const index_js_2 = require("../dream-application/index.js");
4
+ const index_js_2 = require("../dream-app/index.js");
5
5
  const EnvInternal_js_1 = require("../helpers/EnvInternal.js");
6
6
  const SchemaBuilder_js_1 = require("../helpers/cli/SchemaBuilder.js");
7
7
  const generateDream_js_1 = require("../helpers/cli/generateDream.js");
@@ -10,21 +10,25 @@ class DreamCLI {
10
10
  * use this method for initializing a standalone dream application. If using Psychic and Dream together,
11
11
  * a different pattern is used, which leverages the `generateDreamCli` method instead.
12
12
  */
13
- static provide(program, { initializeDreamApplication, seedDb, }) {
13
+ static provide(program, { initializeDreamApp, seedDb, }) {
14
14
  program
15
15
  .command('sync')
16
16
  .description('sync introspects your database, updating your schema to reflect, and then syncs the new schema with the installed dream node module, allowing it provide your schema to the underlying kysely integration')
17
17
  .action(async () => {
18
- await initializeDreamApplication();
18
+ await initializeDreamApp();
19
19
  await index_js_1.default.sync(() => { });
20
20
  process.exit();
21
21
  });
22
- this.generateDreamCli(program, { initializeDreamApplication, seedDb, onSync: () => { } });
22
+ this.generateDreamCli(program, {
23
+ initializeDreamApp,
24
+ seedDb,
25
+ onSync: () => { },
26
+ });
23
27
  }
24
28
  /**
25
29
  * called under the hood when provisioning both psychic and dream applications.
26
30
  */
27
- static generateDreamCli(program, { initializeDreamApplication, seedDb, onSync, }) {
31
+ static generateDreamCli(program, { initializeDreamApp, seedDb, onSync, }) {
28
32
  program
29
33
  .command('generate:migration')
30
34
  .alias('g:migration')
@@ -32,7 +36,7 @@ class DreamCLI {
32
36
  .argument('<migrationName>', 'end with -to-table-name to prepopulate with an alterTable command')
33
37
  .argument('[columnsWithTypes...]', 'properties of the model column1:text/string/enum/etc. column2:text/string/enum/etc. ... columnN:text/string/enum/etc.')
34
38
  .action(async (migrationName, columnsWithTypes) => {
35
- await initializeDreamApplication();
39
+ await initializeDreamApp();
36
40
  await index_js_1.default.generateMigration(migrationName, columnsWithTypes);
37
41
  process.exit();
38
42
  });
@@ -46,7 +50,7 @@ class DreamCLI {
46
50
  .argument('<modelName>', 'the name of the model to create, e.g. Post or Settings/CommunicationPreferences')
47
51
  .argument('[columnsWithTypes...]', 'properties of the model property1:text/string/enum/etc. property2:text/string/enum/etc. ... propertyN:text/string/enum/etc.')
48
52
  .action(async (modelName, columnsWithTypes, options) => {
49
- await initializeDreamApplication();
53
+ await initializeDreamApp();
50
54
  await index_js_1.default.generateDream(modelName, columnsWithTypes, options);
51
55
  process.exit();
52
56
  });
@@ -60,7 +64,7 @@ class DreamCLI {
60
64
  .argument('<parentModelName>', 'name of the parent model')
61
65
  .argument('[columnsWithTypes...]', 'properties of the model property1:text/string/enum/etc. property2:text/string/enum/etc. ... propertyN:text/string/enum/etc.')
62
66
  .action(async (childModelName, extendsWord, parentModelName, columnsWithTypes, options) => {
63
- await initializeDreamApplication();
67
+ await initializeDreamApp();
64
68
  if (extendsWord !== 'extends')
65
69
  throw new Error('Expecting: `<child-name> extends <parent-name> <columns-and-types>');
66
70
  await index_js_1.default.generateStiChild(childModelName, parentModelName, columnsWithTypes, options);
@@ -71,7 +75,7 @@ class DreamCLI {
71
75
  .description('creates a new database, seeding from local .env or .env.test if NODE_ENV=test is set for env vars')
72
76
  .action(async () => {
73
77
  EnvInternal_js_1.default.setBoolean('BYPASS_DB_CONNECTIONS_DURING_INIT');
74
- await initializeDreamApplication({ bypassModelIntegrityCheck: true });
78
+ await initializeDreamApp({ bypassModelIntegrityCheck: true });
75
79
  await index_js_1.default.dbCreate();
76
80
  process.exit();
77
81
  });
@@ -80,7 +84,7 @@ class DreamCLI {
80
84
  .description('db:migrate runs any outstanding database migrations')
81
85
  .option('--skip-sync', 'skips syncing local schema after running migrations')
82
86
  .action(async ({ skipSync }) => {
83
- await initializeDreamApplication({ bypassModelIntegrityCheck: true });
87
+ await initializeDreamApp({ bypassModelIntegrityCheck: true });
84
88
  await index_js_1.default.dbMigrate();
85
89
  if (EnvInternal_js_1.default.isDevelopmentOrTest && !skipSync) {
86
90
  await index_js_1.default.sync(onSync);
@@ -93,7 +97,7 @@ class DreamCLI {
93
97
  .option('--steps <number>', 'number of steps back to travel', myParseInt, 1)
94
98
  .option('--skip-sync', 'skips syncing local schema after running migrations')
95
99
  .action(async ({ steps, skipSync }) => {
96
- await initializeDreamApplication({ bypassModelIntegrityCheck: true });
100
+ await initializeDreamApp({ bypassModelIntegrityCheck: true });
97
101
  await index_js_1.default.dbRollback({ steps });
98
102
  if (EnvInternal_js_1.default.isDevelopmentOrTest && !skipSync) {
99
103
  await index_js_1.default.sync(onSync);
@@ -105,7 +109,7 @@ class DreamCLI {
105
109
  .description('drops the database, seeding from local .env or .env.test if NODE_ENV=test is set for env vars')
106
110
  .action(async () => {
107
111
  EnvInternal_js_1.default.setBoolean('BYPASS_DB_CONNECTIONS_DURING_INIT');
108
- await initializeDreamApplication({ bypassModelIntegrityCheck: true });
112
+ await initializeDreamApp({ bypassModelIntegrityCheck: true });
109
113
  await index_js_1.default.dbDrop();
110
114
  process.exit();
111
115
  });
@@ -114,11 +118,11 @@ class DreamCLI {
114
118
  .description('runs db:drop (safely), then db:create, db:migrate, and db:seed')
115
119
  .action(async () => {
116
120
  EnvInternal_js_1.default.setBoolean('BYPASS_DB_CONNECTIONS_DURING_INIT');
117
- await initializeDreamApplication({ bypassModelIntegrityCheck: true });
121
+ await initializeDreamApp({ bypassModelIntegrityCheck: true });
118
122
  await index_js_1.default.dbDrop();
119
123
  await index_js_1.default.dbCreate();
120
124
  EnvInternal_js_1.default.unsetBoolean('BYPASS_DB_CONNECTIONS_DURING_INIT');
121
- await initializeDreamApplication({ bypassModelIntegrityCheck: true });
125
+ await initializeDreamApp({ bypassModelIntegrityCheck: true });
122
126
  await index_js_1.default.dbMigrate();
123
127
  await index_js_1.default.sync(onSync);
124
128
  await seedDb();
@@ -132,7 +136,7 @@ class DreamCLI {
132
136
  console.log('skipping db seed for test env. To really seed for test, add DREAM_SEED_DB_IN_TEST=1');
133
137
  return;
134
138
  }
135
- await initializeDreamApplication();
139
+ await initializeDreamApp();
136
140
  await seedDb();
137
141
  process.exit();
138
142
  });
@@ -12,7 +12,7 @@ exports.closeAllDbConnections = closeAllDbConnections;
12
12
  // @ts-ignore
13
13
  const pg_1 = require("pg");
14
14
  const kysely_1 = require("kysely");
15
- const index_js_1 = require("../dream-application/index.js");
15
+ const index_js_1 = require("../dream-app/index.js");
16
16
  let connections = {};
17
17
  class DreamDbConnection {
18
18
  static getConnection(connectionType) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = BelongsTo;
4
- const lookupModelByGlobalNameOrNames_js_1 = require("../../../dream-application/helpers/lookupModelByGlobalNameOrNames.js");
4
+ const lookupModelByGlobalNameOrNames_js_1 = require("../../../dream-app/helpers/lookupModelByGlobalNameOrNames.js");
5
5
  const Validates_js_1 = require("../validation/Validates.js");
6
6
  const shared_js_1 = require("./shared.js");
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = HasMany;
4
- const lookupModelByGlobalNameOrNames_js_1 = require("../../../dream-application/helpers/lookupModelByGlobalNameOrNames.js");
4
+ const lookupModelByGlobalNameOrNames_js_1 = require("../../../dream-app/helpers/lookupModelByGlobalNameOrNames.js");
5
5
  const shared_js_1 = require("./shared.js");
6
6
  /**
7
7
  * Establishes a "HasMany" association between the base dream
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = HasOne;
4
- const lookupModelByGlobalNameOrNames_js_1 = require("../../../dream-application/helpers/lookupModelByGlobalNameOrNames.js");
4
+ const lookupModelByGlobalNameOrNames_js_1 = require("../../../dream-app/helpers/lookupModelByGlobalNameOrNames.js");
5
5
  const shared_js_1 = require("./shared.js");
6
6
  /**
7
7
  * Establishes a "HasOne" association between the base dream
@@ -416,7 +416,7 @@ class Query extends ConnectedToDB_js_1.default {
416
416
  *
417
417
  * ```ts
418
418
  * await User.order('id').findEach(user => {
419
- * DreamApplication.log(user)
419
+ * DreamApp.log(user)
420
420
  * })
421
421
  * // User{id: 1}
422
422
  * // User{id: 2}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = executeDatabaseQuery;
4
- const index_js_1 = require("../../dream-application/index.js");
4
+ const index_js_1 = require("../../dream-app/index.js");
5
5
  const EnvInternal_js_1 = require("../../helpers/EnvInternal.js");
6
6
  async function executeDatabaseQuery(kyselyQuery, command) {
7
7
  try {
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cacheDreamApp = cacheDreamApp;
4
+ exports.getCachedDreamAppOrFail = getCachedDreamAppOrFail;
5
+ let _dreamApp = undefined;
6
+ function cacheDreamApp(dreamconf) {
7
+ _dreamApp = dreamconf;
8
+ }
9
+ function getCachedDreamAppOrFail() {
10
+ if (!_dreamApp)
11
+ throw new Error('Must call `initializeDreamApp` or `initializePsychicApp` before loading cached DreamApp.getOrFail()');
12
+ return _dreamApp;
13
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs = require("fs/promises");
4
- const path = require("path");
3
+ const fs = require("node:fs/promises");
4
+ const path = require("node:path");
5
5
  class DreamImporter {
6
6
  static async ls(dir) {
7
7
  try {
@@ -4,7 +4,7 @@ exports.default = importSerializers;
4
4
  exports.setCachedSerializers = setCachedSerializers;
5
5
  exports.getSerializersOrFail = getSerializersOrFail;
6
6
  exports.getSerializersOrBlank = getSerializersOrBlank;
7
- const SerializerNameConflict_js_1 = require("../../../errors/dream-application/SerializerNameConflict.js");
7
+ const SerializerNameConflict_js_1 = require("../../../errors/dream-app/SerializerNameConflict.js");
8
8
  const index_js_1 = require("../../../serializer/index.js");
9
9
  const DreamImporter_js_1 = require("../DreamImporter.js");
10
10
  const globalSerializerKeyFromPath_js_1 = require("../globalSerializerKeyFromPath.js");
@@ -12,8 +12,8 @@ const pg_1 = require("pg");
12
12
  const index_js_1 = require("../db/index.js");
13
13
  const validateTable_js_1 = require("../db/validators/validateTable.js");
14
14
  const index_js_2 = require("../encrypt/index.js");
15
- const DreamApplicationInitMissingCallToLoadModels_js_1 = require("../errors/dream-application/DreamApplicationInitMissingCallToLoadModels.js");
16
- const DreamApplicationInitMissingMissingProjectRoot_js_1 = require("../errors/dream-application/DreamApplicationInitMissingMissingProjectRoot.js");
15
+ const DreamAppInitMissingCallToLoadModels_js_1 = require("../errors/dream-app/DreamAppInitMissingCallToLoadModels.js");
16
+ const DreamAppInitMissingMissingProjectRoot_js_1 = require("../errors/dream-app/DreamAppInitMissingMissingProjectRoot.js");
17
17
  const customPgParsers_js_1 = require("../helpers/customPgParsers.js");
18
18
  const DateTime_js_1 = require("../helpers/DateTime.js");
19
19
  const EnvInternal_js_1 = require("../helpers/EnvInternal.js");
@@ -23,7 +23,7 @@ const importSerializers_js_1 = require("./helpers/importers/importSerializers.js
23
23
  const pgTypes = pg_1.default.types;
24
24
  // this needs to be done top-level to ensure proper configuration
25
25
  DateTime_js_1.Settings.defaultZone = 'UTC';
26
- class DreamApplication {
26
+ class DreamApp {
27
27
  /**
28
28
  * initializes a new dream application and caches it for use
29
29
  * within this processes lifecycle.
@@ -32,24 +32,24 @@ class DreamApplication {
32
32
  * to be able to serve routes, perform serializer lookups,
33
33
  * generate files, connect to the database, etc...
34
34
  *
35
- * In order for this to work properly, the DreamApplication#init
35
+ * In order for this to work properly, the DreamApp#init
36
36
  * function must be called before anything else is called within
37
37
  * Dream.
38
38
  */
39
39
  static async init(cb, opts = {}, deferCb) {
40
- const dreamApp = new DreamApplication(opts);
40
+ const dreamApp = new DreamApp(opts);
41
41
  await cb(dreamApp);
42
42
  await dreamApp.inflections?.();
43
43
  await deferCb?.(dreamApp);
44
44
  for (const plugin of dreamApp.plugins) {
45
45
  await plugin(dreamApp);
46
46
  }
47
- dreamApp.validateApplicationBuildIntegrity({
47
+ dreamApp.validateAppBuildIntegrity({
48
48
  bypassModelIntegrityCheck: opts.bypassModelIntegrityCheck || false,
49
49
  });
50
50
  if (!dreamApp.serializers)
51
51
  (0, importSerializers_js_1.setCachedSerializers)({});
52
- (0, cache_js_1.cacheDreamApplication)(dreamApp);
52
+ (0, cache_js_1.cacheDreamApp)(dreamApp);
53
53
  if (!EnvInternal_js_1.default.boolean('BYPASS_DB_CONNECTIONS_DURING_INIT'))
54
54
  await this.setDatabaseTypeParsers();
55
55
  return dreamApp;
@@ -61,13 +61,13 @@ class DreamApplication {
61
61
  * that would render it in an invalid state
62
62
  *
63
63
  */
64
- validateApplicationBuildIntegrity({ bypassModelIntegrityCheck }) {
64
+ validateAppBuildIntegrity({ bypassModelIntegrityCheck }) {
65
65
  if (!this.projectRoot)
66
- throw new DreamApplicationInitMissingMissingProjectRoot_js_1.default();
66
+ throw new DreamAppInitMissingMissingProjectRoot_js_1.default();
67
67
  if (!this.loadedModels)
68
- throw new DreamApplicationInitMissingCallToLoadModels_js_1.default();
68
+ throw new DreamAppInitMissingCallToLoadModels_js_1.default();
69
69
  if (this.encryption?.columns?.current)
70
- DreamApplication.checkKey('columns', this.encryption.columns.current.key, this.encryption.columns.current.algorithm);
70
+ DreamApp.checkKey('columns', this.encryption.columns.current.key, this.encryption.columns.current.algorithm);
71
71
  if (!bypassModelIntegrityCheck)
72
72
  this.validateApplicationModels();
73
73
  }
@@ -137,19 +137,22 @@ Try setting it to something valid, like:
137
137
  * Returns the cached dream application if it has been set.
138
138
  * If it has not been set, an exception is raised.
139
139
  *
140
- * The dream application can be set by calling DreamApplication#init,
140
+ * The dream application can be set by calling DreamApp#init,
141
141
  * or alternatively, if you are using Psychic along with Dream,
142
- * it can be set during PsychicApplication#init, which will set caches
142
+ * it can be set during PsychicApp#init, which will set caches
143
143
  * for both the dream and psychic applications at once.
144
144
  */
145
145
  static getOrFail() {
146
- return (0, cache_js_1.getCachedDreamApplicationOrFail)();
146
+ return (0, cache_js_1.getCachedDreamAppOrFail)();
147
147
  }
148
148
  static log(...args) {
149
- this.getOrFail().logger.info(...args);
149
+ this.getOrFail().logger.info(this.argsToString(args));
150
150
  }
151
151
  static logWithLevel(level, ...args) {
152
- this.getOrFail().logger[level](...args);
152
+ this.getOrFail().logger[level](this.argsToString(args));
153
+ }
154
+ static argsToString(args) {
155
+ return args.map(str => `${str}`).join(' ');
153
156
  }
154
157
  _specialHooks = {
155
158
  dbLog: [],
@@ -313,4 +316,4 @@ Try setting it to something valid, like:
313
316
  }
314
317
  }
315
318
  }
316
- exports.default = DreamApplication;
319
+ exports.default = DreamApp;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const index_js_1 = require("../dream-application/index.js");
3
+ const index_js_1 = require("../dream-app/index.js");
4
4
  const MissingColumnEncryptionOpts_js_1 = require("../errors/encrypt/MissingColumnEncryptionOpts.js");
5
5
  const index_js_2 = require("./index.js");
6
6
  class InternalEncrypt {
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class DreamApplicationInitMissingCallToLoadModels extends Error {
3
+ class DreamAppInitMissingCallToLoadModels extends Error {
4
4
  get message() {
5
5
  return `
6
- must load models when initializing a new DreamApplication.
6
+ must load models when initializing a new DreamApp.
7
7
 
8
8
  within conf/dream.ts, you must have a call to "#load('models', pathToModels)", i.e.
9
9
 
10
10
 
11
11
  // conf/dream.ts
12
- export default async (app: DreamApplication) => {
12
+ export default async (app: DreamApp) => {
13
13
  await app.load('models', path.join(__dirname, '..', 'app', 'models')
14
14
  }
15
15
  `;
16
16
  }
17
17
  }
18
- exports.default = DreamApplicationInitMissingCallToLoadModels;
18
+ exports.default = DreamAppInitMissingCallToLoadModels;
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class DreamApplicationInitMissingMissingProjectRoot extends Error {
3
+ class DreamAppInitMissingMissingProjectRoot extends Error {
4
4
  get message() {
5
5
  return `
6
- must set app root when initializing a new DreamApplication.
6
+ must set app root when initializing a new DreamApp.
7
7
 
8
8
  within conf/dream.ts, you must have a call to "#set('projectRoot', pathToAppRoot), i.e.
9
9
 
10
10
 
11
11
  // conf/dream.ts
12
- export default async (app: DreamApplication) => {
12
+ export default async (app: DreamApp) => {
13
13
  // this should be the absolute path to the "src" folder.
14
14
  app.set('projectRoot', path.join(__dirname, '..')
15
15
  }
16
16
  `;
17
17
  }
18
18
  }
19
- exports.default = DreamApplicationInitMissingMissingProjectRoot;
19
+ exports.default = DreamAppInitMissingMissingProjectRoot;
@@ -7,7 +7,7 @@ class MissingColumnEncryptionOpts extends Error {
7
7
  encryption keys must be provided to dream:
8
8
 
9
9
  // conf/dream.ts
10
- export default (dream: DreamApplication) => {
10
+ export default (dream: DreamApp) => {
11
11
  dream.set('encryption', {
12
12
  column: {
13
13
  current: {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const index_js_1 = require("../../dream-application/index.js");
3
+ const index_js_1 = require("../../dream-app/index.js");
4
4
  class FailedToIdentifyAssociation extends Error {
5
5
  modelClass;
6
6
  associationType;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const fs = require("fs/promises");
4
3
  const kysely_1 = require("kysely");
5
- const path = require("path");
4
+ const fs = require("node:fs/promises");
5
+ const path = require("node:path");
6
6
  const dataTypes_js_1 = require("../../db/dataTypes.js");
7
7
  const index_js_1 = require("../../db/index.js");
8
- const index_js_2 = require("../../dream-application/index.js");
8
+ const index_js_2 = require("../../dream-app/index.js");
9
9
  const constants_js_1 = require("../../dream/constants.js");
10
10
  const FailedToIdentifyAssociation_js_1 = require("../../errors/schema-builder/FailedToIdentifyAssociation.js");
11
11
  const camelize_js_1 = require("../camelize.js");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = generateDream;
4
- const fs = require("fs/promises");
4
+ const fs = require("node:fs/promises");
5
5
  const dreamFileAndDirPaths_js_1 = require("../path/dreamFileAndDirPaths.js");
6
6
  const dreamPath_js_1 = require("../path/dreamPath.js");
7
7
  const standardizeFullyQualifiedModelName_js_1 = require("../standardizeFullyQualifiedModelName.js");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = generateFactory;
4
- const fs = require("fs/promises");
4
+ const fs = require("node:fs/promises");
5
5
  const dreamFileAndDirPaths_js_1 = require("../path/dreamFileAndDirPaths.js");
6
6
  const dreamPath_js_1 = require("../path/dreamPath.js");
7
7
  const standardizeFullyQualifiedModelName_js_1 = require("../standardizeFullyQualifiedModelName.js");
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = generateMigration;
4
- const fs = require("fs/promises");
5
- const path = require("path");
4
+ const fs = require("node:fs/promises");
5
+ const path = require("node:path");
6
6
  const pluralize_esm_1 = require("pluralize-esm");
7
7
  const generateMigrationContent_js_1 = require("../cli/generateMigrationContent.js");
8
8
  const primaryKeyType_js_1 = require("../db/primaryKeyType.js");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = generateSerializer;
4
- const fs = require("fs/promises");
4
+ const fs = require("node:fs/promises");
5
5
  const dreamFileAndDirPaths_js_1 = require("../path/dreamFileAndDirPaths.js");
6
6
  const dreamPath_js_1 = require("../path/dreamPath.js");
7
7
  const standardizeFullyQualifiedModelName_js_1 = require("../standardizeFullyQualifiedModelName.js");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = generateUnitSpec;
4
- const fs = require("fs/promises");
4
+ const fs = require("node:fs/promises");
5
5
  const dreamFileAndDirPaths_js_1 = require("../path/dreamFileAndDirPaths.js");
6
6
  const dreamPath_js_1 = require("../path/dreamPath.js");
7
7
  const standardizeFullyQualifiedModelName_js_1 = require("../standardizeFullyQualifiedModelName.js");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = createDb;
4
- const index_js_1 = require("../../dream-application/index.js");
4
+ const index_js_1 = require("../../dream-app/index.js");
5
5
  const EnvInternal_js_1 = require("../EnvInternal.js");
6
6
  const loadPgClient_js_1 = require("./loadPgClient.js");
7
7
  async function createDb(connection, dbName) {
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = dropDb;
4
- const index_js_1 = require("../../dream-application/index.js");
4
+ const index_js_1 = require("../../cli/index.js");
5
+ const index_js_2 = require("../../dream-app/index.js");
5
6
  const EnvInternal_js_1 = require("../EnvInternal.js");
6
7
  const loadPgClient_js_1 = require("./loadPgClient.js");
7
- const index_js_2 = require("../../cli/index.js");
8
8
  async function dropDb(connection, dbName) {
9
9
  // this was only ever written to clear the db between tests or in development,
10
10
  // so there is no way to drop in production
11
11
  if (EnvInternal_js_1.default.isProduction)
12
12
  return false;
13
- const dreamApp = index_js_1.default.getOrFail();
13
+ const dreamApp = index_js_2.default.getOrFail();
14
14
  const dbConf = dreamApp.dbConnectionConfig(connection);
15
15
  dbName ||= dbConf.name || null;
16
16
  if (!dbName)
@@ -20,17 +20,17 @@ async function dropDb(connection, dbName) {
20
20
  await client.query(`DROP DATABASE IF EXISTS ${dbName};`);
21
21
  }
22
22
  async function maybeDropDuplicateDatabases(client, dbName) {
23
- const parallelTests = index_js_1.default.getOrFail().parallelTests;
23
+ const parallelTests = index_js_2.default.getOrFail().parallelTests;
24
24
  if (!parallelTests)
25
25
  return;
26
26
  if (EnvInternal_js_1.default.boolean('DREAM_CORE_DEVELOPMENT')) {
27
27
  const replicaTestWorkerDatabaseName = `replica_test_${dbName}`;
28
- index_js_2.default.logger.logContinueProgress(`dropping fake replica test database ${replicaTestWorkerDatabaseName}`, { logPrefix: ' ├ [db]', logPrefixColor: 'cyan' });
28
+ index_js_1.default.logger.logContinueProgress(`dropping fake replica test database ${replicaTestWorkerDatabaseName}`, { logPrefix: ' ├ [db]', logPrefixColor: 'cyan' });
29
29
  await client.query(`DROP DATABASE IF EXISTS ${replicaTestWorkerDatabaseName};`);
30
30
  }
31
31
  for (let i = 2; i <= parallelTests; i++) {
32
32
  const workerDatabaseName = `${dbName}_${i}`;
33
- index_js_2.default.logger.logContinueProgress(`dropping duplicate test database ${workerDatabaseName}`, {
33
+ index_js_1.default.logger.logContinueProgress(`dropping duplicate test database ${workerDatabaseName}`, {
34
34
  logPrefix: ' ├ [db]',
35
35
  logPrefixColor: 'cyan',
36
36
  });
@@ -10,7 +10,7 @@ exports.default = loadPgClient;
10
10
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
11
11
  // @ts-ignore
12
12
  const pg_1 = require("pg");
13
- const index_js_1 = require("../../dream-application/index.js");
13
+ const index_js_1 = require("../../dream-app/index.js");
14
14
  async function loadPgClient({ useSystemDb } = {}) {
15
15
  const dreamconf = index_js_1.default.getOrFail();
16
16
  const creds = dreamconf.dbCredentials.primary;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = primaryKeyType;
4
- const index_js_1 = require("../../dream-application/index.js");
4
+ const index_js_1 = require("../../dream-app/index.js");
5
5
  const constants_js_1 = require("../../dream/constants.js");
6
6
  function primaryKeyType() {
7
7
  const dreamconf = index_js_1.default.getOrFail();