@rvoh/dream 0.32.4 → 0.33.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 (267) hide show
  1. package/dist/cjs/src/Dream.js +1 -1
  2. package/dist/cjs/src/bin/helpers/sync.js +2 -2
  3. package/dist/cjs/src/dream-application/helpers/DreamImporter.js +0 -5
  4. package/dist/cjs/src/dream-application/helpers/lookupClassByGlobalName.js +0 -2
  5. package/dist/cjs/src/dream-application/index.js +4 -10
  6. package/dist/cjs/src/helpers/DreamGlam/howyadoins/whaaaaaaaaaaok.js +2 -2
  7. package/dist/cjs/src/helpers/cli/SchemaBuilder.js +2 -2
  8. package/dist/cjs/src/helpers/cli/autoGeneratedFileDisclaimer.js +33 -0
  9. package/dist/cjs/src/helpers/loadRepl.js +3 -5
  10. package/dist/cjs/src/helpers/path/dreamPath.js +0 -2
  11. package/dist/esm/src/Dream.js +1 -1
  12. package/dist/esm/src/bin/helpers/sync.js +1 -1
  13. package/dist/esm/src/dream-application/helpers/DreamImporter.js +0 -5
  14. package/dist/esm/src/dream-application/helpers/lookupClassByGlobalName.js +0 -2
  15. package/dist/esm/src/dream-application/index.js +4 -10
  16. package/dist/esm/src/helpers/DreamGlam/howyadoins/whaaaaaaaaaaok.js +2 -2
  17. package/dist/esm/src/helpers/cli/SchemaBuilder.js +1 -1
  18. package/dist/esm/src/helpers/cli/autoGeneratedFileDisclaimer.js +30 -0
  19. package/dist/esm/src/helpers/loadRepl.js +3 -5
  20. package/dist/esm/src/helpers/path/dreamPath.js +0 -2
  21. package/dist/types/src/Dream.d.ts +1 -1
  22. package/dist/types/src/dream-application/helpers/DreamImporter.d.ts +0 -1
  23. package/dist/types/src/dream-application/index.d.ts +5 -5
  24. package/dist/types/src/helpers/loadRepl.d.ts +1 -1
  25. package/docs/assets/search.js +1 -1
  26. package/docs/classes/Benchmark.html +2 -2
  27. package/docs/classes/CalendarDate.html +2 -2
  28. package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +3 -3
  29. package/docs/classes/Decorators.html +19 -19
  30. package/docs/classes/Dream.html +126 -126
  31. package/docs/classes/DreamApplication.html +4 -5
  32. package/docs/classes/DreamBin.html +2 -2
  33. package/docs/classes/DreamCLI.html +4 -4
  34. package/docs/classes/DreamDbConnection.html +2 -2
  35. package/docs/classes/DreamGlam.html +2 -2
  36. package/docs/classes/DreamImporter.html +2 -3
  37. package/docs/classes/DreamMigrationHelpers.html +7 -7
  38. package/docs/classes/DreamSerializer.html +2 -2
  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/Query.html +50 -50
  45. package/docs/classes/Range.html +2 -2
  46. package/docs/classes/RecordNotFound.html +3 -3
  47. package/docs/classes/ValidationError.html +3 -3
  48. package/docs/functions/Attribute.html +1 -1
  49. package/docs/functions/RendersMany.html +1 -1
  50. package/docs/functions/RendersOne.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/closeAllDbConnections.html +1 -1
  57. package/docs/functions/compact.html +1 -1
  58. package/docs/functions/db.html +1 -1
  59. package/docs/functions/debug.html +1 -1
  60. package/docs/functions/dreamDbConnections.html +1 -1
  61. package/docs/functions/dreamPath.html +1 -1
  62. package/docs/functions/generateDream.html +1 -1
  63. package/docs/functions/globalClassNameFromFullyQualifiedModelName.html +1 -1
  64. package/docs/functions/hyphenize.html +1 -1
  65. package/docs/functions/inferSerializerFromDreamClassOrViewModelClass.html +1 -1
  66. package/docs/functions/inferSerializerFromDreamOrViewModel.html +1 -1
  67. package/docs/functions/isEmpty.html +1 -1
  68. package/docs/functions/loadRepl.html +1 -1
  69. package/docs/functions/lookupClassByGlobalName.html +1 -1
  70. package/docs/functions/pascalize.html +1 -1
  71. package/docs/functions/pgErrorType.html +1 -1
  72. package/docs/functions/range-1.html +1 -1
  73. package/docs/functions/relativeDreamPath.html +1 -1
  74. package/docs/functions/round.html +1 -1
  75. package/docs/functions/serializerNameFromFullyQualifiedModelName.html +1 -1
  76. package/docs/functions/sharedPathPrefix.html +1 -1
  77. package/docs/functions/snakeify.html +1 -1
  78. package/docs/functions/sort.html +1 -1
  79. package/docs/functions/sortBy.html +1 -1
  80. package/docs/functions/standardizeFullyQualifiedModelName.html +1 -1
  81. package/docs/functions/uncapitalize.html +1 -1
  82. package/docs/functions/uniq.html +1 -1
  83. package/docs/functions/validateColumn.html +1 -1
  84. package/docs/functions/validateTable.html +1 -1
  85. package/docs/interfaces/AttributeStatement.html +2 -2
  86. package/docs/interfaces/DecoratorContext.html +2 -2
  87. package/docs/interfaces/DreamApplicationInitOptions.html +2 -2
  88. package/docs/interfaces/DreamApplicationOpts.html +2 -2
  89. package/docs/interfaces/DreamSerializerAssociationStatement.html +2 -2
  90. package/docs/interfaces/EncryptOptions.html +2 -2
  91. package/docs/interfaces/OpenapiSchemaProperties.html +1 -1
  92. package/docs/interfaces/OpenapiSchemaPropertiesShorthand.html +1 -1
  93. package/docs/interfaces/OpenapiTypeFieldObject.html +1 -1
  94. package/docs/types/Camelized.html +1 -1
  95. package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
  96. package/docs/types/DateTime.html +1 -1
  97. package/docs/types/DreamAssociationMetadata.html +1 -1
  98. package/docs/types/DreamAttributes.html +1 -1
  99. package/docs/types/DreamClassColumn.html +1 -1
  100. package/docs/types/DreamColumn.html +1 -1
  101. package/docs/types/DreamColumnNames.html +1 -1
  102. package/docs/types/DreamLogLevel.html +1 -1
  103. package/docs/types/DreamLogger.html +1 -1
  104. package/docs/types/DreamOrViewModelSerializerKey.html +1 -1
  105. package/docs/types/DreamParamSafeAttributes.html +1 -1
  106. package/docs/types/DreamParamSafeColumnNames.html +1 -1
  107. package/docs/types/DreamSerializerKey.html +1 -1
  108. package/docs/types/DreamSerializers.html +1 -1
  109. package/docs/types/DreamTableSchema.html +1 -1
  110. package/docs/types/DreamVirtualColumns.html +1 -1
  111. package/docs/types/EncryptAlgorithm.html +1 -1
  112. package/docs/types/Hyphenized.html +1 -1
  113. package/docs/types/IdType.html +1 -1
  114. package/docs/types/OpenapiAllTypes.html +1 -1
  115. package/docs/types/OpenapiFormats.html +1 -1
  116. package/docs/types/OpenapiNumberFormats.html +1 -1
  117. package/docs/types/OpenapiPrimitiveTypes.html +1 -1
  118. package/docs/types/OpenapiSchemaArray.html +1 -1
  119. package/docs/types/OpenapiSchemaArrayShorthand.html +1 -1
  120. package/docs/types/OpenapiSchemaBase.html +1 -1
  121. package/docs/types/OpenapiSchemaBody.html +1 -1
  122. package/docs/types/OpenapiSchemaBodyShorthand.html +1 -1
  123. package/docs/types/OpenapiSchemaCommonFields.html +1 -1
  124. package/docs/types/OpenapiSchemaExpressionAllOf.html +1 -1
  125. package/docs/types/OpenapiSchemaExpressionAnyOf.html +1 -1
  126. package/docs/types/OpenapiSchemaExpressionOneOf.html +1 -1
  127. package/docs/types/OpenapiSchemaExpressionRef.html +1 -1
  128. package/docs/types/OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
  129. package/docs/types/OpenapiSchemaInteger.html +1 -1
  130. package/docs/types/OpenapiSchemaNull.html +1 -1
  131. package/docs/types/OpenapiSchemaNumber.html +1 -1
  132. package/docs/types/OpenapiSchemaObject.html +1 -1
  133. package/docs/types/OpenapiSchemaObjectAllOf.html +1 -1
  134. package/docs/types/OpenapiSchemaObjectAllOfShorthand.html +1 -1
  135. package/docs/types/OpenapiSchemaObjectAnyOf.html +1 -1
  136. package/docs/types/OpenapiSchemaObjectAnyOfShorthand.html +1 -1
  137. package/docs/types/OpenapiSchemaObjectBase.html +1 -1
  138. package/docs/types/OpenapiSchemaObjectBaseShorthand.html +1 -1
  139. package/docs/types/OpenapiSchemaObjectOneOf.html +1 -1
  140. package/docs/types/OpenapiSchemaObjectOneOfShorthand.html +1 -1
  141. package/docs/types/OpenapiSchemaObjectShorthand.html +1 -1
  142. package/docs/types/OpenapiSchemaPartialSegment.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/SerializableDreamClassOrViewModelClass.html +1 -1
  159. package/docs/types/SerializableDreamOrViewModel.html +1 -1
  160. package/docs/types/SerializableTypes.html +1 -1
  161. package/docs/types/Snakeified.html +1 -1
  162. package/docs/types/Timestamp.html +1 -1
  163. package/docs/types/UpdateableAssociationProperties.html +1 -1
  164. package/docs/types/UpdateableProperties.html +1 -1
  165. package/docs/types/ValidationType.html +1 -1
  166. package/docs/types/ViewModelSerializerKey.html +1 -1
  167. package/docs/types/WhereStatementForDream.html +1 -1
  168. package/docs/types/WhereStatementForDreamClass.html +1 -1
  169. package/docs/variables/DateTime-1.html +1 -1
  170. package/docs/variables/DreamConst.html +1 -1
  171. package/docs/variables/TRIGRAM_OPERATORS.html +1 -1
  172. package/docs/variables/openapiPrimitiveTypes-1.html +1 -1
  173. package/docs/variables/openapiShorthandPrimitiveTypes-1.html +1 -1
  174. package/docs/variables/ops.html +1 -1
  175. package/docs/variables/primaryKeyTypes.html +1 -1
  176. package/package.json +2 -5
  177. package/boilerplate/app/models/ApplicationModel.ts +0 -14
  178. package/boilerplate/app/serializers/.gitkeep +0 -0
  179. package/boilerplate/bin/esm.js +0 -19
  180. package/boilerplate/cli/helpers/initializeDreamApplication.ts +0 -6
  181. package/boilerplate/cli/index.ts +0 -22
  182. package/boilerplate/conf/inflections.ts +0 -5
  183. package/boilerplate/conf/loadEnv.ts +0 -4
  184. package/boilerplate/conf/repl.ts +0 -11
  185. package/boilerplate/eslint.config.js +0 -21
  186. package/boilerplate/package.json +0 -39
  187. package/boilerplate/tsconfig.build.json +0 -41
  188. package/boilerplate/tsconfig.json +0 -12
  189. package/boilerplate/types/db.ts +0 -5
  190. package/boilerplate/types/dream.ts +0 -3
  191. package/dist/cjs/boilerplate/package.json +0 -39
  192. package/dist/cjs/src/dream-application/helpers/globalServiceKeyFromPath.js +0 -11
  193. package/dist/cjs/src/dream-application/helpers/importers/importServices.js +0 -43
  194. package/dist/cjs/src/global-cli/dream.js +0 -46
  195. package/dist/cjs/src/global-cli/file-builders/DreamtsBuilder.js +0 -69
  196. package/dist/cjs/src/global-cli/file-builders/EnvBuilder.js +0 -27
  197. package/dist/cjs/src/global-cli/file-builders/EslintConfBuilder.js +0 -29
  198. package/dist/cjs/src/global-cli/file-builders/PackagejsonBuilder.js +0 -9
  199. package/dist/cjs/src/global-cli/helpers/argAndValue.js +0 -15
  200. package/dist/cjs/src/global-cli/helpers/autogeneratedFileMessage.js +0 -71
  201. package/dist/cjs/src/global-cli/helpers/buildNewDreamApp.js +0 -63
  202. package/dist/cjs/src/global-cli/helpers/copyRecursive.js +0 -20
  203. package/dist/cjs/src/global-cli/helpers/filterObjectByKey.js +0 -23
  204. package/dist/cjs/src/global-cli/helpers/generateEncryptionKey.js +0 -26
  205. package/dist/cjs/src/global-cli/helpers/globalCliSnakeify.js +0 -1
  206. package/dist/cjs/src/global-cli/helpers/initDreamAppIntoExistingProject.js +0 -85
  207. package/dist/cjs/src/global-cli/helpers/log.js +0 -28
  208. package/dist/cjs/src/global-cli/helpers/logo.js +0 -81
  209. package/dist/cjs/src/global-cli/helpers/primaryKeyTypes.js +0 -13
  210. package/dist/cjs/src/global-cli/helpers/prompt.js +0 -33
  211. package/dist/cjs/src/global-cli/helpers/select.js +0 -113
  212. package/dist/cjs/src/global-cli/helpers/sleep.js +0 -10
  213. package/dist/cjs/src/global-cli/helpers/sspawn.js +0 -21
  214. package/dist/cjs/src/global-cli/helpers/welcomeMessage.js +0 -41
  215. package/dist/cjs/src/global-cli/init.js +0 -56
  216. package/dist/cjs/src/global-cli/new.js +0 -10
  217. package/dist/esm/boilerplate/package.json +0 -39
  218. package/dist/esm/src/dream-application/helpers/globalServiceKeyFromPath.js +0 -8
  219. package/dist/esm/src/dream-application/helpers/importers/importServices.js +0 -37
  220. package/dist/esm/src/global-cli/dream.js +0 -44
  221. package/dist/esm/src/global-cli/file-builders/DreamtsBuilder.js +0 -66
  222. package/dist/esm/src/global-cli/file-builders/EnvBuilder.js +0 -24
  223. package/dist/esm/src/global-cli/file-builders/EslintConfBuilder.js +0 -26
  224. package/dist/esm/src/global-cli/file-builders/PackagejsonBuilder.js +0 -6
  225. package/dist/esm/src/global-cli/helpers/argAndValue.js +0 -12
  226. package/dist/esm/src/global-cli/helpers/autogeneratedFileMessage.js +0 -68
  227. package/dist/esm/src/global-cli/helpers/buildNewDreamApp.js +0 -60
  228. package/dist/esm/src/global-cli/helpers/copyRecursive.js +0 -17
  229. package/dist/esm/src/global-cli/helpers/filterObjectByKey.js +0 -20
  230. package/dist/esm/src/global-cli/helpers/generateEncryptionKey.js +0 -23
  231. package/dist/esm/src/global-cli/helpers/globalCliSnakeify.js +0 -1
  232. package/dist/esm/src/global-cli/helpers/initDreamAppIntoExistingProject.js +0 -82
  233. package/dist/esm/src/global-cli/helpers/log.js +0 -24
  234. package/dist/esm/src/global-cli/helpers/logo.js +0 -77
  235. package/dist/esm/src/global-cli/helpers/primaryKeyTypes.js +0 -10
  236. package/dist/esm/src/global-cli/helpers/prompt.js +0 -30
  237. package/dist/esm/src/global-cli/helpers/select.js +0 -110
  238. package/dist/esm/src/global-cli/helpers/sleep.js +0 -7
  239. package/dist/esm/src/global-cli/helpers/sspawn.js +0 -17
  240. package/dist/esm/src/global-cli/helpers/welcomeMessage.js +0 -38
  241. package/dist/esm/src/global-cli/init.js +0 -53
  242. package/dist/esm/src/global-cli/new.js +0 -7
  243. package/dist/types/src/dream-application/helpers/globalServiceKeyFromPath.d.ts +0 -1
  244. package/dist/types/src/dream-application/helpers/importers/importServices.d.ts +0 -4
  245. package/dist/types/src/global-cli/dream.d.ts +0 -2
  246. package/dist/types/src/global-cli/file-builders/DreamtsBuilder.d.ts +0 -4
  247. package/dist/types/src/global-cli/file-builders/EnvBuilder.d.ts +0 -6
  248. package/dist/types/src/global-cli/file-builders/EslintConfBuilder.d.ts +0 -3
  249. package/dist/types/src/global-cli/file-builders/PackagejsonBuilder.d.ts +0 -3
  250. package/dist/types/src/global-cli/helpers/argAndValue.d.ts +0 -1
  251. package/dist/types/src/global-cli/helpers/buildNewDreamApp.d.ts +0 -2
  252. package/dist/types/src/global-cli/helpers/copyRecursive.d.ts +0 -1
  253. package/dist/types/src/global-cli/helpers/filterObjectByKey.d.ts +0 -1
  254. package/dist/types/src/global-cli/helpers/generateEncryptionKey.d.ts +0 -1
  255. package/dist/types/src/global-cli/helpers/globalCliSnakeify.d.ts +0 -1
  256. package/dist/types/src/global-cli/helpers/initDreamAppIntoExistingProject.d.ts +0 -2
  257. package/dist/types/src/global-cli/helpers/log.d.ts +0 -10
  258. package/dist/types/src/global-cli/helpers/logo.d.ts +0 -2
  259. package/dist/types/src/global-cli/helpers/primaryKeyTypes.d.ts +0 -22
  260. package/dist/types/src/global-cli/helpers/prompt.d.ts +0 -8
  261. package/dist/types/src/global-cli/helpers/select.d.ts +0 -17
  262. package/dist/types/src/global-cli/helpers/sleep.d.ts +0 -1
  263. package/dist/types/src/global-cli/helpers/sspawn.d.ts +0 -2
  264. package/dist/types/src/global-cli/helpers/welcomeMessage.d.ts +0 -1
  265. package/dist/types/src/global-cli/init.d.ts +0 -2
  266. package/dist/types/src/global-cli/new.d.ts +0 -2
  267. /package/dist/types/src/{global-cli/helpers/autogeneratedFileMessage.d.ts → helpers/cli/autoGeneratedFileDisclaimer.d.ts} +0 -0
@@ -1,110 +0,0 @@
1
- import * as colors from 'colorette';
2
- import * as readline from 'readline';
3
- const input = process.stdin;
4
- const output = process.stdout;
5
- let firstCallComplete = false;
6
- export default class Select {
7
- question;
8
- selectIndex = 0;
9
- options;
10
- selector = '>';
11
- isFirstTimeShowMenu = true;
12
- cb = null;
13
- constructor(question, options) {
14
- this.question = question;
15
- this.options = options;
16
- }
17
- async run() {
18
- this.init();
19
- return new Promise(accept => {
20
- this.cb = accept;
21
- });
22
- }
23
- keyPressedHandler(_, key) {
24
- if (key) {
25
- const optionLength = this.options.length - 1;
26
- if (key.name === 'down' && this.selectIndex < optionLength) {
27
- this.selectIndex += 1;
28
- this.createOptionMenu();
29
- }
30
- else if (key.name === 'up' && this.selectIndex > 0) {
31
- this.selectIndex -= 1;
32
- this.createOptionMenu();
33
- }
34
- else if (key.name === 'return') {
35
- this.cb?.(this.options[this.selectIndex]);
36
- input.removeAllListeners('keypress');
37
- if (firstCallComplete) {
38
- output.write('\n');
39
- }
40
- else {
41
- firstCallComplete = true;
42
- }
43
- input.setRawMode(false);
44
- input.pause();
45
- }
46
- else if (key.name === 'escape' || (key.name === 'c' && key.ctrl)) {
47
- this.close();
48
- }
49
- }
50
- }
51
- ansiEraseLines(count) {
52
- //adapted from sindresorhus ansi-escape module
53
- const ESC = '\u001B[';
54
- const eraseLine = ESC + '2K';
55
- const cursorUp = (count = 1) => ESC + count + 'A';
56
- const cursorLeft = ESC + 'G';
57
- let clear = '';
58
- for (let i = 0; i < count; i++) {
59
- clear += eraseLine + (i < count - 1 ? cursorUp() : '');
60
- }
61
- if (count) {
62
- clear += cursorLeft;
63
- }
64
- return clear;
65
- }
66
- init() {
67
- console.log(this.question);
68
- readline.emitKeypressEvents(input);
69
- this.start();
70
- }
71
- start() {
72
- //setup the input for reading
73
- input.setRawMode(true);
74
- input.resume();
75
- input.on('keypress', (event, key) => this.keyPressedHandler(event, key));
76
- if (this.selectIndex >= 0) {
77
- this.createOptionMenu();
78
- }
79
- }
80
- close = () => {
81
- input.setRawMode(false);
82
- input.pause();
83
- process.exit(0);
84
- };
85
- getPadding(num = 10) {
86
- let text = ' ';
87
- for (let i = 0; i < num; i++) {
88
- text += ' ';
89
- }
90
- return text;
91
- }
92
- createOptionMenu() {
93
- const optionLength = this.options.length;
94
- if (this.isFirstTimeShowMenu) {
95
- this.isFirstTimeShowMenu = false;
96
- }
97
- else {
98
- output.write(this.ansiEraseLines(optionLength));
99
- }
100
- const padding = this.getPadding(0);
101
- const cursor = colors.magenta(this.selector);
102
- for (let i = 0; i < optionLength; i++) {
103
- const selectedOption = i === this.selectIndex
104
- ? `${cursor} ${this.options[i]}`
105
- : `${cursor.replace(/.*/, ' ')} ${this.options[i]}`;
106
- const ending = i !== optionLength - 1 ? '\n' : '';
107
- output.write(padding + selectedOption + ending);
108
- }
109
- }
110
- }
@@ -1,7 +0,0 @@
1
- export default function sleep(ms) {
2
- return new Promise(accept => {
3
- setTimeout(() => {
4
- accept({});
5
- }, ms);
6
- });
7
- }
@@ -1,17 +0,0 @@
1
- import { spawn } from 'child_process';
2
- export default function sspawn(command, opts = {}) {
3
- return new Promise((accept, reject) => {
4
- ssspawn(command, opts).on('close', code => {
5
- if (code !== 0)
6
- reject(code);
7
- accept({});
8
- });
9
- });
10
- }
11
- export function ssspawn(command, opts = {}) {
12
- return spawn(command, {
13
- stdio: 'inherit',
14
- shell: true,
15
- ...opts,
16
- });
17
- }
@@ -1,38 +0,0 @@
1
- import * as c from 'colorette';
2
- export default function welcomeMessage(appName) {
3
- return `
4
- ${c.green(c.bold(c.italic(`Welcome to Dream! \n cd into ${c.magentaBright(appName)} to get started`)))}
5
-
6
- ${c.magenta(`to create a database,`)}
7
- ${c.magenta(`$ NODE_ENV=development yarn dream db:create`)}
8
- ${c.magenta(`$ NODE_ENV=test yarn dream db:create`)}
9
-
10
- ${c.magentaBright(`to migrate a database,`)}
11
- ${c.magentaBright(`$ NODE_ENV=development yarn dream db:migrate`)}
12
- ${c.magentaBright(`$ NODE_ENV=test yarn dream db:migrate`)}
13
-
14
- ${c.redBright(`to rollback a database,`)}
15
- ${c.redBright(`$ NODE_ENV=development yarn dream db:rollback`)}
16
- ${c.redBright(`$ NODE_ENV=test yarn dream db:rollback --step=1`)}
17
-
18
- ${c.blueBright(`to drop a database,`)}
19
- ${c.blueBright(`$ NODE_ENV=development yarn dream db:drop`)}
20
- ${c.blueBright(`$ NODE_ENV=test yarn dream db:drop`)}
21
-
22
- # NOTE: doing it this way, you will still need to
23
- # plug the routes manually in your api/src/app/conf/routes.ts file
24
-
25
- ${c.greenBright(`to create a model`)}
26
- ${c.greenBright(`$ yarn dream g:model user organization:belongs_to likes_chalupas:boolean some_id:uuid`)}
27
-
28
- ${c.yellow(`to create a migration`)}
29
- ${c.yellow(`$ yarn dream g:migration create-users`)}
30
-
31
- ${c.magentaBright(`to run unit tests,`)}
32
- ${c.magentaBright(`$ yarn dream uspec`)}
33
-
34
- # NOTE: before you get started, be sure to visit your ${c.magenta('.env')} and ${c.magenta('.env.test')}
35
- # files and make sure they have database credentials set correctly.
36
- # you can see conf/dream.ts to see how those credentials are used.
37
- `;
38
- }
@@ -1,53 +0,0 @@
1
- import initDreamAppIntoExistingProject from './helpers/initDreamAppIntoExistingProject.js';
2
- import { cliDefaultConfigPath, cliDefaultDbPath, cliDefaultFactoriesPath, cliDefaultModelsPath, cliDefaultModelSpecsPath, cliDefaultProjectPath, cliDefaultSerializersPath, cliDefaultServicesPath, cliDefaultTypesPath, cliPrimaryKeyTypes, } from './helpers/primaryKeyTypes.js';
3
- import Prompt from './helpers/prompt.js';
4
- import Select from './helpers/select.js';
5
- export default async function initDreamApp(options) {
6
- if (!options.primaryKeyType || !cliPrimaryKeyTypes.includes(options.primaryKeyType)) {
7
- const answer = await new Select('what primary key type would you like to use?', cliPrimaryKeyTypes).run();
8
- options.primaryKeyType = answer;
9
- }
10
- if (!options.projectPath) {
11
- const answer = await new Prompt(`Relative to the current directory, where would you like us to put your project? (defaults to the current directory)`).run();
12
- if (process.env.DREAM_CORE_DEVELOPMENT === '1' && !answer) {
13
- throw new Error(`
14
- when in dream core development, you must provide an explicit project directory. If you do not specify it,
15
- you risk accidentally overwriting all the root files in the dream directory.
16
- `);
17
- }
18
- options.projectPath = answer || cliDefaultProjectPath;
19
- }
20
- if (!options.configPath) {
21
- const answer = await new Prompt(`Relative to your project root, where would you like us to put your config files? (defaults to ${cliDefaultConfigPath})`).run();
22
- options.configPath = answer || cliDefaultConfigPath;
23
- }
24
- if (!options.modelsPath) {
25
- const answer = await new Prompt(`Relative to your project root, where would you like us to put your models? (defaults to ${cliDefaultModelsPath})`).run();
26
- options.modelsPath = answer || cliDefaultModelsPath;
27
- }
28
- if (!options.serializersPath) {
29
- const answer = await new Prompt(`Relative to your project root, where would you like us to put your serializers? (defaults to ${cliDefaultSerializersPath})`).run();
30
- options.serializersPath = answer || cliDefaultSerializersPath;
31
- }
32
- if (!options.servicesPath) {
33
- const answer = await new Prompt(`Relative to your project root, where would you like us to put your services? (defaults to ${cliDefaultServicesPath})`).run();
34
- options.servicesPath = answer || cliDefaultServicesPath;
35
- }
36
- if (!options.dbPath) {
37
- const answer = await new Prompt(`Relative to your project root, where would you like us to put your db files? (defaults to ${cliDefaultDbPath})`).run();
38
- options.dbPath = answer || cliDefaultDbPath;
39
- }
40
- if (!options.typesPath) {
41
- const answer = await new Prompt(`Relative to your project root, where would you like us to put your dream.ts and db.ts type files? (defaults to ${cliDefaultTypesPath})`).run();
42
- options.typesPath = answer || cliDefaultTypesPath;
43
- }
44
- if (!options.modelSpecsPath) {
45
- const answer = await new Prompt(`Relative to your project root, where would you like us to put your model tests? (defaults to ${cliDefaultModelSpecsPath})`).run();
46
- options.modelSpecsPath = answer || cliDefaultModelSpecsPath;
47
- }
48
- if (!options.factoriesPath) {
49
- const answer = await new Prompt(`Relative to your project root, where would you like us to put your factories? (defaults to ${cliDefaultFactoriesPath})`).run();
50
- options.factoriesPath = answer || cliDefaultFactoriesPath;
51
- }
52
- await initDreamAppIntoExistingProject('dream app', options);
53
- }
@@ -1,7 +0,0 @@
1
- import * as fs from 'fs/promises';
2
- import buildNewDreamApp from './helpers/buildNewDreamApp.js';
3
- export default async function newDreamApp(appName, options) {
4
- const projectPath = `./${appName}`;
5
- await fs.mkdir(projectPath);
6
- await buildNewDreamApp(appName, projectPath, options);
7
- }
@@ -1 +0,0 @@
1
- export default function (filepath: string, dirPath: string): string;
@@ -1,4 +0,0 @@
1
- export default function importServices(servicesPath: string, serviceImportCb: (path: string) => Promise<any>): Promise<Record<string, any>>;
2
- export declare function setCachedServices(services: Record<string, any>): void;
3
- export declare function getServicesOrFail(): Record<string, any>;
4
- export declare function getServicesOrBlank(): Record<string, any>;
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,4 +0,0 @@
1
- import { InitDreamAppCliOptions } from '../helpers/primaryKeyTypes.js';
2
- export default class DreamtsBuilder {
3
- static build(options: InitDreamAppCliOptions): string;
4
- }
@@ -1,6 +0,0 @@
1
- export default class EnvBuilder {
2
- static build({ env, appName }: {
3
- env: 'test' | 'development' | 'production';
4
- appName: string;
5
- }): string;
6
- }
@@ -1,3 +0,0 @@
1
- export default class ESLintConfBuilder {
2
- static buildForViteReact(): string;
3
- }
@@ -1,3 +0,0 @@
1
- export default class PackagejsonBuilder {
2
- static buildAPI(): Promise<string>;
3
- }
@@ -1 +0,0 @@
1
- export default function argAndValue(arg: string, args: string[]): [string | null, string | null];
@@ -1,2 +0,0 @@
1
- import { InitDreamAppCliOptions } from './primaryKeyTypes.js';
2
- export default function buildNewDreamApp(appName: string, projectPath: string, options: InitDreamAppCliOptions): Promise<void>;
@@ -1 +0,0 @@
1
- export default function copyRecursive(src: string, dest: string): void;
@@ -1 +0,0 @@
1
- export default function filterObjectByKey<T extends object, U extends string[], R extends Pick<T, U[number] & keyof T>>(obj: T, arr: U): R;
@@ -1 +0,0 @@
1
- export default function generateEncryptionKey(): string;
@@ -1,2 +0,0 @@
1
- import { InitDreamAppCliOptions } from './primaryKeyTypes.js';
2
- export default function initDreamAppIntoExistingProject(appName: string, options: InitDreamAppCliOptions): Promise<void>;
@@ -1,10 +0,0 @@
1
- export declare class Logger {
2
- cache: string[];
3
- write(text: string, { cache }?: {
4
- cache?: boolean;
5
- }): void;
6
- restoreCache(preRestoreContent?: string): void;
7
- clear(): void;
8
- }
9
- declare const log: Logger;
10
- export default log;
@@ -1,2 +0,0 @@
1
- export default function logo(): string;
2
- export declare function basicLogo(): string;
@@ -1,22 +0,0 @@
1
- export declare const cliPrimaryKeyTypes: readonly ["bigserial", "serial", "uuid"];
2
- export declare const cliDefaultProjectPath = ".";
3
- export declare const cliDefaultConfigPath = "src/conf.js";
4
- export declare const cliDefaultDbPath = "src/db.js";
5
- export declare const cliDefaultTypesPath = "src/types.js";
6
- export declare const cliDefaultModelsPath = "src/app/models.js";
7
- export declare const cliDefaultSerializersPath = "src/app/serializers.js";
8
- export declare const cliDefaultServicesPath = "src/app/services.js";
9
- export declare const cliDefaultModelSpecsPath = "spec/uspec/models.js";
10
- export declare const cliDefaultFactoriesPath = "spec/factories.js";
11
- export interface InitDreamAppCliOptions {
12
- configPath: string;
13
- dbPath: string;
14
- factoriesPath: string;
15
- modelsPath: string;
16
- modelSpecsPath: string;
17
- primaryKeyType: (typeof cliPrimaryKeyTypes)[number];
18
- projectPath: string;
19
- serializersPath: string;
20
- servicesPath: string;
21
- typesPath: string;
22
- }
@@ -1,8 +0,0 @@
1
- export default class Prompt {
2
- private question;
3
- private cb;
4
- constructor(question: string);
5
- run(): Promise<string>;
6
- private init;
7
- close: () => never;
8
- }
@@ -1,17 +0,0 @@
1
- export default class Select<T extends readonly any[]> {
2
- private question;
3
- private selectIndex;
4
- private options;
5
- private selector;
6
- private isFirstTimeShowMenu;
7
- private cb;
8
- constructor(question: string, options: T);
9
- run(): Promise<T[number]>;
10
- private keyPressedHandler;
11
- private ansiEraseLines;
12
- private init;
13
- private start;
14
- close: () => never;
15
- private getPadding;
16
- private createOptionMenu;
17
- }
@@ -1 +0,0 @@
1
- export default function sleep(ms: number): Promise<unknown>;
@@ -1,2 +0,0 @@
1
- export default function sspawn(command: string, opts?: Record<string, unknown>): Promise<unknown>;
2
- export declare function ssspawn(command: string, opts?: Record<string, unknown>): import("child_process").ChildProcess;
@@ -1 +0,0 @@
1
- export default function welcomeMessage(appName: string): string;
@@ -1,2 +0,0 @@
1
- import { InitDreamAppCliOptions } from './helpers/primaryKeyTypes.js';
2
- export default function initDreamApp(options: InitDreamAppCliOptions): Promise<void>;
@@ -1,2 +0,0 @@
1
- import { InitDreamAppCliOptions } from './helpers/primaryKeyTypes.js';
2
- export default function newDreamApp(appName: string, options: InitDreamAppCliOptions): Promise<void>;