@rvoh/dream 2.1.2 → 2.1.3

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 (232) hide show
  1. package/README.md +4 -4
  2. package/dist/cjs/src/Dream.js +35 -0
  3. package/dist/cjs/src/bin/index.js +1 -1
  4. package/dist/cjs/src/cli/index.js +1 -1
  5. package/dist/cjs/src/cli/logger/loggable/DreamCliLoggableText.js +1 -0
  6. package/dist/cjs/src/dream/DreamClassTransactionBuilder.js +30 -0
  7. package/dist/cjs/src/dream/Query.js +30 -0
  8. package/dist/cjs/src/dream/QueryDriver/Base.js +32 -0
  9. package/dist/cjs/src/dream/QueryDriver/Kysely.js +48 -0
  10. package/dist/cjs/src/dream/internal/printSerializerHierarchyLevel.js +2 -0
  11. package/dist/cjs/src/dream-app/helpers/DreamImporter.js +3 -1
  12. package/dist/cjs/src/dream-app/index.js +2 -1
  13. package/dist/cjs/src/helpers/Env.js +2 -0
  14. package/dist/cjs/src/helpers/cli/ASTConnectionBuilder.js +1 -1
  15. package/dist/cjs/src/helpers/cli/DBClassDeprecation.js +2 -0
  16. package/dist/cjs/src/helpers/cli/generateDream.js +2 -1
  17. package/dist/cjs/src/helpers/cli/generateFactory.js +2 -1
  18. package/dist/cjs/src/helpers/cli/generateMigration.js +2 -1
  19. package/dist/cjs/src/helpers/cli/generateMigrationContent.js +1 -1
  20. package/dist/cjs/src/helpers/cli/generateSerializer.js +2 -1
  21. package/dist/cjs/src/helpers/cli/generateUnitSpec.js +2 -1
  22. package/dist/cjs/src/helpers/getFiles.js +3 -1
  23. package/dist/cjs/src/helpers/sspawn.js +2 -0
  24. package/dist/esm/src/Dream.js +35 -0
  25. package/dist/esm/src/bin/index.js +1 -1
  26. package/dist/esm/src/cli/index.js +1 -1
  27. package/dist/esm/src/cli/logger/loggable/DreamCliLoggableText.js +1 -0
  28. package/dist/esm/src/dream/DreamClassTransactionBuilder.js +30 -0
  29. package/dist/esm/src/dream/Query.js +30 -0
  30. package/dist/esm/src/dream/QueryDriver/Base.js +32 -0
  31. package/dist/esm/src/dream/QueryDriver/Kysely.js +48 -0
  32. package/dist/esm/src/dream/internal/printSerializerHierarchyLevel.js +2 -0
  33. package/dist/esm/src/dream-app/helpers/DreamImporter.js +3 -1
  34. package/dist/esm/src/dream-app/index.js +2 -1
  35. package/dist/esm/src/helpers/Env.js +2 -0
  36. package/dist/esm/src/helpers/cli/ASTConnectionBuilder.js +1 -1
  37. package/dist/esm/src/helpers/cli/DBClassDeprecation.js +2 -0
  38. package/dist/esm/src/helpers/cli/generateDream.js +2 -1
  39. package/dist/esm/src/helpers/cli/generateFactory.js +2 -1
  40. package/dist/esm/src/helpers/cli/generateMigration.js +2 -1
  41. package/dist/esm/src/helpers/cli/generateMigrationContent.js +1 -1
  42. package/dist/esm/src/helpers/cli/generateSerializer.js +2 -1
  43. package/dist/esm/src/helpers/cli/generateUnitSpec.js +2 -1
  44. package/dist/esm/src/helpers/getFiles.js +3 -1
  45. package/dist/esm/src/helpers/sspawn.js +2 -0
  46. package/dist/types/src/Dream.d.ts +28 -0
  47. package/dist/types/src/dream/DreamClassTransactionBuilder.d.ts +26 -0
  48. package/dist/types/src/dream/Query.d.ts +26 -0
  49. package/dist/types/src/dream/QueryDriver/Base.d.ts +26 -0
  50. package/dist/types/src/dream/QueryDriver/Kysely.d.ts +26 -0
  51. package/dist/types/src/dream-app/helpers/PackageManager.d.ts +1 -1
  52. package/dist/types/src/dream-app/index.d.ts +2 -2
  53. package/dist/types/src/types/associations/belongsTo.d.ts +1 -1
  54. package/dist/types/src/types/associations/belongsTo.ts +1 -1
  55. package/dist/types/src/types/serializer.ts +2 -2
  56. package/docs/assets/search.js +1 -1
  57. package/docs/classes/db.DreamMigrationHelpers.html +9 -9
  58. package/docs/classes/db.KyselyQueryDriver.html +47 -31
  59. package/docs/classes/db.PostgresQueryDriver.html +48 -32
  60. package/docs/classes/db.QueryDriverBase.html +46 -30
  61. package/docs/classes/errors.CheckConstraintViolation.html +4 -4
  62. package/docs/classes/errors.ColumnOverflow.html +4 -4
  63. package/docs/classes/errors.CreateOrFindByFailedToCreateAndFind.html +4 -4
  64. package/docs/classes/errors.DataIncompatibleWithDatabaseField.html +4 -4
  65. package/docs/classes/errors.DataTypeColumnTypeMismatch.html +4 -4
  66. package/docs/classes/errors.GlobalNameNotSet.html +4 -4
  67. package/docs/classes/errors.InvalidCalendarDate.html +4 -4
  68. package/docs/classes/errors.MissingSerializersDefinition.html +4 -4
  69. package/docs/classes/errors.NonLoadedAssociation.html +4 -4
  70. package/docs/classes/errors.NotNullViolation.html +4 -4
  71. package/docs/classes/errors.RecordNotFound.html +4 -4
  72. package/docs/classes/errors.ValidationError.html +4 -4
  73. package/docs/classes/index.CalendarDate.html +2 -2
  74. package/docs/classes/index.Decorators.html +19 -19
  75. package/docs/classes/index.Dream.html +210 -194
  76. package/docs/classes/index.DreamApp.html +5 -5
  77. package/docs/classes/index.DreamTransaction.html +2 -2
  78. package/docs/classes/index.Env.html +2 -2
  79. package/docs/classes/index.Query.html +91 -75
  80. package/docs/classes/system.CliFileWriter.html +2 -2
  81. package/docs/classes/system.DreamBin.html +2 -2
  82. package/docs/classes/system.DreamCLI.html +5 -5
  83. package/docs/classes/system.DreamImporter.html +2 -2
  84. package/docs/classes/system.DreamLogos.html +2 -2
  85. package/docs/classes/system.DreamSerializerBuilder.html +8 -8
  86. package/docs/classes/system.ObjectSerializerBuilder.html +8 -8
  87. package/docs/classes/utils.Encrypt.html +2 -2
  88. package/docs/classes/utils.Range.html +2 -2
  89. package/docs/functions/db.closeAllDbConnections.html +1 -1
  90. package/docs/functions/db.dreamDbConnections.html +1 -1
  91. package/docs/functions/db.untypedDb.html +1 -1
  92. package/docs/functions/db.validateColumn.html +1 -1
  93. package/docs/functions/db.validateTable.html +1 -1
  94. package/docs/functions/errors.pgErrorType.html +1 -1
  95. package/docs/functions/index.DreamSerializer.html +1 -1
  96. package/docs/functions/index.ObjectSerializer.html +1 -1
  97. package/docs/functions/index.ReplicaSafe.html +1 -1
  98. package/docs/functions/index.STI.html +1 -1
  99. package/docs/functions/index.SoftDelete.html +1 -1
  100. package/docs/functions/utils.camelize.html +1 -1
  101. package/docs/functions/utils.capitalize.html +1 -1
  102. package/docs/functions/utils.cloneDeepSafe.html +1 -1
  103. package/docs/functions/utils.compact.html +1 -1
  104. package/docs/functions/utils.groupBy.html +1 -1
  105. package/docs/functions/utils.hyphenize.html +1 -1
  106. package/docs/functions/utils.intersection.html +1 -1
  107. package/docs/functions/utils.isEmpty.html +1 -1
  108. package/docs/functions/utils.normalizeUnicode.html +1 -1
  109. package/docs/functions/utils.pascalize.html +1 -1
  110. package/docs/functions/utils.percent.html +1 -1
  111. package/docs/functions/utils.range-1.html +1 -1
  112. package/docs/functions/utils.round.html +1 -1
  113. package/docs/functions/utils.sanitizeString.html +1 -1
  114. package/docs/functions/utils.snakeify.html +1 -1
  115. package/docs/functions/utils.sort.html +1 -1
  116. package/docs/functions/utils.sortBy.html +1 -1
  117. package/docs/functions/utils.sortObjectByKey.html +1 -1
  118. package/docs/functions/utils.sortObjectByValue.html +1 -1
  119. package/docs/functions/utils.uncapitalize.html +1 -1
  120. package/docs/functions/utils.uniq.html +1 -1
  121. package/docs/index.html +4 -4
  122. package/docs/interfaces/openapi.OpenapiDescription.html +2 -2
  123. package/docs/interfaces/openapi.OpenapiSchemaProperties.html +1 -1
  124. package/docs/interfaces/openapi.OpenapiSchemaPropertiesShorthand.html +1 -1
  125. package/docs/interfaces/openapi.OpenapiTypeFieldObject.html +1 -1
  126. package/docs/interfaces/types.BelongsToStatement.html +2 -2
  127. package/docs/interfaces/types.DecoratorContext.html +2 -2
  128. package/docs/interfaces/types.DreamAppInitOptions.html +2 -2
  129. package/docs/interfaces/types.DreamAppOpts.html +2 -2
  130. package/docs/interfaces/types.EncryptOptions.html +2 -2
  131. package/docs/interfaces/types.InternalAnyTypedSerializerRendersMany.html +2 -2
  132. package/docs/interfaces/types.InternalAnyTypedSerializerRendersOne.html +2 -2
  133. package/docs/interfaces/types.SerializerRendererOpts.html +2 -2
  134. package/docs/modules/db.html +1 -1
  135. package/docs/modules/errors.html +1 -1
  136. package/docs/modules/index.html +1 -1
  137. package/docs/modules/openapi.html +1 -1
  138. package/docs/modules/system.html +1 -1
  139. package/docs/modules/types.html +1 -1
  140. package/docs/modules/utils.html +1 -1
  141. package/docs/types/index.DateTime.html +1 -1
  142. package/docs/types/openapi.CommonOpenapiSchemaObjectFields.html +1 -1
  143. package/docs/types/openapi.OpenapiAllTypes.html +1 -1
  144. package/docs/types/openapi.OpenapiFormats.html +1 -1
  145. package/docs/types/openapi.OpenapiNumberFormats.html +1 -1
  146. package/docs/types/openapi.OpenapiPrimitiveBaseTypes.html +1 -1
  147. package/docs/types/openapi.OpenapiPrimitiveTypes.html +1 -1
  148. package/docs/types/openapi.OpenapiSchemaArray.html +1 -1
  149. package/docs/types/openapi.OpenapiSchemaArrayShorthand.html +1 -1
  150. package/docs/types/openapi.OpenapiSchemaBase.html +1 -1
  151. package/docs/types/openapi.OpenapiSchemaBody.html +1 -1
  152. package/docs/types/openapi.OpenapiSchemaBodyShorthand.html +1 -1
  153. package/docs/types/openapi.OpenapiSchemaCommonFields.html +1 -1
  154. package/docs/types/openapi.OpenapiSchemaExpressionAllOf.html +1 -1
  155. package/docs/types/openapi.OpenapiSchemaExpressionAnyOf.html +1 -1
  156. package/docs/types/openapi.OpenapiSchemaExpressionOneOf.html +1 -1
  157. package/docs/types/openapi.OpenapiSchemaExpressionRef.html +1 -1
  158. package/docs/types/openapi.OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
  159. package/docs/types/openapi.OpenapiSchemaInteger.html +1 -1
  160. package/docs/types/openapi.OpenapiSchemaNull.html +1 -1
  161. package/docs/types/openapi.OpenapiSchemaNumber.html +1 -1
  162. package/docs/types/openapi.OpenapiSchemaObject.html +1 -1
  163. package/docs/types/openapi.OpenapiSchemaObjectAllOf.html +1 -1
  164. package/docs/types/openapi.OpenapiSchemaObjectAllOfShorthand.html +1 -1
  165. package/docs/types/openapi.OpenapiSchemaObjectAnyOf.html +1 -1
  166. package/docs/types/openapi.OpenapiSchemaObjectAnyOfShorthand.html +1 -1
  167. package/docs/types/openapi.OpenapiSchemaObjectBase.html +1 -1
  168. package/docs/types/openapi.OpenapiSchemaObjectBaseShorthand.html +1 -1
  169. package/docs/types/openapi.OpenapiSchemaObjectOneOf.html +1 -1
  170. package/docs/types/openapi.OpenapiSchemaObjectOneOfShorthand.html +1 -1
  171. package/docs/types/openapi.OpenapiSchemaObjectShorthand.html +1 -1
  172. package/docs/types/openapi.OpenapiSchemaPrimitiveGeneric.html +1 -1
  173. package/docs/types/openapi.OpenapiSchemaShorthandExpressionAllOf.html +1 -1
  174. package/docs/types/openapi.OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
  175. package/docs/types/openapi.OpenapiSchemaShorthandExpressionOneOf.html +1 -1
  176. package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
  177. package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
  178. package/docs/types/openapi.OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
  179. package/docs/types/openapi.OpenapiSchemaString.html +1 -1
  180. package/docs/types/openapi.OpenapiShorthandAllTypes.html +1 -1
  181. package/docs/types/openapi.OpenapiShorthandPrimitiveBaseTypes.html +1 -1
  182. package/docs/types/openapi.OpenapiShorthandPrimitiveTypes.html +1 -1
  183. package/docs/types/openapi.OpenapiTypeField.html +1 -1
  184. package/docs/types/system.DreamAppAllowedPackageManagersEnum.html +1 -1
  185. package/docs/types/types.Camelized.html +1 -1
  186. package/docs/types/types.DbConnectionType.html +1 -1
  187. package/docs/types/types.DbTypes.html +1 -1
  188. package/docs/types/types.DreamAssociationMetadata.html +1 -1
  189. package/docs/types/types.DreamAttributes.html +1 -1
  190. package/docs/types/types.DreamClassAssociationAndStatement.html +1 -1
  191. package/docs/types/types.DreamClassColumn.html +1 -1
  192. package/docs/types/types.DreamColumn.html +1 -1
  193. package/docs/types/types.DreamColumnNames.html +1 -1
  194. package/docs/types/types.DreamLogLevel.html +1 -1
  195. package/docs/types/types.DreamLogger.html +1 -1
  196. package/docs/types/types.DreamModelSerializerType.html +1 -1
  197. package/docs/types/types.DreamOrViewModelClassSerializerKey.html +1 -1
  198. package/docs/types/types.DreamOrViewModelSerializerKey.html +1 -1
  199. package/docs/types/types.DreamParamSafeAttributes.html +1 -1
  200. package/docs/types/types.DreamParamSafeColumnNames.html +1 -1
  201. package/docs/types/types.DreamSerializable.html +1 -1
  202. package/docs/types/types.DreamSerializableArray.html +1 -1
  203. package/docs/types/types.DreamSerializerKey.html +1 -1
  204. package/docs/types/types.DreamSerializers.html +1 -1
  205. package/docs/types/types.DreamVirtualColumns.html +1 -1
  206. package/docs/types/types.EncryptAlgorithm.html +1 -1
  207. package/docs/types/types.HasManyStatement.html +1 -1
  208. package/docs/types/types.HasOneStatement.html +1 -1
  209. package/docs/types/types.Hyphenized.html +1 -1
  210. package/docs/types/types.Pascalized.html +1 -1
  211. package/docs/types/types.RoundingPrecision.html +1 -1
  212. package/docs/types/types.SerializerCasing.html +1 -1
  213. package/docs/types/types.SimpleObjectSerializerType.html +1 -1
  214. package/docs/types/types.Snakeified.html +1 -1
  215. package/docs/types/types.StrictInterface.html +1 -1
  216. package/docs/types/types.UpdateableAssociationProperties.html +1 -1
  217. package/docs/types/types.UpdateableProperties.html +1 -1
  218. package/docs/types/types.ValidationType.html +1 -1
  219. package/docs/types/types.ViewModel.html +1 -1
  220. package/docs/types/types.ViewModelClass.html +1 -1
  221. package/docs/types/types.WhereStatementForDream.html +1 -1
  222. package/docs/types/types.WhereStatementForDreamClass.html +1 -1
  223. package/docs/variables/index.DateTime-1.html +1 -1
  224. package/docs/variables/index.DreamConst.html +1 -1
  225. package/docs/variables/index.ops.html +1 -1
  226. package/docs/variables/openapi.openapiPrimitiveTypes-1.html +1 -1
  227. package/docs/variables/openapi.openapiShorthandPrimitiveTypes-1.html +1 -1
  228. package/docs/variables/system.DreamAppAllowedPackageManagersEnumValues.html +1 -1
  229. package/docs/variables/types.TRIGRAM_OPERATORS.html +1 -1
  230. package/docs/variables/types.primaryKeyTypes.html +1 -1
  231. package/package.json +17 -17
  232. package/CHANGELOG.md +0 -332
@@ -1043,6 +1043,36 @@ export default class Query {
1043
1043
  async min(columnName) {
1044
1044
  return await this.dbDriverInstance().min(columnName);
1045
1045
  }
1046
+ /**
1047
+ * Retrieves the sum value of the specified column
1048
+ * for this Query
1049
+ *
1050
+ * ```ts
1051
+ * await Game.query().sum('score')
1052
+ * // 1
1053
+ * ```
1054
+ *
1055
+ * @param columnName - a column name on the model
1056
+ * @returns the sum of the values of the specified column for this Query
1057
+ */
1058
+ async sum(columnName) {
1059
+ return await this.dbDriverInstance().sum(columnName);
1060
+ }
1061
+ /**
1062
+ * Retrieves the average value of the specified column
1063
+ * for this Query
1064
+ *
1065
+ * ```ts
1066
+ * await Game.query().avg('score')
1067
+ * // 1
1068
+ * ```
1069
+ *
1070
+ * @param columnName - a column name on the model
1071
+ * @returns the average of the values of the specified column for this Query
1072
+ */
1073
+ async avg(columnName) {
1074
+ return await this.dbDriverInstance().avg(columnName);
1075
+ }
1046
1076
  /**
1047
1077
  * Plucks the provided fields from the given dream class table
1048
1078
  *
@@ -273,6 +273,38 @@ export default class QueryDriverBase {
273
273
  async min(columnName) {
274
274
  throw new Error('implement min in child class');
275
275
  }
276
+ /**
277
+ * Retrieves the sum value of the specified column
278
+ * for this Query
279
+ *
280
+ * ```ts
281
+ * await Game.query().sum('score')
282
+ * // 1
283
+ * ```
284
+ *
285
+ * @param columnName - a column name on the model
286
+ * @returns the sum of the values of the specified column for this Query
287
+ */
288
+ // eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-unused-vars
289
+ async sum(columnName) {
290
+ throw new Error('implement sum in child class');
291
+ }
292
+ /**
293
+ * Retrieves the average value of the specified column
294
+ * for this Query
295
+ *
296
+ * ```ts
297
+ * await Game.query().avg('score')
298
+ * // 1
299
+ * ```
300
+ *
301
+ * @param columnName - a column name on the model
302
+ * @returns the average of the values of the specified column for this Query
303
+ */
304
+ // eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-unused-vars
305
+ async avg(columnName) {
306
+ throw new Error('implement avg in child class');
307
+ }
276
308
  /**
277
309
  * Retrieves the number of records in the database
278
310
  *
@@ -194,6 +194,7 @@ export default class KyselyQueryDriver extends QueryDriverBase {
194
194
  }
195
195
  }
196
196
  catch (error) {
197
+ // eslint-disable-next-line no-console
197
198
  console.error(error);
198
199
  await DreamCLI.logger.logProgress('[dream] sync failed, reverting file contents...', async () => {
199
200
  await CliFileWriter.revert();
@@ -452,6 +453,52 @@ export default class KyselyQueryDriver extends QueryDriverBase {
452
453
  const data = await executeDatabaseQuery(kyselyQuery, 'executeTakeFirstOrThrow');
453
454
  return data.min;
454
455
  }
456
+ /**
457
+ * Retrieves the sum value of the specified column
458
+ * for this Query
459
+ *
460
+ * ```ts
461
+ * await Game.query().sum('score')
462
+ * // 1
463
+ * ```
464
+ *
465
+ * @param columnName - a column name on the model
466
+ * @returns the sum of the values of the specified column for this Query
467
+ */
468
+ async sum(columnName) {
469
+ // eslint-disable-next-line @typescript-eslint/unbound-method
470
+ const { sum } = this.dbFor('select').fn;
471
+ let kyselyQuery = new this.constructor(this.query).buildSelect({
472
+ bypassSelectAll: true,
473
+ bypassOrder: true,
474
+ });
475
+ kyselyQuery = kyselyQuery.select(sum(columnName));
476
+ const data = await executeDatabaseQuery(kyselyQuery, 'executeTakeFirstOrThrow');
477
+ return data.sum === null ? null : parseFloat(data.sum);
478
+ }
479
+ /**
480
+ * Retrieves the average value of the specified column
481
+ * for this Query
482
+ *
483
+ * ```ts
484
+ * await Game.query().avg('score')
485
+ * // 1
486
+ * ```
487
+ *
488
+ * @param columnName - a column name on the model
489
+ * @returns the average of the values of the specified column for this Query
490
+ */
491
+ async avg(columnName) {
492
+ // eslint-disable-next-line @typescript-eslint/unbound-method
493
+ const { avg } = this.dbFor('select').fn;
494
+ let kyselyQuery = new this.constructor(this.query).buildSelect({
495
+ bypassSelectAll: true,
496
+ bypassOrder: true,
497
+ });
498
+ kyselyQuery = kyselyQuery.select(avg(columnName));
499
+ const data = await executeDatabaseQuery(kyselyQuery, 'executeTakeFirstOrThrow');
500
+ return data.avg;
501
+ }
455
502
  /**
456
503
  * Retrieves the number of records in the database
457
504
  *
@@ -893,6 +940,7 @@ export default class KyselyQueryDriver extends QueryDriverBase {
893
940
  const hasMany = association.type === 'HasMany';
894
941
  // initialize by trying to access the association, which throws an exception if not yet initialized
895
942
  try {
943
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
896
944
  ;
897
945
  dream[association.as];
898
946
  }
@@ -7,7 +7,9 @@ export default function printSerializerHierarchyLevel({ serializerAssociationTyp
7
7
  });
8
8
  const prefix = `${hierarchyLine} `;
9
9
  const nestedAssociationDisplay = indentation + `${prefix}${serializerAssociationType} ${yoctocolors.cyan(serializerAssociationName)}`;
10
+ // eslint-disable-next-line no-console
10
11
  console.log(nestedAssociationDisplay);
12
+ // eslint-disable-next-line no-console
11
13
  console.log(yoctocolors.gray(indentation +
12
14
  indent(prefix.length, { tabWidth: 1 }) +
13
15
  associationSerializer.globalName));
@@ -4,7 +4,9 @@ export default class DreamImporter {
4
4
  static async ls(dir) {
5
5
  try {
6
6
  const dirents = await fs.readdir(dir, { withFileTypes: true });
7
- const files = await Promise.all(dirents
7
+ const files = await Promise.all(
8
+ // eslint-disable-next-line @typescript-eslint/await-thenable
9
+ dirents
8
10
  .map(dirent => {
9
11
  const res = path.resolve(dir, dirent.name);
10
12
  return dirent.isDirectory()
@@ -137,6 +137,7 @@ export default class DreamApp {
137
137
  }
138
138
  static checkKey(encryptionIdentifier, key, algorithm) {
139
139
  if (!Encrypt.validateKey(key, algorithm))
140
+ // eslint-disable-next-line no-console
140
141
  console.warn(`
141
142
  Your current key value for ${encryptionIdentifier} encryption is invalid.
142
143
  Try setting it to something valid, like:
@@ -410,7 +411,7 @@ function argToString(arg) {
410
411
  return arg.toISO();
411
412
  return util.inspect(arg, { depth: 3 });
412
413
  }
413
- export const DreamAppAllowedPackageManagersEnumValues = ['yarn', 'npm', 'pnpm'];
414
+ export const DreamAppAllowedPackageManagersEnumValues = ['pnpm', 'yarn', 'npm'];
414
415
  // GeneratorImportStyles are used by CLI generators to determine how
415
416
  // to style import suffixes. When integrating with other apps, this
416
417
  // suffix style can change, and may need to be configured.
@@ -38,12 +38,14 @@ export default class Env {
38
38
  return this.optional(env) === '1';
39
39
  }
40
40
  setString(env, val) {
41
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
41
42
  val === undefined ? delete process.env[env] : (process.env[env] = val);
42
43
  }
43
44
  unsetString(env) {
44
45
  delete process.env[env];
45
46
  }
46
47
  setInteger(env, val) {
48
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
47
49
  val === undefined ? delete process.env[env] : (process.env[env] = Math.floor(val).toString());
48
50
  }
49
51
  unsetInteger(env) {
@@ -179,7 +179,7 @@ export default class ASTConnectionBuilder extends ASTBuilder {
179
179
  foreignKey = _foreignKey;
180
180
  }
181
181
  }
182
- catch (err) {
182
+ catch {
183
183
  this.hasForeignKeyError = true;
184
184
  }
185
185
  try {
@@ -37,7 +37,9 @@ export default class DBClassDeprecation {
37
37
  }
38
38
  }
39
39
  catch (err) {
40
+ // eslint-disable-next-line no-console
40
41
  console.error(err);
42
+ // eslint-disable-next-line no-console
41
43
  console.log(`
42
44
  ATTENTION:
43
45
 
@@ -1,4 +1,5 @@
1
1
  import * as fs from 'node:fs/promises';
2
+ import DreamCLI from '../../cli/index.js';
2
3
  import dreamFileAndDirPaths from '../path/dreamFileAndDirPaths.js';
3
4
  import dreamPath from '../path/dreamPath.js';
4
5
  import standardizeFullyQualifiedModelName from '../standardizeFullyQualifiedModelName.js';
@@ -11,7 +12,7 @@ export default async function generateDream({ fullyQualifiedModelName, columnsWi
11
12
  fullyQualifiedModelName = standardizeFullyQualifiedModelName(fullyQualifiedModelName);
12
13
  const { relFilePath, absDirPath, absFilePath } = dreamFileAndDirPaths(dreamPath('models'), `${fullyQualifiedModelName}.ts`);
13
14
  try {
14
- console.log(`generating dream: ${relFilePath}`);
15
+ DreamCLI.logger.log(`[dream] generating dream: ${relFilePath}`);
15
16
  await fs.mkdir(absDirPath, { recursive: true });
16
17
  await fs.writeFile(absFilePath, generateDreamContent({
17
18
  fullyQualifiedModelName,
@@ -3,11 +3,12 @@ import dreamFileAndDirPaths from '../path/dreamFileAndDirPaths.js';
3
3
  import dreamPath from '../path/dreamPath.js';
4
4
  import standardizeFullyQualifiedModelName from '../standardizeFullyQualifiedModelName.js';
5
5
  import generateFactoryContent from './generateFactoryContent.js';
6
+ import DreamCLI from '../../cli/index.js';
6
7
  export default async function generateFactory({ fullyQualifiedModelName, columnsWithTypes, }) {
7
8
  fullyQualifiedModelName = standardizeFullyQualifiedModelName(fullyQualifiedModelName);
8
9
  const { relFilePath, absDirPath, absFilePath } = dreamFileAndDirPaths(dreamPath('factories'), `${fullyQualifiedModelName}Factory.ts`);
9
10
  try {
10
- console.log(`generating factory: ${relFilePath}`);
11
+ DreamCLI.logger.log(`[dream] generating factory: ${relFilePath}`);
11
12
  await fs.mkdir(absDirPath, { recursive: true });
12
13
  await fs.writeFile(absFilePath, generateFactoryContent({ fullyQualifiedModelName, columnsWithTypes }));
13
14
  }
@@ -10,6 +10,7 @@ import dreamFileAndDirPaths from '../path/dreamFileAndDirPaths.js';
10
10
  import dreamPath from '../path/dreamPath.js';
11
11
  import snakeify from '../snakeify.js';
12
12
  import generateStiMigrationContent from './generateStiMigrationContent.js';
13
+ import DreamCLI from '../../cli/index.js';
13
14
  export default async function generateMigration({ migrationName, columnsWithTypes, connectionName, fullyQualifiedModelName, fullyQualifiedParentName, }) {
14
15
  const { relFilePath, absFilePath } = connectionName === 'default'
15
16
  ? dreamFileAndDirPaths(path.join(dreamPath('db'), 'migrations'), `${migrationVersion()}-${hyphenize(migrationName).replace(/\//g, '-')}.ts`)
@@ -41,7 +42,7 @@ export default async function generateMigration({ migrationName, columnsWithType
41
42
  });
42
43
  }
43
44
  try {
44
- console.log(`generating migration: ${relFilePath}`);
45
+ DreamCLI.logger.log(`[dream] generating migration: ${relFilePath}`);
45
46
  await fs.writeFile(absFilePath, finalContent);
46
47
  }
47
48
  catch (error) {
@@ -249,7 +249,7 @@ function generateColumnStr(attributeName, attributeType, descriptors, { omitInli
249
249
  if (attributeName === STI_TYPE_COLUMN_NAME)
250
250
  returnStr = `// CONSIDER: when using type for STI, always use an enum
251
251
  // Try using the enum syntax in your generator, e.g.:
252
- // yarn psy g:model Balloon type:enum:balloon_type:latex,mylar
252
+ // pnpm psy g:model Balloon type:enum:balloon_type:latex,mylar
253
253
  ${returnStr}`;
254
254
  return returnStr;
255
255
  }
@@ -3,11 +3,12 @@ import dreamFileAndDirPaths from '../path/dreamFileAndDirPaths.js';
3
3
  import dreamPath from '../path/dreamPath.js';
4
4
  import standardizeFullyQualifiedModelName from '../standardizeFullyQualifiedModelName.js';
5
5
  import generateSerializerContent from './generateSerializerContent.js';
6
+ import DreamCLI from '../../cli/index.js';
6
7
  export default async function generateSerializer({ fullyQualifiedModelName, columnsWithTypes, fullyQualifiedParentName, stiBaseSerializer, includeAdminSerializers, }) {
7
8
  fullyQualifiedModelName = standardizeFullyQualifiedModelName(fullyQualifiedModelName);
8
9
  const { relFilePath, absDirPath, absFilePath } = dreamFileAndDirPaths(dreamPath('serializers'), `${fullyQualifiedModelName}Serializer.ts`);
9
10
  try {
10
- console.log(`generating serializer: ${relFilePath}`);
11
+ DreamCLI.logger.log(`[dream] generating serializer: ${relFilePath}`);
11
12
  await fs.mkdir(absDirPath, { recursive: true });
12
13
  await fs.writeFile(absFilePath, generateSerializerContent({
13
14
  fullyQualifiedModelName,
@@ -1,4 +1,5 @@
1
1
  import * as fs from 'node:fs/promises';
2
+ import DreamCLI from '../../cli/index.js';
2
3
  import dreamFileAndDirPaths from '../path/dreamFileAndDirPaths.js';
3
4
  import dreamPath from '../path/dreamPath.js';
4
5
  import standardizeFullyQualifiedModelName from '../standardizeFullyQualifiedModelName.js';
@@ -7,7 +8,7 @@ export default async function generateUnitSpec({ fullyQualifiedModelName, }) {
7
8
  fullyQualifiedModelName = standardizeFullyQualifiedModelName(fullyQualifiedModelName);
8
9
  const { relFilePath, absDirPath, absFilePath } = dreamFileAndDirPaths(dreamPath('modelSpecs'), `${fullyQualifiedModelName}.spec.ts`);
9
10
  try {
10
- console.log(`generating spec: ${relFilePath}`);
11
+ DreamCLI.logger.log(`[dream] generating spec: ${relFilePath}`);
11
12
  await fs.mkdir(absDirPath, { recursive: true });
12
13
  await fs.writeFile(absFilePath, generateUnitSpecContent({ fullyQualifiedModelName }));
13
14
  }
@@ -3,7 +3,9 @@ import * as path from 'node:path';
3
3
  export default async function getFiles(dir) {
4
4
  try {
5
5
  const dirents = await fs.readdir(dir, { withFileTypes: true });
6
- const files = await Promise.all(dirents.map(dirent => {
6
+ const files = await Promise.all(
7
+ // eslint-disable-next-line @typescript-eslint/await-thenable
8
+ dirents.map(dirent => {
7
9
  const res = path.resolve(dir, dirent.name);
8
10
  return dirent.isDirectory() ? getFiles(res) : res.replace(/\.ts$/, '.js');
9
11
  }));
@@ -28,6 +28,7 @@ export function ssspawn(command, opts = {}) {
28
28
  opts?.onStdout?.(txt);
29
29
  }
30
30
  else {
31
+ // eslint-disable-next-line no-console
31
32
  console.log(txt);
32
33
  }
33
34
  });
@@ -38,5 +39,6 @@ export function ssspawn(command, opts = {}) {
38
39
  return proc;
39
40
  }
40
41
  function handleSpawnError(err) {
42
+ // eslint-disable-next-line no-console
41
43
  console.error(err?.toString());
42
44
  }
@@ -707,6 +707,34 @@ export default class Dream {
707
707
  * @returns the min value of the specified column for this model's records
708
708
  */
709
709
  static min<T extends typeof Dream, ColumnName extends DreamColumnNames<InstanceType<T>>>(this: T, columnName: ColumnName): Promise<InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]][ColumnName & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]]]["coercedType" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]][ColumnName & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]]]]>;
710
+ /**
711
+ * Retrieves the sum for all values of the specified column
712
+ * for this model's records.
713
+ *
714
+ *
715
+ * ```ts
716
+ * await Game.sum('score')
717
+ * // 100
718
+ * ```
719
+ *
720
+ * @param columnName - a column name on the model
721
+ * @returns the sum for all values of the specified column for this model's records
722
+ */
723
+ static sum<T extends typeof Dream, ColumnName extends DreamColumnNames<InstanceType<T>>>(this: T, columnName: ColumnName): Promise<InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]][ColumnName & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]]]["coercedType" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]][ColumnName & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]]]]>;
724
+ /**
725
+ * Retrieves the average for all values of the specified column
726
+ * for this model's records.
727
+ *
728
+ *
729
+ * ```ts
730
+ * await Game.avg('score')
731
+ * // 100
732
+ * ```
733
+ *
734
+ * @param columnName - a column name on the model
735
+ * @returns the average for all values of the specified column for this model's records
736
+ */
737
+ static avg<T extends typeof Dream, ColumnName extends DreamColumnNames<InstanceType<T>>>(this: T, columnName: ColumnName): Promise<InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]][ColumnName & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]]]["coercedType" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]][ColumnName & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]["columns" & keyof InstanceType<T>["schema"][InstanceType<T>["table"] & keyof InstanceType<T>["schema"]]]]]>;
710
738
  /**
711
739
  * Persists a new record, setting the provided attributes.
712
740
  * Automatically sets createdAt and updatedAt timestamps.
@@ -115,6 +115,32 @@ export default class DreamClassTransactionBuilder<DreamClass extends typeof Drea
115
115
  * @returns The min value of the specified column for this model's records
116
116
  */
117
117
  min<I extends DreamClassTransactionBuilder<DreamClass, DreamInstance>, T extends DreamColumnNames<DreamInstance>>(this: I, columnName: T): Promise<DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]][T & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]]]["coercedType" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]][T & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]]]]>;
118
+ /**
119
+ * Retrieves the sum value of the specified column
120
+ * for this Query
121
+ *
122
+ * ```ts
123
+ * await Game.txn(txn).sum('score')
124
+ * // 1
125
+ * ```
126
+ *
127
+ * @param columnName - a column name on the model
128
+ * @returns the sum of the values of the specified column for this Query
129
+ */
130
+ sum<I extends DreamClassTransactionBuilder<DreamClass, DreamInstance>, T extends DreamColumnNames<DreamInstance>>(this: I, columnName: T): Promise<DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]][T & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]]]["coercedType" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]][T & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]]]]>;
131
+ /**
132
+ * Retrieves the average value of the specified column
133
+ * for this Query
134
+ *
135
+ * ```ts
136
+ * await Game.txn(txn).avg('score')
137
+ * // 1
138
+ * ```
139
+ *
140
+ * @param columnName - a column name on the model
141
+ * @returns the average of the values of the specified column for this Query
142
+ */
143
+ avg<I extends DreamClassTransactionBuilder<DreamClass, DreamInstance>, T extends DreamColumnNames<DreamInstance>>(this: I, columnName: T): Promise<DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]][T & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]]]["coercedType" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]][T & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]["columns" & keyof DreamInstance["schema"][DreamInstance["table"] & keyof DreamInstance["schema"]]]]]>;
118
144
  /**
119
145
  * Persists a new record, setting the provided attributes.
120
146
  * Automatically sets createdAt and updatedAt timestamps.
@@ -752,6 +752,32 @@ export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Re
752
752
  * @returns the min value of the specified column for this Query
753
753
  */
754
754
  min<Q extends Query<DreamInstance, QueryTypeOpts>, DB extends DreamInstance['DB'], ColumnName extends ColumnNamesAccountingForJoinedAssociations<Q['queryTypeOpts']['joinedAssociations'], DB, QueryTypeOpts['rootTableName'], QueryTypeOpts['rootTableAlias']>, ReturnType extends NamespacedOrBaseModelColumnTypes<[ColumnName], Q, DreamInstance>[0]>(columnName: ColumnName): Promise<ReturnType>;
755
+ /**
756
+ * Retrieves the sum value of the specified column
757
+ * for this Query
758
+ *
759
+ * ```ts
760
+ * await Game.query().sum('score')
761
+ * // 1
762
+ * ```
763
+ *
764
+ * @param columnName - a column name on the model
765
+ * @returns the sum of the values of the specified column for this Query
766
+ */
767
+ sum<Q extends Query<DreamInstance, QueryTypeOpts>, DB extends DreamInstance['DB'], ColumnName extends ColumnNamesAccountingForJoinedAssociations<Q['queryTypeOpts']['joinedAssociations'], DB, QueryTypeOpts['rootTableName'], QueryTypeOpts['rootTableAlias']>, ReturnType extends NamespacedOrBaseModelColumnTypes<[ColumnName], Q, DreamInstance>[0]>(columnName: ColumnName): Promise<ReturnType>;
768
+ /**
769
+ * Retrieves the average value of the specified column
770
+ * for this Query
771
+ *
772
+ * ```ts
773
+ * await Game.query().avg('score')
774
+ * // 1
775
+ * ```
776
+ *
777
+ * @param columnName - a column name on the model
778
+ * @returns the average of the values of the specified column for this Query
779
+ */
780
+ avg<Q extends Query<DreamInstance, QueryTypeOpts>, DB extends DreamInstance['DB'], ColumnName extends ColumnNamesAccountingForJoinedAssociations<Q['queryTypeOpts']['joinedAssociations'], DB, QueryTypeOpts['rootTableName'], QueryTypeOpts['rootTableAlias']>, ReturnType extends NamespacedOrBaseModelColumnTypes<[ColumnName], Q, DreamInstance>[0]>(columnName: ColumnName): Promise<ReturnType>;
755
781
  /**
756
782
  * Plucks the provided fields from the given dream class table
757
783
  *
@@ -195,6 +195,32 @@ export default class QueryDriverBase<DreamInstance extends Dream> {
195
195
  * @returns the min value of the specified column for this Query
196
196
  */
197
197
  min(columnName: string): Promise<any>;
198
+ /**
199
+ * Retrieves the sum value of the specified column
200
+ * for this Query
201
+ *
202
+ * ```ts
203
+ * await Game.query().sum('score')
204
+ * // 1
205
+ * ```
206
+ *
207
+ * @param columnName - a column name on the model
208
+ * @returns the sum of the values of the specified column for this Query
209
+ */
210
+ sum(columnName: string): Promise<any>;
211
+ /**
212
+ * Retrieves the average value of the specified column
213
+ * for this Query
214
+ *
215
+ * ```ts
216
+ * await Game.query().avg('score')
217
+ * // 1
218
+ * ```
219
+ *
220
+ * @param columnName - a column name on the model
221
+ * @returns the average of the values of the specified column for this Query
222
+ */
223
+ avg(columnName: string): Promise<any>;
198
224
  /**
199
225
  * Retrieves the number of records in the database
200
226
  *
@@ -168,6 +168,32 @@ export default class KyselyQueryDriver<DreamInstance extends Dream> extends Quer
168
168
  * @returns the min value of the specified column for this Query
169
169
  */
170
170
  min(columnName: string): Promise<any>;
171
+ /**
172
+ * Retrieves the sum value of the specified column
173
+ * for this Query
174
+ *
175
+ * ```ts
176
+ * await Game.query().sum('score')
177
+ * // 1
178
+ * ```
179
+ *
180
+ * @param columnName - a column name on the model
181
+ * @returns the sum of the values of the specified column for this Query
182
+ */
183
+ sum(columnName: string): Promise<any>;
184
+ /**
185
+ * Retrieves the average value of the specified column
186
+ * for this Query
187
+ *
188
+ * ```ts
189
+ * await Game.query().avg('score')
190
+ * // 1
191
+ * ```
192
+ *
193
+ * @param columnName - a column name on the model
194
+ * @returns the average of the values of the specified column for this Query
195
+ */
196
+ avg(columnName: string): Promise<any>;
171
197
  /**
172
198
  * Retrieves the number of records in the database
173
199
  *
@@ -1,5 +1,5 @@
1
1
  export default class PackageManager {
2
- static get packageManager(): "yarn" | "npm" | "pnpm";
2
+ static get packageManager(): "pnpm" | "yarn" | "npm";
3
3
  static add(dependencyOrDependencies: string | string[], { dev }?: {
4
4
  dev?: boolean;
5
5
  }): string;
@@ -130,7 +130,7 @@ export default class DreamApp {
130
130
  private _plugins;
131
131
  get plugins(): ((app: DreamApp) => void | Promise<void>)[];
132
132
  private _packageManager;
133
- get packageManager(): "yarn" | "npm" | "pnpm";
133
+ get packageManager(): "pnpm" | "yarn" | "npm";
134
134
  private _importExtension;
135
135
  get importExtension(): ".js" | ".ts" | "none";
136
136
  /**
@@ -219,7 +219,7 @@ export interface KyselyLogEvent {
219
219
  queryDurationMillis: number;
220
220
  error: unknown;
221
221
  }
222
- export declare const DreamAppAllowedPackageManagersEnumValues: readonly ["yarn", "npm", "pnpm"];
222
+ export declare const DreamAppAllowedPackageManagersEnumValues: readonly ["pnpm", "yarn", "npm"];
223
223
  export type DreamAppAllowedPackageManagersEnum = (typeof DreamAppAllowedPackageManagersEnumValues)[number];
224
224
  export declare const GeneratorImportStyles: readonly [".js", ".ts", "none"];
225
225
  export type GeneratorImportStyle = (typeof GeneratorImportStyles)[number];
@@ -6,7 +6,7 @@ export interface BelongsToStatement<BaseInstance extends Dream, DB, Schema, Tabl
6
6
  globalAssociationNameOrNames: string[];
7
7
  type: 'BelongsTo';
8
8
  as: string;
9
- primaryKey: (associationInstance?: Dream | undefined, opts?: {
9
+ primaryKey: (associationInstance?: Dream, opts?: {
10
10
  associatedClassOverride?: typeof Dream | undefined;
11
11
  }) => keyof DB[TableName] & string;
12
12
  primaryKeyValue: (associationInstance: Dream | null) => any;
@@ -20,7 +20,7 @@ export interface BelongsToStatement<
20
20
  type: 'BelongsTo'
21
21
  as: string
22
22
  primaryKey: (
23
- associationInstance?: Dream | undefined,
23
+ associationInstance?: Dream,
24
24
  opts?: { associatedClassOverride?: typeof Dream | undefined }
25
25
  ) => keyof DB[TableName] & string
26
26
  primaryKeyValue: (associationInstance: Dream | null) => any
@@ -13,13 +13,13 @@ import {
13
13
  export type SerializerCasing = 'camel' | 'snake'
14
14
  export type DreamsOrSerializersOrViewModels = DreamSerializable | DreamSerializableArray
15
15
 
16
- export interface InternalAnyTypedSerializerAttribute<> {
16
+ export interface InternalAnyTypedSerializerAttribute {
17
17
  type: 'attribute'
18
18
  name: string
19
19
  options: Partial<NonAutomaticSerializerAttributeOptionsWithPossibleDecimalRenderOption>
20
20
  }
21
21
 
22
- export interface InternalAnyTypedSerializerDelegatedAttribute<> {
22
+ export interface InternalAnyTypedSerializerDelegatedAttribute {
23
23
  type: 'delegatedAttribute'
24
24
  targetName: string
25
25
  name: string