@rvoh/dream 0.31.0 → 0.31.1

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 (300) hide show
  1. package/dist/cjs/src/Dream.js +2 -3
  2. package/dist/cjs/src/bin/helpers/sync.js +2 -2
  3. package/dist/cjs/src/cli/logger/loggable/DreamCliLoggableSpinner.js +1 -1
  4. package/dist/cjs/src/decorators/field/association/shared.js +8 -8
  5. package/dist/cjs/src/dream/Query.js +5 -5
  6. package/dist/cjs/src/{openapi/types.js → dream/constants.js} +13 -1
  7. package/dist/cjs/src/dream/internal/similarity/SimilarityBuilder.js +3 -3
  8. package/dist/cjs/src/helpers/cli/SchemaBuilder.js +5 -5
  9. package/dist/cjs/src/helpers/cli/generateDream.js +1 -1
  10. package/dist/cjs/src/helpers/db/primaryKeyType.js +2 -2
  11. package/dist/cjs/src/helpers/isEmpty.js +2 -0
  12. package/dist/cjs/src/helpers/sort.js +24 -0
  13. package/dist/cjs/src/helpers/sortBy.js +19 -2
  14. package/dist/cjs/src/helpers/uniq.js +6 -5
  15. package/dist/cjs/src/index.js +8 -7
  16. package/dist/cjs/src/ops/ops-statement.js +3 -3
  17. package/dist/cjs/src/serializer/index.js +2 -2
  18. package/dist/esm/src/Dream.js +3 -4
  19. package/dist/esm/src/bin/helpers/sync.js +2 -2
  20. package/dist/esm/src/cli/logger/loggable/DreamCliLoggableSpinner.js +1 -1
  21. package/dist/esm/src/decorators/field/association/shared.js +6 -6
  22. package/dist/esm/src/dream/Query.js +1 -1
  23. package/dist/esm/src/{openapi/types.js → dream/constants.js} +12 -0
  24. package/dist/esm/src/dream/internal/similarity/SimilarityBuilder.js +1 -1
  25. package/dist/esm/src/errors/associations/InvalidComputedForeignKey.js +1 -1
  26. package/dist/esm/src/helpers/cli/SchemaBuilder.js +3 -3
  27. package/dist/esm/src/helpers/cli/generateDream.js +1 -1
  28. package/dist/esm/src/helpers/db/primaryKeyType.js +1 -1
  29. package/dist/esm/src/helpers/isEmpty.js +2 -0
  30. package/dist/esm/src/helpers/sort.js +21 -0
  31. package/dist/esm/src/helpers/sortBy.js +19 -2
  32. package/dist/esm/src/helpers/uniq.js +6 -5
  33. package/dist/esm/src/index.js +2 -2
  34. package/dist/esm/src/ops/ops-statement.js +1 -1
  35. package/dist/esm/src/serializer/index.js +1 -1
  36. package/dist/types/src/Dream.d.ts +13 -13
  37. package/dist/types/src/cli/logger/DreamCliLogger.d.ts +1 -12
  38. package/dist/types/src/cli/logger/loggable/DreamCliLoggable.d.ts +1 -1
  39. package/dist/types/src/cli/logger/loggable/DreamCliLoggableSpinner.d.ts +1 -1
  40. package/dist/types/src/cli/logger/loggable/DreamCliLoggableText.d.ts +1 -1
  41. package/dist/types/src/cli/logger/loggable/colorize.d.ts +1 -1
  42. package/dist/types/src/db/ConnectedToDB.d.ts +2 -2
  43. package/dist/types/src/db/ConnectionConfRetriever.d.ts +1 -1
  44. package/dist/types/src/db/DreamDbConnection.d.ts +1 -1
  45. package/dist/types/src/db/dataTypes.d.ts +0 -3
  46. package/dist/types/src/db/index.d.ts +1 -1
  47. package/dist/types/src/decorators/Decorators.d.ts +6 -6
  48. package/dist/types/src/decorators/field/association/BelongsTo.d.ts +2 -30
  49. package/dist/types/src/decorators/field/association/HasMany.d.ts +2 -15
  50. package/dist/types/src/decorators/field/association/HasOne.d.ts +2 -7
  51. package/dist/types/src/decorators/field/association/associationToGetterSetterProp.d.ts +4 -4
  52. package/dist/types/src/decorators/field/association/shared.d.ts +1 -100
  53. package/dist/types/src/decorators/field/lifecycle/AfterCreate.d.ts +1 -1
  54. package/dist/types/src/decorators/field/lifecycle/AfterCreateCommit.d.ts +1 -1
  55. package/dist/types/src/decorators/field/lifecycle/AfterSave.d.ts +1 -1
  56. package/dist/types/src/decorators/field/lifecycle/AfterSaveCommit.d.ts +1 -1
  57. package/dist/types/src/decorators/field/lifecycle/AfterUpdate.d.ts +1 -1
  58. package/dist/types/src/decorators/field/lifecycle/AfterUpdateCommit.d.ts +1 -1
  59. package/dist/types/src/decorators/field/lifecycle/BeforeCreate.d.ts +1 -1
  60. package/dist/types/src/decorators/field/lifecycle/BeforeSave.d.ts +1 -1
  61. package/dist/types/src/decorators/field/lifecycle/BeforeUpdate.d.ts +1 -1
  62. package/dist/types/src/decorators/field/lifecycle/shared.d.ts +1 -30
  63. package/dist/types/src/decorators/field/validation/Validates.d.ts +1 -1
  64. package/dist/types/src/dream/DreamClassTransactionBuilder.d.ts +6 -4
  65. package/dist/types/src/dream/DreamInstanceTransactionBuilder.d.ts +4 -2
  66. package/dist/types/src/dream/DreamTransaction.d.ts +1 -1
  67. package/dist/types/src/dream/LeftJoinLoadBuilder.d.ts +3 -2
  68. package/dist/types/src/dream/LoadBuilder.d.ts +3 -2
  69. package/dist/types/src/dream/Query.d.ts +5 -47
  70. package/dist/types/src/dream/constants.d.ts +15 -0
  71. package/dist/types/src/dream/internal/applyScopeBypassingSettingsToQuery.d.ts +1 -1
  72. package/dist/types/src/dream/internal/associations/associationQuery.d.ts +1 -1
  73. package/dist/types/src/dream/internal/associations/associationUpdateQuery.d.ts +1 -1
  74. package/dist/types/src/dream/internal/associations/createAssociation.d.ts +1 -1
  75. package/dist/types/src/dream/internal/associations/destroyAssociation.d.ts +1 -1
  76. package/dist/types/src/dream/internal/associations/undestroyAssociation.d.ts +1 -1
  77. package/dist/types/src/dream/internal/checkSingleValidation.d.ts +1 -1
  78. package/dist/types/src/dream/internal/destroyOptions.d.ts +1 -1
  79. package/dist/types/src/dream/internal/orderByDirection.d.ts +1 -1
  80. package/dist/types/src/dream/internal/runHooksFor.d.ts +1 -1
  81. package/dist/types/src/dream/internal/safelyRunCommitHooks.d.ts +1 -1
  82. package/dist/types/src/dream/internal/scopeHelpers.d.ts +1 -1
  83. package/dist/types/src/dream/internal/similarity/SimilarityBuilder.d.ts +3 -3
  84. package/dist/types/src/dream/internal/sqlResultToDreamInstance.d.ts +1 -1
  85. package/dist/types/src/dream-application/index.d.ts +1 -1
  86. package/dist/types/src/errors/ValidationError.d.ts +1 -1
  87. package/dist/types/src/errors/associations/CanOnlyPassBelongsToModelParam.d.ts +2 -2
  88. package/dist/types/src/errors/associations/CannotAssociateThroughPolymorphic.d.ts +2 -2
  89. package/dist/types/src/errors/associations/CannotCreateAssociationWithThroughContext.d.ts +2 -2
  90. package/dist/types/src/errors/associations/CannotJoinPolymorphicBelongsToError.d.ts +1 -1
  91. package/dist/types/src/errors/associations/CannotPassNullOrUndefinedToRequiredBelongsTo.d.ts +1 -1
  92. package/dist/types/src/errors/associations/InvalidComputedForeignKey.d.ts +1 -1
  93. package/dist/types/src/errors/associations/MissingRequiredAssociationOnClause.d.ts +2 -2
  94. package/dist/types/src/errors/associations/MissingThroughAssociation.d.ts +2 -2
  95. package/dist/types/src/errors/associations/MissingThroughAssociationSource.d.ts +2 -2
  96. package/dist/types/src/helpers/cli/generateMigrationContent.d.ts +1 -1
  97. package/dist/types/src/helpers/cli/generateStiMigrationContent.d.ts +1 -1
  98. package/dist/types/src/helpers/db/createDb.d.ts +1 -1
  99. package/dist/types/src/helpers/db/dropDb.d.ts +1 -1
  100. package/dist/types/src/helpers/db/foreignKeyTypeFromPrimaryKey.d.ts +1 -1
  101. package/dist/types/src/helpers/inferSerializerFromDreamOrViewModel.d.ts +1 -1
  102. package/dist/types/src/helpers/isEmpty.d.ts +1 -1
  103. package/dist/types/src/helpers/objectPathsToArrays.d.ts +1 -1
  104. package/dist/types/src/helpers/sort.d.ts +15 -0
  105. package/dist/types/src/helpers/sortBy.d.ts +2 -2
  106. package/dist/types/src/helpers/stringCasing.d.ts +1 -1
  107. package/dist/types/src/helpers/uniq.d.ts +1 -1
  108. package/dist/types/src/index.d.ts +6 -4
  109. package/dist/types/src/ops/index.d.ts +1 -1
  110. package/dist/types/src/ops/ops-statement.d.ts +1 -1
  111. package/dist/types/src/serializer/decorators/associations/RendersMany.d.ts +1 -1
  112. package/dist/types/src/serializer/decorators/associations/RendersOne.d.ts +1 -1
  113. package/dist/types/src/serializer/decorators/associations/shared.d.ts +2 -1
  114. package/dist/types/src/serializer/decorators/attribute.d.ts +1 -1
  115. package/dist/types/src/serializer/decorators/helpers/dreamAttributeOpenapiShape.d.ts +2 -2
  116. package/dist/types/src/serializer/decorators/helpers/hasSerializersGetter.d.ts +1 -1
  117. package/dist/types/src/serializer/decorators/helpers/maybeSerializableToDreamSerializerCallbackFunction.d.ts +1 -1
  118. package/dist/types/src/types/associations/belongsTo.d.ts +76 -0
  119. package/dist/types/src/types/associations/hasMany.d.ts +80 -0
  120. package/dist/types/src/types/associations/hasOne.d.ts +26 -0
  121. package/dist/types/src/types/associations/shared.d.ts +453 -0
  122. package/dist/types/src/types/db.d.ts +14 -0
  123. package/dist/types/src/types/dream.d.ts +527 -0
  124. package/dist/types/src/types/lifecycle.d.ts +50 -0
  125. package/dist/types/src/types/logger.d.ts +46 -0
  126. package/dist/types/src/types/openapi.d.ts +243 -0
  127. package/dist/types/src/types/query.d.ts +127 -0
  128. package/dist/types/src/types/utils.d.ts +173 -0
  129. package/dist/types/src/types/validation.d.ts +20 -0
  130. package/dist/types/src/types/variadic.d.ts +447 -0
  131. package/docs/assets/navigation.js +1 -1
  132. package/docs/assets/search.js +1 -1
  133. package/docs/classes/Benchmark.html +2 -2
  134. package/docs/classes/CalendarDate.html +2 -2
  135. package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +3 -3
  136. package/docs/classes/Decorators.html +19 -19
  137. package/docs/classes/Dream.html +128 -127
  138. package/docs/classes/DreamApplication.html +4 -4
  139. package/docs/classes/DreamBin.html +2 -2
  140. package/docs/classes/DreamCLI.html +4 -4
  141. package/docs/classes/DreamDbConnection.html +2 -2
  142. package/docs/classes/DreamGlam.html +2 -2
  143. package/docs/classes/DreamImporter.html +2 -2
  144. package/docs/classes/DreamMigrationHelpers.html +7 -7
  145. package/docs/classes/DreamSerializer.html +2 -2
  146. package/docs/classes/DreamTransaction.html +2 -2
  147. package/docs/classes/Encrypt.html +2 -2
  148. package/docs/classes/Env.html +2 -2
  149. package/docs/classes/GlobalNameNotSet.html +3 -3
  150. package/docs/classes/NonLoadedAssociation.html +3 -3
  151. package/docs/classes/Query.html +50 -50
  152. package/docs/classes/Range.html +2 -2
  153. package/docs/classes/RecordNotFound.html +3 -3
  154. package/docs/classes/ValidationError.html +3 -3
  155. package/docs/functions/Attribute.html +1 -1
  156. package/docs/functions/RendersMany.html +1 -1
  157. package/docs/functions/RendersOne.html +1 -1
  158. package/docs/functions/ReplicaSafe.html +1 -1
  159. package/docs/functions/STI.html +1 -1
  160. package/docs/functions/SoftDelete.html +1 -1
  161. package/docs/functions/camelize.html +1 -1
  162. package/docs/functions/capitalize.html +1 -1
  163. package/docs/functions/closeAllDbConnections.html +1 -1
  164. package/docs/functions/compact.html +1 -1
  165. package/docs/functions/db.html +1 -1
  166. package/docs/functions/debug.html +1 -1
  167. package/docs/functions/dreamDbConnections.html +1 -1
  168. package/docs/functions/dreamPath.html +1 -1
  169. package/docs/functions/generateDream.html +1 -1
  170. package/docs/functions/globalClassNameFromFullyQualifiedModelName.html +1 -1
  171. package/docs/functions/hyphenize.html +1 -1
  172. package/docs/functions/inferSerializerFromDreamClassOrViewModelClass.html +1 -1
  173. package/docs/functions/inferSerializerFromDreamOrViewModel.html +1 -1
  174. package/docs/functions/isEmpty.html +1 -1
  175. package/docs/functions/loadRepl.html +1 -1
  176. package/docs/functions/lookupClassByGlobalName.html +1 -1
  177. package/docs/functions/pascalize.html +1 -1
  178. package/docs/functions/pgErrorType.html +1 -1
  179. package/docs/functions/range-1.html +1 -1
  180. package/docs/functions/relativeDreamPath.html +1 -1
  181. package/docs/functions/round.html +1 -1
  182. package/docs/functions/serializerNameFromFullyQualifiedModelName.html +1 -1
  183. package/docs/functions/sharedPathPrefix.html +1 -1
  184. package/docs/functions/snakeify.html +1 -1
  185. package/docs/functions/sort.html +6 -0
  186. package/docs/functions/sortBy.html +6 -1
  187. package/docs/functions/standardizeFullyQualifiedModelName.html +1 -1
  188. package/docs/functions/uncapitalize.html +1 -1
  189. package/docs/functions/uniq.html +1 -1
  190. package/docs/functions/validateColumn.html +1 -1
  191. package/docs/functions/validateTable.html +1 -1
  192. package/docs/interfaces/AttributeStatement.html +2 -2
  193. package/docs/interfaces/DecoratorContext.html +2 -2
  194. package/docs/interfaces/DreamApplicationInitOptions.html +2 -2
  195. package/docs/interfaces/DreamApplicationOpts.html +2 -2
  196. package/docs/interfaces/DreamSerializerAssociationStatement.html +2 -2
  197. package/docs/interfaces/EncryptOptions.html +2 -2
  198. package/docs/interfaces/OpenapiSchemaProperties.html +1 -1
  199. package/docs/interfaces/OpenapiSchemaPropertiesShorthand.html +1 -1
  200. package/docs/interfaces/OpenapiTypeFieldObject.html +1 -1
  201. package/docs/modules.html +1 -0
  202. package/docs/types/Camelized.html +1 -1
  203. package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
  204. package/docs/types/DateTime.html +1 -1
  205. package/docs/types/DreamAssociationMetadata.html +1 -1
  206. package/docs/types/DreamAttributes.html +1 -1
  207. package/docs/types/DreamClassColumn.html +1 -1
  208. package/docs/types/DreamColumn.html +1 -1
  209. package/docs/types/DreamColumnNames.html +1 -1
  210. package/docs/types/DreamLogLevel.html +1 -1
  211. package/docs/types/DreamLogger.html +1 -1
  212. package/docs/types/DreamOrViewModelSerializerKey.html +1 -1
  213. package/docs/types/DreamParamSafeAttributes.html +1 -1
  214. package/docs/types/DreamParamSafeColumnNames.html +1 -1
  215. package/docs/types/DreamSerializerKey.html +1 -1
  216. package/docs/types/DreamSerializers.html +1 -1
  217. package/docs/types/DreamTableSchema.html +1 -1
  218. package/docs/types/DreamVirtualColumns.html +1 -1
  219. package/docs/types/EncryptAlgorithm.html +1 -1
  220. package/docs/types/Hyphenized.html +1 -1
  221. package/docs/types/IdType.html +1 -1
  222. package/docs/types/OpenapiAllTypes.html +1 -1
  223. package/docs/types/OpenapiFormats.html +1 -1
  224. package/docs/types/OpenapiNumberFormats.html +1 -1
  225. package/docs/types/OpenapiPrimitiveTypes.html +1 -1
  226. package/docs/types/OpenapiSchemaArray.html +1 -1
  227. package/docs/types/OpenapiSchemaArrayShorthand.html +1 -1
  228. package/docs/types/OpenapiSchemaBase.html +1 -1
  229. package/docs/types/OpenapiSchemaBody.html +1 -1
  230. package/docs/types/OpenapiSchemaBodyShorthand.html +1 -1
  231. package/docs/types/OpenapiSchemaCommonFields.html +1 -1
  232. package/docs/types/OpenapiSchemaExpressionAllOf.html +1 -1
  233. package/docs/types/OpenapiSchemaExpressionAnyOf.html +1 -1
  234. package/docs/types/OpenapiSchemaExpressionOneOf.html +1 -1
  235. package/docs/types/OpenapiSchemaExpressionRef.html +1 -1
  236. package/docs/types/OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
  237. package/docs/types/OpenapiSchemaInteger.html +1 -1
  238. package/docs/types/OpenapiSchemaNull.html +1 -1
  239. package/docs/types/OpenapiSchemaNumber.html +1 -1
  240. package/docs/types/OpenapiSchemaObject.html +1 -1
  241. package/docs/types/OpenapiSchemaObjectAllOf.html +1 -1
  242. package/docs/types/OpenapiSchemaObjectAllOfShorthand.html +1 -1
  243. package/docs/types/OpenapiSchemaObjectAnyOf.html +1 -1
  244. package/docs/types/OpenapiSchemaObjectAnyOfShorthand.html +1 -1
  245. package/docs/types/OpenapiSchemaObjectBase.html +1 -1
  246. package/docs/types/OpenapiSchemaObjectBaseShorthand.html +1 -1
  247. package/docs/types/OpenapiSchemaObjectOneOf.html +1 -1
  248. package/docs/types/OpenapiSchemaObjectOneOfShorthand.html +1 -1
  249. package/docs/types/OpenapiSchemaObjectShorthand.html +1 -1
  250. package/docs/types/OpenapiSchemaPartialSegment.html +1 -1
  251. package/docs/types/OpenapiSchemaPrimitiveGeneric.html +1 -1
  252. package/docs/types/OpenapiSchemaShorthandExpressionAllOf.html +1 -1
  253. package/docs/types/OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
  254. package/docs/types/OpenapiSchemaShorthandExpressionOneOf.html +1 -1
  255. package/docs/types/OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
  256. package/docs/types/OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
  257. package/docs/types/OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
  258. package/docs/types/OpenapiSchemaString.html +1 -1
  259. package/docs/types/OpenapiShorthandAllTypes.html +1 -1
  260. package/docs/types/OpenapiShorthandPrimitiveTypes.html +1 -1
  261. package/docs/types/OpenapiTypeField.html +1 -1
  262. package/docs/types/Pascalized.html +1 -1
  263. package/docs/types/PrimaryKeyType.html +1 -1
  264. package/docs/types/RoundingPrecision.html +1 -1
  265. package/docs/types/SerializableClassOrSerializerCallback.html +1 -1
  266. package/docs/types/SerializableDreamClassOrViewModelClass.html +1 -1
  267. package/docs/types/SerializableDreamOrViewModel.html +1 -1
  268. package/docs/types/SerializableTypes.html +1 -1
  269. package/docs/types/Snakeified.html +1 -1
  270. package/docs/types/Timestamp.html +1 -1
  271. package/docs/types/UpdateableAssociationProperties.html +1 -1
  272. package/docs/types/UpdateableProperties.html +1 -1
  273. package/docs/types/ValidationType.html +1 -1
  274. package/docs/types/ViewModelSerializerKey.html +1 -1
  275. package/docs/types/WhereStatementForDream.html +1 -1
  276. package/docs/types/WhereStatementForDreamClass.html +1 -1
  277. package/docs/variables/DateTime-1.html +1 -1
  278. package/docs/variables/DreamConst.html +1 -1
  279. package/docs/variables/TRIGRAM_OPERATORS.html +1 -1
  280. package/docs/variables/openapiPrimitiveTypes-1.html +1 -1
  281. package/docs/variables/openapiShorthandPrimitiveTypes-1.html +1 -1
  282. package/docs/variables/ops.html +1 -1
  283. package/docs/variables/primaryKeyTypes.html +1 -1
  284. package/package.json +2 -2
  285. package/dist/cjs/src/db/reflections.js +0 -2
  286. package/dist/cjs/src/db/types.js +0 -2
  287. package/dist/cjs/src/decorators/field/validation/shared.js +0 -2
  288. package/dist/cjs/src/dream/types.js +0 -98
  289. package/dist/cjs/src/helpers/typeutils.js +0 -2
  290. package/dist/esm/src/db/reflections.js +0 -1
  291. package/dist/esm/src/db/types.js +0 -1
  292. package/dist/esm/src/decorators/field/validation/shared.js +0 -1
  293. package/dist/esm/src/dream/types.js +0 -95
  294. package/dist/esm/src/helpers/typeutils.js +0 -1
  295. package/dist/types/src/db/reflections.d.ts +0 -5
  296. package/dist/types/src/db/types.d.ts +0 -1
  297. package/dist/types/src/decorators/field/validation/shared.d.ts +0 -19
  298. package/dist/types/src/dream/types.d.ts +0 -184
  299. package/dist/types/src/helpers/typeutils.d.ts +0 -115
  300. package/dist/types/src/openapi/types.d.ts +0 -139
@@ -1,34 +1,5 @@
1
1
  import Dream from '../../../Dream.js';
2
- import { DreamColumnNames } from '../../../dream/types.js';
3
- export type HookType = 'beforeCreate' | 'beforeSave' | 'beforeUpdate' | 'beforeDestroy' | 'afterCreate' | 'afterSave' | 'afterUpdate' | 'afterDestroy' | CommitHookType;
4
- export type CommitHookType = 'afterCreateCommit' | 'afterSaveCommit' | 'afterUpdateCommit' | 'afterDestroyCommit';
5
- export interface HookStatement {
6
- type: HookType;
7
- className: string;
8
- method: string;
9
- ifChanging?: string[];
10
- ifChanged?: string[];
11
- }
12
- export interface BeforeHookOpts<T extends Dream | null = null> {
13
- ifChanging?: T extends Dream ? DreamColumnNames<T>[] : string[];
14
- }
15
- export interface AfterHookOpts<T extends Dream | null = null> {
16
- ifChanged?: T extends Dream ? DreamColumnNames<T>[] : string[];
17
- }
18
- export interface HookStatementMap {
19
- beforeCreate: readonly HookStatement[] | HookStatement[];
20
- beforeUpdate: readonly HookStatement[] | HookStatement[];
21
- beforeSave: readonly HookStatement[] | HookStatement[];
22
- beforeDestroy: readonly HookStatement[] | HookStatement[];
23
- afterCreate: readonly HookStatement[] | HookStatement[];
24
- afterCreateCommit: readonly HookStatement[] | HookStatement[];
25
- afterUpdate: readonly HookStatement[] | HookStatement[];
26
- afterUpdateCommit: readonly HookStatement[] | HookStatement[];
27
- afterSave: readonly HookStatement[] | HookStatement[];
28
- afterSaveCommit: readonly HookStatement[] | HookStatement[];
29
- afterDestroy: readonly HookStatement[] | HookStatement[];
30
- afterDestroyCommit: readonly HookStatement[] | HookStatement[];
31
- }
2
+ import { HookStatementMap } from '../../../types/lifecycle.js';
32
3
  export declare function blankHooksFactory(dreamClass: typeof Dream, { freeze, }?: {
33
4
  freeze?: boolean;
34
5
  }): HookStatementMap;
@@ -1,5 +1,5 @@
1
1
  import Dream from '../../../Dream.js';
2
- import { ValidationType } from './shared.js';
2
+ import { ValidationType } from '../../../types/validation.js';
3
3
  export default function Validates<VT extends ValidationType, VTArgs extends VT extends 'numericality' ? {
4
4
  min?: number;
5
5
  max?: number;
@@ -1,10 +1,12 @@
1
1
  import { SelectArg, SelectExpression, Updateable } from 'kysely';
2
- import { AssociationTableNames } from '../db/reflections.js';
3
- import { PassthroughOnClause, WhereStatement } from '../decorators/field/association/shared.js';
4
2
  import Dream from '../Dream.js';
3
+ import { PassthroughOnClause, WhereStatement } from '../types/associations/shared.js';
4
+ import { AssociationTableNames } from '../types/db.js';
5
+ import { DefaultScopeName, DreamColumnNames, OrderDir, PassthroughColumnNames, PluckEachArgs, PrimaryKeyForFind, TableColumnNames, UpdateableProperties } from '../types/dream.js';
6
+ import { BaseModelColumnTypes, FindEachOpts, QueryWithJoinedAssociationsType, QueryWithJoinedAssociationsTypeAndNoPreload } from '../types/query.js';
7
+ import { JoinedAssociation, JoinedAssociationsTypeFromAssociations, VariadicJoinsArgs, VariadicLeftJoinLoadArgs, VariadicLoadArgs } from '../types/variadic.js';
5
8
  import DreamTransaction from './DreamTransaction.js';
6
- import Query, { BaseModelColumnTypes, FindEachOpts, QueryWithJoinedAssociationsType, QueryWithJoinedAssociationsTypeAndNoPreload } from './Query.js';
7
- import { DefaultScopeName, DreamColumnNames, JoinedAssociation, JoinedAssociationsTypeFromAssociations, OrderDir, PassthroughColumnNames, PluckEachArgs, PrimaryKeyForFind, TableColumnNames, UpdateableProperties, VariadicJoinsArgs, VariadicLeftJoinLoadArgs, VariadicLoadArgs } from './types.js';
9
+ import Query from './Query.js';
8
10
  export default class DreamClassTransactionBuilder<DreamInstance extends Dream> {
9
11
  dreamInstance: DreamInstance;
10
12
  dreamTransaction: DreamTransaction<Dream>;
@@ -1,10 +1,12 @@
1
1
  import Dream from '../Dream.js';
2
+ import { AllDefaultScopeNames, AssociationNameToDream, DreamAssociationNames, DreamAssociationNamesWithoutRequiredOnClauses, DreamAttributes, JoinOnStatements, UpdateableAssociationProperties, UpdateableProperties } from '../types/dream.js';
3
+ import { DefaultQueryTypeOptions, QueryWithJoinedAssociationsType } from '../types/query.js';
4
+ import { JoinedAssociation, JoinedAssociationsTypeFromAssociations, RequiredOnClauseKeys, VariadicJoinsArgs, VariadicLeftJoinLoadArgs, VariadicLoadArgs } from '../types/variadic.js';
2
5
  import DreamTransaction from './DreamTransaction.js';
3
6
  import { DestroyOptions } from './internal/destroyOptions.js';
4
7
  import LeftJoinLoadBuilder from './LeftJoinLoadBuilder.js';
5
8
  import LoadBuilder from './LoadBuilder.js';
6
- import Query, { DefaultQueryTypeOptions, QueryWithJoinedAssociationsType } from './Query.js';
7
- import { AllDefaultScopeNames, AssociationNameToDream, DreamAssociationNames, DreamAssociationNamesWithoutRequiredOnClauses, DreamAttributes, JoinedAssociation, JoinedAssociationsTypeFromAssociations, JoinOnStatements, RequiredOnClauseKeys, UpdateableAssociationProperties, UpdateableProperties, VariadicJoinsArgs, VariadicLeftJoinLoadArgs, VariadicLoadArgs } from './types.js';
9
+ import Query from './Query.js';
8
10
  export default class DreamInstanceTransactionBuilder<DreamInstance extends Dream> {
9
11
  dreamInstance: DreamInstance;
10
12
  dreamTransaction: DreamTransaction<Dream>;
@@ -1,6 +1,6 @@
1
1
  import { Transaction } from 'kysely';
2
- import { HookStatement } from '../decorators/field/lifecycle/shared.js';
3
2
  import Dream from '../Dream.js';
3
+ import { HookStatement } from '../types/lifecycle.js';
4
4
  export interface TransactionCommitHookStatement {
5
5
  hookStatement: HookStatement;
6
6
  dreamInstance: Dream;
@@ -1,7 +1,8 @@
1
- import { PassthroughOnClause } from '../decorators/field/association/shared.js';
2
1
  import Dream from '../Dream.js';
2
+ import { PassthroughOnClause } from '../types/associations/shared.js';
3
+ import { PassthroughColumnNames } from '../types/dream.js';
4
+ import { VariadicLeftJoinLoadArgs } from '../types/variadic.js';
3
5
  import DreamTransaction from './DreamTransaction.js';
4
- import { PassthroughColumnNames, VariadicLeftJoinLoadArgs } from './types.js';
5
6
  export default class LeftJoinLoadBuilder<DreamInstance extends Dream> {
6
7
  private dream;
7
8
  private dreamTransaction;
@@ -1,7 +1,8 @@
1
- import { PassthroughOnClause } from '../decorators/field/association/shared.js';
2
1
  import Dream from '../Dream.js';
2
+ import { PassthroughOnClause } from '../types/associations/shared.js';
3
+ import { PassthroughColumnNames } from '../types/dream.js';
4
+ import { VariadicLoadArgs } from '../types/variadic.js';
3
5
  import DreamTransaction from './DreamTransaction.js';
4
- import { PassthroughColumnNames, VariadicLoadArgs } from './types.js';
5
6
  export default class LoadBuilder<DreamInstance extends Dream> {
6
7
  private dream;
7
8
  private dreamTransaction;
@@ -1,29 +1,12 @@
1
1
  import { DeleteQueryBuilder, SelectQueryBuilder, UpdateQueryBuilder } from 'kysely';
2
2
  import ConnectedToDB from '../db/ConnectedToDB.js';
3
- import { DbConnectionType } from '../db/types.js';
4
- import { ColumnNamesAccountingForJoinedAssociations, LimitStatement, OffsetStatement, OrderQueryStatement, PassthroughOnClause, WhereStatement, WhereStatementForJoinedAssociation } from '../decorators/field/association/shared.js';
5
3
  import Dream from '../Dream.js';
6
- import { FindInterfaceWithValue } from '../helpers/typeutils.js';
4
+ import { ColumnNamesAccountingForJoinedAssociations, LimitStatement, OffsetStatement, OrderQueryStatement, PassthroughOnClause, WhereStatement, WhereStatementForJoinedAssociation } from '../types/associations/shared.js';
5
+ import { DbConnectionType } from '../types/db.js';
6
+ import { AllDefaultScopeNames, DefaultScopeName, DreamColumnNames, DreamTableSchema, OrderDir, PassthroughColumnNames, PluckEachArgs, PrimaryKeyForFind, RelaxedJoinOnStatement, RelaxedJoinStatement, RelaxedPreloadOnStatement, RelaxedPreloadStatement, TableColumnNames, TableOrAssociationName } from '../types/dream.js';
7
+ import { DefaultQueryTypeOptions, ExtendQueryType, NamespacedOrBaseModelColumnTypes } from '../types/query.js';
8
+ import { JoinedAssociation, JoinedAssociationsTypeFromAssociations, QueryTypeOptions, VariadicJoinsArgs, VariadicLeftJoinLoadArgs, VariadicLoadArgs } from '../types/variadic.js';
7
9
  import DreamTransaction from './DreamTransaction.js';
8
- import { AllDefaultScopeNames, DefaultScopeName, DreamColumnNames, DreamTableSchema, IdType, JoinedAssociation, JoinedAssociationsTypeFromAssociations, OrderDir, PassthroughColumnNames, PluckEachArgs, PrimaryKeyForFind, QueryTypeOptions, RelaxedJoinOnStatement, RelaxedJoinStatement, RelaxedPreloadOnStatement, RelaxedPreloadStatement, TableColumnNames, TableColumnType, TableOrAssociationName, VariadicJoinsArgs, VariadicLeftJoinLoadArgs, VariadicLoadArgs } from './types.js';
9
- export type QueryWithJoinedAssociationsType<Q extends Query<any, any>, JoinedAssociations extends Readonly<JoinedAssociation[]>> = Query<Q['dreamInstance'], ExtendQueryType<Q['queryTypeOpts'], Readonly<{
10
- joinedAssociations: JoinedAssociations;
11
- }>>>;
12
- export type QueryWithJoinedAssociationsTypeAndNoPreload<Q extends Query<any, any>, JoinedAssociations extends Readonly<JoinedAssociation[]> = Readonly<JoinedAssociation[]>> = Query<Q['dreamInstance'], ExtendQueryType<Q['queryTypeOpts'], Readonly<{
13
- joinedAssociations: JoinedAssociations;
14
- allowPreload: false;
15
- }>>>;
16
- export type QueryWithJoinedAssociationsTypeAndNoLeftJoinPreload<Q extends Query<any, any>, JoinedAssociations extends Readonly<JoinedAssociation[]> = Readonly<JoinedAssociation[]>> = Query<Q['dreamInstance'], ExtendQueryType<Q['queryTypeOpts'], Readonly<{
17
- joinedAssociations: JoinedAssociations;
18
- allowLeftJoinPreload: false;
19
- }>>>;
20
- export type DefaultQueryTypeOptions<TableNameSource extends Dream, TableAliasSource extends Dream | string = TableNameSource> = Readonly<{
21
- joinedAssociations: Readonly<[]>;
22
- rootTableName: TableNameSource['table'];
23
- rootTableAlias: TableAliasSource extends Dream ? TableAliasSource['table'] : TableAliasSource;
24
- allowPreload: true;
25
- allowLeftJoinPreload: true;
26
- }>;
27
10
  export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Readonly<QueryTypeOptions> = DefaultQueryTypeOptions<DreamInstance>> extends ConnectedToDB<DreamInstance> {
28
11
  /**
29
12
  * @internal
@@ -1116,28 +1099,3 @@ export interface QueryOpts<DreamInstance extends Dream, ColumnType extends Dream
1116
1099
  connection?: DbConnectionType;
1117
1100
  shouldReallyDestroy?: boolean;
1118
1101
  }
1119
- export interface PreloadedDreamsAndWhatTheyPointTo {
1120
- dream: Dream;
1121
- pointsToPrimaryKey: IdType;
1122
- }
1123
- export interface FindEachOpts {
1124
- batchSize?: number;
1125
- }
1126
- export type ExtendQueryType<OriginalOpts extends Readonly<QueryTypeOptions>, Opts extends Readonly<Partial<QueryTypeOptions>>> = Readonly<{
1127
- joinedAssociations: Opts['joinedAssociations'] extends Readonly<JoinedAssociation[]> ? Readonly<[...OriginalOpts['joinedAssociations'], ...Opts['joinedAssociations']]> : OriginalOpts['joinedAssociations'];
1128
- rootTableName: OriginalOpts['rootTableName'];
1129
- rootTableAlias: OriginalOpts['rootTableAlias'];
1130
- allowPreload: Opts['allowPreload'] extends false ? false : OriginalOpts['allowPreload'];
1131
- allowLeftJoinPreload: Opts['allowLeftJoinPreload'] extends false ? false : OriginalOpts['allowLeftJoinPreload'];
1132
- }>;
1133
- export type NamespacedColumnType<ColumnName, Q extends Query<any, any>, DreamInstance extends Dream, JoinedAssociationsArr = Q['queryTypeOpts']['joinedAssociations'], AssociationName = ColumnName extends `${infer Name extends string}.${string}` ? Name : never, RealColumnName = ColumnName extends `${string}.${infer Col extends string}` ? Col : never, JoinedAssociation extends FindInterfaceWithValue<JoinedAssociationsArr, 'alias', AssociationName> = FindInterfaceWithValue<JoinedAssociationsArr, 'alias', AssociationName>, JoinedTable = JoinedAssociation['table'] extends never ? DreamInstance['table'] : JoinedAssociation['table'], ReturnType = TableColumnType<DreamInstance['schema'], JoinedTable, RealColumnName>> = ReturnType;
1134
- type NamespacedColumnTypes<ColumnNames, Q extends Query<any, any>, DreamInstance extends Dream> = ColumnNames extends Readonly<[infer First, ...infer Rest]> ? [
1135
- NamespacedColumnType<First, Q, DreamInstance>,
1136
- ...NamespacedColumnTypes<Readonly<Rest>, Q, DreamInstance>
1137
- ] : [];
1138
- export type BaseModelColumnTypes<ColumnNames, DreamInstance extends Dream> = ColumnNames extends Readonly<[infer First, ...infer Rest]> ? [
1139
- TableColumnType<DreamInstance['schema'], DreamInstance['table'], First>,
1140
- ...BaseModelColumnTypes<Readonly<Rest>, DreamInstance>
1141
- ] : [];
1142
- export type NamespacedOrBaseModelColumnTypes<ColumnNames, Q extends Query<any, any>, DreamInstance extends Dream> = Q['queryTypeOpts']['joinedAssociations']['length'] extends 0 ? BaseModelColumnTypes<ColumnNames, DreamInstance> : NamespacedColumnTypes<ColumnNames, Q, DreamInstance>;
1143
- export {};
@@ -0,0 +1,15 @@
1
+ export declare const primaryKeyTypes: readonly ["bigserial", "bigint", "uuid", "integer"];
2
+ export declare const TRIGRAM_OPERATORS: readonly ["%", "<%", "<<%"];
3
+ declare class RequiredAttribute {
4
+ constructor();
5
+ }
6
+ declare class PassthroughAttribute {
7
+ constructor();
8
+ }
9
+ export declare const DreamConst: {
10
+ passthrough: typeof PassthroughAttribute;
11
+ required: typeof RequiredAttribute;
12
+ };
13
+ export declare const openapiPrimitiveTypes: readonly ["string", "boolean", "number", "date", "date-time", "double", "integer", "null"];
14
+ export declare const openapiShorthandPrimitiveTypes: readonly ["string", "boolean", "number", "date", "date-time", "double", "integer", "null", "decimal", "string[]", "boolean[]", "number[]", "date[]", "date-time[]", "decimal[]", "double[]", "integer[]", "json"];
15
+ export {};
@@ -1,6 +1,6 @@
1
1
  import Dream from '../../Dream.js';
2
+ import { AllDefaultScopeNames } from '../../types/dream.js';
2
3
  import Query from '../Query.js';
3
- import { AllDefaultScopeNames } from '../types.js';
4
4
  export default function applyScopeBypassingSettingsToQuery<DreamInstance extends Dream>(query: Query<DreamInstance>, { bypassAllDefaultScopes, defaultScopesToBypass, }: {
5
5
  bypassAllDefaultScopes: boolean;
6
6
  defaultScopesToBypass: AllDefaultScopeNames<DreamInstance>[];
@@ -1,7 +1,7 @@
1
1
  import Dream from '../../../Dream.js';
2
+ import { AssociationNameToDream, DreamAssociationNames, JoinOnStatements } from '../../../types/dream.js';
2
3
  import DreamTransaction from '../../DreamTransaction.js';
3
4
  import Query from '../../Query.js';
4
- import { AssociationNameToDream, DreamAssociationNames, JoinOnStatements } from '../../types.js';
5
5
  export default function associationQuery<DreamInstance extends Dream, DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], AssociationName extends DreamAssociationNames<DreamInstance>, AssociationDream extends AssociationNameToDream<DreamInstance, AssociationName>, AssociationTableName extends AssociationDream['table'], AssociationQuery = Query<AssociationNameToDream<DreamInstance, AssociationName>>>(dream: DreamInstance, txn: (DreamTransaction<Dream> | null) | undefined, associationName: AssociationName, { joinOnStatements, bypassAllDefaultScopes, defaultScopesToBypass, }: {
6
6
  joinOnStatements: JoinOnStatements<DB, Schema, AssociationTableName, null>;
7
7
  bypassAllDefaultScopes: boolean;
@@ -1,7 +1,7 @@
1
1
  import Dream from '../../../Dream.js';
2
+ import { AssociationNameToDream, DreamAssociationNames, JoinOnStatements } from '../../../types/dream.js';
2
3
  import DreamTransaction from '../../DreamTransaction.js';
3
4
  import Query from '../../Query.js';
4
- import { AssociationNameToDream, DreamAssociationNames, JoinOnStatements } from '../../types.js';
5
5
  export default function associationUpdateQuery<DreamInstance extends Dream, DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], AssociationName extends DreamAssociationNames<DreamInstance>, AssociationDream extends AssociationNameToDream<DreamInstance, AssociationName>, AssociationTableName extends AssociationDream['table'], AssociationQuery = Query<AssociationNameToDream<DreamInstance, AssociationName>>>(dream: DreamInstance, txn: (DreamTransaction<Dream> | null) | undefined, associationName: AssociationName, { joinOnStatements, bypassAllDefaultScopes, defaultScopesToBypass, }: {
6
6
  joinOnStatements: JoinOnStatements<DB, Schema, AssociationTableName, null>;
7
7
  bypassAllDefaultScopes: boolean;
@@ -1,4 +1,4 @@
1
1
  import Dream from '../../../Dream.js';
2
+ import { DreamAssociationNames, UpdateableAssociationProperties } from '../../../types/dream.js';
2
3
  import DreamTransaction from '../../DreamTransaction.js';
3
- import { DreamAssociationNames, UpdateableAssociationProperties } from '../../types.js';
4
4
  export default function createAssociation<DreamInstance extends Dream, AssociationName extends DreamAssociationNames<DreamInstance>, PossibleArrayAssociationType = DreamInstance[AssociationName & keyof DreamInstance], AssociationType = PossibleArrayAssociationType extends (infer ElementType)[] ? ElementType & typeof Dream : PossibleArrayAssociationType & typeof Dream, RestrictedAssociationType extends AssociationType extends Dream ? AssociationType : never = AssociationType extends Dream ? AssociationType : never>(dream: DreamInstance, txn: (DreamTransaction<Dream> | null) | undefined, associationName: AssociationName, opts?: UpdateableAssociationProperties<DreamInstance, RestrictedAssociationType>): Promise<NonNullable<AssociationType>>;
@@ -1,6 +1,6 @@
1
1
  import Dream from '../../../Dream.js';
2
+ import { AssociationNameToDream, DreamAssociationNames, JoinOnStatements } from '../../../types/dream.js';
2
3
  import DreamTransaction from '../../DreamTransaction.js';
3
- import { AssociationNameToDream, DreamAssociationNames, JoinOnStatements } from '../../types.js';
4
4
  export default function destroyAssociation<DreamInstance extends Dream, DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], AssociationName extends DreamAssociationNames<DreamInstance>, AssociationDream extends AssociationNameToDream<DreamInstance, AssociationName>, AssociationTableName extends AssociationDream['table']>(dream: DreamInstance, txn: (DreamTransaction<Dream> | null) | undefined, associationName: AssociationName, { joinOnStatements, bypassAllDefaultScopes, defaultScopesToBypass, cascade, reallyDestroy, skipHooks, }: {
5
5
  joinOnStatements: JoinOnStatements<DB, Schema, AssociationTableName, null>;
6
6
  bypassAllDefaultScopes: boolean;
@@ -1,6 +1,6 @@
1
1
  import Dream from '../../../Dream.js';
2
+ import { AssociationNameToDream, DreamAssociationNames, JoinOnStatements } from '../../../types/dream.js';
2
3
  import DreamTransaction from '../../DreamTransaction.js';
3
- import { AssociationNameToDream, DreamAssociationNames, JoinOnStatements } from '../../types.js';
4
4
  export default function undestroyAssociation<DreamInstance extends Dream, DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], AssociationName extends DreamAssociationNames<DreamInstance>, AssociationDream extends AssociationNameToDream<DreamInstance, AssociationName>, AssociationTableName extends AssociationDream['table']>(dream: DreamInstance, txn: (DreamTransaction<Dream> | null) | undefined, associationName: AssociationName, { joinOnStatements, bypassAllDefaultScopes, defaultScopesToBypass, cascade, skipHooks, }: {
5
5
  joinOnStatements: JoinOnStatements<DB, Schema, AssociationTableName, null>;
6
6
  bypassAllDefaultScopes: boolean;
@@ -1,3 +1,3 @@
1
- import ValidationStatement from '../../decorators/field/validation/shared.js';
2
1
  import Dream from '../../Dream.js';
2
+ import { ValidationStatement } from '../../types/validation.js';
3
3
  export default function checkSingleValidation(dream: Dream, validation: ValidationStatement): any;
@@ -1,5 +1,5 @@
1
1
  import Dream from '../../Dream.js';
2
- import { AllDefaultScopeNames } from '../types.js';
2
+ import { AllDefaultScopeNames } from '../../types/dream.js';
3
3
  /**
4
4
  * Options for destroying a Dream instance or its associations.
5
5
  */
@@ -1,2 +1,2 @@
1
- import { OrderDir } from '../types.js';
1
+ import { OrderDir } from '../../types/dream.js';
2
2
  export default function orderByDirection(dir: OrderDir | null): import("kysely").RawBuilder<unknown>;
@@ -1,5 +1,5 @@
1
- import { HookStatement, HookType } from '../../decorators/field/lifecycle/shared.js';
2
1
  import Dream from '../../Dream.js';
2
+ import { HookStatement, HookType } from '../../types/lifecycle.js';
3
3
  import DreamTransaction from '../DreamTransaction.js';
4
4
  export default function runHooksFor<T extends Dream>(key: HookType, dream: T, alreadyPersisted: boolean, beforeSaveChanges: Partial<Record<string, {
5
5
  was: any;
@@ -1,5 +1,5 @@
1
- import { CommitHookType } from '../../decorators/field/lifecycle/shared.js';
2
1
  import Dream from '../../Dream.js';
2
+ import { CommitHookType } from '../../types/lifecycle.js';
3
3
  import DreamTransaction from '../DreamTransaction.js';
4
4
  export default function safelyRunCommitHooks<DreamInstance extends Dream>(dream: DreamInstance, hookType: CommitHookType, alreadyPersisted: boolean, beforeSaveChanges: Partial<Record<string, {
5
5
  was: any;
@@ -1,5 +1,5 @@
1
1
  import Dream from '../../Dream.js';
2
- import { AllDefaultScopeNames } from '../types.js';
2
+ import { AllDefaultScopeNames } from '../../types/dream.js';
3
3
  export declare const DEFAULT_BYPASS_ALL_DEFAULT_SCOPES = false;
4
4
  export declare const DEFAULT_CASCADE = true;
5
5
  export declare const DEFAULT_DEFAULT_SCOPES_TO_BYPASS: never[];
@@ -1,10 +1,10 @@
1
1
  import { SelectQueryBuilder, UpdateQueryBuilder } from 'kysely';
2
2
  import ConnectedToDB from '../../../db/ConnectedToDB.js';
3
- import { DbConnectionType } from '../../../db/types.js';
4
- import { WhereStatement } from '../../../decorators/field/association/shared.js';
5
3
  import Dream from '../../../Dream.js';
4
+ import { WhereStatement } from '../../../types/associations/shared.js';
5
+ import { DbConnectionType } from '../../../types/db.js';
6
+ import { JoinOnStatements, RelaxedJoinOnStatement, SimilarityStatement } from '../../../types/dream.js';
6
7
  import DreamTransaction from '../../DreamTransaction.js';
7
- import { JoinOnStatements, RelaxedJoinOnStatement, SimilarityStatement } from '../../types.js';
8
8
  export default class SimilarityBuilder<DreamInstance extends Dream, DB extends DreamInstance['DB'] = DreamInstance['DB'], Schema extends DreamInstance['schema'] = DreamInstance['schema']> extends ConnectedToDB<DreamInstance> {
9
9
  readonly whereStatement: readonly WhereStatement<DB, Schema, any>[];
10
10
  readonly whereNotStatement: readonly WhereStatement<DB, Schema, any>[];
@@ -1,4 +1,4 @@
1
- import { AssociationTableNames } from '../../db/reflections.js';
2
1
  import Dream from '../../Dream.js';
2
+ import { AssociationTableNames } from '../../types/db.js';
3
3
  export default function sqlResultToDreamInstance<DreamClass extends typeof Dream, DreamInstance extends InstanceType<DreamClass> = InstanceType<DreamClass>, Schema extends DreamInstance['schema'] = DreamInstance['schema'], DB extends DreamInstance['DB'] = DreamInstance['DB'], TableName extends AssociationTableNames<DB, Schema> & keyof DB = InstanceType<DreamClass>['table'], Table extends DB[TableName] = DB[TableName]>(dreamClass: DreamClass, sqlResult: any): InstanceType<DreamClass> | Dream;
4
4
  export declare function findExtendingDreamClass(dreamClass: typeof Dream, type: string): typeof Dream | undefined;
@@ -1,6 +1,6 @@
1
1
  import { CompiledQuery } from 'kysely';
2
2
  import Dream from '../Dream.js';
3
- import { primaryKeyTypes } from '../dream/types.js';
3
+ import { primaryKeyTypes } from '../dream/constants.js';
4
4
  import { EncryptOptions } from '../encrypt/index.js';
5
5
  import DreamSerializer from '../serializer/index.js';
6
6
  export default class DreamApplication {
@@ -1,4 +1,4 @@
1
- import { ValidationType } from '../decorators/field/validation/shared.js';
1
+ import { ValidationType } from '../types/validation.js';
2
2
  export default class ValidationError extends Error {
3
3
  dreamClassName: string;
4
4
  errors: {
@@ -1,6 +1,6 @@
1
- import { HasManyStatement } from '../../decorators/field/association/HasMany.js';
2
- import { HasOneStatement } from '../../decorators/field/association/HasOne.js';
3
1
  import Dream from '../../Dream.js';
2
+ import { HasManyStatement } from '../../types/associations/hasMany.js';
3
+ import { HasOneStatement } from '../../types/associations/hasOne.js';
4
4
  export default class CanOnlyPassBelongsToModelParam extends Error {
5
5
  dreamClass: typeof Dream;
6
6
  association: HasManyStatement<any, any, any, any> | HasOneStatement<any, any, any, any>;
@@ -1,6 +1,6 @@
1
- import { HasManyStatement } from '../../decorators/field/association/HasMany.js';
2
- import { HasOneStatement } from '../../decorators/field/association/HasOne.js';
3
1
  import Dream from '../../Dream.js';
2
+ import { HasManyStatement } from '../../types/associations/hasMany.js';
3
+ import { HasOneStatement } from '../../types/associations/hasOne.js';
4
4
  export default class CannotAssociateThroughPolymorphic extends Error {
5
5
  dreamClass: typeof Dream;
6
6
  association: HasManyStatement<any, any, any, any> | HasOneStatement<any, any, any, any>;
@@ -1,6 +1,6 @@
1
- import { HasManyStatement } from '../../decorators/field/association/HasMany.js';
2
- import { HasOneStatement } from '../../decorators/field/association/HasOne.js';
3
1
  import Dream from '../../Dream.js';
2
+ import { HasManyStatement } from '../../types/associations/hasMany.js';
3
+ import { HasOneStatement } from '../../types/associations/hasOne.js';
4
4
  export default class CannotCreateAssociationWithThroughContext extends Error {
5
5
  dreamClass: typeof Dream;
6
6
  association: HasManyStatement<any, any, any, any> | HasOneStatement<any, any, any, any>;
@@ -1,5 +1,5 @@
1
- import { BelongsToStatement } from '../../decorators/field/association/BelongsTo.js';
2
1
  import Dream from '../../Dream.js';
2
+ import { BelongsToStatement } from '../../types/associations/belongsTo.js';
3
3
  export default class CannotJoinPolymorphicBelongsToError extends Error {
4
4
  dreamClass: typeof Dream;
5
5
  association: BelongsToStatement<any, any, any, any>;
@@ -1,5 +1,5 @@
1
- import { BelongsToStatement } from '../../decorators/field/association/BelongsTo.js';
2
1
  import Dream from '../../Dream.js';
2
+ import { BelongsToStatement } from '../../types/associations/belongsTo.js';
3
3
  export default class CannotPassNullOrUndefinedToRequiredBelongsTo extends Error {
4
4
  dreamClass: typeof Dream;
5
5
  association: BelongsToStatement<any, any, any, any>;
@@ -1,5 +1,5 @@
1
- import { PartialAssociationStatement } from '../../decorators/field/association/shared.js';
2
1
  import Dream from '../../Dream.js';
2
+ import { PartialAssociationStatement } from '../../types/associations/shared.js';
3
3
  export declare class InvalidComputedForeignKey extends Error {
4
4
  dreamClass: typeof Dream;
5
5
  partialAssociation: PartialAssociationStatement;
@@ -1,5 +1,5 @@
1
- import { HasManyStatement } from '../../decorators/field/association/HasMany.js';
2
- import { HasOneStatement } from '../../decorators/field/association/HasOne.js';
1
+ import { HasManyStatement } from '../../types/associations/hasMany.js';
2
+ import { HasOneStatement } from '../../types/associations/hasOne.js';
3
3
  export default class MissingRequiredAssociationOnClause extends Error {
4
4
  private association;
5
5
  private column;
@@ -1,6 +1,6 @@
1
- import { HasManyStatement } from '../../decorators/field/association/HasMany.js';
2
- import { HasOneStatement } from '../../decorators/field/association/HasOne.js';
3
1
  import Dream from '../../Dream.js';
2
+ import { HasManyStatement } from '../../types/associations/hasMany.js';
3
+ import { HasOneStatement } from '../../types/associations/hasOne.js';
4
4
  export default class MissingThroughAssociation extends Error {
5
5
  dreamClass: typeof Dream;
6
6
  association: HasManyStatement<any, any, any, any> | HasOneStatement<any, any, any, any>;
@@ -1,6 +1,6 @@
1
- import { HasManyStatement } from '../../decorators/field/association/HasMany.js';
2
- import { HasOneStatement } from '../../decorators/field/association/HasOne.js';
3
1
  import Dream from '../../Dream.js';
2
+ import { HasManyStatement } from '../../types/associations/hasMany.js';
3
+ import { HasOneStatement } from '../../types/associations/hasOne.js';
4
4
  export default class MissingThroughAssociationSource extends Error {
5
5
  dreamClass: typeof Dream;
6
6
  throughClass: typeof Dream;
@@ -1,4 +1,4 @@
1
- import { PrimaryKeyType } from '../../dream/types.js';
1
+ import { PrimaryKeyType } from '../../types/dream.js';
2
2
  export default function generateMigrationContent({ table, columnsWithTypes, primaryKeyType, createOrAlter, }?: {
3
3
  table?: string;
4
4
  columnsWithTypes?: string[];
@@ -1,4 +1,4 @@
1
- import { PrimaryKeyType } from '../../dream/types.js';
1
+ import { PrimaryKeyType } from '../../types/dream.js';
2
2
  export default function generateStiMigrationContent({ table, columnsWithTypes, primaryKeyType, }?: {
3
3
  table?: string;
4
4
  columnsWithTypes?: string[];
@@ -1,2 +1,2 @@
1
- import { DbConnectionType } from '../../db/types.js';
1
+ import { DbConnectionType } from '../../types/db.js';
2
2
  export default function createDb(connection: DbConnectionType, dbName?: string | null): Promise<false | undefined>;
@@ -1,2 +1,2 @@
1
- import { DbConnectionType } from '../../db/types.js';
1
+ import { DbConnectionType } from '../../types/db.js';
2
2
  export default function dropDb(connection: DbConnectionType, dbName?: string | null): Promise<false | undefined>;
@@ -1,2 +1,2 @@
1
- import { PrimaryKeyType } from '../../dream/types.js';
1
+ import { PrimaryKeyType } from '../../types/dream.js';
2
2
  export default function foreignKeyTypeFromPrimaryKey(primaryKey: PrimaryKeyType): "bigint" | "integer" | "uuid";
@@ -1,4 +1,4 @@
1
1
  import Dream from '../Dream.js';
2
- import { SerializableDreamClassOrViewModelClass, SerializableDreamOrViewModel } from '../dream/types.js';
2
+ import { SerializableDreamClassOrViewModelClass, SerializableDreamOrViewModel } from '../types/dream.js';
3
3
  export default function inferSerializerFromDreamOrViewModel(obj: Dream | SerializableDreamOrViewModel, serializerKey?: string | undefined): typeof import("../index.js").DreamSerializer | null;
4
4
  export declare function inferSerializerFromDreamClassOrViewModelClass(classDef: SerializableDreamClassOrViewModelClass, serializerKey?: string | undefined): typeof import("../index.js").DreamSerializer | null;
@@ -1 +1 @@
1
- export default function isEmpty(value: any[] | object): boolean;
1
+ export default function isEmpty(value: unknown[] | Record<string, unknown> | Set<unknown> | Map<unknown, unknown>): boolean;
@@ -1,2 +1,2 @@
1
- import { RelaxedJoinStatement } from '../dream/types.js';
1
+ import { RelaxedJoinStatement } from '../types/dream.js';
2
2
  export default function objectPathsToArrays(obj: RelaxedJoinStatement): string[][];
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Returns a copy of array containing strings, numbers, bigints, and/or IdTypes, sorted in ascending order.
3
+ * To sort other types use {@link sortBy}.
4
+ *
5
+ * ```ts
6
+ * import { sort } from '@rvoh/dream'
7
+ *
8
+ * sort([2, 1, 3])
9
+ * // [1, 2, 3]
10
+ *
11
+ * sort(['world', 'Hello', 'hello', 'World'])
12
+ * // ['hello', 'Hello', 'world', 'World']
13
+ * ```
14
+ */
15
+ export default function sort<ArrayType extends string[] | number[] | bigint[]>(array: ArrayType): ArrayType;
@@ -1,5 +1,5 @@
1
- import { IdType } from '../dream/types.js';
2
- export default function sortBy<T>(array: T[], valueToCompare: (value: T) => number | string | bigint | IdType): T[];
1
+ export default function sortBy<T>(array: T[], valueToCompare: (value: T) => number): T[];
2
+ export default function sortBy<T>(array: T[], valueToCompare: (value: T) => string): T[];
3
3
  export declare class UnsupportedValueFromComparisonFunction extends Error {
4
4
  private aPrime;
5
5
  private bPrime;
@@ -1,4 +1,4 @@
1
- import { NotReadonlyHead, NotReadonlyTail, ReadonlyHead, ReadonlyTail } from './typeutils.js';
1
+ import { NotReadonlyHead, NotReadonlyTail, ReadonlyHead, ReadonlyTail } from '../types/utils.js';
2
2
  type RecursivelyStringCaseObjectKeysInTuple<T extends any[], StringCaseType extends StringCasingOptions> = T['length'] extends 0 ? [] : [
3
3
  RecursiveStringCase<NotReadonlyHead<T>, StringCaseType>,
4
4
  ...RecursivelyStringCaseObjectKeysInTuple<NotReadonlyTail<T>, StringCaseType>
@@ -1 +1 @@
1
- export default function uniq<T>(arr: T[], toKey?: ((a: T) => string) | undefined): T[];
1
+ export default function uniq<ArrayType extends any[], ElementType extends ArrayType extends (infer U)[] ? U : never>(arr: ArrayType, toKey?: ((a: ElementType) => string | number | bigint) | undefined): ArrayType;
@@ -11,15 +11,13 @@ export { default as SoftDelete } from './decorators/class/SoftDelete.js';
11
11
  export { default as STI } from './decorators/class/STI.js';
12
12
  export { type DecoratorContext } from './decorators/DecoratorContextType.js';
13
13
  export { default as Decorators } from './decorators/Decorators.js';
14
- export { type WhereStatementForDream, type WhereStatementForDreamClass, } from './decorators/field/association/shared.js';
15
- export { type ValidationType } from './decorators/field/validation/shared.js';
16
14
  export { default as DreamImporter } from './dream-application/helpers/DreamImporter.js';
17
15
  export { default as lookupClassByGlobalName } from './dream-application/helpers/lookupClassByGlobalName.js';
18
16
  export { default as DreamApplication, type DreamApplicationInitOptions, type DreamApplicationOpts, type DreamLogger, type DreamLogLevel, } from './dream-application/index.js';
19
17
  export { default as Dream } from './Dream.js';
18
+ export { DreamConst, openapiPrimitiveTypes, openapiShorthandPrimitiveTypes, type primaryKeyTypes, type TRIGRAM_OPERATORS, } from './dream/constants.js';
20
19
  export { default as DreamTransaction } from './dream/DreamTransaction.js';
21
20
  export { default as Query } from './dream/Query.js';
22
- export { DreamConst, type DreamAssociationMetadata, type DreamAttributes, type DreamClassColumn, type DreamColumn, type DreamColumnNames, type DreamOrViewModelSerializerKey, type DreamParamSafeAttributes, type DreamParamSafeColumnNames, type DreamSerializerKey, type DreamSerializers, type DreamTableSchema, type DreamVirtualColumns, type IdType, type PrimaryKeyType, type primaryKeyTypes, type SerializableClassOrSerializerCallback, type SerializableDreamClassOrViewModelClass, type SerializableDreamOrViewModel, type Timestamp, type TRIGRAM_OPERATORS, type UpdateableAssociationProperties, type UpdateableProperties, type ViewModelSerializerKey, } from './dream/types.js';
23
21
  export { default as Encrypt, type EncryptAlgorithm, type EncryptOptions } from './encrypt/index.js';
24
22
  export { default as NonLoadedAssociation } from './errors/associations/NonLoadedAssociation.js';
25
23
  export { default as CreateOrFindByFailedToCreateAndFind } from './errors/CreateOrFindByFailedToCreateAndFind.js';
@@ -49,15 +47,19 @@ export { Range, default as range } from './helpers/range.js';
49
47
  export { default as round, type RoundingPrecision } from './helpers/round.js';
50
48
  export { default as serializerNameFromFullyQualifiedModelName } from './helpers/serializerNameFromFullyQualifiedModelName.js';
51
49
  export { default as snakeify } from './helpers/snakeify.js';
50
+ export { default as sort } from './helpers/sort.js';
52
51
  export { default as sortBy } from './helpers/sortBy.js';
53
52
  export { default as standardizeFullyQualifiedModelName } from './helpers/standardizeFullyQualifiedModelName.js';
54
53
  export { type Camelized, type Hyphenized, type Pascalized, type Snakeified } from './helpers/stringCasing.js';
55
54
  export { default as uncapitalize } from './helpers/uncapitalize.js';
56
55
  export { default as uniq } from './helpers/uniq.js';
57
- export { openapiPrimitiveTypes, openapiShorthandPrimitiveTypes, type CommonOpenapiSchemaObjectFields, type OpenapiAllTypes, type OpenapiFormats, type OpenapiNumberFormats, type OpenapiPrimitiveTypes, type OpenapiSchemaArray, type OpenapiSchemaArrayShorthand, type OpenapiSchemaBase, type OpenapiSchemaBody, type OpenapiSchemaBodyShorthand, type OpenapiSchemaCommonFields, type OpenapiSchemaExpressionAllOf, type OpenapiSchemaExpressionAnyOf, type OpenapiSchemaExpressionOneOf, type OpenapiSchemaExpressionRef, type OpenapiSchemaExpressionRefSchemaShorthand, type OpenapiSchemaInteger, type OpenapiSchemaNull, type OpenapiSchemaNumber, type OpenapiSchemaObject, type OpenapiSchemaObjectAllOf, type OpenapiSchemaObjectAllOfShorthand, type OpenapiSchemaObjectAnyOf, type OpenapiSchemaObjectAnyOfShorthand, type OpenapiSchemaObjectBase, type OpenapiSchemaObjectBaseShorthand, type OpenapiSchemaObjectOneOf, type OpenapiSchemaObjectOneOfShorthand, type OpenapiSchemaObjectShorthand, type OpenapiSchemaPartialSegment, type OpenapiSchemaPrimitiveGeneric, type OpenapiSchemaProperties, type OpenapiSchemaPropertiesShorthand, type OpenapiSchemaShorthandExpressionAllOf, type OpenapiSchemaShorthandExpressionAnyOf, type OpenapiSchemaShorthandExpressionOneOf, type OpenapiSchemaShorthandExpressionSerializableRef, type OpenapiSchemaShorthandExpressionSerializerRef, type OpenapiSchemaShorthandPrimitiveGeneric, type OpenapiSchemaString, type OpenapiShorthandAllTypes, type OpenapiShorthandPrimitiveTypes, type OpenapiTypeField, type OpenapiTypeFieldObject, } from './openapi/types.js';
58
56
  export { default as ops } from './ops/index.js';
59
57
  export { default as RendersMany } from './serializer/decorators/associations/RendersMany.js';
60
58
  export { default as RendersOne } from './serializer/decorators/associations/RendersOne.js';
61
59
  export { type DreamSerializerAssociationStatement } from './serializer/decorators/associations/shared.js';
62
60
  export { default as Attribute, type AttributeStatement, type SerializableTypes, } from './serializer/decorators/attribute.js';
63
61
  export { default as DreamSerializer } from './serializer/index.js';
62
+ export { type WhereStatementForDream, type WhereStatementForDreamClass } from './types/associations/shared.js';
63
+ export { type DreamAssociationMetadata, type DreamAttributes, type DreamClassColumn, type DreamColumn, type DreamColumnNames, type DreamOrViewModelSerializerKey, type DreamParamSafeAttributes, type DreamParamSafeColumnNames, type DreamSerializerKey, type DreamSerializers, type DreamTableSchema, type DreamVirtualColumns, type IdType, type PrimaryKeyType, type SerializableClassOrSerializerCallback, type SerializableDreamClassOrViewModelClass, type SerializableDreamOrViewModel, type Timestamp, type UpdateableAssociationProperties, type UpdateableProperties, type ViewModelSerializerKey, } from './types/dream.js';
64
+ export { type CommonOpenapiSchemaObjectFields, type OpenapiAllTypes, type OpenapiFormats, type OpenapiNumberFormats, type OpenapiPrimitiveTypes, type OpenapiSchemaArray, type OpenapiSchemaArrayShorthand, type OpenapiSchemaBase, type OpenapiSchemaBody, type OpenapiSchemaBodyShorthand, type OpenapiSchemaCommonFields, type OpenapiSchemaExpressionAllOf, type OpenapiSchemaExpressionAnyOf, type OpenapiSchemaExpressionOneOf, type OpenapiSchemaExpressionRef, type OpenapiSchemaExpressionRefSchemaShorthand, type OpenapiSchemaInteger, type OpenapiSchemaNull, type OpenapiSchemaNumber, type OpenapiSchemaObject, type OpenapiSchemaObjectAllOf, type OpenapiSchemaObjectAllOfShorthand, type OpenapiSchemaObjectAnyOf, type OpenapiSchemaObjectAnyOfShorthand, type OpenapiSchemaObjectBase, type OpenapiSchemaObjectBaseShorthand, type OpenapiSchemaObjectOneOf, type OpenapiSchemaObjectOneOfShorthand, type OpenapiSchemaObjectShorthand, type OpenapiSchemaPartialSegment, type OpenapiSchemaPrimitiveGeneric, type OpenapiSchemaProperties, type OpenapiSchemaPropertiesShorthand, type OpenapiSchemaShorthandExpressionAllOf, type OpenapiSchemaShorthandExpressionAnyOf, type OpenapiSchemaShorthandExpressionOneOf, type OpenapiSchemaShorthandExpressionSerializableRef, type OpenapiSchemaShorthandExpressionSerializerRef, type OpenapiSchemaShorthandPrimitiveGeneric, type OpenapiSchemaString, type OpenapiShorthandAllTypes, type OpenapiShorthandPrimitiveTypes, type OpenapiTypeField, type OpenapiTypeFieldObject, } from './types/openapi.js';
65
+ export { type ValidationType } from './types/validation.js';
@@ -1,5 +1,5 @@
1
1
  import { ComparisonOperatorExpression as KyselyComparisonOperatorExpression } from 'kysely';
2
- import { TrigramOperator } from '../dream/types.js';
2
+ import { TrigramOperator } from '../types/dream.js';
3
3
  import CurriedOpsStatement from './curried-ops-statement.js';
4
4
  import OpsStatement from './ops-statement.js';
5
5
  type ArrayOperatorType = 'in' | 'not in';
@@ -1,5 +1,5 @@
1
1
  import { ComparisonOperatorExpression as KyselyComparisonOperatorExpression } from 'kysely';
2
- import { TrigramOperator } from '../dream/types.js';
2
+ import { TrigramOperator } from '../types/dream.js';
3
3
  export interface ExtraSimilarityArgs {
4
4
  score?: number;
5
5
  }
@@ -1,4 +1,4 @@
1
- import { SerializableClassOrClasses } from '../../../dream/types.js';
1
+ import { SerializableClassOrClasses } from '../../../types/dream.js';
2
2
  import { RendersOneOrManyOpts } from './shared.js';
3
3
  /**
4
4
  * Establishes a One to Many relationship between
@@ -1,4 +1,4 @@
1
- import { SerializableClassOrClasses } from '../../../dream/types.js';
1
+ import { SerializableClassOrClasses } from '../../../types/dream.js';
2
2
  import { RendersOneOrManyOpts } from './shared.js';
3
3
  /**
4
4
  * Establishes a One to One relationship between