@rvoh/dream 0.43.0-beta.5 → 0.43.0-beta.7

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 (243) hide show
  1. package/dist/cjs/src/Dream.js +3 -4
  2. package/dist/cjs/src/dream/Query.js +15 -11
  3. package/dist/cjs/src/dream/internal/similarity/SimilarityBuilder.js +3 -3
  4. package/dist/cjs/src/helpers/allNestedObjectKeys.js +2 -2
  5. package/dist/cjs/src/helpers/cloneDeepSafe.js +2 -2
  6. package/dist/cjs/src/helpers/{typechecks.js → isObject.js} +2 -7
  7. package/dist/cjs/src/helpers/normalizeString.js +1 -2
  8. package/dist/cjs/src/helpers/sqlAttributes.js +1 -2
  9. package/dist/cjs/src/helpers/stringCasing.js +4 -4
  10. package/dist/cjs/src/index.js +3 -9
  11. package/dist/esm/src/Dream.js +3 -4
  12. package/dist/esm/src/dream/Query.js +11 -7
  13. package/dist/esm/src/dream/internal/similarity/SimilarityBuilder.js +1 -1
  14. package/dist/esm/src/helpers/allNestedObjectKeys.js +1 -1
  15. package/dist/esm/src/helpers/cloneDeepSafe.js +1 -1
  16. package/dist/esm/src/helpers/isObject.js +8 -0
  17. package/dist/esm/src/helpers/normalizeString.js +1 -2
  18. package/dist/esm/src/helpers/sqlAttributes.js +1 -2
  19. package/dist/esm/src/helpers/stringCasing.js +3 -3
  20. package/dist/esm/src/index.js +1 -4
  21. package/dist/types/src/helpers/isObject.d.ts +1 -0
  22. package/dist/types/src/index.d.ts +5 -8
  23. package/dist/types/src/serializer/ObjectSerializer.d.ts +1 -2
  24. package/dist/types/src/serializer/builders/ObjectSerializerBuilder.d.ts +5 -5
  25. package/dist/types/src/types/dream.d.ts +0 -2
  26. package/dist/types/src/types/dream.ts +0 -15
  27. package/dist/types/src/types/serializer.d.ts +0 -8
  28. package/dist/types/src/types/serializer.ts +0 -10
  29. package/dist/types/src/types/utils.d.ts +6 -0
  30. package/dist/types/src/types/utils.ts +8 -0
  31. package/docs/assets/navigation.js +1 -1
  32. package/docs/assets/search.js +1 -1
  33. package/docs/classes/Benchmark.html +2 -2
  34. package/docs/classes/CalendarDate.html +2 -2
  35. package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +3 -3
  36. package/docs/classes/Decorators.html +19 -19
  37. package/docs/classes/Dream.html +131 -131
  38. package/docs/classes/DreamApp.html +4 -4
  39. package/docs/classes/DreamBin.html +2 -2
  40. package/docs/classes/DreamCLI.html +4 -4
  41. package/docs/classes/DreamImporter.html +2 -2
  42. package/docs/classes/DreamLogos.html +2 -2
  43. package/docs/classes/DreamMigrationHelpers.html +7 -7
  44. package/docs/classes/DreamSerializerBuilder.html +2 -2
  45. package/docs/classes/DreamTransaction.html +2 -2
  46. package/docs/classes/Encrypt.html +2 -2
  47. package/docs/classes/Env.html +2 -2
  48. package/docs/classes/GlobalNameNotSet.html +3 -3
  49. package/docs/classes/NonLoadedAssociation.html +3 -3
  50. package/docs/classes/ObjectSerializerBuilder.html +2 -2
  51. package/docs/classes/Query.html +51 -51
  52. package/docs/classes/Range.html +2 -2
  53. package/docs/classes/RecordNotFound.html +3 -3
  54. package/docs/classes/ValidationError.html +3 -3
  55. package/docs/functions/DreamSerializer.html +1 -1
  56. package/docs/functions/ObjectSerializer.html +1 -1
  57. package/docs/functions/ReplicaSafe.html +1 -1
  58. package/docs/functions/STI.html +1 -1
  59. package/docs/functions/SoftDelete.html +1 -1
  60. package/docs/functions/camelize.html +1 -1
  61. package/docs/functions/capitalize.html +1 -1
  62. package/docs/functions/cloneDeepSafe.html +1 -1
  63. package/docs/functions/closeAllDbConnections.html +1 -1
  64. package/docs/functions/compact.html +1 -1
  65. package/docs/functions/dreamDbConnections.html +1 -1
  66. package/docs/functions/dreamPath.html +1 -1
  67. package/docs/functions/expandStiClasses.html +1 -0
  68. package/docs/functions/generateDream.html +1 -1
  69. package/docs/functions/globalClassNameFromFullyQualifiedModelName.html +1 -1
  70. package/docs/functions/groupBy.html +1 -1
  71. package/docs/functions/hyphenize.html +1 -1
  72. package/docs/functions/inferSerializerFromDreamOrViewModel.html +1 -1
  73. package/docs/functions/inferSerializersFromDreamClassOrViewModelClass.html +1 -1
  74. package/docs/functions/intersection.html +1 -1
  75. package/docs/functions/isDreamSerializer.html +1 -1
  76. package/docs/functions/isEmpty.html +1 -1
  77. package/docs/functions/loadRepl.html +1 -1
  78. package/docs/functions/lookupClassByGlobalName.html +1 -1
  79. package/docs/functions/pascalize.html +1 -1
  80. package/docs/functions/pgErrorType.html +1 -1
  81. package/docs/functions/range-1.html +1 -1
  82. package/docs/functions/relativeDreamPath.html +1 -1
  83. package/docs/functions/round.html +1 -1
  84. package/docs/functions/serializerNameFromFullyQualifiedModelName.html +1 -1
  85. package/docs/functions/sharedPathPrefix.html +1 -1
  86. package/docs/functions/snakeify.html +1 -1
  87. package/docs/functions/sort.html +1 -1
  88. package/docs/functions/sortBy.html +1 -1
  89. package/docs/functions/sortObjectByKey.html +1 -1
  90. package/docs/functions/sortObjectByValue.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/untypedDb.html +1 -1
  95. package/docs/functions/validateColumn.html +1 -1
  96. package/docs/functions/validateTable.html +1 -1
  97. package/docs/interfaces/DecoratorContext.html +2 -2
  98. package/docs/interfaces/DreamAppInitOptions.html +2 -2
  99. package/docs/interfaces/DreamAppOpts.html +2 -2
  100. package/docs/interfaces/EncryptOptions.html +2 -2
  101. package/docs/interfaces/InternalAnyTypedSerializerRendersMany.html +4 -0
  102. package/docs/interfaces/InternalAnyTypedSerializerRendersOne.html +4 -0
  103. package/docs/interfaces/OpenapiDescription.html +2 -0
  104. package/docs/interfaces/OpenapiSchemaProperties.html +1 -1
  105. package/docs/interfaces/OpenapiSchemaPropertiesShorthand.html +1 -1
  106. package/docs/interfaces/OpenapiTypeFieldObject.html +1 -1
  107. package/docs/interfaces/SerializerRendererOpts.html +2 -2
  108. package/docs/modules.html +5 -5
  109. package/docs/types/Camelized.html +1 -1
  110. package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
  111. package/docs/types/DateTime.html +1 -1
  112. package/docs/types/DbConnectionType.html +1 -1
  113. package/docs/types/DbTypes.html +1 -0
  114. package/docs/types/DreamAssociationMetadata.html +1 -1
  115. package/docs/types/DreamAttributes.html +1 -1
  116. package/docs/types/DreamClassColumn.html +1 -1
  117. package/docs/types/DreamColumn.html +1 -1
  118. package/docs/types/DreamColumnNames.html +1 -1
  119. package/docs/types/DreamLogLevel.html +1 -1
  120. package/docs/types/DreamLogger.html +1 -1
  121. package/docs/types/DreamModelSerializerType.html +1 -1
  122. package/docs/types/DreamOrViewModelClassSerializerKey.html +1 -1
  123. package/docs/types/DreamOrViewModelSerializerKey.html +1 -1
  124. package/docs/types/DreamParamSafeAttributes.html +1 -1
  125. package/docs/types/DreamParamSafeColumnNames.html +1 -1
  126. package/docs/types/DreamSerializable.html +1 -1
  127. package/docs/types/DreamSerializableArray.html +1 -1
  128. package/docs/types/DreamSerializerKey.html +1 -1
  129. package/docs/types/DreamSerializers.html +1 -1
  130. package/docs/types/DreamTableSchema.html +1 -1
  131. package/docs/types/DreamVirtualColumns.html +1 -1
  132. package/docs/types/EncryptAlgorithm.html +1 -1
  133. package/docs/types/Hyphenized.html +1 -1
  134. package/docs/types/IdType.html +1 -1
  135. package/docs/types/OpenapiAllTypes.html +1 -1
  136. package/docs/types/OpenapiFormats.html +1 -1
  137. package/docs/types/OpenapiNumberFormats.html +1 -1
  138. package/docs/types/OpenapiPrimitiveBaseTypes.html +1 -1
  139. package/docs/types/OpenapiPrimitiveTypes.html +1 -1
  140. package/docs/types/OpenapiSchemaArray.html +1 -1
  141. package/docs/types/OpenapiSchemaArrayShorthand.html +1 -1
  142. package/docs/types/OpenapiSchemaBase.html +1 -1
  143. package/docs/types/OpenapiSchemaBody.html +1 -1
  144. package/docs/types/OpenapiSchemaBodyShorthand.html +1 -1
  145. package/docs/types/OpenapiSchemaCommonFields.html +1 -1
  146. package/docs/types/OpenapiSchemaExpressionAllOf.html +1 -1
  147. package/docs/types/OpenapiSchemaExpressionAnyOf.html +1 -1
  148. package/docs/types/OpenapiSchemaExpressionOneOf.html +1 -1
  149. package/docs/types/OpenapiSchemaExpressionRef.html +1 -1
  150. package/docs/types/OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
  151. package/docs/types/OpenapiSchemaInteger.html +1 -1
  152. package/docs/types/OpenapiSchemaNull.html +1 -1
  153. package/docs/types/OpenapiSchemaNumber.html +1 -1
  154. package/docs/types/OpenapiSchemaObject.html +1 -1
  155. package/docs/types/OpenapiSchemaObjectAllOf.html +1 -1
  156. package/docs/types/OpenapiSchemaObjectAllOfShorthand.html +1 -1
  157. package/docs/types/OpenapiSchemaObjectAnyOf.html +1 -1
  158. package/docs/types/OpenapiSchemaObjectAnyOfShorthand.html +1 -1
  159. package/docs/types/OpenapiSchemaObjectBase.html +1 -1
  160. package/docs/types/OpenapiSchemaObjectBaseShorthand.html +1 -1
  161. package/docs/types/OpenapiSchemaObjectOneOf.html +1 -1
  162. package/docs/types/OpenapiSchemaObjectOneOfShorthand.html +1 -1
  163. package/docs/types/OpenapiSchemaObjectShorthand.html +1 -1
  164. package/docs/types/OpenapiSchemaPrimitiveGeneric.html +1 -1
  165. package/docs/types/OpenapiSchemaShorthandExpressionAllOf.html +1 -1
  166. package/docs/types/OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
  167. package/docs/types/OpenapiSchemaShorthandExpressionOneOf.html +1 -1
  168. package/docs/types/OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
  169. package/docs/types/OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
  170. package/docs/types/OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
  171. package/docs/types/OpenapiSchemaString.html +1 -1
  172. package/docs/types/OpenapiShorthandAllTypes.html +1 -1
  173. package/docs/types/OpenapiShorthandPrimitiveBaseTypes.html +1 -1
  174. package/docs/types/OpenapiShorthandPrimitiveTypes.html +1 -1
  175. package/docs/types/OpenapiTypeField.html +1 -1
  176. package/docs/types/Pascalized.html +1 -1
  177. package/docs/types/PrimaryKeyType.html +1 -1
  178. package/docs/types/RoundingPrecision.html +1 -1
  179. package/docs/types/SerializerCasing.html +1 -1
  180. package/docs/types/SimpleObjectSerializerType.html +1 -1
  181. package/docs/types/Snakeified.html +1 -1
  182. package/docs/types/Timestamp.html +1 -1
  183. package/docs/types/UpdateableAssociationProperties.html +1 -1
  184. package/docs/types/UpdateableProperties.html +1 -1
  185. package/docs/types/ValidationType.html +1 -1
  186. package/docs/types/ViewModel.html +1 -1
  187. package/docs/types/ViewModelClass.html +1 -1
  188. package/docs/types/WhereStatementForDream.html +1 -1
  189. package/docs/types/WhereStatementForDreamClass.html +1 -1
  190. package/docs/variables/DateTime-1.html +1 -1
  191. package/docs/variables/DreamConst.html +1 -1
  192. package/docs/variables/TRIGRAM_OPERATORS.html +1 -1
  193. package/docs/variables/openapiPrimitiveTypes-1.html +1 -1
  194. package/docs/variables/openapiShorthandPrimitiveTypes-1.html +1 -1
  195. package/docs/variables/ops.html +1 -1
  196. package/docs/variables/primaryKeyTypes.html +1 -1
  197. package/package.json +1 -1
  198. package/dist/cjs/src/errors/serializers/AttemptedToDeriveDescendentSerializersFromNonSerializer.js +0 -16
  199. package/dist/cjs/src/errors/serializers/ExpectedSerializerForRendersOneOrManyOption.js +0 -36
  200. package/dist/cjs/src/errors/serializers/NoSerializerFoundForRendersOneAndMany.js +0 -16
  201. package/dist/cjs/src/errors/serializers/NonSerializerPassedToSerializerOpenapiRenderer.js +0 -16
  202. package/dist/cjs/src/errors/serializers/NonSerializerSerializerOverrideProvided.js +0 -23
  203. package/dist/cjs/src/errors/serializers/ObjectSerializerRendersOneAndManyRequireClassType.js +0 -19
  204. package/dist/cjs/src/openapi/allSerializersFromHandWrittenOpenapi.js +0 -26
  205. package/dist/cjs/src/openapi/allSerializersToRefsInOpenapi.js +0 -41
  206. package/dist/cjs/src/openapi/dreamAttributeOpenapiShape.js +0 -138
  207. package/dist/cjs/src/openapi/isOpenapiShorthand.js +0 -11
  208. package/dist/cjs/src/openapi/maybeNullOpenapiShorthandToOpenapiShorthand.js +0 -17
  209. package/dist/cjs/src/openapi/openapiShorthandToOpenapi.js +0 -106
  210. package/dist/cjs/src/serializer/SerializerOpenapiRenderer.js +0 -360
  211. package/dist/esm/src/errors/serializers/AttemptedToDeriveDescendentSerializersFromNonSerializer.js +0 -13
  212. package/dist/esm/src/errors/serializers/ExpectedSerializerForRendersOneOrManyOption.js +0 -33
  213. package/dist/esm/src/errors/serializers/NoSerializerFoundForRendersOneAndMany.js +0 -13
  214. package/dist/esm/src/errors/serializers/NonSerializerPassedToSerializerOpenapiRenderer.js +0 -13
  215. package/dist/esm/src/errors/serializers/NonSerializerSerializerOverrideProvided.js +0 -20
  216. package/dist/esm/src/errors/serializers/ObjectSerializerRendersOneAndManyRequireClassType.js +0 -16
  217. package/dist/esm/src/helpers/typechecks.js +0 -12
  218. package/dist/esm/src/openapi/allSerializersFromHandWrittenOpenapi.js +0 -23
  219. package/dist/esm/src/openapi/allSerializersToRefsInOpenapi.js +0 -38
  220. package/dist/esm/src/openapi/dreamAttributeOpenapiShape.js +0 -132
  221. package/dist/esm/src/openapi/isOpenapiShorthand.js +0 -8
  222. package/dist/esm/src/openapi/maybeNullOpenapiShorthandToOpenapiShorthand.js +0 -14
  223. package/dist/esm/src/openapi/openapiShorthandToOpenapi.js +0 -100
  224. package/dist/esm/src/serializer/SerializerOpenapiRenderer.js +0 -357
  225. package/dist/types/src/errors/serializers/AttemptedToDeriveDescendentSerializersFromNonSerializer.d.ts +0 -5
  226. package/dist/types/src/errors/serializers/ExpectedSerializerForRendersOneOrManyOption.d.ts +0 -8
  227. package/dist/types/src/errors/serializers/NoSerializerFoundForRendersOneAndMany.d.ts +0 -5
  228. package/dist/types/src/errors/serializers/NonSerializerPassedToSerializerOpenapiRenderer.d.ts +0 -5
  229. package/dist/types/src/errors/serializers/NonSerializerSerializerOverrideProvided.d.ts +0 -6
  230. package/dist/types/src/errors/serializers/ObjectSerializerRendersOneAndManyRequireClassType.d.ts +0 -5
  231. package/dist/types/src/helpers/typechecks.d.ts +0 -2
  232. package/dist/types/src/openapi/allSerializersFromHandWrittenOpenapi.d.ts +0 -3
  233. package/dist/types/src/openapi/allSerializersToRefsInOpenapi.d.ts +0 -2
  234. package/dist/types/src/openapi/dreamAttributeOpenapiShape.d.ts +0 -796
  235. package/dist/types/src/openapi/isOpenapiShorthand.d.ts +0 -1
  236. package/dist/types/src/openapi/maybeNullOpenapiShorthandToOpenapiShorthand.d.ts +0 -2
  237. package/dist/types/src/openapi/openapiShorthandToOpenapi.d.ts +0 -16
  238. package/dist/types/src/serializer/SerializerOpenapiRenderer.d.ts +0 -21
  239. package/docs/classes/SerializerOpenapiRenderer.html +0 -6
  240. package/docs/functions/isOpenapiShorthand.html +0 -1
  241. package/docs/functions/maybeNullOpenapiShorthandToOpenapiShorthand.html +0 -1
  242. package/docs/functions/openapiShorthandToOpenapi.html +0 -1
  243. package/docs/types/DreamOrViewModelClassSerializerArrayKeys.html +0 -1
@@ -48,7 +48,6 @@ const DateTime_js_1 = require("./helpers/DateTime.js");
48
48
  const cachedTypeForAttribute_js_1 = require("./helpers/db/cachedTypeForAttribute.js");
49
49
  const isJsonColumn_js_1 = require("./helpers/db/types/isJsonColumn.js");
50
50
  const notEqual_js_1 = require("./helpers/notEqual.js");
51
- const typechecks_js_1 = require("./helpers/typechecks.js");
52
51
  class Dream {
53
52
  DB;
54
53
  /**
@@ -2077,7 +2076,7 @@ class Dream {
2077
2076
  ? null
2078
2077
  : val === undefined
2079
2078
  ? undefined
2080
- : (0, typechecks_js_1.isString)(val)
2079
+ : typeof val === 'string'
2081
2080
  ? val
2082
2081
  : JSON.stringify(val));
2083
2082
  },
@@ -2480,7 +2479,7 @@ class Dream {
2480
2479
  unknownValueToMillis(currentValue) {
2481
2480
  if (!currentValue)
2482
2481
  return;
2483
- if ((0, typechecks_js_1.isString)(currentValue))
2482
+ if (typeof currentValue === 'string')
2484
2483
  currentValue = DateTime_js_1.DateTime.fromISO(currentValue);
2485
2484
  if (currentValue instanceof CalendarDate_js_1.default)
2486
2485
  currentValue = currentValue.toDateTime();
@@ -2493,7 +2492,7 @@ class Dream {
2493
2492
  unknownValueToDateString(currentValue) {
2494
2493
  if (!currentValue)
2495
2494
  return;
2496
- if ((0, typechecks_js_1.isString)(currentValue))
2495
+ if (typeof currentValue === 'string')
2497
2496
  currentValue = CalendarDate_js_1.default.fromISO(currentValue);
2498
2497
  if (currentValue instanceof DateTime_js_1.DateTime)
2499
2498
  currentValue = CalendarDate_js_1.default.fromDateTime(currentValue);
@@ -32,13 +32,13 @@ const cloneDeepSafe_js_1 = require("../helpers/cloneDeepSafe.js");
32
32
  const compact_js_1 = require("../helpers/compact.js");
33
33
  const DateTime_js_1 = require("../helpers/DateTime.js");
34
34
  const isEmpty_js_1 = require("../helpers/isEmpty.js");
35
+ const isObject_js_1 = require("../helpers/isObject.js");
35
36
  const namespaceColumn_js_1 = require("../helpers/namespaceColumn.js");
36
37
  const normalizeString_js_1 = require("../helpers/normalizeString.js");
37
38
  const objectPathsToArrays_js_1 = require("../helpers/objectPathsToArrays.js");
38
39
  const protectAgainstPollutingAssignment_js_1 = require("../helpers/protectAgainstPollutingAssignment.js");
39
40
  const range_js_1 = require("../helpers/range.js");
40
41
  const snakeify_js_1 = require("../helpers/snakeify.js");
41
- const typechecks_js_1 = require("../helpers/typechecks.js");
42
42
  const uniq_js_1 = require("../helpers/uniq.js");
43
43
  const curried_ops_statement_js_1 = require("../ops/curried-ops-statement.js");
44
44
  const index_js_2 = require("../ops/index.js");
@@ -551,7 +551,7 @@ class Query extends ConnectedToDB_js_1.default {
551
551
  if (nextAssociationStatement === undefined) {
552
552
  // just satisfying typing
553
553
  }
554
- else if ((0, typechecks_js_1.isString)(nextAssociationStatement)) {
554
+ else if (typeof nextAssociationStatement === 'string') {
555
555
  const nextStatement = nextAssociationStatement;
556
556
  if (!joinStatements[nextStatement])
557
557
  joinStatements[(0, protectAgainstPollutingAssignment_js_1.default)(nextStatement)] = {};
@@ -573,7 +573,7 @@ class Query extends ConnectedToDB_js_1.default {
573
573
  });
574
574
  //
575
575
  }
576
- else if ((0, typechecks_js_1.isObject)(nextAssociationStatement) && previousAssociationName) {
576
+ else if ((0, isObject_js_1.default)(nextAssociationStatement) && previousAssociationName) {
577
577
  const clonedNextAssociationStatement = (0, cloneDeepSafe_js_1.default)(nextAssociationStatement);
578
578
  const keys = Object.keys(clonedNextAssociationStatement);
579
579
  keys.forEach((key) => {
@@ -908,7 +908,7 @@ class Query extends ConnectedToDB_js_1.default {
908
908
  order(arg) {
909
909
  if (arg === null)
910
910
  return this.clone({ order: null });
911
- if ((0, typechecks_js_1.isString)(arg))
911
+ if (typeof arg === 'string')
912
912
  return this.clone({ order: [{ column: arg, direction: 'asc' }] });
913
913
  let query = this.clone();
914
914
  Object.keys(arg).forEach(key => {
@@ -1190,7 +1190,7 @@ class Query extends ConnectedToDB_js_1.default {
1190
1190
  kyselyQuery = kyselyQuery.select(`${this.namespaceColumn(dbColumnName, association.through)} as ${columnAlias}`);
1191
1191
  };
1192
1192
  if (association.through && association.preloadThroughColumns) {
1193
- if ((0, typechecks_js_1.isObject)(association.preloadThroughColumns)) {
1193
+ if ((0, isObject_js_1.default)(association.preloadThroughColumns)) {
1194
1194
  const preloadMap = association.preloadThroughColumns;
1195
1195
  Object.keys(preloadMap).forEach(columnName => setupPreloadData(columnName));
1196
1196
  }
@@ -1302,7 +1302,7 @@ class Query extends ConnectedToDB_js_1.default {
1302
1302
  return;
1303
1303
  let columnNames = [];
1304
1304
  const columnNameToPreloadedThroughColumnNameMap = {};
1305
- if ((0, typechecks_js_1.isObject)(association.preloadThroughColumns)) {
1305
+ if ((0, isObject_js_1.default)(association.preloadThroughColumns)) {
1306
1306
  const preloadMap = association.preloadThroughColumns;
1307
1307
  columnNames = Object.keys(preloadMap).map(columnName => {
1308
1308
  columnNameToPreloadedThroughColumnNameMap[columnName] = preloadMap[columnName];
@@ -1935,7 +1935,7 @@ class Query extends ConnectedToDB_js_1.default {
1935
1935
  const columnsToPluck = dreamClassToHydrateColumns.map(column => this.namespaceColumn(column.toString(), alias));
1936
1936
  const asHasAssociation = association;
1937
1937
  if (asHasAssociation.through && asHasAssociation.preloadThroughColumns) {
1938
- if ((0, typechecks_js_1.isObject)(asHasAssociation.preloadThroughColumns)) {
1938
+ if ((0, isObject_js_1.default)(asHasAssociation.preloadThroughColumns)) {
1939
1939
  const preloadMap = asHasAssociation.preloadThroughColumns;
1940
1940
  Object.keys(preloadMap).forEach(preloadThroughColumn => {
1941
1941
  throughColumnsToHydrate.push(preloadMap[preloadThroughColumn]);
@@ -2364,7 +2364,7 @@ class Query extends ConnectedToDB_js_1.default {
2364
2364
  return query;
2365
2365
  let selectQuery = query;
2366
2366
  const orderStatement = association.order;
2367
- if ((0, typechecks_js_1.isString)(orderStatement)) {
2367
+ if (typeof orderStatement === 'string') {
2368
2368
  selectQuery = selectQuery.orderBy(this.namespaceColumn(orderStatement, tableNameOrAlias), 'asc');
2369
2369
  }
2370
2370
  else {
@@ -2501,7 +2501,11 @@ class Query extends ConnectedToDB_js_1.default {
2501
2501
  else if (Array.isArray(val)) {
2502
2502
  a = attr;
2503
2503
  b = 'in';
2504
- c = val.map(v => v instanceof DateTime_js_1.DateTime || v instanceof CalendarDate_js_1.default ? v.toSQL() : (0, typechecks_js_1.isString)(v) ? (0, normalizeString_js_1.default)(v) : v);
2504
+ c = val.map(v => v instanceof DateTime_js_1.DateTime || v instanceof CalendarDate_js_1.default
2505
+ ? v.toSQL()
2506
+ : typeof v === 'string'
2507
+ ? (0, normalizeString_js_1.default)(v)
2508
+ : v);
2505
2509
  }
2506
2510
  else if (val instanceof curried_ops_statement_js_1.default) {
2507
2511
  val = val.toOpsStatement(this.dreamClass, attr);
@@ -2544,11 +2548,11 @@ class Query extends ConnectedToDB_js_1.default {
2544
2548
  }
2545
2549
  if (c instanceof DateTime_js_1.DateTime || c instanceof CalendarDate_js_1.default)
2546
2550
  c = c.toSQL();
2547
- else if ((0, typechecks_js_1.isString)(c))
2551
+ else if (typeof c === 'string')
2548
2552
  c = (0, normalizeString_js_1.default)(c);
2549
2553
  if (c2 instanceof DateTime_js_1.DateTime || c2 instanceof CalendarDate_js_1.default)
2550
2554
  c2 = c2.toSQL();
2551
- else if ((0, typechecks_js_1.isString)(c2))
2555
+ else if (typeof c2 === 'string')
2552
2556
  c2 = (0, normalizeString_js_1.default)(c2);
2553
2557
  if (a && c === undefined)
2554
2558
  throw new CannotPassUndefinedAsAValueToAWhereClause_js_1.default(this.dreamClass, a);
@@ -6,8 +6,8 @@ const ConnectedToDB_js_1 = require("../../../db/ConnectedToDB.js");
6
6
  const validateColumn_js_1 = require("../../../db/validators/validateColumn.js");
7
7
  const validateTable_js_1 = require("../../../db/validators/validateTable.js");
8
8
  const validateTableAlias_js_1 = require("../../../db/validators/validateTableAlias.js");
9
+ const isObject_js_1 = require("../../../helpers/isObject.js");
9
10
  const namespaceColumn_js_1 = require("../../../helpers/namespaceColumn.js");
10
- const typechecks_js_1 = require("../../../helpers/typechecks.js");
11
11
  const constants_js_1 = require("../../constants.js");
12
12
  const similaritySelectSql_js_1 = require("./similaritySelectSql.js");
13
13
  const similarityWhereSql_js_1 = require("./similarityWhereSql.js");
@@ -193,7 +193,7 @@ class SimilarityBuilder extends ConnectedToDB_js_1.default {
193
193
  opsStatement: statementOrValueOrNestedObject,
194
194
  });
195
195
  }
196
- else if ((0, typechecks_js_1.isObject)(statementOrValueOrNestedObject) &&
196
+ else if ((0, isObject_js_1.default)(statementOrValueOrNestedObject) &&
197
197
  !statementOrValueOrNestedObject?.isOpsStatement) {
198
198
  // if it is an object, but not an array, it is likely a nested joins statement,
199
199
  // since joinsWhere objects can take a recursive shape, like:
@@ -319,7 +319,7 @@ function removeJoinAndFromObjectHierarchy(obj) {
319
319
  const result = {};
320
320
  for (const key in obj) {
321
321
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
322
- if ((0, typechecks_js_1.isObject)(obj[key])) {
322
+ if ((0, isObject_js_1.default)(obj[key])) {
323
323
  result[key] = removeJoinAndFromObjectHierarchy(obj[key].and || obj[key]);
324
324
  }
325
325
  else {
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = allNestedObjectKeys;
4
- const typechecks_js_1 = require("./typechecks.js");
4
+ const isObject_js_1 = require("./isObject.js");
5
5
  function allNestedObjectKeys(obj) {
6
6
  return Object.keys(obj).flatMap(key => {
7
7
  const next = obj[key];
8
- if ((0, typechecks_js_1.isObject)(next))
8
+ if ((0, isObject_js_1.default)(next))
9
9
  return [key, allNestedObjectKeys(next)].flat();
10
10
  return [key];
11
11
  });
@@ -5,8 +5,8 @@ exports.default = cloneDeepSafe;
5
5
  const ops_statement_js_1 = require("../ops/ops-statement.js");
6
6
  const CalendarDate_js_1 = require("./CalendarDate.js");
7
7
  const DateTime_js_1 = require("./DateTime.js");
8
+ const isObject_js_1 = require("./isObject.js");
8
9
  const range_js_1 = require("./range.js");
9
- const typechecks_js_1 = require("./typechecks.js");
10
10
  /**
11
11
  * Accepts any value and returns a valid clone of that object.
12
12
  * Dream instances, Query instances, and other special types are
@@ -43,7 +43,7 @@ function cloneDeepSafe(original, unsupportedTypeCloneFunction) {
43
43
  return original;
44
44
  if (Array.isArray(original))
45
45
  return original.map(value => cloneDeepSafe(value, unsupportedTypeCloneFunction));
46
- if ((0, typechecks_js_1.isObject)(original) && original.constructor.name === 'Object') {
46
+ if ((0, isObject_js_1.default)(original) && original.constructor.name === 'Object') {
47
47
  const clone = { ...original };
48
48
  Object.keys(clone).forEach(key => (clone[key] = cloneDeepSafe(clone[key], unsupportedTypeCloneFunction)));
49
49
  return clone;
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isString = isString;
4
- exports.isObject = isObject;
5
- function isString(x) {
6
- return typeof x === 'string' || x instanceof String;
7
- }
3
+ exports.default = isObject;
4
+ // also in Psychic
8
5
  function isObject(x) {
9
6
  if (x === null)
10
7
  return false;
11
- if (isString(x))
12
- return false;
13
8
  if (Array.isArray(x))
14
9
  return false;
15
10
  return typeof x === 'object';
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = normalizeString;
4
4
  const index_js_1 = require("../dream-app/index.js");
5
- const typechecks_js_1 = require("./typechecks.js");
6
5
  function normalizeString(val) {
7
6
  const normalizationForm = index_js_1.default.getOrFail().unicodeNormalization;
8
7
  if (normalizationForm === 'none')
9
8
  return val;
10
- return (0, typechecks_js_1.isString)(val) ? val.normalize(normalizationForm) : val;
9
+ return typeof val === 'string' ? val.normalize(normalizationForm) : val;
11
10
  }
@@ -6,7 +6,6 @@ const DateTime_js_1 = require("./DateTime.js");
6
6
  const isDatetimeOrDatetimeArrayColumn_js_1 = require("./db/types/isDatetimeOrDatetimeArrayColumn.js");
7
7
  const isTextOrTextArrayColumn_js_1 = require("./db/types/isTextOrTextArrayColumn.js");
8
8
  const normalizeString_js_1 = require("./normalizeString.js");
9
- const typechecks_js_1 = require("./typechecks.js");
10
9
  function sqlAttributes(dream) {
11
10
  const attributes = dream.dirtyAttributes();
12
11
  const dreamClass = dream.constructor;
@@ -42,5 +41,5 @@ function sqlAttributes(dream) {
42
41
  }, {});
43
42
  }
44
43
  function valueToDatetime(val) {
45
- return (0, typechecks_js_1.isString)(val) ? DateTime_js_1.DateTime.fromISO(val, { zone: 'UTC' }) : val;
44
+ return typeof val === 'string' ? DateTime_js_1.DateTime.fromISO(val, { zone: 'UTC' }) : val;
46
45
  }
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = stringCase;
4
4
  const CalendarDate_js_1 = require("./CalendarDate.js");
5
5
  const DateTime_js_1 = require("./DateTime.js");
6
- const typechecks_js_1 = require("./typechecks.js");
6
+ const isObject_js_1 = require("./isObject.js");
7
7
  function stringCase(target, stringCaser) {
8
- if ((0, typechecks_js_1.isString)(target))
8
+ if (typeof target === 'string')
9
9
  return stringCaser(target);
10
10
  return recursiveStringCase(target, stringCaser);
11
11
  }
@@ -14,11 +14,11 @@ function recursiveStringCase(target, stringCaser) {
14
14
  return null;
15
15
  if (target === undefined)
16
16
  return undefined;
17
- if ((0, typechecks_js_1.isString)(target))
17
+ if (typeof target === 'string')
18
18
  return target;
19
19
  if (Array.isArray(target))
20
20
  return target.map(s => recursiveStringCase(s, stringCaser));
21
- if ((0, typechecks_js_1.isObject)(target)) {
21
+ if ((0, isObject_js_1.default)(target)) {
22
22
  if (target instanceof DateTime_js_1.DateTime)
23
23
  return target;
24
24
  if (target instanceof CalendarDate_js_1.default)
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.range = exports.Range = exports.sharedPathPrefix = exports.relativeDreamPath = exports.dreamPath = exports.pascalize = exports.loadRepl = exports.isEmpty = exports.intersection = exports.hyphenize = exports.groupBy = exports.globalClassNameFromFullyQualifiedModelName = exports.Env = exports.DreamLogos = exports.DateTime = exports.compact = exports.cloneDeepSafe = exports.generateDream = exports.capitalize = exports.camelize = exports.CalendarDate = exports.Benchmark = exports.ValidationError = exports.RecordNotFound = exports.GlobalNameNotSet = exports.CreateOrFindByFailedToCreateAndFind = exports.NonLoadedAssociation = exports.Encrypt = exports.Query = exports.DreamTransaction = exports.openapiShorthandPrimitiveTypes = exports.openapiPrimitiveTypes = exports.DreamConst = exports.Dream = exports.DreamApp = exports.lookupClassByGlobalName = exports.DreamImporter = exports.Decorators = exports.STI = exports.SoftDelete = exports.ReplicaSafe = exports.validateTable = exports.validateColumn = exports.DreamMigrationHelpers = exports.untypedDb = exports.pgErrorType = exports.dreamDbConnections = exports.closeAllDbConnections = exports.DreamCLI = exports.DreamBin = void 0;
4
- exports.ObjectSerializerBuilder = exports.DreamSerializerBuilder = exports.ObjectSerializer = exports.DreamSerializer = exports.SerializerOpenapiRenderer = exports.serializerNameFromFullyQualifiedModelName = exports.isDreamSerializer = exports.inferSerializersFromDreamClassOrViewModelClass = exports.inferSerializerFromDreamOrViewModel = exports.ops = exports.openapiShorthandToOpenapi = exports.maybeNullOpenapiShorthandToOpenapiShorthand = exports.isOpenapiShorthand = exports.uniq = exports.uncapitalize = exports.standardizeFullyQualifiedModelName = exports.sortObjectByValue = exports.sortObjectByKey = exports.sortBy = exports.sort = exports.snakeify = exports.round = void 0;
4
+ exports.ObjectSerializerBuilder = exports.DreamSerializerBuilder = exports.ObjectSerializer = exports.DreamSerializer = exports.serializerNameFromFullyQualifiedModelName = exports.isDreamSerializer = exports.inferSerializersFromDreamClassOrViewModelClass = exports.inferSerializerFromDreamOrViewModel = exports.ops = exports.uniq = exports.uncapitalize = exports.expandStiClasses = exports.standardizeFullyQualifiedModelName = exports.sortObjectByValue = exports.sortObjectByKey = exports.sortBy = exports.sort = exports.snakeify = 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");
@@ -112,16 +112,12 @@ var sortObjectByValue_js_1 = require("./helpers/sortObjectByValue.js");
112
112
  Object.defineProperty(exports, "sortObjectByValue", { enumerable: true, get: function () { return sortObjectByValue_js_1.default; } });
113
113
  var standardizeFullyQualifiedModelName_js_1 = require("./helpers/standardizeFullyQualifiedModelName.js");
114
114
  Object.defineProperty(exports, "standardizeFullyQualifiedModelName", { enumerable: true, get: function () { return standardizeFullyQualifiedModelName_js_1.default; } });
115
+ var expandStiClasses_js_1 = require("./helpers/sti/expandStiClasses.js");
116
+ Object.defineProperty(exports, "expandStiClasses", { enumerable: true, get: function () { return expandStiClasses_js_1.default; } });
115
117
  var uncapitalize_js_1 = require("./helpers/uncapitalize.js");
116
118
  Object.defineProperty(exports, "uncapitalize", { enumerable: true, get: function () { return uncapitalize_js_1.default; } });
117
119
  var uniq_js_1 = require("./helpers/uniq.js");
118
120
  Object.defineProperty(exports, "uniq", { enumerable: true, get: function () { return uniq_js_1.default; } });
119
- var isOpenapiShorthand_js_1 = require("./openapi/isOpenapiShorthand.js");
120
- Object.defineProperty(exports, "isOpenapiShorthand", { enumerable: true, get: function () { return isOpenapiShorthand_js_1.default; } });
121
- var maybeNullOpenapiShorthandToOpenapiShorthand_js_1 = require("./openapi/maybeNullOpenapiShorthandToOpenapiShorthand.js");
122
- Object.defineProperty(exports, "maybeNullOpenapiShorthandToOpenapiShorthand", { enumerable: true, get: function () { return maybeNullOpenapiShorthandToOpenapiShorthand_js_1.default; } });
123
- var openapiShorthandToOpenapi_js_1 = require("./openapi/openapiShorthandToOpenapi.js");
124
- Object.defineProperty(exports, "openapiShorthandToOpenapi", { enumerable: true, get: function () { return openapiShorthandToOpenapi_js_1.default; } });
125
121
  var index_js_6 = require("./ops/index.js");
126
122
  Object.defineProperty(exports, "ops", { enumerable: true, get: function () { return index_js_6.default; } });
127
123
  var inferSerializerFromDreamOrViewModel_js_1 = require("./serializer/helpers/inferSerializerFromDreamOrViewModel.js");
@@ -131,8 +127,6 @@ var isDreamSerializer_js_1 = require("./serializer/helpers/isDreamSerializer.js"
131
127
  Object.defineProperty(exports, "isDreamSerializer", { enumerable: true, get: function () { return isDreamSerializer_js_1.default; } });
132
128
  var serializerNameFromFullyQualifiedModelName_js_1 = require("./serializer/helpers/serializerNameFromFullyQualifiedModelName.js");
133
129
  Object.defineProperty(exports, "serializerNameFromFullyQualifiedModelName", { enumerable: true, get: function () { return serializerNameFromFullyQualifiedModelName_js_1.default; } });
134
- var SerializerOpenapiRenderer_js_1 = require("./serializer/SerializerOpenapiRenderer.js");
135
- Object.defineProperty(exports, "SerializerOpenapiRenderer", { enumerable: true, get: function () { return SerializerOpenapiRenderer_js_1.default; } });
136
130
  var DreamSerializer_js_1 = require("./serializer/DreamSerializer.js");
137
131
  Object.defineProperty(exports, "DreamSerializer", { enumerable: true, get: function () { return DreamSerializer_js_1.default; } });
138
132
  var ObjectSerializer_js_1 = require("./serializer/ObjectSerializer.js");
@@ -46,7 +46,6 @@ import { DateTime } from './helpers/DateTime.js';
46
46
  import cachedTypeForAttribute from './helpers/db/cachedTypeForAttribute.js';
47
47
  import isJsonColumn from './helpers/db/types/isJsonColumn.js';
48
48
  import notEqual from './helpers/notEqual.js';
49
- import { isString } from './helpers/typechecks.js';
50
49
  export default class Dream {
51
50
  DB;
52
51
  /**
@@ -2075,7 +2074,7 @@ export default class Dream {
2075
2074
  ? null
2076
2075
  : val === undefined
2077
2076
  ? undefined
2078
- : isString(val)
2077
+ : typeof val === 'string'
2079
2078
  ? val
2080
2079
  : JSON.stringify(val));
2081
2080
  },
@@ -2478,7 +2477,7 @@ export default class Dream {
2478
2477
  unknownValueToMillis(currentValue) {
2479
2478
  if (!currentValue)
2480
2479
  return;
2481
- if (isString(currentValue))
2480
+ if (typeof currentValue === 'string')
2482
2481
  currentValue = DateTime.fromISO(currentValue);
2483
2482
  if (currentValue instanceof CalendarDate)
2484
2483
  currentValue = currentValue.toDateTime();
@@ -2491,7 +2490,7 @@ export default class Dream {
2491
2490
  unknownValueToDateString(currentValue) {
2492
2491
  if (!currentValue)
2493
2492
  return;
2494
- if (isString(currentValue))
2493
+ if (typeof currentValue === 'string')
2495
2494
  currentValue = CalendarDate.fromISO(currentValue);
2496
2495
  if (currentValue instanceof DateTime)
2497
2496
  currentValue = CalendarDate.fromDateTime(currentValue);
@@ -30,13 +30,13 @@ import cloneDeepSafe from '../helpers/cloneDeepSafe.js';
30
30
  import compact from '../helpers/compact.js';
31
31
  import { DateTime } from '../helpers/DateTime.js';
32
32
  import isEmpty from '../helpers/isEmpty.js';
33
+ import isObject from '../helpers/isObject.js';
33
34
  import namespaceColumn from '../helpers/namespaceColumn.js';
34
35
  import normalizeString from '../helpers/normalizeString.js';
35
36
  import objectPathsToArrays from '../helpers/objectPathsToArrays.js';
36
37
  import protectAgainstPollutingAssignment from '../helpers/protectAgainstPollutingAssignment.js';
37
38
  import { Range } from '../helpers/range.js';
38
39
  import snakeify from '../helpers/snakeify.js';
39
- import { isObject, isString } from '../helpers/typechecks.js';
40
40
  import uniq from '../helpers/uniq.js';
41
41
  import CurriedOpsStatement from '../ops/curried-ops-statement.js';
42
42
  import ops from '../ops/index.js';
@@ -549,7 +549,7 @@ export default class Query extends ConnectedToDB {
549
549
  if (nextAssociationStatement === undefined) {
550
550
  // just satisfying typing
551
551
  }
552
- else if (isString(nextAssociationStatement)) {
552
+ else if (typeof nextAssociationStatement === 'string') {
553
553
  const nextStatement = nextAssociationStatement;
554
554
  if (!joinStatements[nextStatement])
555
555
  joinStatements[protectAgainstPollutingAssignment(nextStatement)] = {};
@@ -906,7 +906,7 @@ export default class Query extends ConnectedToDB {
906
906
  order(arg) {
907
907
  if (arg === null)
908
908
  return this.clone({ order: null });
909
- if (isString(arg))
909
+ if (typeof arg === 'string')
910
910
  return this.clone({ order: [{ column: arg, direction: 'asc' }] });
911
911
  let query = this.clone();
912
912
  Object.keys(arg).forEach(key => {
@@ -2362,7 +2362,7 @@ export default class Query extends ConnectedToDB {
2362
2362
  return query;
2363
2363
  let selectQuery = query;
2364
2364
  const orderStatement = association.order;
2365
- if (isString(orderStatement)) {
2365
+ if (typeof orderStatement === 'string') {
2366
2366
  selectQuery = selectQuery.orderBy(this.namespaceColumn(orderStatement, tableNameOrAlias), 'asc');
2367
2367
  }
2368
2368
  else {
@@ -2499,7 +2499,11 @@ export default class Query extends ConnectedToDB {
2499
2499
  else if (Array.isArray(val)) {
2500
2500
  a = attr;
2501
2501
  b = 'in';
2502
- c = val.map(v => v instanceof DateTime || v instanceof CalendarDate ? v.toSQL() : isString(v) ? normalizeString(v) : v);
2502
+ c = val.map(v => v instanceof DateTime || v instanceof CalendarDate
2503
+ ? v.toSQL()
2504
+ : typeof v === 'string'
2505
+ ? normalizeString(v)
2506
+ : v);
2503
2507
  }
2504
2508
  else if (val instanceof CurriedOpsStatement) {
2505
2509
  val = val.toOpsStatement(this.dreamClass, attr);
@@ -2542,11 +2546,11 @@ export default class Query extends ConnectedToDB {
2542
2546
  }
2543
2547
  if (c instanceof DateTime || c instanceof CalendarDate)
2544
2548
  c = c.toSQL();
2545
- else if (isString(c))
2549
+ else if (typeof c === 'string')
2546
2550
  c = normalizeString(c);
2547
2551
  if (c2 instanceof DateTime || c2 instanceof CalendarDate)
2548
2552
  c2 = c2.toSQL();
2549
- else if (isString(c2))
2553
+ else if (typeof c2 === 'string')
2550
2554
  c2 = normalizeString(c2);
2551
2555
  if (a && c === undefined)
2552
2556
  throw new CannotPassUndefinedAsAValueToAWhereClause(this.dreamClass, a);
@@ -3,8 +3,8 @@ import ConnectedToDB from '../../../db/ConnectedToDB.js';
3
3
  import validateColumn from '../../../db/validators/validateColumn.js';
4
4
  import validateTable from '../../../db/validators/validateTable.js';
5
5
  import validateTableAlias from '../../../db/validators/validateTableAlias.js';
6
+ import isObject from '../../../helpers/isObject.js';
6
7
  import namespaceColumn from '../../../helpers/namespaceColumn.js';
7
- import { isObject } from '../../../helpers/typechecks.js';
8
8
  import { TRIGRAM_OPERATORS } from '../../constants.js';
9
9
  import similaritySelectSql from './similaritySelectSql.js';
10
10
  import similarityWhereSql from './similarityWhereSql.js';
@@ -1,4 +1,4 @@
1
- import { isObject } from './typechecks.js';
1
+ import isObject from './isObject.js';
2
2
  export default function allNestedObjectKeys(obj) {
3
3
  return Object.keys(obj).flatMap(key => {
4
4
  const next = obj[key];
@@ -1,8 +1,8 @@
1
1
  import OpsStatement from '../ops/ops-statement.js';
2
2
  import CalendarDate from './CalendarDate.js';
3
3
  import { DateTime } from './DateTime.js';
4
+ import isObject from './isObject.js';
4
5
  import { Range } from './range.js';
5
- import { isObject } from './typechecks.js';
6
6
  /**
7
7
  * Accepts any value and returns a valid clone of that object.
8
8
  * Dream instances, Query instances, and other special types are
@@ -0,0 +1,8 @@
1
+ // also in Psychic
2
+ export default function isObject(x) {
3
+ if (x === null)
4
+ return false;
5
+ if (Array.isArray(x))
6
+ return false;
7
+ return typeof x === 'object';
8
+ }
@@ -1,8 +1,7 @@
1
1
  import DreamApp from '../dream-app/index.js';
2
- import { isString } from './typechecks.js';
3
2
  export default function normalizeString(val) {
4
3
  const normalizationForm = DreamApp.getOrFail().unicodeNormalization;
5
4
  if (normalizationForm === 'none')
6
5
  return val;
7
- return isString(val) ? val.normalize(normalizationForm) : val;
6
+ return typeof val === 'string' ? val.normalize(normalizationForm) : val;
8
7
  }
@@ -3,7 +3,6 @@ import { DateTime } from './DateTime.js';
3
3
  import isDatetimeOrDatetimeArrayColumn from './db/types/isDatetimeOrDatetimeArrayColumn.js';
4
4
  import isTextOrTextArrayColumn from './db/types/isTextOrTextArrayColumn.js';
5
5
  import normalizeString from './normalizeString.js';
6
- import { isString } from './typechecks.js';
7
6
  export default function sqlAttributes(dream) {
8
7
  const attributes = dream.dirtyAttributes();
9
8
  const dreamClass = dream.constructor;
@@ -39,5 +38,5 @@ export default function sqlAttributes(dream) {
39
38
  }, {});
40
39
  }
41
40
  function valueToDatetime(val) {
42
- return isString(val) ? DateTime.fromISO(val, { zone: 'UTC' }) : val;
41
+ return typeof val === 'string' ? DateTime.fromISO(val, { zone: 'UTC' }) : val;
43
42
  }
@@ -1,8 +1,8 @@
1
1
  import CalendarDate from './CalendarDate.js';
2
2
  import { DateTime } from './DateTime.js';
3
- import { isObject, isString } from './typechecks.js';
3
+ import isObject from './isObject.js';
4
4
  export default function stringCase(target, stringCaser) {
5
- if (isString(target))
5
+ if (typeof target === 'string')
6
6
  return stringCaser(target);
7
7
  return recursiveStringCase(target, stringCaser);
8
8
  }
@@ -11,7 +11,7 @@ function recursiveStringCase(target, stringCaser) {
11
11
  return null;
12
12
  if (target === undefined)
13
13
  return undefined;
14
- if (isString(target))
14
+ if (typeof target === 'string')
15
15
  return target;
16
16
  if (Array.isArray(target))
17
17
  return target.map(s => recursiveStringCase(s, stringCaser));
@@ -51,16 +51,13 @@ export { default as sortBy } from './helpers/sortBy.js';
51
51
  export { default as sortObjectByKey } from './helpers/sortObjectByKey.js';
52
52
  export { default as sortObjectByValue } from './helpers/sortObjectByValue.js';
53
53
  export { default as standardizeFullyQualifiedModelName } from './helpers/standardizeFullyQualifiedModelName.js';
54
+ export { default as expandStiClasses } from './helpers/sti/expandStiClasses.js';
54
55
  export { default as uncapitalize } from './helpers/uncapitalize.js';
55
56
  export { default as uniq } from './helpers/uniq.js';
56
- export { default as isOpenapiShorthand } from './openapi/isOpenapiShorthand.js';
57
- export { default as maybeNullOpenapiShorthandToOpenapiShorthand } from './openapi/maybeNullOpenapiShorthandToOpenapiShorthand.js';
58
- export { default as openapiShorthandToOpenapi } from './openapi/openapiShorthandToOpenapi.js';
59
57
  export { default as ops } from './ops/index.js';
60
58
  export { default as inferSerializerFromDreamOrViewModel, inferSerializersFromDreamClassOrViewModelClass, } from './serializer/helpers/inferSerializerFromDreamOrViewModel.js';
61
59
  export { default as isDreamSerializer } from './serializer/helpers/isDreamSerializer.js';
62
60
  export { default as serializerNameFromFullyQualifiedModelName } from './serializer/helpers/serializerNameFromFullyQualifiedModelName.js';
63
- export { default as SerializerOpenapiRenderer } from './serializer/SerializerOpenapiRenderer.js';
64
61
  export { default as DreamSerializer } from './serializer/DreamSerializer.js';
65
62
  export { default as ObjectSerializer } from './serializer/ObjectSerializer.js';
66
63
  export { default as DreamSerializerBuilder } from './serializer/builders/DreamSerializerBuilder.js';
@@ -0,0 +1 @@
1
+ export default function isObject(x: any): boolean;
@@ -52,25 +52,22 @@ export { default as sortBy } from './helpers/sortBy.js';
52
52
  export { default as sortObjectByKey } from './helpers/sortObjectByKey.js';
53
53
  export { default as sortObjectByValue } from './helpers/sortObjectByValue.js';
54
54
  export { default as standardizeFullyQualifiedModelName } from './helpers/standardizeFullyQualifiedModelName.js';
55
+ export { default as expandStiClasses } from './helpers/sti/expandStiClasses.js';
55
56
  export { type Camelized, type Hyphenized, type Pascalized, type Snakeified } from './helpers/stringCasing.js';
56
57
  export { default as uncapitalize } from './helpers/uncapitalize.js';
57
58
  export { default as uniq } from './helpers/uniq.js';
58
- export { default as isOpenapiShorthand } from './openapi/isOpenapiShorthand.js';
59
- export { default as maybeNullOpenapiShorthandToOpenapiShorthand } from './openapi/maybeNullOpenapiShorthandToOpenapiShorthand.js';
60
- export { default as openapiShorthandToOpenapi } from './openapi/openapiShorthandToOpenapi.js';
61
59
  export { default as ops } from './ops/index.js';
62
60
  export { default as inferSerializerFromDreamOrViewModel, inferSerializersFromDreamClassOrViewModelClass, } from './serializer/helpers/inferSerializerFromDreamOrViewModel.js';
63
61
  export { default as isDreamSerializer } from './serializer/helpers/isDreamSerializer.js';
64
62
  export { default as serializerNameFromFullyQualifiedModelName } from './serializer/helpers/serializerNameFromFullyQualifiedModelName.js';
65
- export { default as SerializerOpenapiRenderer } from './serializer/SerializerOpenapiRenderer.js';
66
63
  export { type SerializerRendererOpts } from './serializer/SerializerRenderer.js';
67
64
  export { default as DreamSerializer } from './serializer/DreamSerializer.js';
68
65
  export { default as ObjectSerializer } from './serializer/ObjectSerializer.js';
69
66
  export { default as DreamSerializerBuilder } from './serializer/builders/DreamSerializerBuilder.js';
70
67
  export { default as ObjectSerializerBuilder } from './serializer/builders/ObjectSerializerBuilder.js';
71
68
  export { type WhereStatementForDream, type WhereStatementForDreamClass } from './types/associations/shared.js';
72
- export { type DbConnectionType } from './types/db.js';
73
- export { type DreamAssociationMetadata, type DreamAttributes, type DreamClassColumn, type DreamColumn, type DreamColumnNames, type DreamOrViewModelClassSerializerArrayKeys, type DreamOrViewModelClassSerializerKey, type DreamOrViewModelSerializerKey, type DreamParamSafeAttributes, type DreamParamSafeColumnNames, type DreamSerializable, type DreamSerializableArray, type DreamSerializerKey, type DreamSerializers, type DreamTableSchema, type DreamVirtualColumns, type IdType, type PrimaryKeyType, type Timestamp, type UpdateableAssociationProperties, type UpdateableProperties, type ViewModel, type ViewModelClass, } from './types/dream.js';
74
- export { type CommonOpenapiSchemaObjectFields, type OpenapiAllTypes, type OpenapiFormats, type OpenapiNumberFormats, type OpenapiPrimitiveBaseTypes, 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 OpenapiSchemaPrimitiveGeneric, type OpenapiSchemaProperties, type OpenapiSchemaPropertiesShorthand, type OpenapiSchemaShorthandExpressionAllOf, type OpenapiSchemaShorthandExpressionAnyOf, type OpenapiSchemaShorthandExpressionOneOf, type OpenapiSchemaShorthandExpressionSerializableRef, type OpenapiSchemaShorthandExpressionSerializerRef, type OpenapiSchemaShorthandPrimitiveGeneric, type OpenapiSchemaString, type OpenapiShorthandAllTypes, type OpenapiShorthandPrimitiveBaseTypes, type OpenapiShorthandPrimitiveTypes, type OpenapiTypeField, type OpenapiTypeFieldObject, } from './types/openapi.js';
75
- export { type DreamModelSerializerType, type SerializerCasing, type SimpleObjectSerializerType, } from './types/serializer.js';
69
+ export { type DbConnectionType, type DbTypes } from './types/db.js';
70
+ export { type DreamAssociationMetadata, type DreamAttributes, type DreamClassColumn, type DreamColumn, type DreamColumnNames, type DreamOrViewModelClassSerializerKey, type DreamOrViewModelSerializerKey, type DreamParamSafeAttributes, type DreamParamSafeColumnNames, type DreamSerializable, type DreamSerializableArray, type DreamSerializerKey, type DreamSerializers, type DreamTableSchema, type DreamVirtualColumns, type IdType, type PrimaryKeyType, type Timestamp, type UpdateableAssociationProperties, type UpdateableProperties, type ViewModel, type ViewModelClass, } from './types/dream.js';
71
+ export { type CommonOpenapiSchemaObjectFields, type OpenapiAllTypes, type OpenapiDescription, type OpenapiFormats, type OpenapiNumberFormats, type OpenapiPrimitiveBaseTypes, 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 OpenapiSchemaPrimitiveGeneric, type OpenapiSchemaProperties, type OpenapiSchemaPropertiesShorthand, type OpenapiSchemaShorthandExpressionAllOf, type OpenapiSchemaShorthandExpressionAnyOf, type OpenapiSchemaShorthandExpressionOneOf, type OpenapiSchemaShorthandExpressionSerializableRef, type OpenapiSchemaShorthandExpressionSerializerRef, type OpenapiSchemaShorthandPrimitiveGeneric, type OpenapiSchemaString, type OpenapiShorthandAllTypes, type OpenapiShorthandPrimitiveBaseTypes, type OpenapiShorthandPrimitiveTypes, type OpenapiTypeField, type OpenapiTypeFieldObject, } from './types/openapi.js';
72
+ export { type DreamModelSerializerType, type InternalAnyTypedSerializerRendersMany, type InternalAnyTypedSerializerRendersOne, type SerializerCasing, type SimpleObjectSerializerType, } from './types/serializer.js';
76
73
  export { type ValidationType } from './types/validation.js';
@@ -1,3 +1,2 @@
1
- import Dream from '../Dream.js';
2
1
  import ObjectSerializerBuilder from './builders/ObjectSerializerBuilder.js';
3
- export default function ObjectSerializer<DataType extends object | null, PassthroughDataType extends object | undefined = undefined>(data: DataType extends Dream ? never : DataType, passthroughData?: PassthroughDataType): ObjectSerializerBuilder<DataType, PassthroughDataType, Exclude<DataType, null>>;
2
+ export default function ObjectSerializer<DataType extends object | null, PassthroughDataType extends object | undefined = undefined>(data: DataType, passthroughData?: PassthroughDataType): ObjectSerializerBuilder<DataType, PassthroughDataType, Exclude<DataType, null>>;
@@ -26,12 +26,12 @@ export default class ObjectSerializerBuilder<MaybeNullDataType extends object |
26
26
  serializer: SerializerType<AssociatedModelType>;
27
27
  } : AssociatedModelType extends object ? {
28
28
  serializer: SerializerType<AssociatedModelType>;
29
- } : object, Options extends {
29
+ } : never, Options extends {
30
30
  as?: string;
31
31
  flatten?: boolean;
32
32
  optional?: boolean;
33
- } & SerializerOptions>(name: AttributeName, options?: Options): this;
34
- rendersMany<AttributeName extends keyof DataType & string, AssociatedModelType extends DataType[AttributeName] extends (Dream | ViewModel)[] ? DataType[AttributeName] extends (infer U)[] ? U : object : object, SerializerOptions extends AssociatedModelType extends Dream ? {
33
+ } & SerializerOptions>(name: AttributeName, options: Options): this;
34
+ rendersMany<AttributeName extends keyof DataType & string, AssociatedModelType extends DataType[AttributeName] extends (Dream | ViewModel | object)[] ? DataType[AttributeName] extends (infer U)[] ? U : never : never, SerializerOptions extends AssociatedModelType extends Dream ? {
35
35
  dreamClass: typeof Dream;
36
36
  serializerKey?: DreamOrViewModelSerializerKey<AssociatedModelType>;
37
37
  } | {
@@ -43,8 +43,8 @@ export default class ObjectSerializerBuilder<MaybeNullDataType extends object |
43
43
  serializer: SerializerType<AssociatedModelType>;
44
44
  } : AssociatedModelType extends object ? {
45
45
  serializer: SerializerType<AssociatedModelType>;
46
- } : object, Options extends {
46
+ } : never, Options extends {
47
47
  as?: string;
48
- } & SerializerOptions>(name: AttributeName, options?: Options): this;
48
+ } & SerializerOptions>(name: AttributeName, options: Options): this;
49
49
  render(passthrough?: any, opts?: SerializerRendererOpts): Record<string, any> | null;
50
50
  }