@rvoh/dream 1.0.0 → 1.0.2

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 (198) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/src/bin/index.js +2 -2
  3. package/dist/cjs/src/cli/index.js +3 -2
  4. package/dist/cjs/src/decorators/field/association/shared.js +1 -1
  5. package/dist/cjs/src/dream/QueryDriver/Kysely.js +39 -21
  6. package/dist/cjs/src/dream-app/helpers/PackageManager.js +38 -0
  7. package/dist/cjs/src/dream-app/index.js +9 -0
  8. package/dist/cjs/src/helpers/cli/SchemaBuilder.js +9 -4
  9. package/dist/cjs/src/index.js +3 -2
  10. package/dist/esm/src/bin/index.js +2 -2
  11. package/dist/esm/src/cli/index.js +3 -2
  12. package/dist/esm/src/decorators/field/association/shared.js +1 -1
  13. package/dist/esm/src/dream/QueryDriver/Kysely.js +39 -21
  14. package/dist/esm/src/dream-app/helpers/PackageManager.js +35 -0
  15. package/dist/esm/src/dream-app/index.js +8 -0
  16. package/dist/esm/src/helpers/cli/SchemaBuilder.js +9 -4
  17. package/dist/esm/src/index.js +1 -1
  18. package/dist/types/src/bin/index.d.ts +3 -1
  19. package/dist/types/src/dream/Query.d.ts +3 -1
  20. package/dist/types/src/dream/QueryDriver/Kysely.d.ts +4 -2
  21. package/dist/types/src/dream-app/helpers/PackageManager.d.ts +7 -0
  22. package/dist/types/src/dream-app/index.d.ts +6 -2
  23. package/dist/types/src/helpers/cli/SchemaBuilder.d.ts +1 -0
  24. package/dist/types/src/index.d.ts +1 -1
  25. package/docs/assets/navigation.js +1 -1
  26. package/docs/assets/search.js +1 -1
  27. package/docs/classes/Benchmark.html +2 -2
  28. package/docs/classes/CalendarDate.html +2 -2
  29. package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +3 -3
  30. package/docs/classes/Decorators.html +19 -19
  31. package/docs/classes/Dream.html +136 -136
  32. package/docs/classes/DreamApp.html +5 -4
  33. package/docs/classes/DreamBin.html +2 -2
  34. package/docs/classes/DreamCLI.html +4 -4
  35. package/docs/classes/DreamImporter.html +2 -2
  36. package/docs/classes/DreamLogos.html +2 -2
  37. package/docs/classes/DreamMigrationHelpers.html +7 -7
  38. package/docs/classes/DreamSerializerBuilder.html +8 -8
  39. package/docs/classes/DreamTransaction.html +2 -2
  40. package/docs/classes/Encrypt.html +2 -2
  41. package/docs/classes/Env.html +2 -2
  42. package/docs/classes/GlobalNameNotSet.html +3 -3
  43. package/docs/classes/NonLoadedAssociation.html +3 -3
  44. package/docs/classes/ObjectSerializerBuilder.html +8 -8
  45. package/docs/classes/Query.html +60 -60
  46. package/docs/classes/Range.html +2 -2
  47. package/docs/classes/RecordNotFound.html +3 -3
  48. package/docs/classes/ValidationError.html +3 -3
  49. package/docs/functions/DreamSerializer.html +1 -1
  50. package/docs/functions/ObjectSerializer.html +1 -1
  51. package/docs/functions/ReplicaSafe.html +1 -1
  52. package/docs/functions/STI.html +1 -1
  53. package/docs/functions/SoftDelete.html +1 -1
  54. package/docs/functions/camelize.html +1 -1
  55. package/docs/functions/capitalize.html +1 -1
  56. package/docs/functions/cloneDeepSafe.html +1 -1
  57. package/docs/functions/closeAllDbConnections.html +1 -1
  58. package/docs/functions/compact.html +1 -1
  59. package/docs/functions/dreamDbConnections.html +1 -1
  60. package/docs/functions/dreamPath.html +1 -1
  61. package/docs/functions/expandStiClasses.html +1 -1
  62. package/docs/functions/generateDream.html +1 -1
  63. package/docs/functions/globalClassNameFromFullyQualifiedModelName.html +1 -1
  64. package/docs/functions/groupBy.html +1 -1
  65. package/docs/functions/hyphenize.html +1 -1
  66. package/docs/functions/inferSerializerFromDreamOrViewModel.html +1 -1
  67. package/docs/functions/inferSerializersFromDreamClassOrViewModelClass.html +1 -1
  68. package/docs/functions/intersection.html +1 -1
  69. package/docs/functions/isDreamSerializer.html +1 -1
  70. package/docs/functions/isEmpty.html +1 -1
  71. package/docs/functions/loadRepl.html +1 -1
  72. package/docs/functions/lookupClassByGlobalName.html +1 -1
  73. package/docs/functions/normalizeUnicode.html +1 -1
  74. package/docs/functions/pascalize.html +1 -1
  75. package/docs/functions/pgErrorType.html +1 -1
  76. package/docs/functions/range-1.html +1 -1
  77. package/docs/functions/relativeDreamPath.html +1 -1
  78. package/docs/functions/round.html +1 -1
  79. package/docs/functions/serializerNameFromFullyQualifiedModelName.html +1 -1
  80. package/docs/functions/sharedPathPrefix.html +1 -1
  81. package/docs/functions/snakeify.html +1 -1
  82. package/docs/functions/sort.html +1 -1
  83. package/docs/functions/sortBy.html +1 -1
  84. package/docs/functions/sortObjectByKey.html +1 -1
  85. package/docs/functions/sortObjectByValue.html +1 -1
  86. package/docs/functions/standardizeFullyQualifiedModelName.html +1 -1
  87. package/docs/functions/uncapitalize.html +1 -1
  88. package/docs/functions/uniq.html +1 -1
  89. package/docs/functions/untypedDb.html +1 -1
  90. package/docs/functions/validateColumn.html +1 -1
  91. package/docs/functions/validateTable.html +1 -1
  92. package/docs/interfaces/BelongsToStatement.html +2 -2
  93. package/docs/interfaces/DecoratorContext.html +2 -2
  94. package/docs/interfaces/DreamAppInitOptions.html +2 -2
  95. package/docs/interfaces/DreamAppOpts.html +2 -2
  96. package/docs/interfaces/EncryptOptions.html +2 -2
  97. package/docs/interfaces/InternalAnyTypedSerializerRendersMany.html +2 -2
  98. package/docs/interfaces/InternalAnyTypedSerializerRendersOne.html +2 -2
  99. package/docs/interfaces/OpenapiDescription.html +2 -2
  100. package/docs/interfaces/OpenapiSchemaProperties.html +1 -1
  101. package/docs/interfaces/OpenapiSchemaPropertiesShorthand.html +1 -1
  102. package/docs/interfaces/OpenapiTypeFieldObject.html +1 -1
  103. package/docs/interfaces/SerializerRendererOpts.html +2 -2
  104. package/docs/modules.html +2 -0
  105. package/docs/types/Camelized.html +1 -1
  106. package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
  107. package/docs/types/DateTime.html +1 -1
  108. package/docs/types/DbConnectionType.html +1 -1
  109. package/docs/types/DbTypes.html +1 -1
  110. package/docs/types/DreamAppAllowedPackageManagersEnum.html +1 -0
  111. package/docs/types/DreamAssociationMetadata.html +1 -1
  112. package/docs/types/DreamAttributes.html +1 -1
  113. package/docs/types/DreamClassAssociationAndStatement.html +1 -1
  114. package/docs/types/DreamClassColumn.html +1 -1
  115. package/docs/types/DreamColumn.html +1 -1
  116. package/docs/types/DreamColumnNames.html +1 -1
  117. package/docs/types/DreamLogLevel.html +1 -1
  118. package/docs/types/DreamLogger.html +1 -1
  119. package/docs/types/DreamModelSerializerType.html +1 -1
  120. package/docs/types/DreamOrViewModelClassSerializerKey.html +1 -1
  121. package/docs/types/DreamOrViewModelSerializerKey.html +1 -1
  122. package/docs/types/DreamParamSafeAttributes.html +1 -1
  123. package/docs/types/DreamParamSafeColumnNames.html +1 -1
  124. package/docs/types/DreamSerializable.html +1 -1
  125. package/docs/types/DreamSerializableArray.html +1 -1
  126. package/docs/types/DreamSerializerKey.html +1 -1
  127. package/docs/types/DreamSerializers.html +1 -1
  128. package/docs/types/DreamTableSchema.html +1 -1
  129. package/docs/types/DreamVirtualColumns.html +1 -1
  130. package/docs/types/EncryptAlgorithm.html +1 -1
  131. package/docs/types/HasManyStatement.html +1 -1
  132. package/docs/types/HasOneStatement.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/DreamAppAllowedPackageManagersEnumValues.html +1 -0
  192. package/docs/variables/DreamConst.html +1 -1
  193. package/docs/variables/TRIGRAM_OPERATORS.html +1 -1
  194. package/docs/variables/openapiPrimitiveTypes-1.html +1 -1
  195. package/docs/variables/openapiShorthandPrimitiveTypes-1.html +1 -1
  196. package/docs/variables/ops.html +1 -1
  197. package/docs/variables/primaryKeyTypes.html +1 -1
  198. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -0,0 +1,7 @@
1
+ # 1.0.1
2
+
3
+ - [bug] fix preloading STI model via polymporhic association (polymorphic type was being altered to the STI child rather than left as the STI base)
4
+
5
+ ## 1.0.2
6
+
7
+ - stop computing foreign keys in schema builder when building schema for through associations
@@ -5,8 +5,8 @@ const Query_js_1 = require("../dream/Query.js");
5
5
  const generateDream_js_1 = require("../helpers/cli/generateDream.js");
6
6
  const sspawn_js_1 = require("../helpers/sspawn.js");
7
7
  class DreamBin {
8
- static async sync(onSync) {
9
- await Query_js_1.default.dbDriverClass().sync(onSync);
8
+ static async sync(onSync, options) {
9
+ await Query_js_1.default.dbDriverClass().sync(onSync, options);
10
10
  }
11
11
  static async dbCreate() {
12
12
  await Query_js_1.default.dbDriverClass().dbCreate();
@@ -59,9 +59,10 @@ class DreamCLI {
59
59
  program
60
60
  .command('sync')
61
61
  .description('sync introspects your database, updating your schema to reflect, and then syncs the new schema with the installed dream node module, allowing it provide your schema to the underlying kysely integration')
62
- .action(async () => {
62
+ .option('--schema-only')
63
+ .action(async (options = {}) => {
63
64
  await initializeDreamApp();
64
- await index_js_1.default.sync(() => { });
65
+ await index_js_1.default.sync(() => { }, options);
65
66
  process.exit();
66
67
  });
67
68
  this.generateDreamCli(program, {
@@ -90,7 +90,7 @@ function applyGetterAndSetter(target, partialAssociation, { foreignKeyBase, isBe
90
90
  partialAssociation.primaryKeyValue(associatedModel);
91
91
  if (partialAssociation.polymorphic)
92
92
  this[foreignKeyTypeField(foreignKeyBase, dreamClass, partialAssociation)] =
93
- associatedModel?.['sanitizedConstructorName'];
93
+ associatedModel?.['stiBaseClassOrOwnClassName'];
94
94
  }
95
95
  },
96
96
  });
@@ -2,9 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const kysely_1 = require("kysely");
4
4
  const pluralize_esm_1 = require("pluralize-esm");
5
+ const sync_js_1 = require("../../bin/helpers/sync.js");
5
6
  const index_js_1 = require("../../cli/index.js");
6
7
  const index_js_2 = require("../../db/index.js");
7
8
  const associationToGetterSetterProp_js_1 = require("../../decorators/field/association/associationToGetterSetterProp.js");
9
+ const PackageManager_js_1 = require("../../dream-app/helpers/PackageManager.js");
8
10
  const index_js_3 = require("../../dream-app/index.js");
9
11
  const CannotAssociateThroughPolymorphic_js_1 = require("../../errors/associations/CannotAssociateThroughPolymorphic.js");
10
12
  const CannotJoinPolymorphicBelongsToError_js_1 = require("../../errors/associations/CannotJoinPolymorphicBelongsToError.js");
@@ -19,8 +21,11 @@ const UnexpectedUndefined_js_1 = require("../../errors/UnexpectedUndefined.js");
19
21
  const CalendarDate_js_1 = require("../../helpers/CalendarDate.js");
20
22
  const camelize_js_1 = require("../../helpers/camelize.js");
21
23
  const generateMigration_js_1 = require("../../helpers/cli/generateMigration.js");
24
+ const SchemaBuilder_js_1 = require("../../helpers/cli/SchemaBuilder.js");
22
25
  const compact_js_1 = require("../../helpers/compact.js");
23
26
  const DateTime_js_1 = require("../../helpers/DateTime.js");
27
+ const createDb_js_1 = require("../../helpers/db/createDb.js");
28
+ const dropDb_js_1 = require("../../helpers/db/dropDb.js");
24
29
  const loadPgClient_js_1 = require("../../helpers/db/loadPgClient.js");
25
30
  const runMigration_js_1 = require("../../helpers/db/runMigration.js");
26
31
  const EnvInternal_js_1 = require("../../helpers/EnvInternal.js");
@@ -45,10 +50,6 @@ const SimilarityBuilder_js_1 = require("../internal/similarity/SimilarityBuilder
45
50
  const sqlResultToDreamInstance_js_1 = require("../internal/sqlResultToDreamInstance.js");
46
51
  const Query_js_1 = require("../Query.js");
47
52
  const Base_js_1 = require("./Base.js");
48
- const sync_js_1 = require("../../bin/helpers/sync.js");
49
- const SchemaBuilder_js_1 = require("../../helpers/cli/SchemaBuilder.js");
50
- const createDb_js_1 = require("../../helpers/db/createDb.js");
51
- const dropDb_js_1 = require("../../helpers/db/dropDb.js");
52
53
  class KyselyQueryDriver extends Base_js_1.default {
53
54
  // ATTENTION FRED
54
55
  // stop trying to make this async. You never learn...
@@ -92,16 +93,35 @@ class KyselyQueryDriver extends Base_js_1.default {
92
93
  static async generateMigration(migrationName, columnsWithTypes) {
93
94
  await (0, generateMigration_js_1.default)({ migrationName, columnsWithTypes });
94
95
  }
95
- static async sync(onSync) {
96
- index_js_1.default.logger.logStartProgress('writing db schema...');
97
- await (0, sync_js_1.default)();
98
- index_js_1.default.logger.logEndProgress();
96
+ static async sync(onSync, options = {}) {
97
+ if (!options?.schemaOnly) {
98
+ index_js_1.default.logger.logStartProgress('writing db schema...');
99
+ await (0, sync_js_1.default)();
100
+ index_js_1.default.logger.logEndProgress();
101
+ }
99
102
  index_js_1.default.logger.logStartProgress('building dream schema...');
100
- await new SchemaBuilder_js_1.default().build();
103
+ const schemaBuilder = new SchemaBuilder_js_1.default();
104
+ await schemaBuilder.build();
101
105
  index_js_1.default.logger.logEndProgress();
102
- // intentionally leaving logs off here, since it allows other
103
- // onSync handlers to determine their own independent logging approach
104
- await onSync();
106
+ if (schemaBuilder.hasForeignKeyError && !options?.schemaOnly) {
107
+ index_js_1.default.logger.logStartProgress('triggering resync to correct for foreign key errors...');
108
+ // TODO: make this customizable to enable dream apps to separate
109
+ const cliCmd = EnvInternal_js_1.default.boolean('DREAM_CORE_DEVELOPMENT') ? 'dream' : 'psy';
110
+ await index_js_1.default.spawn(PackageManager_js_1.default.runCmd(`${cliCmd} sync --schema-only`), {
111
+ onStdout: str => {
112
+ index_js_1.default.logger.logContinueProgress(`${str}`, {
113
+ logPrefix: ' ├ [resync]',
114
+ logPrefixColor: 'blue',
115
+ });
116
+ },
117
+ });
118
+ index_js_1.default.logger.logEndProgress();
119
+ }
120
+ if (!options?.schemaOnly) {
121
+ // intentionally leaving logs off here, since it allows other
122
+ // onSync handlers to determine their own independent logging approach
123
+ await onSync();
124
+ }
105
125
  }
106
126
  /**
107
127
  * create the database. Must respond to the NODE_ENV value.
@@ -1613,13 +1633,13 @@ class KyselyQueryDriver extends Base_js_1.default {
1613
1633
  throw new Error(`Association ${association.as} points to an array of models but is not designated polymorphic`);
1614
1634
  if (association.type !== 'BelongsTo')
1615
1635
  throw new Error(`Polymorphic association ${association.as} points to an array of models but is ${association.type}. Only BelongsTo associations may point to an array of models.`);
1616
- const associatedDreams = [];
1636
+ const nestedDreamsForNextRoundOfPreloading = [];
1617
1637
  for (const associatedModel of association.modelCB()) {
1618
- await this.preloadPolymorphicAssociationModel(dreams, association, associatedModel, associatedDreams);
1638
+ await this.preloadPolymorphicAssociationModel(dreams, association, associatedModel, nestedDreamsForNextRoundOfPreloading);
1619
1639
  }
1620
- return associatedDreams;
1640
+ return nestedDreamsForNextRoundOfPreloading;
1621
1641
  }
1622
- async preloadPolymorphicAssociationModel(dreams, association, associatedDreamClass, associatedDreams) {
1642
+ async preloadPolymorphicAssociationModel(dreams, association, associatedDreamClass, nestedDreamsForNextRoundOfPreloading) {
1623
1643
  const relevantAssociatedModels = dreams.filter((dream) => {
1624
1644
  const field = association.foreignKeyTypeField();
1625
1645
  return dream[field] === associatedDreamClass['stiBaseClassOrOwnClassName'] || dream[field] === null;
@@ -1638,16 +1658,14 @@ class KyselyQueryDriver extends Base_js_1.default {
1638
1658
  [associatedDreamClass.primaryKey]: relevantAssociatedModels.map((dream) => dream[association.foreignKey()]),
1639
1659
  })
1640
1660
  .all();
1641
- loadedAssociations.forEach((loadedAssociation) => associatedDreams.push(loadedAssociation));
1661
+ loadedAssociations.forEach((loadedAssociation) => nestedDreamsForNextRoundOfPreloading.push(loadedAssociation));
1642
1662
  //////////////////////////////////////////////////////////////////////////////////////////////
1643
1663
  // Associate each loaded association with each dream based on primary key and foreign key type
1644
1664
  //////////////////////////////////////////////////////////////////////////////////////////////
1645
1665
  for (const loadedAssociation of loadedAssociations) {
1646
1666
  dreams
1647
- .filter((dream) => {
1648
- return (dream[association.foreignKeyTypeField()] === loadedAssociation['stiBaseClassOrOwnClassName'] &&
1649
- dream[association.foreignKey()] === association.primaryKeyValue(loadedAssociation));
1650
- })
1667
+ .filter((dream) => dream[association.foreignKeyTypeField()] === loadedAssociation['stiBaseClassOrOwnClassName'] &&
1668
+ dream[association.foreignKey()] === association.primaryKeyValue(loadedAssociation))
1651
1669
  .forEach((dream) => {
1652
1670
  dream[association.as] = loadedAssociation;
1653
1671
  });
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("../../dream-app/index.js");
4
+ class PackageManager {
5
+ static get packageManager() {
6
+ return index_js_1.default.getOrFail().packageManager;
7
+ }
8
+ static add(dependencyOrDependencies, { dev } = {}) {
9
+ const dependency = Array.isArray(dependencyOrDependencies)
10
+ ? dependencyOrDependencies.join(' ')
11
+ : dependencyOrDependencies;
12
+ if (dev) {
13
+ switch (this.packageManager) {
14
+ case 'npm':
15
+ return `${this.packageManager} install --save-dev ${dependency}`;
16
+ default:
17
+ return `${this.packageManager} add -D ${dependency}`;
18
+ }
19
+ }
20
+ else {
21
+ switch (this.packageManager) {
22
+ case 'npm':
23
+ return `${this.packageManager} install ${dependency}`;
24
+ default:
25
+ return `${this.packageManager} add ${dependency}`;
26
+ }
27
+ }
28
+ }
29
+ static runCmd(cmd) {
30
+ switch (this.packageManager) {
31
+ case 'npm':
32
+ return `npm run ${cmd}`;
33
+ default:
34
+ return `${this.packageManager} ${cmd}`;
35
+ }
36
+ }
37
+ }
38
+ exports.default = PackageManager;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DreamAppAllowedPackageManagersEnumValues = void 0;
3
4
  // after building for esm, importing pg using the following:
4
5
  //
5
6
  // import * as pg from 'pg'
@@ -211,6 +212,10 @@ Try setting it to something valid, like:
211
212
  get plugins() {
212
213
  return this._plugins;
213
214
  }
215
+ _packageManager;
216
+ get packageManager() {
217
+ return this._packageManager;
218
+ }
214
219
  loadedModels = false;
215
220
  constructor(opts) {
216
221
  if (opts?.db)
@@ -314,6 +319,9 @@ Try setting it to something valid, like:
314
319
  case 'unicodeNormalization':
315
320
  this._unicodeNormalization = options;
316
321
  break;
322
+ case 'packageManager':
323
+ this._packageManager = options;
324
+ break;
317
325
  case 'paginationPageSize':
318
326
  this._paginationPageSize = options;
319
327
  break;
@@ -347,3 +355,4 @@ function argToString(arg) {
347
355
  return arg.toISO();
348
356
  return util.inspect(arg, { depth: 3 });
349
357
  }
358
+ exports.DreamAppAllowedPackageManagersEnumValues = ['yarn', 'npm', 'pnpm'];
@@ -17,6 +17,7 @@ const sortBy_js_1 = require("../sortBy.js");
17
17
  const uniq_js_1 = require("../uniq.js");
18
18
  const autoGeneratedFileDisclaimer_js_1 = require("./autoGeneratedFileDisclaimer.js");
19
19
  class SchemaBuilder {
20
+ hasForeignKeyError = false;
20
21
  async build() {
21
22
  const { schemaConstContent, passthroughColumns, allDefaultScopeNames } = await this.buildSchemaContent();
22
23
  const imports = await this.getSchemaImports(schemaConstContent);
@@ -272,11 +273,15 @@ may need to update the table getter in the corresponding Dream.
272
273
  // split off into a separate file from the types we diliver in types/dream.ts
273
274
  let foreignKey = null;
274
275
  try {
275
- const _foreignKey = associationMetaData.foreignKey();
276
- foreignKey = _foreignKey;
276
+ const isThroughAssociation = associationMetaData.through;
277
+ if (!isThroughAssociation) {
278
+ const _foreignKey = associationMetaData.foreignKey();
279
+ foreignKey = _foreignKey;
280
+ }
277
281
  }
278
- catch {
279
- // noop
282
+ catch (err) {
283
+ this.hasForeignKeyError = true;
284
+ // console.error(err)
280
285
  }
281
286
  tableAssociationData[associationName] ||= {
282
287
  tables: [],
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Range = exports.sharedPathPrefix = exports.relativeDreamPath = exports.dreamPath = exports.pascalize = exports.normalizeUnicode = 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.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 = exports.range = void 0;
3
+ exports.sharedPathPrefix = exports.relativeDreamPath = exports.dreamPath = exports.pascalize = exports.normalizeUnicode = 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.DreamAppAllowedPackageManagersEnumValues = 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.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 = exports.range = exports.Range = 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");
@@ -33,6 +33,7 @@ var lookupClassByGlobalName_js_1 = require("./dream-app/helpers/lookupClassByGlo
33
33
  Object.defineProperty(exports, "lookupClassByGlobalName", { enumerable: true, get: function () { return lookupClassByGlobalName_js_1.default; } });
34
34
  var index_js_4 = require("./dream-app/index.js");
35
35
  Object.defineProperty(exports, "DreamApp", { enumerable: true, get: function () { return index_js_4.default; } });
36
+ Object.defineProperty(exports, "DreamAppAllowedPackageManagersEnumValues", { enumerable: true, get: function () { return index_js_4.DreamAppAllowedPackageManagersEnumValues; } });
36
37
  var Dream_js_1 = require("./Dream.js");
37
38
  Object.defineProperty(exports, "Dream", { enumerable: true, get: function () { return Dream_js_1.default; } });
38
39
  var constants_js_1 = require("./dream/constants.js");
@@ -3,8 +3,8 @@ import Query from '../dream/Query.js';
3
3
  import generateDream from '../helpers/cli/generateDream.js';
4
4
  import sspawn from '../helpers/sspawn.js';
5
5
  export default class DreamBin {
6
- static async sync(onSync) {
7
- await Query.dbDriverClass().sync(onSync);
6
+ static async sync(onSync, options) {
7
+ await Query.dbDriverClass().sync(onSync, options);
8
8
  }
9
9
  static async dbCreate() {
10
10
  await Query.dbDriverClass().dbCreate();
@@ -57,9 +57,10 @@ export default class DreamCLI {
57
57
  program
58
58
  .command('sync')
59
59
  .description('sync introspects your database, updating your schema to reflect, and then syncs the new schema with the installed dream node module, allowing it provide your schema to the underlying kysely integration')
60
- .action(async () => {
60
+ .option('--schema-only')
61
+ .action(async (options = {}) => {
61
62
  await initializeDreamApp();
62
- await DreamBin.sync(() => { });
63
+ await DreamBin.sync(() => { }, options);
63
64
  process.exit();
64
65
  });
65
66
  this.generateDreamCli(program, {
@@ -81,7 +81,7 @@ export function applyGetterAndSetter(target, partialAssociation, { foreignKeyBas
81
81
  partialAssociation.primaryKeyValue(associatedModel);
82
82
  if (partialAssociation.polymorphic)
83
83
  this[foreignKeyTypeField(foreignKeyBase, dreamClass, partialAssociation)] =
84
- associatedModel?.['sanitizedConstructorName'];
84
+ associatedModel?.['stiBaseClassOrOwnClassName'];
85
85
  }
86
86
  },
87
87
  });
@@ -1,8 +1,10 @@
1
1
  import { sql, } from 'kysely';
2
2
  import pluralize from 'pluralize-esm';
3
+ import writeSyncFile from '../../bin/helpers/sync.js';
3
4
  import DreamCLI from '../../cli/index.js';
4
5
  import _db from '../../db/index.js';
5
6
  import associationToGetterSetterProp from '../../decorators/field/association/associationToGetterSetterProp.js';
7
+ import PackageManager from '../../dream-app/helpers/PackageManager.js';
6
8
  import DreamApp from '../../dream-app/index.js';
7
9
  import CannotAssociateThroughPolymorphic from '../../errors/associations/CannotAssociateThroughPolymorphic.js';
8
10
  import CannotJoinPolymorphicBelongsToError from '../../errors/associations/CannotJoinPolymorphicBelongsToError.js';
@@ -17,8 +19,11 @@ import UnexpectedUndefined from '../../errors/UnexpectedUndefined.js';
17
19
  import CalendarDate from '../../helpers/CalendarDate.js';
18
20
  import camelize from '../../helpers/camelize.js';
19
21
  import generateMigration from '../../helpers/cli/generateMigration.js';
22
+ import SchemaBuilder from '../../helpers/cli/SchemaBuilder.js';
20
23
  import compact from '../../helpers/compact.js';
21
24
  import { DateTime } from '../../helpers/DateTime.js';
25
+ import createDb from '../../helpers/db/createDb.js';
26
+ import _dropDb from '../../helpers/db/dropDb.js';
22
27
  import loadPgClient from '../../helpers/db/loadPgClient.js';
23
28
  import runMigration from '../../helpers/db/runMigration.js';
24
29
  import EnvInternal from '../../helpers/EnvInternal.js';
@@ -43,10 +48,6 @@ import SimilarityBuilder from '../internal/similarity/SimilarityBuilder.js';
43
48
  import sqlResultToDreamInstance from '../internal/sqlResultToDreamInstance.js';
44
49
  import Query from '../Query.js';
45
50
  import QueryDriverBase from './Base.js';
46
- import writeSyncFile from '../../bin/helpers/sync.js';
47
- import SchemaBuilder from '../../helpers/cli/SchemaBuilder.js';
48
- import createDb from '../../helpers/db/createDb.js';
49
- import _dropDb from '../../helpers/db/dropDb.js';
50
51
  export default class KyselyQueryDriver extends QueryDriverBase {
51
52
  // ATTENTION FRED
52
53
  // stop trying to make this async. You never learn...
@@ -90,16 +91,35 @@ export default class KyselyQueryDriver extends QueryDriverBase {
90
91
  static async generateMigration(migrationName, columnsWithTypes) {
91
92
  await generateMigration({ migrationName, columnsWithTypes });
92
93
  }
93
- static async sync(onSync) {
94
- DreamCLI.logger.logStartProgress('writing db schema...');
95
- await writeSyncFile();
96
- DreamCLI.logger.logEndProgress();
94
+ static async sync(onSync, options = {}) {
95
+ if (!options?.schemaOnly) {
96
+ DreamCLI.logger.logStartProgress('writing db schema...');
97
+ await writeSyncFile();
98
+ DreamCLI.logger.logEndProgress();
99
+ }
97
100
  DreamCLI.logger.logStartProgress('building dream schema...');
98
- await new SchemaBuilder().build();
101
+ const schemaBuilder = new SchemaBuilder();
102
+ await schemaBuilder.build();
99
103
  DreamCLI.logger.logEndProgress();
100
- // intentionally leaving logs off here, since it allows other
101
- // onSync handlers to determine their own independent logging approach
102
- await onSync();
104
+ if (schemaBuilder.hasForeignKeyError && !options?.schemaOnly) {
105
+ DreamCLI.logger.logStartProgress('triggering resync to correct for foreign key errors...');
106
+ // TODO: make this customizable to enable dream apps to separate
107
+ const cliCmd = EnvInternal.boolean('DREAM_CORE_DEVELOPMENT') ? 'dream' : 'psy';
108
+ await DreamCLI.spawn(PackageManager.runCmd(`${cliCmd} sync --schema-only`), {
109
+ onStdout: str => {
110
+ DreamCLI.logger.logContinueProgress(`${str}`, {
111
+ logPrefix: ' ├ [resync]',
112
+ logPrefixColor: 'blue',
113
+ });
114
+ },
115
+ });
116
+ DreamCLI.logger.logEndProgress();
117
+ }
118
+ if (!options?.schemaOnly) {
119
+ // intentionally leaving logs off here, since it allows other
120
+ // onSync handlers to determine their own independent logging approach
121
+ await onSync();
122
+ }
103
123
  }
104
124
  /**
105
125
  * create the database. Must respond to the NODE_ENV value.
@@ -1611,13 +1631,13 @@ export default class KyselyQueryDriver extends QueryDriverBase {
1611
1631
  throw new Error(`Association ${association.as} points to an array of models but is not designated polymorphic`);
1612
1632
  if (association.type !== 'BelongsTo')
1613
1633
  throw new Error(`Polymorphic association ${association.as} points to an array of models but is ${association.type}. Only BelongsTo associations may point to an array of models.`);
1614
- const associatedDreams = [];
1634
+ const nestedDreamsForNextRoundOfPreloading = [];
1615
1635
  for (const associatedModel of association.modelCB()) {
1616
- await this.preloadPolymorphicAssociationModel(dreams, association, associatedModel, associatedDreams);
1636
+ await this.preloadPolymorphicAssociationModel(dreams, association, associatedModel, nestedDreamsForNextRoundOfPreloading);
1617
1637
  }
1618
- return associatedDreams;
1638
+ return nestedDreamsForNextRoundOfPreloading;
1619
1639
  }
1620
- async preloadPolymorphicAssociationModel(dreams, association, associatedDreamClass, associatedDreams) {
1640
+ async preloadPolymorphicAssociationModel(dreams, association, associatedDreamClass, nestedDreamsForNextRoundOfPreloading) {
1621
1641
  const relevantAssociatedModels = dreams.filter((dream) => {
1622
1642
  const field = association.foreignKeyTypeField();
1623
1643
  return dream[field] === associatedDreamClass['stiBaseClassOrOwnClassName'] || dream[field] === null;
@@ -1636,16 +1656,14 @@ export default class KyselyQueryDriver extends QueryDriverBase {
1636
1656
  [associatedDreamClass.primaryKey]: relevantAssociatedModels.map((dream) => dream[association.foreignKey()]),
1637
1657
  })
1638
1658
  .all();
1639
- loadedAssociations.forEach((loadedAssociation) => associatedDreams.push(loadedAssociation));
1659
+ loadedAssociations.forEach((loadedAssociation) => nestedDreamsForNextRoundOfPreloading.push(loadedAssociation));
1640
1660
  //////////////////////////////////////////////////////////////////////////////////////////////
1641
1661
  // Associate each loaded association with each dream based on primary key and foreign key type
1642
1662
  //////////////////////////////////////////////////////////////////////////////////////////////
1643
1663
  for (const loadedAssociation of loadedAssociations) {
1644
1664
  dreams
1645
- .filter((dream) => {
1646
- return (dream[association.foreignKeyTypeField()] === loadedAssociation['stiBaseClassOrOwnClassName'] &&
1647
- dream[association.foreignKey()] === association.primaryKeyValue(loadedAssociation));
1648
- })
1665
+ .filter((dream) => dream[association.foreignKeyTypeField()] === loadedAssociation['stiBaseClassOrOwnClassName'] &&
1666
+ dream[association.foreignKey()] === association.primaryKeyValue(loadedAssociation))
1649
1667
  .forEach((dream) => {
1650
1668
  dream[association.as] = loadedAssociation;
1651
1669
  });
@@ -0,0 +1,35 @@
1
+ import DreamApp from '../../dream-app/index.js';
2
+ export default class PackageManager {
3
+ static get packageManager() {
4
+ return DreamApp.getOrFail().packageManager;
5
+ }
6
+ static add(dependencyOrDependencies, { dev } = {}) {
7
+ const dependency = Array.isArray(dependencyOrDependencies)
8
+ ? dependencyOrDependencies.join(' ')
9
+ : dependencyOrDependencies;
10
+ if (dev) {
11
+ switch (this.packageManager) {
12
+ case 'npm':
13
+ return `${this.packageManager} install --save-dev ${dependency}`;
14
+ default:
15
+ return `${this.packageManager} add -D ${dependency}`;
16
+ }
17
+ }
18
+ else {
19
+ switch (this.packageManager) {
20
+ case 'npm':
21
+ return `${this.packageManager} install ${dependency}`;
22
+ default:
23
+ return `${this.packageManager} add ${dependency}`;
24
+ }
25
+ }
26
+ }
27
+ static runCmd(cmd) {
28
+ switch (this.packageManager) {
29
+ case 'npm':
30
+ return `npm run ${cmd}`;
31
+ default:
32
+ return `${this.packageManager} ${cmd}`;
33
+ }
34
+ }
35
+ }
@@ -209,6 +209,10 @@ Try setting it to something valid, like:
209
209
  get plugins() {
210
210
  return this._plugins;
211
211
  }
212
+ _packageManager;
213
+ get packageManager() {
214
+ return this._packageManager;
215
+ }
212
216
  loadedModels = false;
213
217
  constructor(opts) {
214
218
  if (opts?.db)
@@ -312,6 +316,9 @@ Try setting it to something valid, like:
312
316
  case 'unicodeNormalization':
313
317
  this._unicodeNormalization = options;
314
318
  break;
319
+ case 'packageManager':
320
+ this._packageManager = options;
321
+ break;
315
322
  case 'paginationPageSize':
316
323
  this._paginationPageSize = options;
317
324
  break;
@@ -344,3 +351,4 @@ function argToString(arg) {
344
351
  return arg.toISO();
345
352
  return util.inspect(arg, { depth: 3 });
346
353
  }
354
+ export const DreamAppAllowedPackageManagersEnumValues = ['yarn', 'npm', 'pnpm'];
@@ -15,6 +15,7 @@ import sortBy from '../sortBy.js';
15
15
  import uniq from '../uniq.js';
16
16
  import autogeneratedFileDisclaimer from './autoGeneratedFileDisclaimer.js';
17
17
  export default class SchemaBuilder {
18
+ hasForeignKeyError = false;
18
19
  async build() {
19
20
  const { schemaConstContent, passthroughColumns, allDefaultScopeNames } = await this.buildSchemaContent();
20
21
  const imports = await this.getSchemaImports(schemaConstContent);
@@ -270,11 +271,15 @@ may need to update the table getter in the corresponding Dream.
270
271
  // split off into a separate file from the types we diliver in types/dream.ts
271
272
  let foreignKey = null;
272
273
  try {
273
- const _foreignKey = associationMetaData.foreignKey();
274
- foreignKey = _foreignKey;
274
+ const isThroughAssociation = associationMetaData.through;
275
+ if (!isThroughAssociation) {
276
+ const _foreignKey = associationMetaData.foreignKey();
277
+ foreignKey = _foreignKey;
278
+ }
275
279
  }
276
- catch {
277
- // noop
280
+ catch (err) {
281
+ this.hasForeignKeyError = true;
282
+ // console.error(err)
278
283
  }
279
284
  tableAssociationData[associationName] ||= {
280
285
  tables: [],
@@ -12,7 +12,7 @@ export { default as STI } from './decorators/class/STI.js';
12
12
  export { default as Decorators } from './decorators/Decorators.js';
13
13
  export { default as DreamImporter } from './dream-app/helpers/DreamImporter.js';
14
14
  export { default as lookupClassByGlobalName } from './dream-app/helpers/lookupClassByGlobalName.js';
15
- export { default as DreamApp, } from './dream-app/index.js';
15
+ export { default as DreamApp, DreamAppAllowedPackageManagersEnumValues, } from './dream-app/index.js';
16
16
  export { default as Dream } from './Dream.js';
17
17
  export { DreamConst, openapiPrimitiveTypes, openapiShorthandPrimitiveTypes, } from './dream/constants.js';
18
18
  export { default as DreamTransaction } from './dream/DreamTransaction.js';
@@ -1,5 +1,7 @@
1
1
  export default class DreamBin {
2
- static sync(onSync: () => Promise<void> | void): Promise<void>;
2
+ static sync(onSync: () => Promise<void> | void, options?: {
3
+ schemaOnly?: boolean;
4
+ }): Promise<void>;
3
5
  static dbCreate(): Promise<void>;
4
6
  static dbDrop(): Promise<void>;
5
7
  static dbMigrate(): Promise<void>;
@@ -850,7 +850,9 @@ export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Re
850
850
  steps: number;
851
851
  }): Promise<void>;
852
852
  generateMigration(migrationName: string, columnsWithTypes: string[]): Promise<void>;
853
- sync(onSync: () => Promise<void> | void): Promise<void>;
853
+ sync(onSync: () => Promise<void> | void, options?: {
854
+ schemaOnly?: boolean;
855
+ }): Promise<void>;
854
856
  dbCreate(): Promise<void>;
855
857
  dbDrop(): Promise<void>;
856
858
  saveDream(dream: Dream, txn?: DreamTransaction<Dream> | null): Promise<any>;
@@ -1,12 +1,12 @@
1
1
  import { DeleteQueryBuilder, Kysely, Transaction as KyselyTransaction, SelectQueryBuilder, UpdateQueryBuilder } from 'kysely';
2
2
  import Dream from '../../Dream.js';
3
3
  import { AssociationStatement } from '../../types/associations/shared.js';
4
+ import { DbConnectionType } from '../../types/db.js';
4
5
  import { DreamColumnNames, DreamTableSchema, SqlCommandType } from '../../types/dream.js';
5
6
  import { PreloadedDreamsAndWhatTheyPointTo, QueryToKyselyDBType, QueryToKyselyTableNamesType } from '../../types/query.js';
6
7
  import DreamTransaction from '../DreamTransaction.js';
7
8
  import Query from '../Query.js';
8
9
  import QueryDriverBase from './Base.js';
9
- import { DbConnectionType } from '../../types/db.js';
10
10
  export default class KyselyQueryDriver<DreamInstance extends Dream> extends QueryDriverBase<DreamInstance> {
11
11
  dbFor(sqlCommandType: SqlCommandType): Kysely<DreamInstance['DB']> | KyselyTransaction<DreamInstance['DB']>;
12
12
  /**
@@ -20,7 +20,9 @@ export default class KyselyQueryDriver<DreamInstance extends Dream> extends Quer
20
20
  steps: number;
21
21
  }): Promise<void>;
22
22
  static generateMigration(migrationName: string, columnsWithTypes: string[]): Promise<void>;
23
- static sync(onSync: () => Promise<void> | void): Promise<void>;
23
+ static sync(onSync: () => Promise<void> | void, options?: {
24
+ schemaOnly?: boolean;
25
+ }): Promise<void>;
24
26
  /**
25
27
  * create the database. Must respond to the NODE_ENV value.
26
28
  */
@@ -0,0 +1,7 @@
1
+ export default class PackageManager {
2
+ static get packageManager(): "yarn" | "npm" | "pnpm";
3
+ static add(dependencyOrDependencies: string | string[], { dev }?: {
4
+ dev?: boolean;
5
+ }): string;
6
+ static runCmd(cmd: string): string;
7
+ }