@rvoh/dream 0.40.7 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/cjs/src/helpers/cli/SchemaBuilder.js +28 -25
  2. package/dist/cjs/src/helpers/comparisonKey.js +10 -0
  3. package/dist/cjs/src/helpers/intersection.js +14 -0
  4. package/dist/cjs/src/helpers/uniq.js +4 -9
  5. package/dist/cjs/src/index.js +4 -2
  6. package/dist/esm/src/helpers/cli/SchemaBuilder.js +28 -25
  7. package/dist/esm/src/helpers/comparisonKey.js +7 -0
  8. package/dist/esm/src/helpers/intersection.js +11 -0
  9. package/dist/esm/src/helpers/uniq.js +4 -9
  10. package/dist/esm/src/index.js +1 -0
  11. package/dist/types/src/helpers/cli/SchemaBuilder.d.ts +0 -1
  12. package/dist/types/src/helpers/comparisonKey.d.ts +1 -0
  13. package/dist/types/src/helpers/inferSerializerFromDreamOrViewModel.d.ts +3 -3
  14. package/dist/types/src/helpers/intersection.d.ts +1 -0
  15. package/dist/types/src/index.d.ts +2 -1
  16. package/dist/types/src/types/dream.d.ts +8 -6
  17. package/dist/types/src/types/dream.ts +29 -19
  18. package/dist/types/src/types/openapi.d.ts +2 -2
  19. package/dist/types/src/types/openapi.ts +2 -2
  20. package/docs/assets/navigation.js +1 -1
  21. package/docs/assets/search.js +1 -1
  22. package/docs/classes/Benchmark.html +2 -2
  23. package/docs/classes/CalendarDate.html +2 -2
  24. package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +3 -3
  25. package/docs/classes/Decorators.html +19 -19
  26. package/docs/classes/Dream.html +129 -129
  27. package/docs/classes/DreamApp.html +4 -4
  28. package/docs/classes/DreamBin.html +2 -2
  29. package/docs/classes/DreamCLI.html +4 -4
  30. package/docs/classes/DreamImporter.html +2 -2
  31. package/docs/classes/DreamLogos.html +2 -2
  32. package/docs/classes/DreamMigrationHelpers.html +7 -7
  33. package/docs/classes/DreamSerializer.html +2 -2
  34. package/docs/classes/DreamTransaction.html +2 -2
  35. package/docs/classes/Encrypt.html +2 -2
  36. package/docs/classes/Env.html +2 -2
  37. package/docs/classes/GlobalNameNotSet.html +3 -3
  38. package/docs/classes/NonLoadedAssociation.html +3 -3
  39. package/docs/classes/Query.html +50 -50
  40. package/docs/classes/Range.html +2 -2
  41. package/docs/classes/RecordNotFound.html +3 -3
  42. package/docs/classes/ValidationError.html +3 -3
  43. package/docs/functions/Attribute.html +1 -1
  44. package/docs/functions/RendersMany.html +1 -1
  45. package/docs/functions/RendersOne.html +1 -1
  46. package/docs/functions/ReplicaSafe.html +1 -1
  47. package/docs/functions/STI.html +1 -1
  48. package/docs/functions/SoftDelete.html +1 -1
  49. package/docs/functions/camelize.html +1 -1
  50. package/docs/functions/capitalize.html +1 -1
  51. package/docs/functions/closeAllDbConnections.html +1 -1
  52. package/docs/functions/compact.html +1 -1
  53. package/docs/functions/dreamDbConnections.html +1 -1
  54. package/docs/functions/dreamPath.html +1 -1
  55. package/docs/functions/generateDream.html +1 -1
  56. package/docs/functions/globalClassNameFromFullyQualifiedModelName.html +1 -1
  57. package/docs/functions/hyphenize.html +1 -1
  58. package/docs/functions/inferSerializerFromDreamClassOrViewModelClass.html +1 -1
  59. package/docs/functions/inferSerializerFromDreamOrViewModel.html +1 -1
  60. package/docs/functions/intersection.html +1 -0
  61. package/docs/functions/isEmpty.html +1 -1
  62. package/docs/functions/loadRepl.html +1 -1
  63. package/docs/functions/lookupClassByGlobalName.html +1 -1
  64. package/docs/functions/pascalize.html +1 -1
  65. package/docs/functions/pgErrorType.html +1 -1
  66. package/docs/functions/range-1.html +1 -1
  67. package/docs/functions/relativeDreamPath.html +1 -1
  68. package/docs/functions/round.html +1 -1
  69. package/docs/functions/serializerNameFromFullyQualifiedModelName.html +1 -1
  70. package/docs/functions/sharedPathPrefix.html +1 -1
  71. package/docs/functions/snakeify.html +1 -1
  72. package/docs/functions/sort.html +1 -1
  73. package/docs/functions/sortBy.html +1 -1
  74. package/docs/functions/standardizeFullyQualifiedModelName.html +1 -1
  75. package/docs/functions/uncapitalize.html +1 -1
  76. package/docs/functions/uniq.html +1 -1
  77. package/docs/functions/untypedDb.html +1 -1
  78. package/docs/functions/validateColumn.html +1 -1
  79. package/docs/functions/validateTable.html +1 -1
  80. package/docs/interfaces/AttributeStatement.html +2 -2
  81. package/docs/interfaces/DecoratorContext.html +2 -2
  82. package/docs/interfaces/DreamAppInitOptions.html +2 -2
  83. package/docs/interfaces/DreamAppOpts.html +2 -2
  84. package/docs/interfaces/DreamSerializerAssociationStatement.html +2 -2
  85. package/docs/interfaces/EncryptOptions.html +2 -2
  86. package/docs/interfaces/OpenapiSchemaProperties.html +1 -1
  87. package/docs/interfaces/OpenapiSchemaPropertiesShorthand.html +1 -1
  88. package/docs/interfaces/OpenapiTypeFieldObject.html +1 -1
  89. package/docs/modules.html +7 -3
  90. package/docs/types/Camelized.html +1 -1
  91. package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
  92. package/docs/types/DateTime.html +1 -1
  93. package/docs/types/DbConnectionType.html +1 -1
  94. package/docs/types/DreamAssociationMetadata.html +1 -1
  95. package/docs/types/DreamAttributes.html +1 -1
  96. package/docs/types/DreamClassColumn.html +1 -1
  97. package/docs/types/DreamColumn.html +1 -1
  98. package/docs/types/DreamColumnNames.html +1 -1
  99. package/docs/types/DreamLogLevel.html +1 -1
  100. package/docs/types/DreamLogger.html +1 -1
  101. package/docs/types/DreamOrViewModelClassSerializerArrayKeys.html +1 -0
  102. package/docs/types/DreamOrViewModelClassSerializerKey.html +1 -0
  103. package/docs/types/DreamOrViewModelSerializerKey.html +1 -1
  104. package/docs/types/DreamParamSafeAttributes.html +1 -1
  105. package/docs/types/DreamParamSafeColumnNames.html +1 -1
  106. package/docs/types/DreamSerializable.html +1 -0
  107. package/docs/types/DreamSerializableArray.html +1 -0
  108. package/docs/types/DreamSerializerKey.html +1 -1
  109. package/docs/types/DreamSerializers.html +1 -1
  110. package/docs/types/DreamTableSchema.html +1 -1
  111. package/docs/types/DreamVirtualColumns.html +1 -1
  112. package/docs/types/EncryptAlgorithm.html +1 -1
  113. package/docs/types/Hyphenized.html +1 -1
  114. package/docs/types/IdType.html +1 -1
  115. package/docs/types/OpenapiAllTypes.html +1 -1
  116. package/docs/types/OpenapiFormats.html +1 -1
  117. package/docs/types/OpenapiNumberFormats.html +1 -1
  118. package/docs/types/OpenapiPrimitiveTypes.html +1 -1
  119. package/docs/types/OpenapiSchemaArray.html +1 -1
  120. package/docs/types/OpenapiSchemaArrayShorthand.html +1 -1
  121. package/docs/types/OpenapiSchemaBase.html +1 -1
  122. package/docs/types/OpenapiSchemaBody.html +1 -1
  123. package/docs/types/OpenapiSchemaBodyShorthand.html +1 -1
  124. package/docs/types/OpenapiSchemaCommonFields.html +1 -1
  125. package/docs/types/OpenapiSchemaExpressionAllOf.html +1 -1
  126. package/docs/types/OpenapiSchemaExpressionAnyOf.html +1 -1
  127. package/docs/types/OpenapiSchemaExpressionOneOf.html +1 -1
  128. package/docs/types/OpenapiSchemaExpressionRef.html +1 -1
  129. package/docs/types/OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
  130. package/docs/types/OpenapiSchemaInteger.html +1 -1
  131. package/docs/types/OpenapiSchemaNull.html +1 -1
  132. package/docs/types/OpenapiSchemaNumber.html +1 -1
  133. package/docs/types/OpenapiSchemaObject.html +1 -1
  134. package/docs/types/OpenapiSchemaObjectAllOf.html +1 -1
  135. package/docs/types/OpenapiSchemaObjectAllOfShorthand.html +1 -1
  136. package/docs/types/OpenapiSchemaObjectAnyOf.html +1 -1
  137. package/docs/types/OpenapiSchemaObjectAnyOfShorthand.html +1 -1
  138. package/docs/types/OpenapiSchemaObjectBase.html +1 -1
  139. package/docs/types/OpenapiSchemaObjectBaseShorthand.html +1 -1
  140. package/docs/types/OpenapiSchemaObjectOneOf.html +1 -1
  141. package/docs/types/OpenapiSchemaObjectOneOfShorthand.html +1 -1
  142. package/docs/types/OpenapiSchemaObjectShorthand.html +1 -1
  143. package/docs/types/OpenapiSchemaPrimitiveGeneric.html +1 -1
  144. package/docs/types/OpenapiSchemaShorthandExpressionAllOf.html +1 -1
  145. package/docs/types/OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
  146. package/docs/types/OpenapiSchemaShorthandExpressionOneOf.html +1 -1
  147. package/docs/types/OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
  148. package/docs/types/OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
  149. package/docs/types/OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
  150. package/docs/types/OpenapiSchemaString.html +1 -1
  151. package/docs/types/OpenapiShorthandAllTypes.html +1 -1
  152. package/docs/types/OpenapiShorthandPrimitiveTypes.html +1 -1
  153. package/docs/types/OpenapiTypeField.html +1 -1
  154. package/docs/types/Pascalized.html +1 -1
  155. package/docs/types/PrimaryKeyType.html +1 -1
  156. package/docs/types/RoundingPrecision.html +1 -1
  157. package/docs/types/SerializableClassOrSerializerCallback.html +1 -1
  158. package/docs/types/SerializableTypes.html +1 -1
  159. package/docs/types/Snakeified.html +1 -1
  160. package/docs/types/Timestamp.html +1 -1
  161. package/docs/types/UpdateableAssociationProperties.html +1 -1
  162. package/docs/types/UpdateableProperties.html +1 -1
  163. package/docs/types/ValidationType.html +1 -1
  164. package/docs/types/ViewModel.html +1 -0
  165. package/docs/types/ViewModelClass.html +1 -0
  166. package/docs/types/WhereStatementForDream.html +1 -1
  167. package/docs/types/WhereStatementForDreamClass.html +1 -1
  168. package/docs/variables/DateTime-1.html +1 -1
  169. package/docs/variables/DreamConst.html +1 -1
  170. package/docs/variables/TRIGRAM_OPERATORS.html +1 -1
  171. package/docs/variables/openapiPrimitiveTypes-1.html +1 -1
  172. package/docs/variables/openapiShorthandPrimitiveTypes-1.html +1 -1
  173. package/docs/variables/ops.html +1 -1
  174. package/docs/variables/primaryKeyTypes.html +1 -1
  175. package/package.json +1 -1
  176. package/docs/types/SerializableDreamClassOrViewModelClass.html +0 -1
  177. package/docs/types/SerializableDreamOrViewModel.html +0 -1
  178. package/docs/types/ViewModelSerializerKey.html +0 -1
@@ -11,6 +11,7 @@ const FailedToIdentifyAssociation_js_1 = require("../../errors/schema-builder/Fa
11
11
  const camelize_js_1 = require("../camelize.js");
12
12
  const compact_js_1 = require("../compact.js");
13
13
  const EnvInternal_js_1 = require("../EnvInternal.js");
14
+ const intersection_js_1 = require("../intersection.js");
14
15
  const pascalize_js_1 = require("../pascalize.js");
15
16
  const sortBy_js_1 = require("../sortBy.js");
16
17
  const uniq_js_1 = require("../uniq.js");
@@ -164,37 +165,45 @@ ${tableName}: {
164
165
  }
165
166
  async tableData(tableName) {
166
167
  const dreamApp = index_js_2.default.getOrFail();
167
- const models = Object.values(dreamApp.models);
168
- const model = models.find(model => model.table === tableName);
169
- if (!model)
168
+ const models = Object.values(dreamApp.models).filter(model => model.table === tableName);
169
+ const maybeModel = models[0];
170
+ if (!maybeModel)
170
171
  throw new Error(`
171
172
  Could not find a Dream model with table "${tableName}".
172
173
 
173
174
  If you recently changed the name of a table in a migration, you
174
175
  may need to update the table getter in the corresponding Dream.
175
176
  `);
177
+ const baseModel = maybeModel['stiBaseClassOrOwnClass'];
176
178
  const associationData = this.getAssociationData(tableName);
177
- let serializers;
178
- try {
179
- serializers =
180
- model?.prototype?.['serializers'] || {};
181
- }
182
- catch {
183
- serializers = {};
184
- }
179
+ const allStiChildren = models.filter(model => model['isSTIChild']);
180
+ const modelsToCheck = allStiChildren.length ? allStiChildren : [baseModel];
181
+ // If a table is STI, then we look only at the serializers attached to
182
+ // all STI children (not the STI base model because the base model may not have any serializers)
183
+ const eachModelSerializerKeys = modelsToCheck.map(model => {
184
+ let serializers = {};
185
+ try {
186
+ serializers = model?.prototype?.['serializers'] || {};
187
+ }
188
+ catch {
189
+ // no-op
190
+ }
191
+ return Object.keys(serializers);
192
+ });
193
+ const serializerKeys = (0, intersection_js_1.default)(...eachModelSerializerKeys);
185
194
  return {
186
- primaryKey: model.prototype.primaryKey,
187
- createdAtField: model.prototype.createdAtField,
188
- updatedAtField: model.prototype.updatedAtField,
189
- deletedAtField: model.prototype.deletedAtField,
195
+ primaryKey: baseModel.prototype.primaryKey,
196
+ createdAtField: baseModel.prototype.createdAtField,
197
+ updatedAtField: baseModel.prototype.updatedAtField,
198
+ deletedAtField: baseModel.prototype.deletedAtField,
190
199
  scopes: {
191
- default: model['scopes'].default.map(scopeStatement => scopeStatement.method),
192
- named: model['scopes'].named.map(scopeStatement => scopeStatement.method),
200
+ default: (0, uniq_js_1.default)(models.flatMap(model => model['scopes'].default.map(scopeStatement => scopeStatement.method))),
201
+ named: (0, uniq_js_1.default)(models.flatMap(model => model['scopes'].named.map(scopeStatement => scopeStatement.method))),
193
202
  },
194
203
  columns: await this.getColumnData(tableName, associationData),
195
- virtualColumns: this.getVirtualColumns(tableName),
204
+ virtualColumns: (0, uniq_js_1.default)(models.flatMap(model => model['virtualAttributes'].map(prop => prop.property) || [])),
196
205
  associations: associationData,
197
- serializerKeys: Object.keys(serializers),
206
+ serializerKeys,
198
207
  };
199
208
  }
200
209
  async getColumnData(tableName, associationData) {
@@ -229,12 +238,6 @@ may need to update the table getter in the corresponding Dream.
229
238
  const enumName = (0, pascalize_js_1.default)(row.udtName.replace(/\[\]$/, ''));
230
239
  return enumName;
231
240
  }
232
- getVirtualColumns(tableName) {
233
- const dreamApp = index_js_2.default.getOrFail();
234
- const models = (0, sortBy_js_1.default)(Object.values(dreamApp.models), m => m.table);
235
- const model = models.find(model => model.table === tableName);
236
- return model?.['virtualAttributes']?.map(prop => prop.property) || [];
237
- }
238
241
  async getSchemaData() {
239
242
  const tables = await this.getTables();
240
243
  const schemaData = {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = comparisonKey;
4
+ function comparisonKey(val, toKey = undefined) {
5
+ return val?.isDreamInstance
6
+ ? val.comparisonKey
7
+ : toKey
8
+ ? toKey(val)
9
+ : val;
10
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = intersection;
4
+ const comparisonKey_js_1 = require("./comparisonKey.js");
5
+ const uniq_js_1 = require("./uniq.js");
6
+ function intersection(...arrs) {
7
+ if (!arrs.length)
8
+ return [];
9
+ return (0, uniq_js_1.default)(arrs.reduce((workingArray, arr) => _intersection(workingArray, arr), arrs[0]));
10
+ }
11
+ function _intersection(arr, arr2) {
12
+ const mappedArr2 = arr2.map(val => (0, comparisonKey_js_1.default)(val));
13
+ return arr.filter(val => mappedArr2.includes((0, comparisonKey_js_1.default)(val)));
14
+ }
@@ -1,19 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = uniq;
4
+ const comparisonKey_js_1 = require("./comparisonKey.js");
4
5
  function uniq(arr, toKey = undefined) {
5
- if (toKey)
6
- return uniqWith(arr, toKey);
7
- return uniqWith(arr, a => String(a));
8
- }
9
- function uniqWith(arr, toKey) {
10
6
  const map = arr.reduce((acc, val) => {
11
- // Prefix with underscore to ensure that the values cannot be interpreted as integers.
7
+ const baseKey = (0, comparisonKey_js_1.default)(val, toKey);
8
+ // Prefix with underscore to ensure that the values cannot be _interpreted_ as integers.
12
9
  // If they can be interpreted as integers, then the keys are ordered not by the
13
10
  // order in which they were added, but in ascending numerical order.
14
- const key = val?.isDreamInstance
15
- ? val.comparisonKey
16
- : `_${toKey(val)}`;
11
+ const key = typeof baseKey === 'string' ? baseKey : `_${baseKey}`;
17
12
  acc[key] ||= val;
18
13
  return acc;
19
14
  }, {});
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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 = exports.DreamLogos = exports.DateTime = 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.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.DreamSerializer = exports.Attribute = exports.RendersOne = exports.RendersMany = exports.ops = exports.uniq = exports.uncapitalize = exports.standardizeFullyQualifiedModelName = exports.sortBy = exports.sort = exports.snakeify = exports.serializerNameFromFullyQualifiedModelName = void 0;
3
+ exports.range = exports.Range = exports.sharedPathPrefix = exports.relativeDreamPath = exports.dreamPath = exports.pascalize = exports.loadRepl = exports.isEmpty = exports.intersection = exports.inferSerializerFromDreamOrViewModel = exports.inferSerializerFromDreamClassOrViewModelClass = exports.hyphenize = exports.globalClassNameFromFullyQualifiedModelName = exports.Env = exports.DreamLogos = exports.DateTime = 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.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.DreamSerializer = exports.Attribute = exports.RendersOne = exports.RendersMany = exports.ops = exports.uniq = exports.uncapitalize = exports.standardizeFullyQualifiedModelName = exports.sortBy = exports.sort = 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");
@@ -80,6 +80,8 @@ Object.defineProperty(exports, "hyphenize", { enumerable: true, get: function ()
80
80
  var inferSerializerFromDreamOrViewModel_js_1 = require("./helpers/inferSerializerFromDreamOrViewModel.js");
81
81
  Object.defineProperty(exports, "inferSerializerFromDreamClassOrViewModelClass", { enumerable: true, get: function () { return inferSerializerFromDreamOrViewModel_js_1.inferSerializerFromDreamClassOrViewModelClass; } });
82
82
  Object.defineProperty(exports, "inferSerializerFromDreamOrViewModel", { enumerable: true, get: function () { return inferSerializerFromDreamOrViewModel_js_1.default; } });
83
+ var intersection_js_1 = require("./helpers/intersection.js");
84
+ Object.defineProperty(exports, "intersection", { enumerable: true, get: function () { return intersection_js_1.default; } });
83
85
  var isEmpty_js_1 = require("./helpers/isEmpty.js");
84
86
  Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return isEmpty_js_1.default; } });
85
87
  var loadRepl_js_1 = require("./helpers/loadRepl.js");
@@ -9,6 +9,7 @@ import FailedToIdentifyAssociation from '../../errors/schema-builder/FailedToIde
9
9
  import camelize from '../camelize.js';
10
10
  import compact from '../compact.js';
11
11
  import EnvInternal from '../EnvInternal.js';
12
+ import intersection from '../intersection.js';
12
13
  import pascalize from '../pascalize.js';
13
14
  import sortBy from '../sortBy.js';
14
15
  import uniq from '../uniq.js';
@@ -162,37 +163,45 @@ ${tableName}: {
162
163
  }
163
164
  async tableData(tableName) {
164
165
  const dreamApp = DreamApp.getOrFail();
165
- const models = Object.values(dreamApp.models);
166
- const model = models.find(model => model.table === tableName);
167
- if (!model)
166
+ const models = Object.values(dreamApp.models).filter(model => model.table === tableName);
167
+ const maybeModel = models[0];
168
+ if (!maybeModel)
168
169
  throw new Error(`
169
170
  Could not find a Dream model with table "${tableName}".
170
171
 
171
172
  If you recently changed the name of a table in a migration, you
172
173
  may need to update the table getter in the corresponding Dream.
173
174
  `);
175
+ const baseModel = maybeModel['stiBaseClassOrOwnClass'];
174
176
  const associationData = this.getAssociationData(tableName);
175
- let serializers;
176
- try {
177
- serializers =
178
- model?.prototype?.['serializers'] || {};
179
- }
180
- catch {
181
- serializers = {};
182
- }
177
+ const allStiChildren = models.filter(model => model['isSTIChild']);
178
+ const modelsToCheck = allStiChildren.length ? allStiChildren : [baseModel];
179
+ // If a table is STI, then we look only at the serializers attached to
180
+ // all STI children (not the STI base model because the base model may not have any serializers)
181
+ const eachModelSerializerKeys = modelsToCheck.map(model => {
182
+ let serializers = {};
183
+ try {
184
+ serializers = model?.prototype?.['serializers'] || {};
185
+ }
186
+ catch {
187
+ // no-op
188
+ }
189
+ return Object.keys(serializers);
190
+ });
191
+ const serializerKeys = intersection(...eachModelSerializerKeys);
183
192
  return {
184
- primaryKey: model.prototype.primaryKey,
185
- createdAtField: model.prototype.createdAtField,
186
- updatedAtField: model.prototype.updatedAtField,
187
- deletedAtField: model.prototype.deletedAtField,
193
+ primaryKey: baseModel.prototype.primaryKey,
194
+ createdAtField: baseModel.prototype.createdAtField,
195
+ updatedAtField: baseModel.prototype.updatedAtField,
196
+ deletedAtField: baseModel.prototype.deletedAtField,
188
197
  scopes: {
189
- default: model['scopes'].default.map(scopeStatement => scopeStatement.method),
190
- named: model['scopes'].named.map(scopeStatement => scopeStatement.method),
198
+ default: uniq(models.flatMap(model => model['scopes'].default.map(scopeStatement => scopeStatement.method))),
199
+ named: uniq(models.flatMap(model => model['scopes'].named.map(scopeStatement => scopeStatement.method))),
191
200
  },
192
201
  columns: await this.getColumnData(tableName, associationData),
193
- virtualColumns: this.getVirtualColumns(tableName),
202
+ virtualColumns: uniq(models.flatMap(model => model['virtualAttributes'].map(prop => prop.property) || [])),
194
203
  associations: associationData,
195
- serializerKeys: Object.keys(serializers),
204
+ serializerKeys,
196
205
  };
197
206
  }
198
207
  async getColumnData(tableName, associationData) {
@@ -227,12 +236,6 @@ may need to update the table getter in the corresponding Dream.
227
236
  const enumName = pascalize(row.udtName.replace(/\[\]$/, ''));
228
237
  return enumName;
229
238
  }
230
- getVirtualColumns(tableName) {
231
- const dreamApp = DreamApp.getOrFail();
232
- const models = sortBy(Object.values(dreamApp.models), m => m.table);
233
- const model = models.find(model => model.table === tableName);
234
- return model?.['virtualAttributes']?.map(prop => prop.property) || [];
235
- }
236
239
  async getSchemaData() {
237
240
  const tables = await this.getTables();
238
241
  const schemaData = {};
@@ -0,0 +1,7 @@
1
+ export default function comparisonKey(val, toKey = undefined) {
2
+ return val?.isDreamInstance
3
+ ? val.comparisonKey
4
+ : toKey
5
+ ? toKey(val)
6
+ : val;
7
+ }
@@ -0,0 +1,11 @@
1
+ import comparisonKey from './comparisonKey.js';
2
+ import uniq from './uniq.js';
3
+ export default function intersection(...arrs) {
4
+ if (!arrs.length)
5
+ return [];
6
+ return uniq(arrs.reduce((workingArray, arr) => _intersection(workingArray, arr), arrs[0]));
7
+ }
8
+ function _intersection(arr, arr2) {
9
+ const mappedArr2 = arr2.map(val => comparisonKey(val));
10
+ return arr.filter(val => mappedArr2.includes(comparisonKey(val)));
11
+ }
@@ -1,16 +1,11 @@
1
+ import comparisonKey from './comparisonKey.js';
1
2
  export default function uniq(arr, toKey = undefined) {
2
- if (toKey)
3
- return uniqWith(arr, toKey);
4
- return uniqWith(arr, a => String(a));
5
- }
6
- function uniqWith(arr, toKey) {
7
3
  const map = arr.reduce((acc, val) => {
8
- // Prefix with underscore to ensure that the values cannot be interpreted as integers.
4
+ const baseKey = comparisonKey(val, toKey);
5
+ // Prefix with underscore to ensure that the values cannot be _interpreted_ as integers.
9
6
  // If they can be interpreted as integers, then the keys are ordered not by the
10
7
  // order in which they were added, but in ascending numerical order.
11
- const key = val?.isDreamInstance
12
- ? val.comparisonKey
13
- : `_${toKey(val)}`;
8
+ const key = typeof baseKey === 'string' ? baseKey : `_${baseKey}`;
14
9
  acc[key] ||= val;
15
10
  return acc;
16
11
  }, {});
@@ -35,6 +35,7 @@ export { default as Env } from './helpers/Env.js';
35
35
  export { default as globalClassNameFromFullyQualifiedModelName } from './helpers/globalClassNameFromFullyQualifiedModelName.js';
36
36
  export { default as hyphenize } from './helpers/hyphenize.js';
37
37
  export { inferSerializerFromDreamClassOrViewModelClass, default as inferSerializerFromDreamOrViewModel, } from './helpers/inferSerializerFromDreamOrViewModel.js';
38
+ export { default as intersection } from './helpers/intersection.js';
38
39
  export { default as isEmpty } from './helpers/isEmpty.js';
39
40
  export { default as loadRepl } from './helpers/loadRepl.js';
40
41
  export { default as pascalize } from './helpers/pascalize.js';
@@ -6,7 +6,6 @@ export default class SchemaBuilder {
6
6
  private tableData;
7
7
  private getColumnData;
8
8
  private enumType;
9
- private getVirtualColumns;
10
9
  private getSchemaData;
11
10
  private getAssociationData;
12
11
  private getExportedModulesFromDbSync;
@@ -0,0 +1 @@
1
+ export default function comparisonKey<ElementType>(val: ElementType, toKey?: ((a: ElementType) => string | number | bigint) | undefined): string | number | bigint | ElementType;
@@ -1,4 +1,4 @@
1
1
  import Dream from '../Dream.js';
2
- import { SerializableDreamClassOrViewModelClass, SerializableDreamOrViewModel } from '../types/dream.js';
3
- export default function inferSerializerFromDreamOrViewModel(obj: Dream | SerializableDreamOrViewModel, serializerKey?: string | undefined): typeof import("../index.js").DreamSerializer | null;
4
- export declare function inferSerializerFromDreamClassOrViewModelClass(classDef: SerializableDreamClassOrViewModelClass, serializerKey?: string | undefined): typeof import("../index.js").DreamSerializer | null;
2
+ import { ViewModel, ViewModelClass } from '../types/dream.js';
3
+ export default function inferSerializerFromDreamOrViewModel(obj: Dream | ViewModel, serializerKey?: string | undefined): typeof import("../index.js").DreamSerializer | null;
4
+ export declare function inferSerializerFromDreamClassOrViewModelClass(classDef: ViewModelClass, serializerKey?: string | undefined): typeof import("../index.js").DreamSerializer | null;
@@ -0,0 +1 @@
1
+ export default function intersection<ArrayType extends any[]>(...arrs: ArrayType[]): ArrayType;
@@ -36,6 +36,7 @@ export { default as Env } from './helpers/Env.js';
36
36
  export { default as globalClassNameFromFullyQualifiedModelName } from './helpers/globalClassNameFromFullyQualifiedModelName.js';
37
37
  export { default as hyphenize } from './helpers/hyphenize.js';
38
38
  export { inferSerializerFromDreamClassOrViewModelClass, default as inferSerializerFromDreamOrViewModel, } from './helpers/inferSerializerFromDreamOrViewModel.js';
39
+ export { default as intersection } from './helpers/intersection.js';
39
40
  export { default as isEmpty } from './helpers/isEmpty.js';
40
41
  export { default as loadRepl } from './helpers/loadRepl.js';
41
42
  export { default as pascalize } from './helpers/pascalize.js';
@@ -60,6 +61,6 @@ export { default as Attribute, type AttributeStatement, type SerializableTypes,
60
61
  export { default as DreamSerializer } from './serializer/index.js';
61
62
  export { type WhereStatementForDream, type WhereStatementForDreamClass } from './types/associations/shared.js';
62
63
  export { type DbConnectionType } from './types/db.js';
63
- export { type DreamAssociationMetadata, type DreamAttributes, type DreamClassColumn, type DreamColumn, type DreamColumnNames, type DreamOrViewModelSerializerKey, type DreamParamSafeAttributes, type DreamParamSafeColumnNames, type DreamSerializerKey, type DreamSerializers, type DreamTableSchema, type DreamVirtualColumns, type IdType, type PrimaryKeyType, type SerializableClassOrSerializerCallback, type SerializableDreamClassOrViewModelClass, type SerializableDreamOrViewModel, type Timestamp, type UpdateableAssociationProperties, type UpdateableProperties, type ViewModelSerializerKey, } from './types/dream.js';
64
+ export { type 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 SerializableClassOrSerializerCallback, type Timestamp, type UpdateableAssociationProperties, type UpdateableProperties, type ViewModel, type ViewModelClass, } from './types/dream.js';
64
65
  export { type CommonOpenapiSchemaObjectFields, type OpenapiAllTypes, type OpenapiFormats, type OpenapiNumberFormats, type OpenapiPrimitiveTypes, type OpenapiSchemaArray, type OpenapiSchemaArrayShorthand, type OpenapiSchemaBase, type OpenapiSchemaBody, type OpenapiSchemaBodyShorthand, type OpenapiSchemaCommonFields, type OpenapiSchemaExpressionAllOf, type OpenapiSchemaExpressionAnyOf, type OpenapiSchemaExpressionOneOf, type OpenapiSchemaExpressionRef, type OpenapiSchemaExpressionRefSchemaShorthand, type OpenapiSchemaInteger, type OpenapiSchemaNull, type OpenapiSchemaNumber, type OpenapiSchemaObject, type OpenapiSchemaObjectAllOf, type OpenapiSchemaObjectAllOfShorthand, type OpenapiSchemaObjectAnyOf, type OpenapiSchemaObjectAnyOfShorthand, type OpenapiSchemaObjectBase, type OpenapiSchemaObjectBaseShorthand, type OpenapiSchemaObjectOneOf, type OpenapiSchemaObjectOneOfShorthand, type OpenapiSchemaObjectShorthand, type OpenapiSchemaPrimitiveGeneric, type OpenapiSchemaProperties, type OpenapiSchemaPropertiesShorthand, type OpenapiSchemaShorthandExpressionAllOf, type OpenapiSchemaShorthandExpressionAnyOf, type OpenapiSchemaShorthandExpressionOneOf, type OpenapiSchemaShorthandExpressionSerializableRef, type OpenapiSchemaShorthandExpressionSerializerRef, type OpenapiSchemaShorthandPrimitiveGeneric, type OpenapiSchemaString, type OpenapiShorthandAllTypes, type OpenapiShorthandPrimitiveTypes, type OpenapiTypeField, type OpenapiTypeFieldObject, } from './types/openapi.js';
65
66
  export { type ValidationType } from './types/validation.js';
@@ -88,11 +88,9 @@ export type ViewModel = {
88
88
  serializers: Record<string, string>;
89
89
  };
90
90
  export type ViewModelClass = abstract new (...args: any) => ViewModel;
91
- export type SerializableDreamOrViewModel = ViewModel;
92
- export type SerializableDreamClassOrViewModelClass = abstract new (...args: any) => SerializableDreamOrViewModel;
93
91
  export type DreamSerializerCallback = () => typeof DreamSerializer;
94
- export type SerializableClassOrSerializerCallback = SerializableDreamClassOrViewModelClass | DreamSerializerCallback;
95
- export type SerializableClassOrClasses = DreamSerializerCallback | SerializableDreamClassOrViewModelClass | SerializableDreamClassOrViewModelClass[];
92
+ export type SerializableClassOrSerializerCallback = ViewModelClass | DreamSerializerCallback;
93
+ export type SerializableClassOrClasses = DreamSerializerCallback | ViewModelClass | ViewModelClass[];
96
94
  export type NextPreloadArgumentType<Schema, PreviousTableNames, PreviousSchemaAssociations = PreviousTableNames extends undefined ? undefined : Schema[PreviousTableNames & keyof Schema]['associations' & keyof Schema[PreviousTableNames & keyof Schema]]> = PreviousTableNames extends undefined ? undefined : (keyof PreviousSchemaAssociations & string) | (keyof PreviousSchemaAssociations & string)[];
97
95
  export type PreloadArgumentTypeAssociatedTableNames<Schema, PreviousTableNames, ArgumentType, PreviousSchemaAssociations = PreviousTableNames extends undefined ? undefined : Schema[PreviousTableNames & keyof Schema]> = ArgumentType extends string[] ? undefined : (PreviousSchemaAssociations[ArgumentType & (keyof PreviousSchemaAssociations & string)] & string[])[number];
98
96
  export type AssociationNameToDreamClassMap = Record<string, typeof Dream>;
@@ -118,9 +116,13 @@ export type DreamSerializeOptions<T> = {
118
116
  serializerKey?: DreamSerializerKey<T>;
119
117
  casing?: 'camel' | 'snake' | null;
120
118
  };
119
+ export type DreamOrViewModelClassSerializerKey<T> = T extends typeof Dream ? DreamSerializerKey<InstanceType<T>> : T extends ViewModelClass ? ViewModelSerializerKey<InstanceType<T>> : never;
121
120
  export type DreamOrViewModelSerializerKey<T> = T extends Dream ? DreamSerializerKey<T> : ViewModelSerializerKey<T>;
122
- export type DreamSerializerKey<T, U = T extends (infer R)[] ? R : T, Table = U['table' & keyof U] extends string ? U['table' & keyof U] : never, Schema = U['schema' & keyof U] extends object ? U['schema' & keyof U] : never, TableSchema = Table extends never ? never : Schema extends never ? never : Schema[Table & keyof Schema], SerializerKeys = TableSchema extends never ? never : TableSchema['serializerKeys' & keyof TableSchema] & (string[] | Readonly<string[]>), SerializerKey = SerializerKeys extends string[] | Readonly<string[]> ? SerializerKeys[number] : never> = SerializerKey;
123
- export type ViewModelSerializerKey<T, U = T extends (infer R)[] ? R : T, SerializerType = U extends null ? never : U['serializers' & keyof U] extends object ? keyof U['serializers' & keyof U] : never> = SerializerType;
121
+ export type DreamSerializable = typeof Dream | ViewModelClass | typeof DreamSerializer;
122
+ export type DreamSerializableArray<StartingArray extends readonly DreamSerializable[] = [], Depth extends number = 0> = Depth extends 20 ? StartingArray : StartingArray | DreamSerializableArray<[DreamSerializable, ...StartingArray], Inc<Depth>>;
123
+ export type DreamOrViewModelClassSerializerArrayKeys<T extends DreamSerializableArray> = T['length'] extends 0 ? string : T[0] extends typeof Dream | ViewModelClass ? DreamOrViewModelClassSerializerKey<T[0]> & DreamOrViewModelClassSerializerArrayKeys<T extends [any, ...infer Rest] ? Rest : never> : DreamOrViewModelClassSerializerArrayKeys<T extends [any, ...infer Rest] ? Rest : never>;
124
+ export type DreamSerializerKey<T, Table = T['table' & keyof T] extends string ? T['table' & keyof T] : never, Schema = T['schema' & keyof T] extends object ? T['schema' & keyof T] : never, TableSchema = Table extends never ? never : Schema extends never ? never : Schema[Table & keyof Schema], SerializerKeys = TableSchema extends never ? never : TableSchema['serializerKeys' & keyof TableSchema] & (string[] | Readonly<string[]>), SerializerKey = SerializerKeys extends string[] | Readonly<string[]> ? SerializerKeys[number] : never> = SerializerKey;
125
+ export type ViewModelSerializerKey<T, SerializerType = T extends null ? never : T['serializers' & keyof T] extends object ? keyof T['serializers' & keyof T] : never> = SerializerType;
124
126
  export interface SimilarityStatement {
125
127
  tableName: string;
126
128
  tableAlias: string;
@@ -356,20 +356,10 @@ export type DreamConstructorType<T extends Dream> = (new (...arguments_: any[])
356
356
  export type ViewModel = { serializers: Record<string, string> }
357
357
  export type ViewModelClass = abstract new (...args: any) => ViewModel
358
358
 
359
- export type SerializableDreamOrViewModel = ViewModel
360
- export type SerializableDreamClassOrViewModelClass = abstract new (
361
- ...args: any
362
- ) => SerializableDreamOrViewModel
363
-
364
359
  export type DreamSerializerCallback = () => typeof DreamSerializer
365
- export type SerializableClassOrSerializerCallback =
366
- | SerializableDreamClassOrViewModelClass
367
- | DreamSerializerCallback
360
+ export type SerializableClassOrSerializerCallback = ViewModelClass | DreamSerializerCallback
368
361
 
369
- export type SerializableClassOrClasses =
370
- | DreamSerializerCallback
371
- | SerializableDreamClassOrViewModelClass
372
- | SerializableDreamClassOrViewModelClass[]
362
+ export type SerializableClassOrClasses = DreamSerializerCallback | ViewModelClass | ViewModelClass[]
373
363
 
374
364
  // preload
375
365
  export type NextPreloadArgumentType<
@@ -447,15 +437,36 @@ export type DreamSerializeOptions<T> = {
447
437
  casing?: 'camel' | 'snake' | null
448
438
  }
449
439
 
440
+ export type DreamOrViewModelClassSerializerKey<T> = T extends typeof Dream
441
+ ? DreamSerializerKey<InstanceType<T>>
442
+ : T extends ViewModelClass
443
+ ? ViewModelSerializerKey<InstanceType<T>>
444
+ : never
445
+
450
446
  export type DreamOrViewModelSerializerKey<T> = T extends Dream
451
447
  ? DreamSerializerKey<T>
452
448
  : ViewModelSerializerKey<T>
453
449
 
450
+ export type DreamSerializable = typeof Dream | ViewModelClass | typeof DreamSerializer
451
+
452
+ export type DreamSerializableArray<
453
+ StartingArray extends readonly DreamSerializable[] = [],
454
+ Depth extends number = 0,
455
+ > = Depth extends 20
456
+ ? StartingArray
457
+ : StartingArray | DreamSerializableArray<[DreamSerializable, ...StartingArray], Inc<Depth>>
458
+
459
+ export type DreamOrViewModelClassSerializerArrayKeys<T extends DreamSerializableArray> = T['length'] extends 0
460
+ ? string
461
+ : T[0] extends typeof Dream | ViewModelClass
462
+ ? DreamOrViewModelClassSerializerKey<T[0]> &
463
+ DreamOrViewModelClassSerializerArrayKeys<T extends [any, ...infer Rest] ? Rest : never>
464
+ : DreamOrViewModelClassSerializerArrayKeys<T extends [any, ...infer Rest] ? Rest : never>
465
+
454
466
  export type DreamSerializerKey<
455
467
  T,
456
- U = T extends (infer R)[] ? R : T,
457
- Table = U['table' & keyof U] extends string ? U['table' & keyof U] : never,
458
- Schema = U['schema' & keyof U] extends object ? U['schema' & keyof U] : never,
468
+ Table = T['table' & keyof T] extends string ? T['table' & keyof T] : never,
469
+ Schema = T['schema' & keyof T] extends object ? T['schema' & keyof T] : never,
459
470
  TableSchema = Table extends never ? never : Schema extends never ? never : Schema[Table & keyof Schema],
460
471
  SerializerKeys = TableSchema extends never
461
472
  ? never
@@ -465,11 +476,10 @@ export type DreamSerializerKey<
465
476
 
466
477
  export type ViewModelSerializerKey<
467
478
  T,
468
- U = T extends (infer R)[] ? R : T,
469
- SerializerType = U extends null
479
+ SerializerType = T extends null
470
480
  ? never
471
- : U['serializers' & keyof U] extends object
472
- ? keyof U['serializers' & keyof U]
481
+ : T['serializers' & keyof T] extends object
482
+ ? keyof T['serializers' & keyof T]
473
483
  : never,
474
484
  > = SerializerType
475
485
 
@@ -1,6 +1,6 @@
1
1
  import { openapiPrimitiveTypes, openapiShorthandPrimitiveTypes } from '../dream/constants.js';
2
2
  import DreamSerializer from '../serializer/index.js';
3
- import { SerializableDreamClassOrViewModelClass } from './dream.js';
3
+ import { ViewModelClass } from './dream.js';
4
4
  export type OpenapiSchemaBody = OpenapiSchemaBase | OpenapiSchemaPrimitiveGeneric | OpenapiSchemaExpressionAnyOf | OpenapiSchemaExpressionOneOf | OpenapiSchemaExpressionAllOf | OpenapiSchemaObject | OpenapiSchemaArray;
5
5
  export type OpenapiSchemaBodyShorthand = OpenapiSchemaBase | OpenapiSchemaShorthandPrimitiveGeneric | OpenapiSchemaShorthandExpressionAnyOf | OpenapiSchemaShorthandExpressionOneOf | OpenapiSchemaShorthandExpressionAllOf | OpenapiSchemaObjectShorthand | OpenapiSchemaArrayShorthand | OpenapiSchemaNull | OpenapiSchemaExpressionRefSchemaShorthand | OpenapiSchemaShorthandExpressionSerializerRef | OpenapiSchemaShorthandExpressionSerializableRef;
6
6
  export type OpenapiSchemaBase = OpenapiSchemaString | OpenapiSchemaInteger | OpenapiSchemaNumber | OpenapiSchemaNull | OpenapiSchemaExpressionRef;
@@ -19,7 +19,7 @@ export type OpenapiSchemaShorthandExpressionSerializerRef = {
19
19
  maybeNull?: boolean;
20
20
  };
21
21
  export type OpenapiSchemaShorthandExpressionSerializableRef = {
22
- $serializable: SerializableDreamClassOrViewModelClass;
22
+ $serializable: ViewModelClass;
23
23
  key?: string;
24
24
  many?: boolean;
25
25
  maybeNull?: boolean;
@@ -1,6 +1,6 @@
1
1
  import { openapiPrimitiveTypes, openapiShorthandPrimitiveTypes } from '../dream/constants.js'
2
2
  import DreamSerializer from '../serializer/index.js'
3
- import { SerializableDreamClassOrViewModelClass } from './dream.js'
3
+ import { ViewModelClass } from './dream.js'
4
4
 
5
5
  export type OpenapiSchemaBody =
6
6
  | OpenapiSchemaBase
@@ -50,7 +50,7 @@ export type OpenapiSchemaShorthandExpressionSerializerRef = {
50
50
  }
51
51
 
52
52
  export type OpenapiSchemaShorthandExpressionSerializableRef = {
53
- $serializable: SerializableDreamClassOrViewModelClass
53
+ $serializable: ViewModelClass
54
54
  key?: string
55
55
  many?: boolean
56
56
  maybeNull?: boolean
@@ -1 +1 @@
1
- window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE62aUZPaNhSF/wvPadOkTdrmDdglYbK7EKDpQ6fTEfYF1JUlVxbbkE7/e0cGbNm6vpK9fcT3nO/IwpZky7/9MzLwxYzejSYgk0PG9OPoxShn5jB6N0oEKwooXlalbw8mE6MXo0cu09G7V69/+vdF5Z8yATJl+oYZ8BFulaRoYAYWesZlOjnNGBeQbtT56Fim9jACD5uozBtIlGZG6cJH1zWSoIFliNkeDvrGed5hHed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