@rvoh/dream 0.32.4 → 0.34.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.
- package/dist/cjs/src/Dream.js +1 -1
- package/dist/cjs/src/bin/helpers/sync.js +2 -2
- package/dist/cjs/src/dream-application/helpers/DreamImporter.js +0 -5
- package/dist/cjs/src/dream-application/helpers/lookupClassByGlobalName.js +0 -2
- package/dist/cjs/src/dream-application/index.js +4 -10
- package/dist/cjs/src/helpers/DreamGlam/howyadoins/whaaaaaaaaaaok.js +2 -2
- package/dist/cjs/src/helpers/cli/SchemaBuilder.js +2 -2
- package/dist/cjs/src/helpers/cli/autoGeneratedFileDisclaimer.js +33 -0
- package/dist/cjs/src/helpers/loadRepl.js +3 -5
- package/dist/cjs/src/helpers/path/dreamPath.js +0 -2
- package/dist/cjs/src/index.js +3 -4
- package/dist/esm/src/Dream.js +1 -1
- package/dist/esm/src/bin/helpers/sync.js +1 -1
- package/dist/esm/src/dream-application/helpers/DreamImporter.js +0 -5
- package/dist/esm/src/dream-application/helpers/lookupClassByGlobalName.js +0 -2
- package/dist/esm/src/dream-application/index.js +4 -10
- package/dist/esm/src/helpers/DreamGlam/howyadoins/whaaaaaaaaaaok.js +2 -2
- package/dist/esm/src/helpers/cli/SchemaBuilder.js +1 -1
- package/dist/esm/src/helpers/cli/autoGeneratedFileDisclaimer.js +30 -0
- package/dist/esm/src/helpers/loadRepl.js +3 -5
- package/dist/esm/src/helpers/path/dreamPath.js +0 -2
- package/dist/esm/src/index.js +2 -2
- package/dist/types/src/Dream.d.ts +1 -1
- package/dist/types/src/dream-application/helpers/DreamImporter.d.ts +0 -1
- package/dist/types/src/dream-application/index.d.ts +5 -5
- package/dist/types/src/helpers/loadRepl.d.ts +1 -1
- package/dist/types/src/index.d.ts +3 -2
- package/docs/assets/icons.js +1 -1
- package/docs/assets/icons.svg +1 -1
- package/docs/assets/main.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +66 -21
- package/docs/classes/Benchmark.html +2 -2
- package/docs/classes/CalendarDate.html +2 -2
- package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +6 -5
- package/docs/classes/Decorators.html +19 -19
- package/docs/classes/Dream.html +131 -131
- package/docs/classes/DreamApplication.html +4 -5
- package/docs/classes/DreamBin.html +2 -2
- package/docs/classes/DreamCLI.html +4 -4
- package/docs/classes/DreamGlam.html +2 -2
- package/docs/classes/DreamImporter.html +2 -3
- package/docs/classes/DreamMigrationHelpers.html +7 -7
- package/docs/classes/DreamSerializer.html +2 -2
- package/docs/classes/DreamTransaction.html +2 -2
- package/docs/classes/Encrypt.html +2 -2
- package/docs/classes/Env.html +2 -2
- package/docs/classes/GlobalNameNotSet.html +6 -5
- package/docs/classes/NonLoadedAssociation.html +6 -5
- package/docs/classes/Query.html +51 -51
- package/docs/classes/Range.html +2 -2
- package/docs/classes/RecordNotFound.html +6 -5
- package/docs/classes/ValidationError.html +6 -5
- package/docs/functions/Attribute.html +1 -1
- package/docs/functions/RendersMany.html +1 -1
- package/docs/functions/RendersOne.html +1 -1
- package/docs/functions/ReplicaSafe.html +1 -1
- package/docs/functions/STI.html +1 -1
- package/docs/functions/SoftDelete.html +1 -1
- package/docs/functions/camelize.html +1 -1
- package/docs/functions/capitalize.html +1 -1
- package/docs/functions/closeAllDbConnections.html +1 -1
- package/docs/functions/compact.html +1 -1
- package/docs/functions/debug.html +1 -1
- package/docs/functions/dreamDbConnections.html +1 -1
- package/docs/functions/dreamPath.html +1 -1
- package/docs/functions/generateDream.html +1 -1
- package/docs/functions/globalClassNameFromFullyQualifiedModelName.html +1 -1
- package/docs/functions/hyphenize.html +1 -1
- package/docs/functions/inferSerializerFromDreamClassOrViewModelClass.html +1 -1
- package/docs/functions/inferSerializerFromDreamOrViewModel.html +1 -1
- package/docs/functions/isEmpty.html +1 -1
- package/docs/functions/loadRepl.html +1 -1
- package/docs/functions/lookupClassByGlobalName.html +1 -1
- package/docs/functions/pascalize.html +1 -1
- package/docs/functions/pgErrorType.html +1 -1
- package/docs/functions/range-1.html +1 -1
- package/docs/functions/relativeDreamPath.html +1 -1
- package/docs/functions/round.html +1 -1
- package/docs/functions/serializerNameFromFullyQualifiedModelName.html +1 -1
- package/docs/functions/sharedPathPrefix.html +1 -1
- package/docs/functions/snakeify.html +1 -1
- package/docs/functions/sort.html +1 -1
- package/docs/functions/sortBy.html +1 -1
- package/docs/functions/standardizeFullyQualifiedModelName.html +1 -1
- package/docs/functions/uncapitalize.html +1 -1
- package/docs/functions/uniq.html +1 -1
- package/docs/functions/untypedDb.html +1 -0
- package/docs/functions/validateColumn.html +1 -1
- package/docs/functions/validateTable.html +1 -1
- package/docs/index.html +7 -7
- package/docs/interfaces/AttributeStatement.html +2 -2
- package/docs/interfaces/DecoratorContext.html +2 -2
- package/docs/interfaces/DreamApplicationInitOptions.html +2 -2
- package/docs/interfaces/DreamApplicationOpts.html +2 -2
- package/docs/interfaces/DreamSerializerAssociationStatement.html +2 -2
- package/docs/interfaces/EncryptOptions.html +2 -2
- package/docs/interfaces/OpenapiSchemaProperties.html +1 -1
- package/docs/interfaces/OpenapiSchemaPropertiesShorthand.html +1 -1
- package/docs/interfaces/OpenapiTypeFieldObject.html +1 -1
- package/docs/modules.html +10 -10
- package/docs/types/Camelized.html +1 -1
- package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
- package/docs/types/DateTime.html +1 -1
- package/docs/types/DbConnectionType.html +1 -0
- package/docs/types/DreamAssociationMetadata.html +1 -1
- package/docs/types/DreamAttributes.html +1 -1
- package/docs/types/DreamClassColumn.html +1 -1
- package/docs/types/DreamColumn.html +1 -1
- package/docs/types/DreamColumnNames.html +1 -1
- package/docs/types/DreamLogLevel.html +1 -1
- package/docs/types/DreamLogger.html +1 -1
- package/docs/types/DreamOrViewModelSerializerKey.html +1 -1
- package/docs/types/DreamParamSafeAttributes.html +1 -1
- package/docs/types/DreamParamSafeColumnNames.html +1 -1
- package/docs/types/DreamSerializerKey.html +1 -1
- package/docs/types/DreamSerializers.html +1 -1
- package/docs/types/DreamTableSchema.html +1 -1
- package/docs/types/DreamVirtualColumns.html +1 -1
- package/docs/types/EncryptAlgorithm.html +1 -1
- package/docs/types/Hyphenized.html +1 -1
- package/docs/types/IdType.html +1 -1
- package/docs/types/OpenapiAllTypes.html +1 -1
- package/docs/types/OpenapiFormats.html +1 -1
- package/docs/types/OpenapiNumberFormats.html +1 -1
- package/docs/types/OpenapiPrimitiveTypes.html +1 -1
- package/docs/types/OpenapiSchemaArray.html +1 -1
- package/docs/types/OpenapiSchemaArrayShorthand.html +1 -1
- package/docs/types/OpenapiSchemaBase.html +1 -1
- package/docs/types/OpenapiSchemaBody.html +1 -1
- package/docs/types/OpenapiSchemaBodyShorthand.html +1 -1
- package/docs/types/OpenapiSchemaCommonFields.html +1 -1
- package/docs/types/OpenapiSchemaExpressionAllOf.html +1 -1
- package/docs/types/OpenapiSchemaExpressionAnyOf.html +1 -1
- package/docs/types/OpenapiSchemaExpressionOneOf.html +1 -1
- package/docs/types/OpenapiSchemaExpressionRef.html +1 -1
- package/docs/types/OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
- package/docs/types/OpenapiSchemaInteger.html +1 -1
- package/docs/types/OpenapiSchemaNull.html +1 -1
- package/docs/types/OpenapiSchemaNumber.html +1 -1
- package/docs/types/OpenapiSchemaObject.html +1 -1
- package/docs/types/OpenapiSchemaObjectAllOf.html +1 -1
- package/docs/types/OpenapiSchemaObjectAllOfShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectAnyOf.html +1 -1
- package/docs/types/OpenapiSchemaObjectAnyOfShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectBase.html +1 -1
- package/docs/types/OpenapiSchemaObjectBaseShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectOneOf.html +1 -1
- package/docs/types/OpenapiSchemaObjectOneOfShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectShorthand.html +1 -1
- package/docs/types/OpenapiSchemaPartialSegment.html +1 -1
- package/docs/types/OpenapiSchemaPrimitiveGeneric.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionAllOf.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionOneOf.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
- package/docs/types/OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
- package/docs/types/OpenapiSchemaString.html +1 -1
- package/docs/types/OpenapiShorthandAllTypes.html +1 -1
- package/docs/types/OpenapiShorthandPrimitiveTypes.html +1 -1
- package/docs/types/OpenapiTypeField.html +1 -1
- package/docs/types/Pascalized.html +1 -1
- package/docs/types/PrimaryKeyType.html +1 -1
- package/docs/types/RoundingPrecision.html +1 -1
- package/docs/types/SerializableClassOrSerializerCallback.html +1 -1
- package/docs/types/SerializableDreamClassOrViewModelClass.html +1 -1
- package/docs/types/SerializableDreamOrViewModel.html +1 -1
- package/docs/types/SerializableTypes.html +1 -1
- package/docs/types/Snakeified.html +1 -1
- package/docs/types/Timestamp.html +1 -1
- package/docs/types/UpdateableAssociationProperties.html +1 -1
- package/docs/types/UpdateableProperties.html +1 -1
- package/docs/types/ValidationType.html +1 -1
- package/docs/types/ViewModelSerializerKey.html +1 -1
- package/docs/types/WhereStatementForDream.html +1 -1
- package/docs/types/WhereStatementForDreamClass.html +1 -1
- package/docs/variables/DateTime-1.html +1 -1
- package/docs/variables/DreamConst.html +1 -1
- package/docs/variables/TRIGRAM_OPERATORS.html +1 -1
- package/docs/variables/openapiPrimitiveTypes-1.html +1 -1
- package/docs/variables/openapiShorthandPrimitiveTypes-1.html +1 -1
- package/docs/variables/ops.html +1 -1
- package/docs/variables/primaryKeyTypes.html +1 -1
- package/package.json +4 -7
- package/boilerplate/app/models/ApplicationModel.ts +0 -14
- package/boilerplate/app/serializers/.gitkeep +0 -0
- package/boilerplate/bin/esm.js +0 -19
- package/boilerplate/cli/helpers/initializeDreamApplication.ts +0 -6
- package/boilerplate/cli/index.ts +0 -22
- package/boilerplate/conf/inflections.ts +0 -5
- package/boilerplate/conf/loadEnv.ts +0 -4
- package/boilerplate/conf/repl.ts +0 -11
- package/boilerplate/eslint.config.js +0 -21
- package/boilerplate/package.json +0 -39
- package/boilerplate/tsconfig.build.json +0 -41
- package/boilerplate/tsconfig.json +0 -12
- package/boilerplate/types/db.ts +0 -5
- package/boilerplate/types/dream.ts +0 -3
- package/dist/cjs/boilerplate/package.json +0 -39
- package/dist/cjs/src/dream-application/helpers/globalServiceKeyFromPath.js +0 -11
- package/dist/cjs/src/dream-application/helpers/importers/importServices.js +0 -43
- package/dist/cjs/src/global-cli/dream.js +0 -46
- package/dist/cjs/src/global-cli/file-builders/DreamtsBuilder.js +0 -69
- package/dist/cjs/src/global-cli/file-builders/EnvBuilder.js +0 -27
- package/dist/cjs/src/global-cli/file-builders/EslintConfBuilder.js +0 -29
- package/dist/cjs/src/global-cli/file-builders/PackagejsonBuilder.js +0 -9
- package/dist/cjs/src/global-cli/helpers/argAndValue.js +0 -15
- package/dist/cjs/src/global-cli/helpers/autogeneratedFileMessage.js +0 -71
- package/dist/cjs/src/global-cli/helpers/buildNewDreamApp.js +0 -63
- package/dist/cjs/src/global-cli/helpers/copyRecursive.js +0 -20
- package/dist/cjs/src/global-cli/helpers/filterObjectByKey.js +0 -23
- package/dist/cjs/src/global-cli/helpers/generateEncryptionKey.js +0 -26
- package/dist/cjs/src/global-cli/helpers/globalCliSnakeify.js +0 -1
- package/dist/cjs/src/global-cli/helpers/initDreamAppIntoExistingProject.js +0 -85
- package/dist/cjs/src/global-cli/helpers/log.js +0 -28
- package/dist/cjs/src/global-cli/helpers/logo.js +0 -81
- package/dist/cjs/src/global-cli/helpers/primaryKeyTypes.js +0 -13
- package/dist/cjs/src/global-cli/helpers/prompt.js +0 -33
- package/dist/cjs/src/global-cli/helpers/select.js +0 -113
- package/dist/cjs/src/global-cli/helpers/sleep.js +0 -10
- package/dist/cjs/src/global-cli/helpers/sspawn.js +0 -21
- package/dist/cjs/src/global-cli/helpers/welcomeMessage.js +0 -41
- package/dist/cjs/src/global-cli/init.js +0 -56
- package/dist/cjs/src/global-cli/new.js +0 -10
- package/dist/esm/boilerplate/package.json +0 -39
- package/dist/esm/src/dream-application/helpers/globalServiceKeyFromPath.js +0 -8
- package/dist/esm/src/dream-application/helpers/importers/importServices.js +0 -37
- package/dist/esm/src/global-cli/dream.js +0 -44
- package/dist/esm/src/global-cli/file-builders/DreamtsBuilder.js +0 -66
- package/dist/esm/src/global-cli/file-builders/EnvBuilder.js +0 -24
- package/dist/esm/src/global-cli/file-builders/EslintConfBuilder.js +0 -26
- package/dist/esm/src/global-cli/file-builders/PackagejsonBuilder.js +0 -6
- package/dist/esm/src/global-cli/helpers/argAndValue.js +0 -12
- package/dist/esm/src/global-cli/helpers/autogeneratedFileMessage.js +0 -68
- package/dist/esm/src/global-cli/helpers/buildNewDreamApp.js +0 -60
- package/dist/esm/src/global-cli/helpers/copyRecursive.js +0 -17
- package/dist/esm/src/global-cli/helpers/filterObjectByKey.js +0 -20
- package/dist/esm/src/global-cli/helpers/generateEncryptionKey.js +0 -23
- package/dist/esm/src/global-cli/helpers/globalCliSnakeify.js +0 -1
- package/dist/esm/src/global-cli/helpers/initDreamAppIntoExistingProject.js +0 -82
- package/dist/esm/src/global-cli/helpers/log.js +0 -24
- package/dist/esm/src/global-cli/helpers/logo.js +0 -77
- package/dist/esm/src/global-cli/helpers/primaryKeyTypes.js +0 -10
- package/dist/esm/src/global-cli/helpers/prompt.js +0 -30
- package/dist/esm/src/global-cli/helpers/select.js +0 -110
- package/dist/esm/src/global-cli/helpers/sleep.js +0 -7
- package/dist/esm/src/global-cli/helpers/sspawn.js +0 -17
- package/dist/esm/src/global-cli/helpers/welcomeMessage.js +0 -38
- package/dist/esm/src/global-cli/init.js +0 -53
- package/dist/esm/src/global-cli/new.js +0 -7
- package/dist/types/src/dream-application/helpers/globalServiceKeyFromPath.d.ts +0 -1
- package/dist/types/src/dream-application/helpers/importers/importServices.d.ts +0 -4
- package/dist/types/src/global-cli/dream.d.ts +0 -2
- package/dist/types/src/global-cli/file-builders/DreamtsBuilder.d.ts +0 -4
- package/dist/types/src/global-cli/file-builders/EnvBuilder.d.ts +0 -6
- package/dist/types/src/global-cli/file-builders/EslintConfBuilder.d.ts +0 -3
- package/dist/types/src/global-cli/file-builders/PackagejsonBuilder.d.ts +0 -3
- package/dist/types/src/global-cli/helpers/argAndValue.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/buildNewDreamApp.d.ts +0 -2
- package/dist/types/src/global-cli/helpers/copyRecursive.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/filterObjectByKey.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/generateEncryptionKey.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/globalCliSnakeify.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/initDreamAppIntoExistingProject.d.ts +0 -2
- package/dist/types/src/global-cli/helpers/log.d.ts +0 -10
- package/dist/types/src/global-cli/helpers/logo.d.ts +0 -2
- package/dist/types/src/global-cli/helpers/primaryKeyTypes.d.ts +0 -22
- package/dist/types/src/global-cli/helpers/prompt.d.ts +0 -8
- package/dist/types/src/global-cli/helpers/select.d.ts +0 -17
- package/dist/types/src/global-cli/helpers/sleep.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/sspawn.d.ts +0 -2
- package/dist/types/src/global-cli/helpers/welcomeMessage.d.ts +0 -1
- package/dist/types/src/global-cli/init.d.ts +0 -2
- package/dist/types/src/global-cli/new.d.ts +0 -2
- package/docs/classes/DreamDbConnection.html +0 -4
- package/docs/functions/db.html +0 -1
- /package/dist/types/src/{global-cli/helpers/autogeneratedFileMessage.d.ts → helpers/cli/autoGeneratedFileDisclaimer.d.ts} +0 -0
package/dist/cjs/src/Dream.js
CHANGED
|
@@ -411,7 +411,7 @@ class Dream {
|
|
|
411
411
|
* @internal
|
|
412
412
|
*
|
|
413
413
|
* Used by DreamApplication during the load process
|
|
414
|
-
* for models
|
|
414
|
+
* for models and serializers to assign
|
|
415
415
|
* unique global names to each model based on the file
|
|
416
416
|
* name of that model.
|
|
417
417
|
*/
|
|
@@ -7,12 +7,12 @@ const index_js_1 = require("../../cli/index.js");
|
|
|
7
7
|
const colorize_js_1 = require("../../cli/logger/loggable/colorize.js");
|
|
8
8
|
const ConnectionConfRetriever_js_1 = require("../../db/ConnectionConfRetriever.js");
|
|
9
9
|
const index_js_2 = require("../../dream-application/index.js");
|
|
10
|
-
const autogeneratedFileMessage_js_1 = require("../../global-cli/helpers/autogeneratedFileMessage.js");
|
|
11
10
|
const compact_js_1 = require("../../helpers/compact.js");
|
|
12
11
|
const EnvInternal_js_1 = require("../../helpers/EnvInternal.js");
|
|
13
12
|
const dreamPath_js_1 = require("../../helpers/path/dreamPath.js");
|
|
14
13
|
const snakeify_js_1 = require("../../helpers/snakeify.js");
|
|
15
14
|
const sspawn_js_1 = require("../../helpers/sspawn.js");
|
|
15
|
+
const autoGeneratedFileDisclaimer_js_1 = require("../../helpers/cli/autoGeneratedFileDisclaimer.js");
|
|
16
16
|
async function writeSyncFile() {
|
|
17
17
|
const dbConf = new ConnectionConfRetriever_js_1.default().getConnectionConf('primary');
|
|
18
18
|
const dreamApp = index_js_2.default.getOrFail();
|
|
@@ -66,7 +66,7 @@ function addCustomImports(file) {
|
|
|
66
66
|
const customImports = EnvInternal_js_1.default.boolean('DREAM_CORE_DEVELOPMENT')
|
|
67
67
|
? "import type CalendarDate from '../../src/helpers/CalendarDate.js'\nimport { type DateTime } from '../../src/helpers/DateTime.js'"
|
|
68
68
|
: "import { type CalendarDate, type DateTime } from '@rvoh/dream'";
|
|
69
|
-
return `${(0,
|
|
69
|
+
return `${(0, autoGeneratedFileDisclaimer_js_1.default)()}${customImports}
|
|
70
70
|
${file}`;
|
|
71
71
|
}
|
|
72
72
|
function replaceInt8Type(str) {
|
|
@@ -37,10 +37,5 @@ class DreamImporter {
|
|
|
37
37
|
]))));
|
|
38
38
|
return serializerClasses;
|
|
39
39
|
}
|
|
40
|
-
static async importServices(pathToServices, importCb) {
|
|
41
|
-
const servicePaths = await DreamImporter.ls(pathToServices);
|
|
42
|
-
const serviceClasses = (await Promise.all(servicePaths.map(servicePath => importCb(servicePath).then(serviceClass => [servicePath, serviceClass]))));
|
|
43
|
-
return serviceClasses;
|
|
44
|
-
}
|
|
45
40
|
}
|
|
46
41
|
exports.default = DreamImporter;
|
|
@@ -3,13 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = lookupClassByGlobalName;
|
|
4
4
|
const importModels_js_1 = require("./importers/importModels.js");
|
|
5
5
|
const importSerializers_js_1 = require("./importers/importSerializers.js");
|
|
6
|
-
const importServices_js_1 = require("./importers/importServices.js");
|
|
7
6
|
let _globalNameMap;
|
|
8
7
|
function lookupClassByGlobalName(globalName) {
|
|
9
8
|
if (_globalNameMap)
|
|
10
9
|
return _globalNameMap[globalName] || null;
|
|
11
10
|
_globalNameMap = {
|
|
12
|
-
...(0, importServices_js_1.getServicesOrFail)(),
|
|
13
11
|
...(0, importSerializers_js_1.getSerializersOrFail)(),
|
|
14
12
|
...(0, importModels_js_1.getModelsOrFail)(),
|
|
15
13
|
};
|
|
@@ -20,7 +20,6 @@ const EnvInternal_js_1 = require("../helpers/EnvInternal.js");
|
|
|
20
20
|
const cache_js_1 = require("./cache.js");
|
|
21
21
|
const importModels_js_1 = require("./helpers/importers/importModels.js");
|
|
22
22
|
const importSerializers_js_1 = require("./helpers/importers/importSerializers.js");
|
|
23
|
-
const importServices_js_1 = require("./helpers/importers/importServices.js");
|
|
24
23
|
const pgTypes = pg_1.default.types;
|
|
25
24
|
// this needs to be done top-level to ensure proper configuration
|
|
26
25
|
DateTime_js_1.Settings.defaultZone = 'UTC';
|
|
@@ -50,8 +49,6 @@ class DreamApplication {
|
|
|
50
49
|
});
|
|
51
50
|
if (!dreamApp.serializers)
|
|
52
51
|
(0, importSerializers_js_1.setCachedSerializers)({});
|
|
53
|
-
if (!dreamApp.services)
|
|
54
|
-
(0, importServices_js_1.setCachedServices)({});
|
|
55
52
|
(0, cache_js_1.cacheDreamApplication)(dreamApp);
|
|
56
53
|
if (!EnvInternal_js_1.default.boolean('BYPASS_DB_CONNECTIONS_DURING_INIT'))
|
|
57
54
|
await this.setDatabaseTypeParsers();
|
|
@@ -156,6 +153,7 @@ Try setting it to something valid, like:
|
|
|
156
153
|
}
|
|
157
154
|
_specialHooks = {
|
|
158
155
|
dbLog: [],
|
|
156
|
+
replStart: [],
|
|
159
157
|
};
|
|
160
158
|
get specialHooks() {
|
|
161
159
|
return this._specialHooks;
|
|
@@ -221,7 +219,6 @@ Try setting it to something valid, like:
|
|
|
221
219
|
models: opts?.paths?.models || 'src/app/models',
|
|
222
220
|
modelSpecs: opts?.paths?.modelSpecs || 'spec/unit/models',
|
|
223
221
|
serializers: opts?.paths?.serializers || 'src/app/serializers',
|
|
224
|
-
services: opts?.paths?.services || 'src/app/services',
|
|
225
222
|
types: opts?.paths?.types || 'src/types',
|
|
226
223
|
};
|
|
227
224
|
}
|
|
@@ -231,9 +228,6 @@ Try setting it to something valid, like:
|
|
|
231
228
|
get serializers() {
|
|
232
229
|
return (0, importSerializers_js_1.getSerializersOrFail)();
|
|
233
230
|
}
|
|
234
|
-
get services() {
|
|
235
|
-
return (0, importServices_js_1.getServicesOrFail)();
|
|
236
|
-
}
|
|
237
231
|
async load(resourceType, resourcePath, importCb) {
|
|
238
232
|
switch (resourceType) {
|
|
239
233
|
case 'models':
|
|
@@ -243,9 +237,6 @@ Try setting it to something valid, like:
|
|
|
243
237
|
case 'serializers':
|
|
244
238
|
await (0, importSerializers_js_1.default)(resourcePath, importCb);
|
|
245
239
|
break;
|
|
246
|
-
case 'services':
|
|
247
|
-
await (0, importServices_js_1.default)(resourcePath, importCb);
|
|
248
|
-
break;
|
|
249
240
|
}
|
|
250
241
|
}
|
|
251
242
|
plugin(cb) {
|
|
@@ -294,6 +285,9 @@ Try setting it to something valid, like:
|
|
|
294
285
|
case 'db:log':
|
|
295
286
|
this._specialHooks.dbLog.push(cb);
|
|
296
287
|
break;
|
|
288
|
+
case 'repl:start':
|
|
289
|
+
this._specialHooks.replStart.push(cb);
|
|
290
|
+
break;
|
|
297
291
|
}
|
|
298
292
|
}
|
|
299
293
|
}
|
|
@@ -47,7 +47,7 @@ function whaaaaaaaaaaok() {
|
|
|
47
47
|
}
|
|
48
48
|
function whaaaaaaaaaaokBasic() {
|
|
49
49
|
return `
|
|
50
|
-
|
|
50
|
+
,▄█▄
|
|
51
51
|
]█▄▄ ╓█████▌
|
|
52
52
|
▐██████▄ ▄█████▓╣█
|
|
53
53
|
║████████▄, , ,,▄,▄▄▄▓██████╬╬╣╣▌
|
|
@@ -55,7 +55,7 @@ function whaaaaaaaaaaokBasic() {
|
|
|
55
55
|
╙█╬╬╬▓███████████████████████▒▓▌
|
|
56
56
|
╙▓█▓██████████████████████████
|
|
57
57
|
╚██████▀███████████╩█▓▌▐▓████▄
|
|
58
|
-
'║█████\`╣█Γ║████████▄▄φ▓█████▌
|
|
58
|
+
'║█████\`╣█Γ║████████▄▄φ▓█████▌
|
|
59
59
|
║█████████████████████▓█████▌
|
|
60
60
|
█████████████▓▓████████████
|
|
61
61
|
║█████████████████████████
|
|
@@ -8,13 +8,13 @@ const index_js_1 = require("../../db/index.js");
|
|
|
8
8
|
const index_js_2 = require("../../dream-application/index.js");
|
|
9
9
|
const constants_js_1 = require("../../dream/constants.js");
|
|
10
10
|
const FailedToIdentifyAssociation_js_1 = require("../../errors/schema-builder/FailedToIdentifyAssociation.js");
|
|
11
|
-
const autogeneratedFileMessage_js_1 = require("../../global-cli/helpers/autogeneratedFileMessage.js");
|
|
12
11
|
const camelize_js_1 = require("../camelize.js");
|
|
13
12
|
const compact_js_1 = require("../compact.js");
|
|
14
13
|
const EnvInternal_js_1 = require("../EnvInternal.js");
|
|
15
14
|
const pascalize_js_1 = require("../pascalize.js");
|
|
16
15
|
const sortBy_js_1 = require("../sortBy.js");
|
|
17
16
|
const uniq_js_1 = require("../uniq.js");
|
|
17
|
+
const autoGeneratedFileDisclaimer_js_1 = require("./autoGeneratedFileDisclaimer.js");
|
|
18
18
|
class SchemaBuilder {
|
|
19
19
|
async build() {
|
|
20
20
|
const { schemaConstContent, passthroughColumns, allDefaultScopeNames } = await this.buildSchemaContent();
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
: "import { type CalendarDate, type DateTime } from '@rvoh/dream'";
|
|
31
31
|
const dreamApp = index_js_2.default.getOrFail();
|
|
32
32
|
const newSchemaFileContents = `\
|
|
33
|
-
${(0,
|
|
33
|
+
${(0, autoGeneratedFileDisclaimer_js_1.default)()}
|
|
34
34
|
${calendarDateImportStatement}
|
|
35
35
|
${importStr}
|
|
36
36
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = autogeneratedFileDisclaimer;
|
|
4
|
+
const DreamGlam_js_1 = require("../DreamGlam/DreamGlam.js");
|
|
5
|
+
function autogeneratedFileDisclaimer(startComment = '\n/*', endComment = '\n*/') {
|
|
6
|
+
return `\
|
|
7
|
+
${startComment}
|
|
8
|
+
${DreamGlam_js_1.default.whaaaaaaaaaaokBasic()}
|
|
9
|
+
|
|
10
|
+
This file was automatically generated by my cat, Aster.
|
|
11
|
+
He does not want you mucking about with his files,
|
|
12
|
+
and we are pretty lax on trimming his nails.
|
|
13
|
+
|
|
14
|
+
I mean, we have him pretty well fenced in but he is an
|
|
15
|
+
escape artist and he still manages to get fleas!
|
|
16
|
+
|
|
17
|
+
My point is, don't go mucking about with his files!
|
|
18
|
+
|
|
19
|
+
He actually has a hopefully well-tempered message for
|
|
20
|
+
us humans, he says:
|
|
21
|
+
|
|
22
|
+
"
|
|
23
|
+
Dear pathetic humans,
|
|
24
|
+
|
|
25
|
+
Here is a haiku to keep you in line
|
|
26
|
+
|
|
27
|
+
don't dare go mucking
|
|
28
|
+
with my files, I lyke them fine
|
|
29
|
+
prettierignore
|
|
30
|
+
"
|
|
31
|
+
${endComment}
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
@@ -19,7 +19,7 @@ const sort_js_1 = require("./sort.js");
|
|
|
19
19
|
const sortBy_js_1 = require("./sortBy.js");
|
|
20
20
|
const uncapitalize_js_1 = require("./uncapitalize.js");
|
|
21
21
|
const uniq_js_1 = require("./uniq.js");
|
|
22
|
-
function loadRepl(context) {
|
|
22
|
+
async function loadRepl(context) {
|
|
23
23
|
const dreamApp = index_js_1.default.getOrFail();
|
|
24
24
|
context.CalendarDate = CalendarDate_js_1.default;
|
|
25
25
|
context.DateTime = DateTime_js_1.DateTime;
|
|
@@ -41,9 +41,7 @@ function loadRepl(context) {
|
|
|
41
41
|
for (const globalName of Object.keys(dreamApp.models)) {
|
|
42
42
|
context[(0, pascalizePath_js_1.default)(globalName)] = dreamApp.models[globalName];
|
|
43
43
|
}
|
|
44
|
-
for (const
|
|
45
|
-
|
|
46
|
-
context[(0, pascalizePath_js_1.default)(globalName)] = dreamApp.services[globalName];
|
|
47
|
-
}
|
|
44
|
+
for (const hook of dreamApp.specialHooks.replStart) {
|
|
45
|
+
await hook(context);
|
|
48
46
|
}
|
|
49
47
|
}
|
package/dist/cjs/src/index.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Range = exports.sharedPathPrefix = exports.relativeDreamPath = exports.dreamPath = exports.pascalize = exports.loadRepl = exports.isEmpty = exports.inferSerializerFromDreamOrViewModel = exports.inferSerializerFromDreamClassOrViewModelClass = exports.hyphenize = exports.globalClassNameFromFullyQualifiedModelName = exports.Env = exports.DreamGlam = exports.debug = exports.DateTime = exports.compact = exports.generateDream = exports.capitalize = exports.camelize = exports.CalendarDate = exports.Benchmark = exports.ValidationError = exports.RecordNotFound = exports.GlobalNameNotSet = exports.CreateOrFindByFailedToCreateAndFind = exports.NonLoadedAssociation = exports.Encrypt = exports.Query = exports.DreamTransaction = exports.openapiShorthandPrimitiveTypes = exports.openapiPrimitiveTypes = exports.DreamConst = exports.Dream = exports.DreamApplication = exports.lookupClassByGlobalName = exports.DreamImporter = exports.Decorators = exports.STI = exports.SoftDelete = exports.ReplicaSafe = exports.validateTable = exports.validateColumn = exports.DreamMigrationHelpers = exports.
|
|
4
|
-
exports.DreamSerializer = exports.Attribute = exports.RendersOne = exports.RendersMany = exports.ops = exports.uniq = exports.uncapitalize = exports.standardizeFullyQualifiedModelName = exports.sortBy = exports.sort = exports.snakeify = exports.serializerNameFromFullyQualifiedModelName = exports.round =
|
|
3
|
+
exports.range = exports.Range = exports.sharedPathPrefix = exports.relativeDreamPath = exports.dreamPath = exports.pascalize = exports.loadRepl = exports.isEmpty = exports.inferSerializerFromDreamOrViewModel = exports.inferSerializerFromDreamClassOrViewModelClass = exports.hyphenize = exports.globalClassNameFromFullyQualifiedModelName = exports.Env = exports.DreamGlam = exports.debug = exports.DateTime = exports.compact = exports.generateDream = exports.capitalize = exports.camelize = exports.CalendarDate = exports.Benchmark = exports.ValidationError = exports.RecordNotFound = exports.GlobalNameNotSet = exports.CreateOrFindByFailedToCreateAndFind = exports.NonLoadedAssociation = exports.Encrypt = exports.Query = exports.DreamTransaction = exports.openapiShorthandPrimitiveTypes = exports.openapiPrimitiveTypes = exports.DreamConst = exports.Dream = exports.DreamApplication = exports.lookupClassByGlobalName = exports.DreamImporter = exports.Decorators = exports.STI = exports.SoftDelete = exports.ReplicaSafe = exports.validateTable = exports.validateColumn = exports.DreamMigrationHelpers = exports.untypedDb = exports.pgErrorType = exports.dreamDbConnections = exports.closeAllDbConnections = exports.DreamCLI = exports.DreamBin = void 0;
|
|
4
|
+
exports.DreamSerializer = exports.Attribute = exports.RendersOne = exports.RendersMany = exports.ops = exports.uniq = exports.uncapitalize = exports.standardizeFullyQualifiedModelName = exports.sortBy = exports.sort = exports.snakeify = exports.serializerNameFromFullyQualifiedModelName = exports.round = void 0;
|
|
5
5
|
var index_js_1 = require("./bin/index.js");
|
|
6
6
|
Object.defineProperty(exports, "DreamBin", { enumerable: true, get: function () { return index_js_1.default; } });
|
|
7
7
|
var index_js_2 = require("./cli/index.js");
|
|
8
8
|
Object.defineProperty(exports, "DreamCLI", { enumerable: true, get: function () { return index_js_2.default; } });
|
|
9
9
|
var DreamDbConnection_js_1 = require("./db/DreamDbConnection.js");
|
|
10
10
|
Object.defineProperty(exports, "closeAllDbConnections", { enumerable: true, get: function () { return DreamDbConnection_js_1.closeAllDbConnections; } });
|
|
11
|
-
Object.defineProperty(exports, "DreamDbConnection", { enumerable: true, get: function () { return DreamDbConnection_js_1.default; } });
|
|
12
11
|
Object.defineProperty(exports, "dreamDbConnections", { enumerable: true, get: function () { return DreamDbConnection_js_1.dreamDbConnections; } });
|
|
13
12
|
var errors_js_1 = require("./db/errors.js");
|
|
14
13
|
Object.defineProperty(exports, "pgErrorType", { enumerable: true, get: function () { return errors_js_1.pgErrorType; } });
|
|
15
14
|
var index_js_3 = require("./db/index.js");
|
|
16
|
-
Object.defineProperty(exports, "
|
|
15
|
+
Object.defineProperty(exports, "untypedDb", { enumerable: true, get: function () { return index_js_3.default; } });
|
|
17
16
|
var DreamMigrationHelpers_js_1 = require("./db/migration-helpers/DreamMigrationHelpers.js");
|
|
18
17
|
Object.defineProperty(exports, "DreamMigrationHelpers", { enumerable: true, get: function () { return DreamMigrationHelpers_js_1.default; } });
|
|
19
18
|
var validateColumn_js_1 = require("./db/validators/validateColumn.js");
|
package/dist/esm/src/Dream.js
CHANGED
|
@@ -409,7 +409,7 @@ export default class Dream {
|
|
|
409
409
|
* @internal
|
|
410
410
|
*
|
|
411
411
|
* Used by DreamApplication during the load process
|
|
412
|
-
* for models
|
|
412
|
+
* for models and serializers to assign
|
|
413
413
|
* unique global names to each model based on the file
|
|
414
414
|
* name of that model.
|
|
415
415
|
*/
|
|
@@ -4,12 +4,12 @@ import DreamCLI from '../../cli/index.js';
|
|
|
4
4
|
import colorize from '../../cli/logger/loggable/colorize.js';
|
|
5
5
|
import ConnectionConfRetriever from '../../db/ConnectionConfRetriever.js';
|
|
6
6
|
import DreamApplication from '../../dream-application/index.js';
|
|
7
|
-
import autogeneratedFileDisclaimer from '../../global-cli/helpers/autogeneratedFileMessage.js';
|
|
8
7
|
import compact from '../../helpers/compact.js';
|
|
9
8
|
import EnvInternal from '../../helpers/EnvInternal.js';
|
|
10
9
|
import dreamPath from '../../helpers/path/dreamPath.js';
|
|
11
10
|
import snakeify from '../../helpers/snakeify.js';
|
|
12
11
|
import sspawn from '../../helpers/sspawn.js';
|
|
12
|
+
import autogeneratedFileDisclaimer from '../../helpers/cli/autoGeneratedFileDisclaimer.js';
|
|
13
13
|
export default async function writeSyncFile() {
|
|
14
14
|
const dbConf = new ConnectionConfRetriever().getConnectionConf('primary');
|
|
15
15
|
const dreamApp = DreamApplication.getOrFail();
|
|
@@ -35,9 +35,4 @@ export default class DreamImporter {
|
|
|
35
35
|
]))));
|
|
36
36
|
return serializerClasses;
|
|
37
37
|
}
|
|
38
|
-
static async importServices(pathToServices, importCb) {
|
|
39
|
-
const servicePaths = await DreamImporter.ls(pathToServices);
|
|
40
|
-
const serviceClasses = (await Promise.all(servicePaths.map(servicePath => importCb(servicePath).then(serviceClass => [servicePath, serviceClass]))));
|
|
41
|
-
return serviceClasses;
|
|
42
|
-
}
|
|
43
38
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { getModelsOrFail } from './importers/importModels.js';
|
|
2
2
|
import { getSerializersOrFail } from './importers/importSerializers.js';
|
|
3
|
-
import { getServicesOrFail } from './importers/importServices.js';
|
|
4
3
|
let _globalNameMap;
|
|
5
4
|
export default function lookupClassByGlobalName(globalName) {
|
|
6
5
|
if (_globalNameMap)
|
|
7
6
|
return _globalNameMap[globalName] || null;
|
|
8
7
|
_globalNameMap = {
|
|
9
|
-
...getServicesOrFail(),
|
|
10
8
|
...getSerializersOrFail(),
|
|
11
9
|
...getModelsOrFail(),
|
|
12
10
|
};
|
|
@@ -18,7 +18,6 @@ import EnvInternal from '../helpers/EnvInternal.js';
|
|
|
18
18
|
import { cacheDreamApplication, getCachedDreamApplicationOrFail } from './cache.js';
|
|
19
19
|
import importModels, { getModelsOrFail } from './helpers/importers/importModels.js';
|
|
20
20
|
import importSerializers, { getSerializersOrFail, setCachedSerializers, } from './helpers/importers/importSerializers.js';
|
|
21
|
-
import importServices, { getServicesOrFail, setCachedServices } from './helpers/importers/importServices.js';
|
|
22
21
|
const pgTypes = pg.types;
|
|
23
22
|
// this needs to be done top-level to ensure proper configuration
|
|
24
23
|
Settings.defaultZone = 'UTC';
|
|
@@ -48,8 +47,6 @@ export default class DreamApplication {
|
|
|
48
47
|
});
|
|
49
48
|
if (!dreamApp.serializers)
|
|
50
49
|
setCachedSerializers({});
|
|
51
|
-
if (!dreamApp.services)
|
|
52
|
-
setCachedServices({});
|
|
53
50
|
cacheDreamApplication(dreamApp);
|
|
54
51
|
if (!EnvInternal.boolean('BYPASS_DB_CONNECTIONS_DURING_INIT'))
|
|
55
52
|
await this.setDatabaseTypeParsers();
|
|
@@ -154,6 +151,7 @@ Try setting it to something valid, like:
|
|
|
154
151
|
}
|
|
155
152
|
_specialHooks = {
|
|
156
153
|
dbLog: [],
|
|
154
|
+
replStart: [],
|
|
157
155
|
};
|
|
158
156
|
get specialHooks() {
|
|
159
157
|
return this._specialHooks;
|
|
@@ -219,7 +217,6 @@ Try setting it to something valid, like:
|
|
|
219
217
|
models: opts?.paths?.models || 'src/app/models',
|
|
220
218
|
modelSpecs: opts?.paths?.modelSpecs || 'spec/unit/models',
|
|
221
219
|
serializers: opts?.paths?.serializers || 'src/app/serializers',
|
|
222
|
-
services: opts?.paths?.services || 'src/app/services',
|
|
223
220
|
types: opts?.paths?.types || 'src/types',
|
|
224
221
|
};
|
|
225
222
|
}
|
|
@@ -229,9 +226,6 @@ Try setting it to something valid, like:
|
|
|
229
226
|
get serializers() {
|
|
230
227
|
return getSerializersOrFail();
|
|
231
228
|
}
|
|
232
|
-
get services() {
|
|
233
|
-
return getServicesOrFail();
|
|
234
|
-
}
|
|
235
229
|
async load(resourceType, resourcePath, importCb) {
|
|
236
230
|
switch (resourceType) {
|
|
237
231
|
case 'models':
|
|
@@ -241,9 +235,6 @@ Try setting it to something valid, like:
|
|
|
241
235
|
case 'serializers':
|
|
242
236
|
await importSerializers(resourcePath, importCb);
|
|
243
237
|
break;
|
|
244
|
-
case 'services':
|
|
245
|
-
await importServices(resourcePath, importCb);
|
|
246
|
-
break;
|
|
247
238
|
}
|
|
248
239
|
}
|
|
249
240
|
plugin(cb) {
|
|
@@ -292,6 +283,9 @@ Try setting it to something valid, like:
|
|
|
292
283
|
case 'db:log':
|
|
293
284
|
this._specialHooks.dbLog.push(cb);
|
|
294
285
|
break;
|
|
286
|
+
case 'repl:start':
|
|
287
|
+
this._specialHooks.replStart.push(cb);
|
|
288
|
+
break;
|
|
295
289
|
}
|
|
296
290
|
}
|
|
297
291
|
}
|
|
@@ -43,7 +43,7 @@ export default function whaaaaaaaaaaok() {
|
|
|
43
43
|
}
|
|
44
44
|
export function whaaaaaaaaaaokBasic() {
|
|
45
45
|
return `
|
|
46
|
-
|
|
46
|
+
,▄█▄
|
|
47
47
|
]█▄▄ ╓█████▌
|
|
48
48
|
▐██████▄ ▄█████▓╣█
|
|
49
49
|
║████████▄, , ,,▄,▄▄▄▓██████╬╬╣╣▌
|
|
@@ -51,7 +51,7 @@ export function whaaaaaaaaaaokBasic() {
|
|
|
51
51
|
╙█╬╬╬▓███████████████████████▒▓▌
|
|
52
52
|
╙▓█▓██████████████████████████
|
|
53
53
|
╚██████▀███████████╩█▓▌▐▓████▄
|
|
54
|
-
'║█████\`╣█Γ║████████▄▄φ▓█████▌
|
|
54
|
+
'║█████\`╣█Γ║████████▄▄φ▓█████▌
|
|
55
55
|
║█████████████████████▓█████▌
|
|
56
56
|
█████████████▓▓████████████
|
|
57
57
|
║█████████████████████████
|
|
@@ -6,13 +6,13 @@ import _db from '../../db/index.js';
|
|
|
6
6
|
import DreamApplication from '../../dream-application/index.js';
|
|
7
7
|
import { DreamConst } from '../../dream/constants.js';
|
|
8
8
|
import FailedToIdentifyAssociation from '../../errors/schema-builder/FailedToIdentifyAssociation.js';
|
|
9
|
-
import autogeneratedFileDisclaimer from '../../global-cli/helpers/autogeneratedFileMessage.js';
|
|
10
9
|
import camelize from '../camelize.js';
|
|
11
10
|
import compact from '../compact.js';
|
|
12
11
|
import EnvInternal from '../EnvInternal.js';
|
|
13
12
|
import pascalize from '../pascalize.js';
|
|
14
13
|
import sortBy from '../sortBy.js';
|
|
15
14
|
import uniq from '../uniq.js';
|
|
15
|
+
import autogeneratedFileDisclaimer from './autoGeneratedFileDisclaimer.js';
|
|
16
16
|
export default class SchemaBuilder {
|
|
17
17
|
async build() {
|
|
18
18
|
const { schemaConstContent, passthroughColumns, allDefaultScopeNames } = await this.buildSchemaContent();
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import DreamGlam from '../DreamGlam/DreamGlam.js';
|
|
2
|
+
export default function autogeneratedFileDisclaimer(startComment = '\n/*', endComment = '\n*/') {
|
|
3
|
+
return `\
|
|
4
|
+
${startComment}
|
|
5
|
+
${DreamGlam.whaaaaaaaaaaokBasic()}
|
|
6
|
+
|
|
7
|
+
This file was automatically generated by my cat, Aster.
|
|
8
|
+
He does not want you mucking about with his files,
|
|
9
|
+
and we are pretty lax on trimming his nails.
|
|
10
|
+
|
|
11
|
+
I mean, we have him pretty well fenced in but he is an
|
|
12
|
+
escape artist and he still manages to get fleas!
|
|
13
|
+
|
|
14
|
+
My point is, don't go mucking about with his files!
|
|
15
|
+
|
|
16
|
+
He actually has a hopefully well-tempered message for
|
|
17
|
+
us humans, he says:
|
|
18
|
+
|
|
19
|
+
"
|
|
20
|
+
Dear pathetic humans,
|
|
21
|
+
|
|
22
|
+
Here is a haiku to keep you in line
|
|
23
|
+
|
|
24
|
+
don't dare go mucking
|
|
25
|
+
with my files, I lyke them fine
|
|
26
|
+
prettierignore
|
|
27
|
+
"
|
|
28
|
+
${endComment}
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
@@ -16,7 +16,7 @@ import sort from './sort.js';
|
|
|
16
16
|
import sortBy from './sortBy.js';
|
|
17
17
|
import uncapitalize from './uncapitalize.js';
|
|
18
18
|
import uniq from './uniq.js';
|
|
19
|
-
export default function loadRepl(context) {
|
|
19
|
+
export default async function loadRepl(context) {
|
|
20
20
|
const dreamApp = DreamApplication.getOrFail();
|
|
21
21
|
context.CalendarDate = CalendarDate;
|
|
22
22
|
context.DateTime = DateTime;
|
|
@@ -38,9 +38,7 @@ export default function loadRepl(context) {
|
|
|
38
38
|
for (const globalName of Object.keys(dreamApp.models)) {
|
|
39
39
|
context[pascalizePath(globalName)] = dreamApp.models[globalName];
|
|
40
40
|
}
|
|
41
|
-
for (const
|
|
42
|
-
|
|
43
|
-
context[pascalizePath(globalName)] = dreamApp.services[globalName];
|
|
44
|
-
}
|
|
41
|
+
for (const hook of dreamApp.specialHooks.replStart) {
|
|
42
|
+
await hook(context);
|
|
45
43
|
}
|
|
46
44
|
}
|
package/dist/esm/src/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { default as DreamBin } from './bin/index.js';
|
|
2
2
|
export { default as DreamCLI } from './cli/index.js';
|
|
3
|
-
export { closeAllDbConnections,
|
|
3
|
+
export { closeAllDbConnections, dreamDbConnections } from './db/DreamDbConnection.js';
|
|
4
4
|
export { pgErrorType } from './db/errors.js';
|
|
5
|
-
export { default as
|
|
5
|
+
export { default as untypedDb } from './db/index.js';
|
|
6
6
|
export { default as DreamMigrationHelpers } from './db/migration-helpers/DreamMigrationHelpers.js';
|
|
7
7
|
export { default as validateColumn } from './db/validators/validateColumn.js';
|
|
8
8
|
export { default as validateTable } from './db/validators/validateTable.js';
|
|
@@ -327,7 +327,7 @@ export default class Dream {
|
|
|
327
327
|
* @internal
|
|
328
328
|
*
|
|
329
329
|
* Used by DreamApplication during the load process
|
|
330
|
-
* for models
|
|
330
|
+
* for models and serializers to assign
|
|
331
331
|
* unique global names to each model based on the file
|
|
332
332
|
* name of that model.
|
|
333
333
|
*/
|
|
@@ -4,5 +4,4 @@ export default class DreamImporter {
|
|
|
4
4
|
static ls(dir: string): Promise<string[]>;
|
|
5
5
|
static importDreams(pathToModels: string, importCb: (path: string) => Promise<any>): Promise<[string, typeof Dream][]>;
|
|
6
6
|
static importSerializers(pathToSerializers: string, importCb: (path: string) => Promise<any>): Promise<[string, Record<string, typeof DreamSerializer>][]>;
|
|
7
|
-
static importServices(pathToServices: string, importCb: (path: string) => Promise<any>): Promise<[string, any][]>;
|
|
8
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CompiledQuery } from 'kysely';
|
|
2
|
+
import { Context } from 'node:vm';
|
|
2
3
|
import Dream from '../Dream.js';
|
|
3
4
|
import { primaryKeyTypes } from '../dream/constants.js';
|
|
4
5
|
import { EncryptOptions } from '../encrypt/index.js';
|
|
@@ -77,13 +78,12 @@ export default class DreamApplication {
|
|
|
77
78
|
constructor(opts?: Partial<DreamApplicationOpts>);
|
|
78
79
|
get models(): Record<string, typeof Dream>;
|
|
79
80
|
get serializers(): Record<string, typeof DreamSerializer>;
|
|
80
|
-
|
|
81
|
-
load<RT extends 'models' | 'serializers' | 'services'>(resourceType: RT, resourcePath: string, importCb: (path: string) => Promise<any>): Promise<void>;
|
|
81
|
+
load<RT extends 'models' | 'serializers'>(resourceType: RT, resourcePath: string, importCb: (path: string) => Promise<any>): Promise<void>;
|
|
82
82
|
plugin(cb: (app: DreamApplication) => void | Promise<void>): void;
|
|
83
83
|
set<ApplyOpt extends DreamApplicationSetOption>(applyOption: ApplyOpt, options: ApplyOpt extends 'db' ? DreamDbCredentialOptions : ApplyOpt extends 'encryption' ? DreamApplicationEncryptionOptions : ApplyOpt extends 'primaryKeyType' ? (typeof primaryKeyTypes)[number] : ApplyOpt extends 'logger' ? DreamLogger : ApplyOpt extends 'projectRoot' ? string : ApplyOpt extends 'inflections' ? () => void | Promise<void> : ApplyOpt extends 'paths' ? DreamDirectoryPaths : ApplyOpt extends 'parallelTests' ? number : never): void;
|
|
84
|
-
on<T extends DreamHookEventType>(hookEventType: T, cb: T extends 'db:log' ? (event: KyselyLogEvent) => void : never): void;
|
|
84
|
+
on<T extends DreamHookEventType>(hookEventType: T, cb: T extends 'db:log' ? (event: KyselyLogEvent) => void : T extends 'repl:start' ? (context: Context) => void | Promise<void> : never): void;
|
|
85
85
|
}
|
|
86
|
-
export type DreamHookEventType = 'db:log';
|
|
86
|
+
export type DreamHookEventType = 'db:log' | 'repl:start';
|
|
87
87
|
export interface DreamApplicationOpts {
|
|
88
88
|
projectRoot: string;
|
|
89
89
|
primaryKeyType: (typeof primaryKeyTypes)[number];
|
|
@@ -97,7 +97,6 @@ export type DreamApplicationSetOption = 'db' | 'encryption' | 'inflections' | 'l
|
|
|
97
97
|
export interface DreamDirectoryPaths {
|
|
98
98
|
models?: string;
|
|
99
99
|
serializers?: string;
|
|
100
|
-
services?: string;
|
|
101
100
|
conf?: string;
|
|
102
101
|
db?: string;
|
|
103
102
|
modelSpecs?: string;
|
|
@@ -133,6 +132,7 @@ interface SegmentedEncryptionOptions {
|
|
|
133
132
|
}
|
|
134
133
|
export interface DreamApplicationSpecialHooks {
|
|
135
134
|
dbLog: ((event: KyselyLogEvent) => void)[];
|
|
135
|
+
replStart: ((context: Context) => void | Promise<void>)[];
|
|
136
136
|
}
|
|
137
137
|
export interface DreamApplicationInitOptions {
|
|
138
138
|
bypassModelIntegrityCheck?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function loadRepl(context: Record<string, unknown>): void
|
|
1
|
+
export default function loadRepl(context: Record<string, unknown>): Promise<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { default as DreamBin } from './bin/index.js';
|
|
2
2
|
export { default as DreamCLI } from './cli/index.js';
|
|
3
|
-
export { closeAllDbConnections,
|
|
3
|
+
export { closeAllDbConnections, dreamDbConnections } from './db/DreamDbConnection.js';
|
|
4
4
|
export { pgErrorType } from './db/errors.js';
|
|
5
|
-
export { default as
|
|
5
|
+
export { default as untypedDb } from './db/index.js';
|
|
6
6
|
export { default as DreamMigrationHelpers } from './db/migration-helpers/DreamMigrationHelpers.js';
|
|
7
7
|
export { default as validateColumn } from './db/validators/validateColumn.js';
|
|
8
8
|
export { default as validateTable } from './db/validators/validateTable.js';
|
|
@@ -60,6 +60,7 @@ export { type DreamSerializerAssociationStatement } from './serializer/decorator
|
|
|
60
60
|
export { default as Attribute, type AttributeStatement, type SerializableTypes, } from './serializer/decorators/attribute.js';
|
|
61
61
|
export { default as DreamSerializer } from './serializer/index.js';
|
|
62
62
|
export { type WhereStatementForDream, type WhereStatementForDreamClass } from './types/associations/shared.js';
|
|
63
|
+
export { type DbConnectionType } from './types/db.js';
|
|
63
64
|
export { type DreamAssociationMetadata, type DreamAttributes, type DreamClassColumn, type DreamColumn, type DreamColumnNames, type DreamOrViewModelSerializerKey, type DreamParamSafeAttributes, type DreamParamSafeColumnNames, type DreamSerializerKey, type DreamSerializers, type DreamTableSchema, type DreamVirtualColumns, type IdType, type PrimaryKeyType, type SerializableClassOrSerializerCallback, type SerializableDreamClassOrViewModelClass, type SerializableDreamOrViewModel, type Timestamp, type UpdateableAssociationProperties, type UpdateableProperties, type ViewModelSerializerKey, } from './types/dream.js';
|
|
64
65
|
export { type CommonOpenapiSchemaObjectFields, type OpenapiAllTypes, type OpenapiFormats, type OpenapiNumberFormats, type OpenapiPrimitiveTypes, type OpenapiSchemaArray, type OpenapiSchemaArrayShorthand, type OpenapiSchemaBase, type OpenapiSchemaBody, type OpenapiSchemaBodyShorthand, type OpenapiSchemaCommonFields, type OpenapiSchemaExpressionAllOf, type OpenapiSchemaExpressionAnyOf, type OpenapiSchemaExpressionOneOf, type OpenapiSchemaExpressionRef, type OpenapiSchemaExpressionRefSchemaShorthand, type OpenapiSchemaInteger, type OpenapiSchemaNull, type OpenapiSchemaNumber, type OpenapiSchemaObject, type OpenapiSchemaObjectAllOf, type OpenapiSchemaObjectAllOfShorthand, type OpenapiSchemaObjectAnyOf, type OpenapiSchemaObjectAnyOfShorthand, type OpenapiSchemaObjectBase, type OpenapiSchemaObjectBaseShorthand, type OpenapiSchemaObjectOneOf, type OpenapiSchemaObjectOneOfShorthand, type OpenapiSchemaObjectShorthand, type OpenapiSchemaPartialSegment, type OpenapiSchemaPrimitiveGeneric, type OpenapiSchemaProperties, type OpenapiSchemaPropertiesShorthand, type OpenapiSchemaShorthandExpressionAllOf, type OpenapiSchemaShorthandExpressionAnyOf, type OpenapiSchemaShorthandExpressionOneOf, type OpenapiSchemaShorthandExpressionSerializableRef, type OpenapiSchemaShorthandExpressionSerializerRef, type OpenapiSchemaShorthandPrimitiveGeneric, type OpenapiSchemaString, type OpenapiShorthandAllTypes, type OpenapiShorthandPrimitiveTypes, type OpenapiTypeField, type OpenapiTypeFieldObject, } from './types/openapi.js';
|
|
65
66
|
export { type ValidationType } from './types/validation.js';
|