@rvoh/dream 0.29.1 → 0.29.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 (203) hide show
  1. package/README.md +2 -2
  2. package/boilerplate/app/models/ApplicationModel.ts +1 -1
  3. package/boilerplate/cli/helpers/initializeDreamApplication.ts +1 -1
  4. package/boilerplate/cli/index.ts +1 -1
  5. package/boilerplate/conf/repl.ts +1 -1
  6. package/boilerplate/package.json +2 -2
  7. package/dist/cjs/boilerplate/package.json +2 -2
  8. package/dist/cjs/src/Dream.js +1 -1
  9. package/dist/cjs/src/bin/helpers/sync.js +1 -1
  10. package/dist/cjs/src/decorators/Decorators.js +34 -26
  11. package/dist/cjs/src/decorators/sortable/Sortable.js +8 -19
  12. package/dist/cjs/src/global-cli/file-builders/DreamtsBuilder.js +1 -1
  13. package/dist/cjs/src/helpers/cli/SchemaBuilder.js +1 -1
  14. package/dist/cjs/src/helpers/cli/generateDreamContent.js +1 -1
  15. package/dist/cjs/src/helpers/cli/generateFactoryContent.js +1 -1
  16. package/dist/cjs/src/helpers/cli/generateMigrationContent.js +1 -1
  17. package/dist/cjs/src/helpers/cli/generateSerializerContent.js +1 -1
  18. package/dist/cjs/src/index.js +2 -28
  19. package/dist/esm/boilerplate/package.json +2 -2
  20. package/dist/esm/src/Dream.js +1 -1
  21. package/dist/esm/src/bin/helpers/sync.js +1 -1
  22. package/dist/esm/src/decorators/Decorators.js +34 -26
  23. package/dist/esm/src/decorators/sortable/Sortable.js +8 -19
  24. package/dist/esm/src/global-cli/file-builders/DreamtsBuilder.js +1 -1
  25. package/dist/esm/src/helpers/cli/SchemaBuilder.js +1 -1
  26. package/dist/esm/src/helpers/cli/generateDreamContent.js +1 -1
  27. package/dist/esm/src/helpers/cli/generateFactoryContent.js +1 -1
  28. package/dist/esm/src/helpers/cli/generateMigrationContent.js +1 -1
  29. package/dist/esm/src/helpers/cli/generateSerializerContent.js +1 -1
  30. package/dist/esm/src/index.js +0 -13
  31. package/dist/types/src/Dream.d.ts +1 -1
  32. package/dist/types/src/decorators/Decorators.d.ts +34 -26
  33. package/dist/types/src/index.d.ts +0 -13
  34. package/docs/assets/navigation.js +1 -1
  35. package/docs/assets/search.js +1 -1
  36. package/docs/classes/Benchmark.html +2 -2
  37. package/docs/classes/CalendarDate.html +2 -2
  38. package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +3 -3
  39. package/docs/classes/Decorators.html +31 -28
  40. package/docs/classes/Dream.html +123 -123
  41. package/docs/classes/DreamApplication.html +4 -4
  42. package/docs/classes/DreamBin.html +2 -2
  43. package/docs/classes/DreamCLI.html +3 -3
  44. package/docs/classes/DreamImporter.html +2 -2
  45. package/docs/classes/DreamMigrationHelpers.html +7 -7
  46. package/docs/classes/DreamSerializer.html +2 -2
  47. package/docs/classes/DreamTransaction.html +2 -2
  48. package/docs/classes/Encrypt.html +2 -2
  49. package/docs/classes/Env.html +2 -2
  50. package/docs/classes/GlobalNameNotSet.html +3 -3
  51. package/docs/classes/NonLoadedAssociation.html +3 -3
  52. package/docs/classes/Query.html +50 -50
  53. package/docs/classes/Range.html +2 -2
  54. package/docs/classes/RecordNotFound.html +3 -3
  55. package/docs/classes/ValidationError.html +3 -3
  56. package/docs/functions/Attribute.html +1 -1
  57. package/docs/functions/RendersMany.html +1 -1
  58. package/docs/functions/RendersOne.html +1 -1
  59. package/docs/functions/ReplicaSafe.html +1 -1
  60. package/docs/functions/STI.html +1 -1
  61. package/docs/functions/Scope.html +1 -1
  62. package/docs/functions/SoftDelete.html +1 -1
  63. package/docs/functions/Validate.html +1 -1
  64. package/docs/functions/Validates.html +1 -1
  65. package/docs/functions/Virtual.html +1 -1
  66. package/docs/functions/camelize.html +1 -1
  67. package/docs/functions/capitalize.html +1 -1
  68. package/docs/functions/closeAllDbConnections.html +1 -1
  69. package/docs/functions/compact.html +1 -1
  70. package/docs/functions/db.html +1 -1
  71. package/docs/functions/debug.html +1 -1
  72. package/docs/functions/dreamDbConnections.html +1 -1
  73. package/docs/functions/dreamPath.html +1 -1
  74. package/docs/functions/generateDream.html +1 -1
  75. package/docs/functions/globalClassNameFromFullyQualifiedModelName.html +1 -1
  76. package/docs/functions/hyphenize.html +1 -1
  77. package/docs/functions/inferSerializerFromDreamClassOrViewModelClass.html +1 -1
  78. package/docs/functions/inferSerializerFromDreamOrViewModel.html +1 -1
  79. package/docs/functions/isEmpty.html +1 -1
  80. package/docs/functions/loadRepl.html +1 -1
  81. package/docs/functions/lookupClassByGlobalName.html +1 -1
  82. package/docs/functions/pascalize.html +1 -1
  83. package/docs/functions/pgErrorType.html +1 -1
  84. package/docs/functions/range-1.html +1 -1
  85. package/docs/functions/relativeDreamPath.html +1 -1
  86. package/docs/functions/round.html +1 -1
  87. package/docs/functions/serializerNameFromFullyQualifiedModelName.html +1 -1
  88. package/docs/functions/sharedPathPrefix.html +1 -1
  89. package/docs/functions/snakeify.html +1 -1
  90. package/docs/functions/sortBy.html +1 -1
  91. package/docs/functions/standardizeFullyQualifiedModelName.html +1 -1
  92. package/docs/functions/uncapitalize.html +1 -1
  93. package/docs/functions/uniq.html +1 -1
  94. package/docs/functions/validateColumn.html +1 -1
  95. package/docs/functions/validateTable.html +1 -1
  96. package/docs/index.html +2 -2
  97. package/docs/interfaces/AttributeStatement.html +2 -2
  98. package/docs/interfaces/DecoratorContext.html +2 -2
  99. package/docs/interfaces/DreamApplicationInitOptions.html +2 -2
  100. package/docs/interfaces/DreamApplicationOpts.html +2 -2
  101. package/docs/interfaces/DreamSerializerAssociationStatement.html +2 -2
  102. package/docs/interfaces/EncryptOptions.html +2 -2
  103. package/docs/interfaces/OpenapiSchemaProperties.html +1 -1
  104. package/docs/interfaces/OpenapiSchemaPropertiesShorthand.html +1 -1
  105. package/docs/interfaces/OpenapiTypeFieldObject.html +1 -1
  106. package/docs/modules.html +1 -14
  107. package/docs/types/Camelized.html +1 -1
  108. package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
  109. package/docs/types/DreamAssociationMetadata.html +1 -1
  110. package/docs/types/DreamAttributes.html +1 -1
  111. package/docs/types/DreamClassColumn.html +1 -1
  112. package/docs/types/DreamColumn.html +1 -1
  113. package/docs/types/DreamColumnNames.html +1 -1
  114. package/docs/types/DreamLogLevel.html +1 -1
  115. package/docs/types/DreamLogger.html +1 -1
  116. package/docs/types/DreamOrViewModelSerializerKey.html +1 -1
  117. package/docs/types/DreamParamSafeAttributes.html +1 -1
  118. package/docs/types/DreamParamSafeColumnNames.html +1 -1
  119. package/docs/types/DreamSerializerKey.html +1 -1
  120. package/docs/types/DreamSerializers.html +1 -1
  121. package/docs/types/DreamTableSchema.html +1 -1
  122. package/docs/types/DreamVirtualColumns.html +1 -1
  123. package/docs/types/EncryptAlgorithm.html +1 -1
  124. package/docs/types/Hyphenized.html +1 -1
  125. package/docs/types/IdType.html +1 -1
  126. package/docs/types/OpenapiAllTypes.html +1 -1
  127. package/docs/types/OpenapiFormats.html +1 -1
  128. package/docs/types/OpenapiNumberFormats.html +1 -1
  129. package/docs/types/OpenapiPrimitiveTypes.html +1 -1
  130. package/docs/types/OpenapiSchemaArray.html +1 -1
  131. package/docs/types/OpenapiSchemaArrayShorthand.html +1 -1
  132. package/docs/types/OpenapiSchemaBase.html +1 -1
  133. package/docs/types/OpenapiSchemaBody.html +1 -1
  134. package/docs/types/OpenapiSchemaBodyShorthand.html +1 -1
  135. package/docs/types/OpenapiSchemaCommonFields.html +1 -1
  136. package/docs/types/OpenapiSchemaExpressionAllOf.html +1 -1
  137. package/docs/types/OpenapiSchemaExpressionAnyOf.html +1 -1
  138. package/docs/types/OpenapiSchemaExpressionOneOf.html +1 -1
  139. package/docs/types/OpenapiSchemaExpressionRef.html +1 -1
  140. package/docs/types/OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
  141. package/docs/types/OpenapiSchemaInteger.html +1 -1
  142. package/docs/types/OpenapiSchemaNull.html +1 -1
  143. package/docs/types/OpenapiSchemaNumber.html +1 -1
  144. package/docs/types/OpenapiSchemaObject.html +1 -1
  145. package/docs/types/OpenapiSchemaObjectAllOf.html +1 -1
  146. package/docs/types/OpenapiSchemaObjectAllOfShorthand.html +1 -1
  147. package/docs/types/OpenapiSchemaObjectAnyOf.html +1 -1
  148. package/docs/types/OpenapiSchemaObjectAnyOfShorthand.html +1 -1
  149. package/docs/types/OpenapiSchemaObjectBase.html +1 -1
  150. package/docs/types/OpenapiSchemaObjectBaseShorthand.html +1 -1
  151. package/docs/types/OpenapiSchemaObjectOneOf.html +1 -1
  152. package/docs/types/OpenapiSchemaObjectOneOfShorthand.html +1 -1
  153. package/docs/types/OpenapiSchemaObjectShorthand.html +1 -1
  154. package/docs/types/OpenapiSchemaPartialSegment.html +1 -1
  155. package/docs/types/OpenapiSchemaPrimitiveGeneric.html +1 -1
  156. package/docs/types/OpenapiSchemaShorthandExpressionAllOf.html +1 -1
  157. package/docs/types/OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
  158. package/docs/types/OpenapiSchemaShorthandExpressionOneOf.html +1 -1
  159. package/docs/types/OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
  160. package/docs/types/OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
  161. package/docs/types/OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
  162. package/docs/types/OpenapiSchemaString.html +1 -1
  163. package/docs/types/OpenapiShorthandAllTypes.html +1 -1
  164. package/docs/types/OpenapiShorthandPrimitiveTypes.html +1 -1
  165. package/docs/types/OpenapiTypeField.html +1 -1
  166. package/docs/types/Pascalized.html +1 -1
  167. package/docs/types/PrimaryKeyType.html +1 -1
  168. package/docs/types/RoundingPrecision.html +1 -1
  169. package/docs/types/SerializableClassOrSerializerCallback.html +1 -1
  170. package/docs/types/SerializableDreamClassOrViewModelClass.html +1 -1
  171. package/docs/types/SerializableDreamOrViewModel.html +1 -1
  172. package/docs/types/SerializableTypes.html +1 -1
  173. package/docs/types/Snakeified.html +1 -1
  174. package/docs/types/Timestamp.html +1 -1
  175. package/docs/types/UpdateableAssociationProperties.html +1 -1
  176. package/docs/types/UpdateableProperties.html +1 -1
  177. package/docs/types/ValidationType.html +1 -1
  178. package/docs/types/ViewModelSerializerKey.html +1 -1
  179. package/docs/types/WhereStatementForDream.html +1 -1
  180. package/docs/types/WhereStatementForDreamClass.html +1 -1
  181. package/docs/variables/DreamConst.html +1 -1
  182. package/docs/variables/TRIGRAM_OPERATORS.html +1 -1
  183. package/docs/variables/openapiPrimitiveTypes-1.html +1 -1
  184. package/docs/variables/openapiShorthandPrimitiveTypes-1.html +1 -1
  185. package/docs/variables/ops.html +1 -1
  186. package/docs/variables/primaryKeyTypes.html +1 -1
  187. package/package.json +1 -1
  188. package/dist/cjs/src/errors/sortable/CannotCallSortableOnSTIChild.js +0 -18
  189. package/dist/esm/src/errors/sortable/CannotCallSortableOnSTIChild.js +0 -15
  190. package/dist/types/src/errors/sortable/CannotCallSortableOnSTIChild.d.ts +0 -6
  191. package/docs/functions/AfterCreate.html +0 -1
  192. package/docs/functions/AfterCreateCommit.html +0 -13
  193. package/docs/functions/AfterDestroy.html +0 -1
  194. package/docs/functions/AfterDestroyCommit.html +0 -13
  195. package/docs/functions/AfterSave.html +0 -1
  196. package/docs/functions/AfterSaveCommit.html +0 -13
  197. package/docs/functions/AfterUpdate.html +0 -1
  198. package/docs/functions/AfterUpdateCommit.html +0 -13
  199. package/docs/functions/BeforeCreate.html +0 -1
  200. package/docs/functions/BeforeDestroy.html +0 -1
  201. package/docs/functions/BeforeSave.html +0 -1
  202. package/docs/functions/BeforeUpdate.html +0 -1
  203. package/docs/functions/Sortable.html +0 -1
package/README.md CHANGED
@@ -290,7 +290,7 @@ Open the generated migration, create the pg_trgm extension and create a gin inde
290
290
 
291
291
  ```ts
292
292
  import { Kysely, sql } from 'kysely'
293
- import { createGinIndex, createExtension } from '@rvohealth/dream'
293
+ import { createGinIndex, createExtension } from '@rvoh/dream'
294
294
 
295
295
  export async function up(db: Kysely<any>): Promise<void> {
296
296
  // this only needs to be run once per db
@@ -315,7 +315,7 @@ NODE_ENV=development yarn psy db:migrate
315
315
  Now you can take full advantage of pg_trgm using the dream adapters!
316
316
 
317
317
  ```ts
318
- import { ops } from '@rvohealth/dream'
318
+ import { ops } from '@rvoh/dream'
319
319
 
320
320
  // applies a score match of 0.3
321
321
  const users = await User.where({ name: ops.similarity('steeven hawkins') }).all()
@@ -1,4 +1,4 @@
1
- import { Dream } from '@rvohealth/dream'
1
+ import { Dream } from '@rvoh/dream'
2
2
  import { globalSchema, schema } from '../../db/schema'
3
3
  import { DBClass } from '../../db/sync'
4
4
 
@@ -1,4 +1,4 @@
1
- import { DreamApplication } from '@rvohealth/dream'
1
+ import { DreamApplication } from '@rvoh/dream'
2
2
  import dreamConfCb from '../../app/conf/dream'
3
3
 
4
4
  export default async function initializeDreamApplication() {
@@ -7,7 +7,7 @@
7
7
 
8
8
  import '../conf/loadEnv'
9
9
 
10
- import { DreamCLI } from '@rvohealth/dream'
10
+ import { DreamCLI } from '@rvoh/dream'
11
11
  import { Command } from 'commander'
12
12
  import seedDb from '../db/seed'
13
13
  import initializeDreamApplication from './helpers/initializeDreamApplication'
@@ -1,6 +1,6 @@
1
1
  import './loadEnv.js'
2
2
 
3
- import { loadRepl } from '@rvohealth/dream'
3
+ import { loadRepl } from '@rvoh/dream'
4
4
  import * as repl from 'node:repl'
5
5
  import initializePsychicApplication from '../cli/helpers/initializePsychicApplication'
6
6
 
@@ -13,7 +13,7 @@
13
13
  "lint": "yarn run eslint --no-warn-ignored \"src/**/*.ts\" \"spec/**/*.ts\""
14
14
  },
15
15
  "dependencies": {
16
- "@rvohealth/dream": "1.0.0",
16
+ "@rvoh/dream": "1.0.0",
17
17
  "@types/luxon": "^3.4.2",
18
18
  "@types/node": "^20.11.17",
19
19
  "@types/pg": "^8.11.3",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@eslint/js": "=9.0.0",
28
- "@rvohealth/dream-spec-helpers": "1.0.0",
28
+ "@rvoh/dream-spec-helpers": "1.0.0",
29
29
  "@types/jest": "^29.5.12",
30
30
  "@types/luxon": "^3.4.2",
31
31
  "@types/node": "^20.11.17",
@@ -13,7 +13,7 @@
13
13
  "lint": "yarn run eslint --no-warn-ignored \"src/**/*.ts\" \"spec/**/*.ts\""
14
14
  },
15
15
  "dependencies": {
16
- "@rvohealth/dream": "1.0.0",
16
+ "@rvoh/dream": "1.0.0",
17
17
  "@types/luxon": "^3.4.2",
18
18
  "@types/node": "^20.11.17",
19
19
  "@types/pg": "^8.11.3",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@eslint/js": "=9.0.0",
28
- "@rvohealth/dream-spec-helpers": "1.0.0",
28
+ "@rvoh/dream-spec-helpers": "1.0.0",
29
29
  "@types/jest": "^29.5.12",
30
30
  "@types/luxon": "^3.4.2",
31
31
  "@types/node": "^20.11.17",
@@ -1075,7 +1075,7 @@ class Dream {
1075
1075
  *
1076
1076
  * ```ts
1077
1077
  * class Post extends ApplicationModel {
1078
- * @Sortable({ scope: ['user']})
1078
+ * @Deco.Sortable({ scope: ['user']})
1079
1079
  * public position: DreamColumn<User, 'position'>
1080
1080
  * }
1081
1081
  *
@@ -59,7 +59,7 @@ export type Timestamp = ColumnType<DateTime | CalendarDate>`);
59
59
  function addCustomImports(file) {
60
60
  const calendarDateImportStatement = EnvInternal_js_1.default.boolean('DREAM_CORE_DEVELOPMENT')
61
61
  ? "import CalendarDate from '../../src/helpers/CalendarDate'"
62
- : "import { CalendarDate } from '@rvohealth/dream'";
62
+ : "import { CalendarDate } from '@rvoh/dream'";
63
63
  const customImports = `${calendarDateImportStatement}
64
64
  import { DateTime } from 'luxon'`;
65
65
  return `${(0, autogeneratedFileMessage_js_1.default)()}${customImports}
@@ -99,8 +99,16 @@ class Decorators {
99
99
  // end: HasOne
100
100
  //////////////
101
101
  /**
102
- * Shortcut to the Sortable decorator, which also provides extra type protection which cannot be provided
103
- * with the Sortable decorator.
102
+ * Sortable decorator.
103
+ *
104
+ * NOTE: the Sortable decorator may not be used in STI child models (it may be used in the STI base class)
105
+ *
106
+ * ```ts
107
+ * class Balloon {
108
+ * @Deco.Sortable()
109
+ * public position: DreamColumn<Balloon, 'position'>
110
+ * }
111
+ * ```
104
112
  *
105
113
  * @param scope - The column, association, or combination there-of which you would like to restrict the incrementing logic to
106
114
  * @returns A Sortable decorator
@@ -109,11 +117,11 @@ class Decorators {
109
117
  return (0, Sortable_js_1.default)(opts);
110
118
  }
111
119
  /**
112
- * Shortcut to the BeforeCreate decorator
120
+ * BeforeCreate decorator
113
121
  *
114
122
  * ```ts
115
123
  * class User {
116
- * User.BeforeCreate()
124
+ * @Deco.BeforeCreate()
117
125
  * public doSomething() {
118
126
  * console.log('hi!')
119
127
  * }
@@ -127,11 +135,11 @@ class Decorators {
127
135
  return (0, BeforeCreate_js_1.default)(opts);
128
136
  }
129
137
  /**
130
- * Shortcut to the BeforeSave decorator
138
+ * BeforeSave decorator
131
139
  *
132
140
  * ```ts
133
141
  * class User {
134
- * User.BeforeSave()
142
+ * @Deco.BeforeSave()
135
143
  * public doSomething() {
136
144
  * console.log('hi!')
137
145
  * }
@@ -145,11 +153,11 @@ class Decorators {
145
153
  return (0, BeforeSave_js_1.default)(opts);
146
154
  }
147
155
  /**
148
- * Shortcut to the BeforeUpdate decorator
156
+ * BeforeUpdate decorator
149
157
  *
150
158
  * ```ts
151
159
  * class User {
152
- * User.BeforeUpdate()
160
+ * @Deco.BeforeUpdate()
153
161
  * public doSomething() {
154
162
  * console.log('hi!')
155
163
  * }
@@ -163,11 +171,11 @@ class Decorators {
163
171
  return (0, BeforeUpdate_js_1.default)(opts);
164
172
  }
165
173
  /**
166
- * Shortcut to the BeforeDestroy decorator
174
+ * BeforeDestroy decorator
167
175
  *
168
176
  * ```ts
169
177
  * class User {
170
- * User.BeforeDestroy()
178
+ * @Deco.BeforeDestroy()
171
179
  * public doSomething() {
172
180
  * console.log('hi!')
173
181
  * }
@@ -180,11 +188,11 @@ class Decorators {
180
188
  return (0, BeforeDestroy_js_1.default)();
181
189
  }
182
190
  /**
183
- * Shortcut to the AfterCreate decorator
191
+ * AfterCreate decorator
184
192
  *
185
193
  * ```ts
186
194
  * class User {
187
- * User.AfterCreate()
195
+ * @Deco.AfterCreate()
188
196
  * public doSomething() {
189
197
  * console.log('hi!')
190
198
  * }
@@ -198,11 +206,11 @@ class Decorators {
198
206
  return (0, AfterCreate_js_1.default)(opts);
199
207
  }
200
208
  /**
201
- * Shortcut to the AfterCreateCommit decorator
209
+ * AfterCreateCommit decorator
202
210
  *
203
211
  * ```ts
204
212
  * class User {
205
- * User.AfterCreateCommit()
213
+ * @Deco.AfterCreateCommit()
206
214
  * public doSomething() {
207
215
  * console.log('hi!')
208
216
  * }
@@ -215,11 +223,11 @@ class Decorators {
215
223
  return (0, AfterCreateCommit_js_1.default)(opts);
216
224
  }
217
225
  /**
218
- * Shortcut to the AfterSave decorator
226
+ * AfterSave decorator
219
227
  *
220
228
  * ```ts
221
229
  * class User {
222
- * User.AfterSave()
230
+ * @Deco.AfterSave()
223
231
  * public doSomething() {
224
232
  * console.log('hi!')
225
233
  * }
@@ -233,11 +241,11 @@ class Decorators {
233
241
  return (0, AfterSave_js_1.default)(opts);
234
242
  }
235
243
  /**
236
- * Shortcut to the AfterSaveCommit decorator
244
+ * AfterSaveCommit decorator
237
245
  *
238
246
  * ```ts
239
247
  * class User {
240
- * User.AfterSaveCommit()
248
+ * @Deco.AfterSaveCommit()
241
249
  * public doSomething() {
242
250
  * console.log('hi!')
243
251
  * }
@@ -251,11 +259,11 @@ class Decorators {
251
259
  return (0, AfterSaveCommit_js_1.default)(opts);
252
260
  }
253
261
  /**
254
- * Shortcut to the AfterUpdate decorator
262
+ * AfterUpdate decorator
255
263
  *
256
264
  * ```ts
257
265
  * class User {
258
- * User.AfterUpdate()
266
+ * @Deco.AfterUpdate()
259
267
  * public doSomething() {
260
268
  * console.log('hi!')
261
269
  * }
@@ -269,11 +277,11 @@ class Decorators {
269
277
  return (0, AfterUpdate_js_1.default)(opts);
270
278
  }
271
279
  /**
272
- * Shortcut to the AfterUpdateCommit decorator
280
+ * AfterUpdateCommit decorator
273
281
  *
274
282
  * ```ts
275
283
  * class User {
276
- * User.AfterUpdateCommit()
284
+ * @Deco.AfterUpdateCommit()
277
285
  * public doSomething() {
278
286
  * console.log('hi!')
279
287
  * }
@@ -287,11 +295,11 @@ class Decorators {
287
295
  return (0, AfterUpdateCommit_js_1.default)(opts);
288
296
  }
289
297
  /**
290
- * Shortcut to the AfterDestroy decorator
298
+ * AfterDestroy decorator
291
299
  *
292
300
  * ```ts
293
301
  * class User {
294
- * User.AfterDestroy()
302
+ * @Deco.AfterDestroy()
295
303
  * public doSomething() {
296
304
  * console.log('hi!')
297
305
  * }
@@ -305,11 +313,11 @@ class Decorators {
305
313
  return (0, AfterDestroy_js_1.default)();
306
314
  }
307
315
  /**
308
- * Shortcut to the AfterDestroyCommit decorator
316
+ * AfterDestroyCommit decorator
309
317
  *
310
318
  * ```ts
311
319
  * class User {
312
- * User.AfterDestroyCommit()
320
+ * @Deco.AfterDestroyCommit()
313
321
  * public doSomething() {
314
322
  * console.log('hi!')
315
323
  * }
@@ -9,6 +9,7 @@ const AfterDestroyCommit_js_1 = require("../hooks/AfterDestroyCommit.js");
9
9
  const AfterUpdate_js_1 = require("../hooks/AfterUpdate.js");
10
10
  const AfterUpdateCommit_js_1 = require("../hooks/AfterUpdateCommit.js");
11
11
  const BeforeSave_js_1 = require("../hooks/BeforeSave.js");
12
+ const STI_js_1 = require("../STI.js");
12
13
  const scopeArray_js_1 = require("./helpers/scopeArray.js");
13
14
  const afterSortableCreate_js_1 = require("./hooks/afterSortableCreate.js");
14
15
  const afterSortableDestroy_js_1 = require("./hooks/afterSortableDestroy.js");
@@ -22,18 +23,6 @@ function Sortable(opts = {}) {
22
23
  const dreamClass = dream.constructor;
23
24
  if (!dreamClass['globallyInitializingDecorators'])
24
25
  return;
25
- if (dreamClass['sti']['active']) {
26
- if (!(dreamClass instanceof dreamClass['stiBaseClassOrOwnClass'])) {
27
- // what we should really be doing is throwing CannotCallSortableOnSTIChild,
28
- // but we cannot, since there is no way to know during this initializer if
29
- // the Sortable decorator was applied to the STI child, or the STI parent.
30
- //
31
- // because of this bizarre issue, we are forced to early return when
32
- // we are processing Sortable on an STI child.
33
- // throw new CannotCallSortableOnSTIChild(dreamClass)
34
- return;
35
- }
36
- }
37
26
  if (!Object.getOwnPropertyDescriptor(dreamClass, 'sortableFields')) {
38
27
  // This pattern allows `sortableFields` on a base STI class and on
39
28
  // child STI classes. The new `sortableFields` property will be created
@@ -58,7 +47,7 @@ function Sortable(opts = {}) {
58
47
  // before saving, we remember the new value for position, but clear it from our
59
48
  // supervised attributes to prevent position from saving
60
49
  dreamPrototype[beforeSaveMethodName] = async function (txn) {
61
- let query = dreamClass.query();
50
+ let query = dreamClass.query().removeDefaultScope(STI_js_1.STI_SCOPE_NAME);
62
51
  if (txn)
63
52
  query = query.txn(txn);
64
53
  await (0, beforeSortableSave_js_1.default)({
@@ -73,7 +62,7 @@ function Sortable(opts = {}) {
73
62
  // if no transaction is provided, leverage update commit hook instead
74
63
  if (!txn)
75
64
  return;
76
- const query = dreamClass.query().txn(txn);
65
+ const query = dreamClass.query().removeDefaultScope(STI_js_1.STI_SCOPE_NAME).txn(txn);
77
66
  await (0, afterSortableUpdate_js_1.default)({
78
67
  dream: this,
79
68
  positionField,
@@ -86,7 +75,7 @@ function Sortable(opts = {}) {
86
75
  // if transaction is provided, leverage update hook instead
87
76
  if (txn)
88
77
  return;
89
- const query = dreamClass.query();
78
+ const query = dreamClass.query().removeDefaultScope(STI_js_1.STI_SCOPE_NAME);
90
79
  await (0, afterSortableUpdate_js_1.default)({
91
80
  dream: this,
92
81
  positionField,
@@ -101,7 +90,7 @@ function Sortable(opts = {}) {
101
90
  // if no transaction is provided, leverage create commit hook instead
102
91
  if (!txn)
103
92
  return;
104
- const query = dreamClass.query().txn(txn);
93
+ const query = dreamClass.query().removeDefaultScope(STI_js_1.STI_SCOPE_NAME).txn(txn);
105
94
  await (0, afterSortableCreate_js_1.default)({
106
95
  dream: this,
107
96
  positionField,
@@ -114,7 +103,7 @@ function Sortable(opts = {}) {
114
103
  // if transaction is provided, leverage create hook instead
115
104
  if (txn)
116
105
  return;
117
- const query = dreamClass.query();
106
+ const query = dreamClass.query().removeDefaultScope(STI_js_1.STI_SCOPE_NAME);
118
107
  await (0, afterSortableCreate_js_1.default)({
119
108
  dream: this,
120
109
  positionField,
@@ -128,7 +117,7 @@ function Sortable(opts = {}) {
128
117
  // if no transaction is provided, leverage destroy commit hook instead
129
118
  if (!txn)
130
119
  return;
131
- const query = dreamClass.query().txn(txn);
120
+ const query = dreamClass.query().removeDefaultScope(STI_js_1.STI_SCOPE_NAME).txn(txn);
132
121
  await (0, afterSortableDestroy_js_1.default)({
133
122
  dream: this,
134
123
  positionField,
@@ -140,7 +129,7 @@ function Sortable(opts = {}) {
140
129
  // if transaction is provided, leverage destroy hook instead
141
130
  if (txn)
142
131
  return;
143
- const query = dreamClass.query();
132
+ const query = dreamClass.query().removeDefaultScope(STI_js_1.STI_SCOPE_NAME);
144
133
  await (0, afterSortableDestroy_js_1.default)({
145
134
  dream: this,
146
135
  positionField,
@@ -5,7 +5,7 @@ class DreamtsBuilder {
5
5
  const { configPath, dbPath, typesPath, factoriesPath, modelsPath, serializersPath, servicesPath, modelSpecsPath, primaryKeyType, } = options;
6
6
  return `\
7
7
  import * as path from 'path'
8
- import { DreamApplication } from '@rvohealth/dream'
8
+ import { DreamApplication } from '@rvoh/dream'
9
9
  import inflections from './inflections'
10
10
 
11
11
  export default async function (app: DreamApplication) {
@@ -26,7 +26,7 @@ import {
26
26
  : '';
27
27
  const calendarDateImportStatement = EnvInternal_js_1.default.boolean('DREAM_CORE_DEVELOPMENT')
28
28
  ? "import CalendarDate from '../../src/helpers/CalendarDate'"
29
- : "import { CalendarDate } from '@rvohealth/dream'";
29
+ : "import { CalendarDate } from '@rvoh/dream'";
30
30
  const dreamApp = index_js_2.default.getOrFail();
31
31
  const newSchemaFileContents = `\
32
32
  ${(0, autogeneratedFileMessage_js_1.default)()}
@@ -74,7 +74,7 @@ public ${(0, camelize_js_1.default)(attributeName)}: ${getAttributeType(attribut
74
74
  timestamps = timestamps.replace(/\n$/, '');
75
75
  const tableName = (0, snakeify_js_1.default)((0, pluralize_esm_1.default)(fullyQualifiedModelName.replace(/\//g, '_')));
76
76
  return `\
77
- import { ${(0, uniq_js_1.default)(dreamImports).join(', ')} } from '@rvohealth/dream'${(0, uniq_js_1.default)(modelImportStatements).join('')}
77
+ import { ${(0, uniq_js_1.default)(dreamImports).join(', ')} } from '@rvoh/dream'${(0, uniq_js_1.default)(modelImportStatements).join('')}
78
78
 
79
79
  const Deco = new Decorators<InstanceType<typeof ${modelClassName}>>()
80
80
 
@@ -48,7 +48,7 @@ function generateFactoryContent({ fullyQualifiedModelName, columnsWithTypes, })
48
48
  const relativePath = (0, relativeDreamPath_js_1.default)('factories', 'models', fullyQualifiedModelName);
49
49
  const modelClassName = (0, globalClassNameFromFullyQualifiedModelName_js_1.default)(fullyQualifiedModelName);
50
50
  return `\
51
- import { ${(0, uniq_js_1.default)(dreamImports).join(', ')} } from '@rvohealth/dream'
51
+ import { ${(0, uniq_js_1.default)(dreamImports).join(', ')} } from '@rvoh/dream'
52
52
  import ${modelClassName} from '${relativePath}'${additionalImports.length ? '\n' + (0, uniq_js_1.default)(additionalImports).join('\n') : ''}
53
53
  ${stringAttributes.length ? '\nlet counter = 0\n' : ''}
54
54
  export default async function create${modelClassName}(attrs: UpdateableProperties<${modelClassName}> = {}) {
@@ -68,7 +68,7 @@ export async function down(db: Kysely<any>): Promise<void> {
68
68
  const columnDefLines = columnDefs.length ? newline + columnDefs.join(newline) : '';
69
69
  const columnDropLines = columnDrops.length ? newline + columnDrops.join(newline) + newline : '';
70
70
  return `\
71
- ${dreamImports.length ? `import { ${dreamImports.join(', ')} } from '@rvohealth/dream'\n` : ''}import { ${kyselyImports.join(', ')} } from 'kysely'
71
+ ${dreamImports.length ? `import { ${dreamImports.join(', ')} } from '@rvoh/dream'\n` : ''}import { ${kyselyImports.join(', ')} } from 'kysely'
72
72
 
73
73
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
74
  export async function up(db: Kysely<any>): Promise<void> {
@@ -57,7 +57,7 @@ function generateSerializerContent({ fullyQualifiedModelName, columnsWithTypes =
57
57
  });
58
58
  let dreamImport = '';
59
59
  if (dreamImports.length) {
60
- dreamImport = `import { ${(0, uniq_js_1.default)(dreamImports).join(', ')} } from '@rvohealth/dream'`;
60
+ dreamImport = `import { ${(0, uniq_js_1.default)(dreamImports).join(', ')} } from '@rvoh/dream'`;
61
61
  }
62
62
  const additionalImportsStr = additionalImports.length ? (0, uniq_js_1.default)(additionalImports).join('') : '';
63
63
  return `\
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debug = exports.compact = exports.generateDream = exports.capitalize = exports.camelize = exports.CalendarDate = exports.Benchmark = exports.ValidationError = exports.RecordNotFound = exports.GlobalNameNotSet = exports.CreateOrFindByFailedToCreateAndFind = exports.NonLoadedAssociation = exports.Encrypt = exports.DreamConst = exports.Query = exports.DreamTransaction = exports.Dream = exports.DreamApplication = exports.lookupClassByGlobalName = exports.DreamImporter = exports.Virtual = exports.Validates = exports.Validate = exports.STI = exports.Sortable = exports.SoftDelete = exports.Scope = exports.ReplicaSafe = exports.BeforeUpdate = exports.BeforeSave = exports.BeforeDestroy = exports.BeforeCreate = exports.AfterUpdateCommit = exports.AfterUpdate = exports.AfterSaveCommit = exports.AfterSave = exports.AfterDestroyCommit = exports.AfterDestroy = exports.AfterCreateCommit = exports.AfterCreate = exports.Decorators = exports.validateTable = exports.validateColumn = exports.DreamMigrationHelpers = exports.db = exports.pgErrorType = exports.dreamDbConnections = exports.closeAllDbConnections = exports.DreamCLI = exports.DreamBin = void 0;
4
- exports.DreamSerializer = exports.Attribute = exports.RendersOne = exports.RendersMany = exports.ops = exports.openapiShorthandPrimitiveTypes = exports.openapiPrimitiveTypes = exports.uniq = exports.uncapitalize = exports.standardizeFullyQualifiedModelName = exports.sortBy = exports.snakeify = exports.serializerNameFromFullyQualifiedModelName = exports.round = exports.range = exports.Range = exports.sharedPathPrefix = exports.relativeDreamPath = exports.dreamPath = exports.pascalize = exports.loadRepl = exports.isEmpty = exports.inferSerializerFromDreamOrViewModel = exports.inferSerializerFromDreamClassOrViewModelClass = exports.hyphenize = exports.globalClassNameFromFullyQualifiedModelName = exports.Env = void 0;
3
+ exports.range = exports.Range = exports.sharedPathPrefix = exports.relativeDreamPath = exports.dreamPath = exports.pascalize = exports.loadRepl = exports.isEmpty = exports.inferSerializerFromDreamOrViewModel = exports.inferSerializerFromDreamClassOrViewModelClass = exports.hyphenize = exports.globalClassNameFromFullyQualifiedModelName = exports.Env = exports.debug = exports.compact = exports.generateDream = exports.capitalize = exports.camelize = exports.CalendarDate = exports.Benchmark = exports.ValidationError = exports.RecordNotFound = exports.GlobalNameNotSet = exports.CreateOrFindByFailedToCreateAndFind = exports.NonLoadedAssociation = exports.Encrypt = exports.DreamConst = exports.Query = exports.DreamTransaction = exports.Dream = exports.DreamApplication = exports.lookupClassByGlobalName = exports.DreamImporter = exports.Virtual = exports.Validates = exports.Validate = exports.STI = exports.SoftDelete = exports.Scope = exports.ReplicaSafe = exports.Decorators = exports.validateTable = exports.validateColumn = exports.DreamMigrationHelpers = exports.db = exports.pgErrorType = exports.dreamDbConnections = exports.closeAllDbConnections = exports.DreamCLI = exports.DreamBin = void 0;
4
+ exports.DreamSerializer = exports.Attribute = exports.RendersOne = exports.RendersMany = exports.ops = exports.openapiShorthandPrimitiveTypes = exports.openapiPrimitiveTypes = exports.uniq = exports.uncapitalize = exports.standardizeFullyQualifiedModelName = exports.sortBy = exports.snakeify = exports.serializerNameFromFullyQualifiedModelName = exports.round = void 0;
5
5
  var index_js_1 = require("./bin/index.js");
6
6
  Object.defineProperty(exports, "DreamBin", { enumerable: true, get: function () { return index_js_1.default; } });
7
7
  var index_js_2 = require("./cli/index.js");
@@ -21,38 +21,12 @@ var validateTable_js_1 = require("./db/validators/validateTable.js");
21
21
  Object.defineProperty(exports, "validateTable", { enumerable: true, get: function () { return validateTable_js_1.default; } });
22
22
  var Decorators_js_1 = require("./decorators/Decorators.js");
23
23
  Object.defineProperty(exports, "Decorators", { enumerable: true, get: function () { return Decorators_js_1.default; } });
24
- var AfterCreate_js_1 = require("./decorators/hooks/AfterCreate.js");
25
- Object.defineProperty(exports, "AfterCreate", { enumerable: true, get: function () { return AfterCreate_js_1.default; } });
26
- var AfterCreateCommit_js_1 = require("./decorators/hooks/AfterCreateCommit.js");
27
- Object.defineProperty(exports, "AfterCreateCommit", { enumerable: true, get: function () { return AfterCreateCommit_js_1.default; } });
28
- var AfterDestroy_js_1 = require("./decorators/hooks/AfterDestroy.js");
29
- Object.defineProperty(exports, "AfterDestroy", { enumerable: true, get: function () { return AfterDestroy_js_1.default; } });
30
- var AfterDestroyCommit_js_1 = require("./decorators/hooks/AfterDestroyCommit.js");
31
- Object.defineProperty(exports, "AfterDestroyCommit", { enumerable: true, get: function () { return AfterDestroyCommit_js_1.default; } });
32
- var AfterSave_js_1 = require("./decorators/hooks/AfterSave.js");
33
- Object.defineProperty(exports, "AfterSave", { enumerable: true, get: function () { return AfterSave_js_1.default; } });
34
- var AfterSaveCommit_js_1 = require("./decorators/hooks/AfterSaveCommit.js");
35
- Object.defineProperty(exports, "AfterSaveCommit", { enumerable: true, get: function () { return AfterSaveCommit_js_1.default; } });
36
- var AfterUpdate_js_1 = require("./decorators/hooks/AfterUpdate.js");
37
- Object.defineProperty(exports, "AfterUpdate", { enumerable: true, get: function () { return AfterUpdate_js_1.default; } });
38
- var AfterUpdateCommit_js_1 = require("./decorators/hooks/AfterUpdateCommit.js");
39
- Object.defineProperty(exports, "AfterUpdateCommit", { enumerable: true, get: function () { return AfterUpdateCommit_js_1.default; } });
40
- var BeforeCreate_js_1 = require("./decorators/hooks/BeforeCreate.js");
41
- Object.defineProperty(exports, "BeforeCreate", { enumerable: true, get: function () { return BeforeCreate_js_1.default; } });
42
- var BeforeDestroy_js_1 = require("./decorators/hooks/BeforeDestroy.js");
43
- Object.defineProperty(exports, "BeforeDestroy", { enumerable: true, get: function () { return BeforeDestroy_js_1.default; } });
44
- var BeforeSave_js_1 = require("./decorators/hooks/BeforeSave.js");
45
- Object.defineProperty(exports, "BeforeSave", { enumerable: true, get: function () { return BeforeSave_js_1.default; } });
46
- var BeforeUpdate_js_1 = require("./decorators/hooks/BeforeUpdate.js");
47
- Object.defineProperty(exports, "BeforeUpdate", { enumerable: true, get: function () { return BeforeUpdate_js_1.default; } });
48
24
  var ReplicaSafe_js_1 = require("./decorators/ReplicaSafe.js");
49
25
  Object.defineProperty(exports, "ReplicaSafe", { enumerable: true, get: function () { return ReplicaSafe_js_1.default; } });
50
26
  var Scope_js_1 = require("./decorators/Scope.js");
51
27
  Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return Scope_js_1.default; } });
52
28
  var SoftDelete_js_1 = require("./decorators/SoftDelete.js");
53
29
  Object.defineProperty(exports, "SoftDelete", { enumerable: true, get: function () { return SoftDelete_js_1.default; } });
54
- var Sortable_js_1 = require("./decorators/sortable/Sortable.js");
55
- Object.defineProperty(exports, "Sortable", { enumerable: true, get: function () { return Sortable_js_1.default; } });
56
30
  var STI_js_1 = require("./decorators/STI.js");
57
31
  Object.defineProperty(exports, "STI", { enumerable: true, get: function () { return STI_js_1.default; } });
58
32
  var Validate_js_1 = require("./decorators/validations/Validate.js");
@@ -13,7 +13,7 @@
13
13
  "lint": "yarn run eslint --no-warn-ignored \"src/**/*.ts\" \"spec/**/*.ts\""
14
14
  },
15
15
  "dependencies": {
16
- "@rvohealth/dream": "1.0.0",
16
+ "@rvoh/dream": "1.0.0",
17
17
  "@types/luxon": "^3.4.2",
18
18
  "@types/node": "^20.11.17",
19
19
  "@types/pg": "^8.11.3",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@eslint/js": "=9.0.0",
28
- "@rvohealth/dream-spec-helpers": "1.0.0",
28
+ "@rvoh/dream-spec-helpers": "1.0.0",
29
29
  "@types/jest": "^29.5.12",
30
30
  "@types/luxon": "^3.4.2",
31
31
  "@types/node": "^20.11.17",
@@ -1073,7 +1073,7 @@ export default class Dream {
1073
1073
  *
1074
1074
  * ```ts
1075
1075
  * class Post extends ApplicationModel {
1076
- * @Sortable({ scope: ['user']})
1076
+ * @Deco.Sortable({ scope: ['user']})
1077
1077
  * public position: DreamColumn<User, 'position'>
1078
1078
  * }
1079
1079
  *
@@ -56,7 +56,7 @@ export type Timestamp = ColumnType<DateTime | CalendarDate>`);
56
56
  function addCustomImports(file) {
57
57
  const calendarDateImportStatement = EnvInternal.boolean('DREAM_CORE_DEVELOPMENT')
58
58
  ? "import CalendarDate from '../../src/helpers/CalendarDate'"
59
- : "import { CalendarDate } from '@rvohealth/dream'";
59
+ : "import { CalendarDate } from '@rvoh/dream'";
60
60
  const customImports = `${calendarDateImportStatement}
61
61
  import { DateTime } from 'luxon'`;
62
62
  return `${autogeneratedFileDisclaimer()}${customImports}