@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,39 +0,0 @@
1
- {
2
- "type": "module",
3
- "name": "tbd",
4
- "version": "0.0.0",
5
- "main": "src/index.ts",
6
- "author": "tbd",
7
- "private": true,
8
- "scripts": {
9
- "dream": "yarn dreamts",
10
- "dreamjs": "node --experimental-modules dist/test-app/cli/index.js",
11
- "dreamts": "node --experimental-specifier-resolution=node --import=./bin/esm.js ./src/cli/index.ts",
12
- "console": "node --experimental-specifier-resolution=node --import=./bin/esm.js ./src/conf/repl.ts",
13
- "lint": "yarn run eslint --no-warn-ignored \"src/**/*.ts\" \"spec/**/*.ts\""
14
- },
15
- "dependencies": {
16
- "@rvoh/dream": "1.0.0",
17
- "@types/node": "^20.11.17",
18
- "@types/pg": "^8.11.3",
19
- "kysely-codegen": "^0.11.0",
20
- "kysely": "^0.27.2",
21
- "pg": "^8.11.3",
22
- "winston": "^3.13.0"
23
- },
24
- "devDependencies": {
25
- "@eslint/js": "=9.0.0",
26
- "@rvoh/dream-spec-helpers": "1.0.0",
27
- "@types/jest": "^29.5.12",
28
- "@types/node": "^20.11.17",
29
- "@types/pg": "^8.11.3",
30
- "eslint": "=9.0.0",
31
- "jest": "^29.7.0",
32
- "luxon-jest-matchers": "^0.1.14",
33
- "prettier": "^3.2.5",
34
- "ts-jest": "^29.1.4",
35
- "ts-node": "^10.9.2",
36
- "typescript-eslint": "=7.18.0",
37
- "typescript": "^5.4.5"
38
- }
39
- }
@@ -1,41 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "forceConsistentCasingInFileNames": true,
4
- "lib": ["ES2022"],
5
- "module": "Node16",
6
- "moduleResolution": "node16",
7
- "noImplicitAny": true,
8
- "outDir": "./dist",
9
- "rootDir": "./",
10
- "skipLibCheck": true,
11
- "sourceMap": true,
12
- "strict": true,
13
- "strictBindCallApply": true,
14
- "strictNullChecks": true,
15
-
16
- /**
17
- * Dream properties are initialized when a Dream model is
18
- * loaded from the database, and custom setters and getters
19
- * are applied during the initialization. The setters are
20
- * intentionally disabled before the constructor of
21
- * classes that extend Dream is run to prevent the ESNext
22
- * behavior of setting properties to undefined (or even explicit
23
- * setting in the constructor) from overriding data loaded from
24
- * the database.
25
- */
26
- "strictPropertyInitialization": false,
27
-
28
- "target": "ES2022",
29
- "useUnknownInCatchVariables": true,
30
- },
31
- "include": ["src", "noop"],
32
-
33
- /**
34
- * this ts-node block is necessary to get node commands to leverage the ts-node esm loader
35
- * removing this block will lead to ambiguous crashing in node with no stack traces.
36
- */
37
- "ts-node": {
38
- "transpileOnly": true,
39
- "esm": true
40
- }
41
- }
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "./tsconfig.build.json",
3
- "ts-node": {
4
- "ignore": [],
5
- "include": ["src/**/*"]
6
- },
7
- "compilerOptions": {
8
- "baseUrl": "src",
9
- "types": ["luxon-jest-matchers"],
10
- },
11
- "include": ["src", "spec"]
12
- }
@@ -1,5 +0,0 @@
1
- export interface DB {}
2
-
3
- export class DBClass {}
4
-
5
- export const AllColumns = [] as const
@@ -1,3 +0,0 @@
1
- export const schema = {} as const
2
-
3
- export const globalSchema = {} as const
@@ -1,39 +0,0 @@
1
- {
2
- "type": "module",
3
- "name": "tbd",
4
- "version": "0.0.0",
5
- "main": "src/index.ts",
6
- "author": "tbd",
7
- "private": true,
8
- "scripts": {
9
- "dream": "yarn dreamts",
10
- "dreamjs": "node --experimental-modules dist/test-app/cli/index.js",
11
- "dreamts": "node --experimental-specifier-resolution=node --import=./bin/esm.js ./src/cli/index.ts",
12
- "console": "node --experimental-specifier-resolution=node --import=./bin/esm.js ./src/conf/repl.ts",
13
- "lint": "yarn run eslint --no-warn-ignored \"src/**/*.ts\" \"spec/**/*.ts\""
14
- },
15
- "dependencies": {
16
- "@rvoh/dream": "1.0.0",
17
- "@types/node": "^20.11.17",
18
- "@types/pg": "^8.11.3",
19
- "kysely-codegen": "^0.11.0",
20
- "kysely": "^0.27.2",
21
- "pg": "^8.11.3",
22
- "winston": "^3.13.0"
23
- },
24
- "devDependencies": {
25
- "@eslint/js": "=9.0.0",
26
- "@rvoh/dream-spec-helpers": "1.0.0",
27
- "@types/jest": "^29.5.12",
28
- "@types/node": "^20.11.17",
29
- "@types/pg": "^8.11.3",
30
- "eslint": "=9.0.0",
31
- "jest": "^29.7.0",
32
- "luxon-jest-matchers": "^0.1.14",
33
- "prettier": "^3.2.5",
34
- "ts-jest": "^29.1.4",
35
- "ts-node": "^10.9.2",
36
- "typescript-eslint": "=7.18.0",
37
- "typescript": "^5.4.5"
38
- }
39
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- function default_1(filepath, dirPath) {
5
- const prefixPath = dirPath;
6
- return ('services/' +
7
- filepath
8
- .replace(prefixPath, '')
9
- .replace(/\.[jt]s$/, '')
10
- .replace(/^\//, ''));
11
- }
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = importServices;
4
- exports.setCachedServices = setCachedServices;
5
- exports.getServicesOrFail = getServicesOrFail;
6
- exports.getServicesOrBlank = getServicesOrBlank;
7
- const DreamImporter_js_1 = require("../DreamImporter.js");
8
- const globalServiceKeyFromPath_js_1 = require("../globalServiceKeyFromPath.js");
9
- let _services;
10
- async function importServices(servicesPath, serviceImportCb) {
11
- if (_services)
12
- return _services;
13
- _services = {};
14
- const serviceClasses = await DreamImporter_js_1.default.importServices(servicesPath, serviceImportCb);
15
- for (const [servicePath, serviceClass] of serviceClasses) {
16
- // we only want to register services within our app
17
- // that are backgroundable, since the only purpose
18
- // for keeping these indices is to be able to summon
19
- // a service for backgrounding.
20
- if (typeof serviceClass?.background === 'function' || typeof serviceClass?.schedule === 'function') {
21
- const serviceKey = (0, globalServiceKeyFromPath_js_1.default)(servicePath, servicesPath);
22
- if (typeof serviceClass['setGlobalName'] === 'function') {
23
- serviceClass['setGlobalName'](serviceKey);
24
- }
25
- else {
26
- serviceClass.globalName = serviceKey;
27
- }
28
- _services[serviceKey] = serviceClass;
29
- }
30
- }
31
- return _services;
32
- }
33
- function setCachedServices(services) {
34
- _services = services;
35
- }
36
- function getServicesOrFail() {
37
- if (!_services)
38
- throw new Error('Must call loadServices before calling getServicesOrFail');
39
- return _services;
40
- }
41
- function getServicesOrBlank() {
42
- return _services || {};
43
- }
@@ -1,46 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- // nice reference for shell commands:
4
- // https://www.freecodecamp.org/news/node-js-child-processes-everything-you-need-to-know-e69498fe970a/
5
- // commanderjs docs:
6
- // https://github.com/tj/commander.js#quick-start
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const commander_1 = require("commander");
9
- const primaryKeyTypes_js_1 = require("./helpers/primaryKeyTypes.js");
10
- const init_js_1 = require("./init.js");
11
- const new_js_1 = require("./new.js");
12
- const program = new commander_1.Command();
13
- program
14
- .command('new')
15
- .description('creates a new dream app using the name provided')
16
- .argument('<name>', 'name of the app you want to create')
17
- .option('--primary-key-type <KEY_TYPE>', `One of: ${primaryKeyTypes_js_1.cliPrimaryKeyTypes.join(', ')}. The type of primary key to use by default when generating Dream models (can be changed on a model-by-model basis as needed in each migration file)`)
18
- .option('--project-path <PATH>', 'the root of the project', primaryKeyTypes_js_1.cliDefaultProjectPath)
19
- .option('--config-path <PATH>', 'the path from your project root to the config directory', primaryKeyTypes_js_1.cliDefaultConfigPath)
20
- .option('--db-path <PATH>', 'the path from your project root to the db directory', primaryKeyTypes_js_1.cliDefaultDbPath)
21
- .option('--types-path <PATH>', 'the path from your project root to the types directory', primaryKeyTypes_js_1.cliDefaultTypesPath)
22
- .option('--models-path <PATH>', 'the path from your project root to the models directory', primaryKeyTypes_js_1.cliDefaultModelsPath)
23
- .option('--serializers-path <PATH>', 'the path from your project root to the serializers directory', primaryKeyTypes_js_1.cliDefaultSerializersPath)
24
- .option('--services-path <PATH>', 'the path from your project root to the services directory', primaryKeyTypes_js_1.cliDefaultServicesPath)
25
- .option('--model-specs-path <PATH>', 'the path from your project root to the model specs directory', primaryKeyTypes_js_1.cliDefaultModelSpecsPath)
26
- .option('--factories-path <PATH>', 'the path from your project root to the spec factories directory', primaryKeyTypes_js_1.cliDefaultFactoriesPath)
27
- .action(async (name, options) => {
28
- await (0, new_js_1.default)(name, options);
29
- });
30
- program
31
- .command('init')
32
- .description('initialize a new dream app into your existing application')
33
- .option('--primary-key-type <KEY_TYPE>', `One of: ${primaryKeyTypes_js_1.cliPrimaryKeyTypes.join(', ')}. The type of primary key to use by default when generating Dream models (can be changed on a model-by-model basis as needed in each migration file)`)
34
- .option('--project-path <PATH>', 'the root of the project')
35
- .option('--config-path <PATH>', 'the path from your project root to the config directory')
36
- .option('--db-path <PATH>', 'the path from your project root to the db directory')
37
- .option('--types-path <PATH>', 'the path from your project root to the types directory')
38
- .option('--models-path <PATH>', 'the path from your project root to the models directory')
39
- .option('--serializers-path <PATH>', 'the path from your project root to the serializers directory')
40
- .option('--services-path <PATH>', 'the path from your project root to the services directory')
41
- .option('--model-specs-path <PATH>', 'the path from your project root to the model specs directory')
42
- .option('--factories-path <PATH>', 'the path from your project root to the spec factories directory')
43
- .action(async (options) => {
44
- await (0, init_js_1.default)(options);
45
- });
46
- program.parse();
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class DreamtsBuilder {
4
- static build(options) {
5
- const { configPath, dbPath, typesPath, factoriesPath, modelsPath, serializersPath, servicesPath, modelSpecsPath, primaryKeyType, } = options;
6
- return `\
7
- import * as path from 'path'
8
- import { DreamApplication } from '@rvoh/dream'
9
- import inflections from './inflections.js'
10
-
11
- export default async function (app: DreamApplication) {
12
- await app.load('models', path.join(__dirname, '..', 'models'))
13
- await app.load('serializers', path.join(__dirname, '..', 'serializers'))
14
- await app.load('services', path.join(__dirname, '..', 'services'))
15
-
16
- app.set('projectRoot', path.join(__dirname, '..', '..', '..'))
17
- app.set('primaryKeyType', '${primaryKeyType}')
18
- app.set('inflections', inflections)
19
-
20
- // app.set(
21
- // 'logger',
22
- // winston.createLogger({
23
- // level: 'info',
24
- // format: winston.format.json(),
25
- // defaultMeta: { service: 'user-service' },
26
- // transports: [
27
- // new winston.transports.File({ filename: 'error.log', level: 'error' }),
28
- // new winston.transports.File({ filename: 'combined.log' }),
29
- // ],
30
- // })
31
- // )
32
-
33
- // provides a list of path overrides for your app. This is optional, and will default
34
- // to the paths expected for a typical psychic application.
35
- app.set('paths', {
36
- conf: '${configPath}',
37
- db: '${dbPath}',
38
- types: '${typesPath}',
39
- factories: '${factoriesPath}',
40
- models: '${modelsPath}',
41
- serializers: '${serializersPath}',
42
- services: '${servicesPath}',
43
- modelSpecs: '${modelSpecsPath}',
44
- })
45
-
46
- // provides db credentials and configuration for your app.
47
- app.set('db', {
48
- primary: {
49
- user: process.env.DB_USER!,
50
- password: process.env.DB_PASSWORD!,
51
- host: process.env.DB_HOST!,
52
- name: process.env.DB_NAME!,
53
- port: parseInt(process.env.DB_PORT!),
54
- useSsl: process.env.DB_USE_SSL === '1',
55
- },
56
- replica: {
57
- user: process.env.DB_USER!,
58
- password: process.env.DB_PASSWORD!,
59
- host: process.env.REPLICA_DB_HOST!,
60
- name: process.env.REPLICA_DB_NAME!,
61
- port: parseInt(process.env.DB_PORT!),
62
- useSsl: process.env.DB_USE_SSL === '1',
63
- },
64
- })
65
- }
66
- `;
67
- }
68
- }
69
- exports.default = DreamtsBuilder;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const generateEncryptionKey_js_1 = require("../helpers/generateEncryptionKey.js");
4
- class EnvBuilder {
5
- static build({ env, appName }) {
6
- return `\
7
- DB_USER=
8
- DB_NAME=${snakeify(appName)}_${env}
9
- DB_PORT=5432
10
- DB_HOST=localhost
11
- APP_ENCRYPTION_KEY='${(0, generateEncryptionKey_js_1.default)()}'
12
- TZ=UTC
13
- `;
14
- }
15
- }
16
- exports.default = EnvBuilder;
17
- // TODO: import from shared space. The version within dream contains the most robust variant of snakeify,
18
- // though we don't really use it for anything other than string transformations, so this version has been simplified.
19
- function snakeify(str) {
20
- return str
21
- .replace(/[ _-]+/g, '_')
22
- .replace(/(?:^|\.?)([A-Z])/g, (_, y) => '_' + y.toLowerCase())
23
- .replace(/^_/, '')
24
- .replace(/\//g, '_')
25
- .replace(/-/g, '_')
26
- .toLowerCase();
27
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class ESLintConfBuilder {
4
- static buildForViteReact() {
5
- return `\
6
- export default {
7
- root: true,
8
- env: { browser: true, es2020: true },
9
- extends: [
10
- 'eslint:recommended',
11
- 'plugin:@typescript-eslint/recommended',
12
- 'plugin:react-hooks/recommended',
13
- ],
14
- ignorePatterns: ['dist', '.eslintrc.cjs'],
15
- parser: '@typescript-eslint/parser',
16
- plugins: ['react-refresh'],
17
- rules: {
18
- 'react-refresh/only-export-components': [
19
- 'warn',
20
- { allowConstantExport: true },
21
- ],
22
- '@typescript-eslint/no-explicit-any': [
23
- 'off',
24
- ]
25
- },
26
- }`;
27
- }
28
- }
29
- exports.default = ESLintConfBuilder;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class PackagejsonBuilder {
4
- static async buildAPI() {
5
- const packagejson = await Promise.resolve().then(() => require('../../../boilerplate/package.json'));
6
- return JSON.stringify(packagejson, null, 2);
7
- }
8
- }
9
- exports.default = PackagejsonBuilder;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = argAndValue;
4
- function argAndValue(arg, args) {
5
- const argIndex = args.findIndex(a => a === arg);
6
- const foundArg = argIndex === -1 ? null : args[argIndex];
7
- const foundValue = argIndex === -1 ? null : valueOrNull(argIndex, args);
8
- return [foundArg ?? null, foundValue];
9
- }
10
- function valueOrNull(argIndex, args) {
11
- const value = args[argIndex + 1];
12
- if (value === undefined || /--/.test(value))
13
- return null;
14
- return value;
15
- }
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = autogeneratedFileDisclaimer;
4
- const logo_js_1 = require("./logo.js");
5
- function autogeneratedFileDisclaimer(startComment = '\n/*', endComment = '\n*/') {
6
- return `\
7
- ${startComment}
8
- --#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
9
- #--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
10
- --#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
11
- #--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
12
- BEGIN AUTOGENERATED MESSAGE
13
- --#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
14
- #--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
15
- --#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
16
- #--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
17
-
18
-
19
- ${(0, logo_js_1.basicLogo)()}
20
-
21
- This file was automatically generated by my cat, Aster.
22
- He does not want you mucking about with his files,
23
- and we are pretty lax on trimming his nails.
24
-
25
- I mean, we have him pretty well fenced in but he is an
26
- escape artist and he still manages to get fleas!
27
-
28
- My point is, don't go mucking about with his files!
29
-
30
- He actually has a hopefully well-tempered message for
31
- us humans, he says:
32
-
33
- "
34
- Dear pathetic humans,
35
-
36
- Here is a haiku to keep you in line
37
-
38
- don't dare go mucking
39
- with my files, I lyke them fine
40
- prettierignore
41
- "
42
-
43
- Sorry, that's the best we are ganna get from him
44
- when you ask him to add a disclaimer to all
45
- autogenerated files on a SUNDAY, when the sun
46
- is hitting the perfect spot in the living room
47
- for a mid-morning nap! He can get saucy, and he
48
- is looking over my shoulder and would like me to
49
- remind all humans that
50
-
51
- "
52
- a.) I have sharp claws.
53
- b.) All laptops are ok sleeping places for your
54
- cat overlords. when we decide to sleep on
55
- them, it is because they are our beds, and
56
- we just loan them out to you so you can go
57
- out and get us the right food.
58
- "
59
-
60
- --#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
61
- #--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
62
- --#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
63
- #--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
64
- END AUTOGENERATED MESSAGE
65
- --#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
66
- #--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
67
- --#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
68
- #--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
69
- ${endComment}
70
- `;
71
- }
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = buildNewDreamApp;
4
- const c = require("colorette");
5
- const fs = require("fs");
6
- const DreamtsBuilder_js_1 = require("../file-builders/DreamtsBuilder.js");
7
- const EnvBuilder_js_1 = require("../file-builders/EnvBuilder.js");
8
- const PackagejsonBuilder_js_1 = require("../file-builders/PackagejsonBuilder.js");
9
- const copyRecursive_js_1 = require("./copyRecursive.js");
10
- const log_js_1 = require("./log.js");
11
- const primaryKeyTypes_js_1 = require("./primaryKeyTypes.js");
12
- const select_js_1 = require("./select.js");
13
- const sleep_js_1 = require("./sleep.js");
14
- const sspawn_js_1 = require("./sspawn.js");
15
- const welcomeMessage_js_1 = require("./welcomeMessage.js");
16
- function testEnv() {
17
- return process.env.NODE_ENV === 'test';
18
- }
19
- async function buildNewDreamApp(appName, projectPath, options) {
20
- if (!options.primaryKeyType) {
21
- const answer = await new select_js_1.default('what primary key type would you like to use?', primaryKeyTypes_js_1.cliPrimaryKeyTypes).run();
22
- options.primaryKeyType = answer;
23
- }
24
- (0, copyRecursive_js_1.default)(__dirname + '/../../../boilerplate', `${projectPath}/src`);
25
- if (!testEnv()) {
26
- log_js_1.default.restoreCache();
27
- log_js_1.default.write(c.green(`Step 1. write boilerplate to ${appName}: Done!`), { cache: true });
28
- log_js_1.default.write(c.green(`Step 2. building default config files...`));
29
- }
30
- fs.writeFileSync(`${projectPath}/.env`, EnvBuilder_js_1.default.build({ appName, env: 'development' }));
31
- fs.writeFileSync(`${projectPath}/.env.test`, EnvBuilder_js_1.default.build({ appName, env: 'test' }));
32
- fs.writeFileSync(projectPath + '/package.json', await PackagejsonBuilder_js_1.default.buildAPI());
33
- fs.writeFileSync(`${projectPath}/src/conf/dream.ts`, DreamtsBuilder_js_1.default.build(options));
34
- if (!testEnv()) {
35
- log_js_1.default.restoreCache();
36
- log_js_1.default.write(c.green(`Step 2. build default config files: Done!`), { cache: true });
37
- log_js_1.default.write(c.green(`Step 3. Installing dream dependencies...`));
38
- // only run yarn install if not in test env to save time
39
- await (0, sspawn_js_1.default)(`cd ${projectPath} && touch yarn.lock && yarn install`);
40
- }
41
- // sleeping here because yarn has a delayed print that we need to clean up
42
- if (!testEnv())
43
- await (0, sleep_js_1.default)(1000);
44
- if (!testEnv()) {
45
- log_js_1.default.restoreCache();
46
- log_js_1.default.write(c.green(`Step 3. Install dream dependencies: Done!`), { cache: true });
47
- log_js_1.default.write(c.green(`Step 4. Initializing git repository...`));
48
- // only do this if not test, since using git in CI will fail
49
- await (0, sspawn_js_1.default)(`cd ./${appName} && git init`);
50
- }
51
- if (!testEnv()) {
52
- log_js_1.default.restoreCache();
53
- log_js_1.default.write(c.green(`Step 4. Initialize git repository: Done!`), { cache: true });
54
- log_js_1.default.write(c.green(`Step 5. Building project...`));
55
- }
56
- // don't sync yet, since we need to run migrations first
57
- // await sspawn(`yarn --cwd=${projectPath} dream sync:existing`)
58
- if (!testEnv()) {
59
- log_js_1.default.restoreCache();
60
- log_js_1.default.write(c.green(`Step 5. Build project: Done!`), { cache: true });
61
- console.log((0, welcomeMessage_js_1.default)(appName));
62
- }
63
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = copyRecursive;
4
- const fs = require("fs");
5
- const path = require("path");
6
- function copyRecursive(src, dest) {
7
- const exists = fs.existsSync(src);
8
- const stats = exists && fs.statSync(src);
9
- const isDirectory = exists && stats.isDirectory();
10
- if (isDirectory) {
11
- if (!['.', './.'].includes(dest) && !fs.existsSync(dest))
12
- fs.mkdirSync(dest);
13
- fs.readdirSync(src).forEach(function (childItemName) {
14
- copyRecursive(path.join(src, childItemName), path.join(dest, childItemName));
15
- });
16
- }
17
- else {
18
- fs.copyFileSync(src, dest);
19
- }
20
- }
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = filterObjectByKey;
4
- function filterObjectByKey(obj, arr) {
5
- const workingObj = {};
6
- const booleanObj = {};
7
- arr.forEach(key => (booleanObj[key] = true));
8
- arr.forEach(key => {
9
- if (booleanObj[key])
10
- workingObj[protectAgainstPollutingAssignment(key)] = obj[key];
11
- });
12
- return workingObj;
13
- }
14
- const reservedKeys = new Map([
15
- ['__proto__', true],
16
- ['constructor', true],
17
- ['prototype', true],
18
- ]);
19
- function protectAgainstPollutingAssignment(key) {
20
- if (reservedKeys.get(key))
21
- throw new Error(`Passed "${key}" as the key to modify an object`);
22
- return key;
23
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = generateEncryptionKey;
4
- function generateEncryptionKey() {
5
- return (Math.random().toString(36).substr(2, 10) +
6
- '-' +
7
- Math.random().toString(36).substr(2, 10) +
8
- '-' +
9
- Math.random().toString(36).substr(2, 10) +
10
- '-' +
11
- Math.random().toString(36).substr(2, 10) +
12
- '-' +
13
- Math.random().toString(36).substr(2, 10) +
14
- '-' +
15
- Math.random().toString(36).substr(2, 10) +
16
- '-' +
17
- Math.random().toString(36).substr(2, 10) +
18
- '-' +
19
- Math.random().toString(36).substr(2, 10) +
20
- '-' +
21
- Math.random().toString(36).substr(2, 10) +
22
- '-' +
23
- Math.random().toString(36).substr(2, 10) +
24
- '-' +
25
- Math.random().toString(36).substr(2, 10));
26
- }
@@ -1 +0,0 @@
1
- "use strict";