@rvoh/dream 0.29.3 → 0.29.4
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 +58 -1
- package/dist/cjs/src/decorators/STI.js +1 -1
- package/dist/cjs/src/decorators/associations/shared.js +3 -3
- package/dist/cjs/src/decorators/hooks/AfterCreate.js +1 -1
- package/dist/cjs/src/decorators/hooks/AfterCreateCommit.js +1 -1
- package/dist/cjs/src/decorators/hooks/AfterDestroy.js +1 -1
- package/dist/cjs/src/decorators/hooks/AfterDestroyCommit.js +1 -1
- package/dist/cjs/src/decorators/hooks/AfterSave.js +1 -1
- package/dist/cjs/src/decorators/hooks/AfterSaveCommit.js +1 -1
- package/dist/cjs/src/decorators/hooks/AfterUpdate.js +1 -1
- package/dist/cjs/src/decorators/hooks/AfterUpdateCommit.js +1 -1
- package/dist/cjs/src/decorators/hooks/BeforeCreate.js +1 -1
- package/dist/cjs/src/decorators/hooks/BeforeDestroy.js +1 -1
- package/dist/cjs/src/decorators/hooks/BeforeSave.js +1 -1
- package/dist/cjs/src/decorators/hooks/BeforeUpdate.js +1 -1
- package/dist/cjs/src/dream/Query.js +8 -8
- package/dist/cjs/src/dream/internal/associations/createAssociation.js +1 -1
- package/dist/cjs/src/dream/internal/runHooksFor.js +1 -1
- package/dist/cjs/src/dream/internal/saveDream.js +1 -1
- package/dist/cjs/src/dream/internal/sqlResultToDreamInstance.js +1 -1
- package/dist/cjs/src/errors/CannotCallUndestroyOnANonSoftDeleteModel.js +1 -1
- package/dist/cjs/src/errors/CannotDefineAssociationWithBothDependentAndPassthrough.js +1 -1
- package/dist/cjs/src/errors/CannotDefineAssociationWithBothDependentAndRequiredOnClause.js +1 -1
- package/dist/cjs/src/errors/CannotPassUndefinedAsAValueToAWhereClause.js +1 -1
- package/dist/cjs/src/errors/CannotReloadUnsavedDream.js +1 -1
- package/dist/cjs/src/errors/CreateOrFindByFailedToCreateAndFind.js +1 -1
- package/dist/cjs/src/errors/DoNotSetEncryptedFieldsDirectly.js +1 -1
- package/dist/cjs/src/errors/MissingDeletedAtFieldForSoftDelete.js +1 -1
- package/dist/cjs/src/errors/MissingSerializersDefinition.js +5 -5
- package/dist/cjs/src/errors/MissingTable.js +4 -4
- package/dist/cjs/src/errors/NonBelongsToAssociationProvidedAsSortableDecoratorScope.js +2 -2
- package/dist/cjs/src/errors/NonExistentScopeProvidedToResort.js +2 -2
- package/dist/cjs/src/errors/SortableDecoratorRequiresColumnOrBelongsToAssociation.js +3 -3
- package/dist/cjs/src/errors/associations/CanOnlyPassBelongsToModelParam.js +1 -1
- package/dist/cjs/src/errors/associations/CannotAssociateThroughPolymorphic.js +1 -1
- package/dist/cjs/src/errors/associations/CannotCreateAssociationWithThroughContext.js +1 -1
- package/dist/cjs/src/errors/associations/CannotJoinPolymorphicBelongsToError.js +1 -1
- package/dist/cjs/src/errors/associations/CannotPassNullOrUndefinedToRequiredBelongsTo.js +1 -1
- package/dist/cjs/src/errors/associations/InvalidComputedForeignKey.js +2 -2
- package/dist/cjs/src/errors/associations/JoinAttemptedOnMissingAssociation.js +4 -4
- package/dist/cjs/src/errors/associations/MissingThroughAssociation.js +4 -4
- package/dist/cjs/src/errors/associations/MissingThroughAssociationSource.js +10 -10
- package/dist/cjs/src/errors/associations/NonLoadedAssociation.js +1 -1
- package/dist/cjs/src/errors/ops/AnyRequiresArrayColumn.js +1 -1
- package/dist/cjs/src/errors/schema-builder/FailedToIdentifyAssociation.js +4 -4
- package/dist/cjs/src/errors/sti/STIChildMissing.js +1 -1
- package/dist/cjs/src/errors/sti/StiChildIncompatibleWithSoftDeleteDecorator.js +1 -1
- package/dist/esm/src/Dream.js +58 -1
- package/dist/esm/src/decorators/STI.js +1 -1
- package/dist/esm/src/decorators/associations/shared.js +3 -3
- package/dist/esm/src/decorators/hooks/AfterCreate.js +1 -1
- package/dist/esm/src/decorators/hooks/AfterCreateCommit.js +1 -1
- package/dist/esm/src/decorators/hooks/AfterDestroy.js +1 -1
- package/dist/esm/src/decorators/hooks/AfterDestroyCommit.js +1 -1
- package/dist/esm/src/decorators/hooks/AfterSave.js +1 -1
- package/dist/esm/src/decorators/hooks/AfterSaveCommit.js +1 -1
- package/dist/esm/src/decorators/hooks/AfterUpdate.js +1 -1
- package/dist/esm/src/decorators/hooks/AfterUpdateCommit.js +1 -1
- package/dist/esm/src/decorators/hooks/BeforeCreate.js +1 -1
- package/dist/esm/src/decorators/hooks/BeforeDestroy.js +1 -1
- package/dist/esm/src/decorators/hooks/BeforeSave.js +1 -1
- package/dist/esm/src/decorators/hooks/BeforeUpdate.js +1 -1
- package/dist/esm/src/dream/Query.js +8 -8
- package/dist/esm/src/dream/internal/associations/createAssociation.js +1 -1
- package/dist/esm/src/dream/internal/runHooksFor.js +1 -1
- package/dist/esm/src/dream/internal/saveDream.js +1 -1
- package/dist/esm/src/dream/internal/sqlResultToDreamInstance.js +1 -1
- package/dist/esm/src/errors/CannotCallUndestroyOnANonSoftDeleteModel.js +1 -1
- package/dist/esm/src/errors/CannotDefineAssociationWithBothDependentAndPassthrough.js +1 -1
- package/dist/esm/src/errors/CannotDefineAssociationWithBothDependentAndRequiredOnClause.js +1 -1
- package/dist/esm/src/errors/CannotPassUndefinedAsAValueToAWhereClause.js +1 -1
- package/dist/esm/src/errors/CannotReloadUnsavedDream.js +1 -1
- package/dist/esm/src/errors/CreateOrFindByFailedToCreateAndFind.js +1 -1
- package/dist/esm/src/errors/DoNotSetEncryptedFieldsDirectly.js +1 -1
- package/dist/esm/src/errors/MissingDeletedAtFieldForSoftDelete.js +1 -1
- package/dist/esm/src/errors/MissingSerializersDefinition.js +5 -5
- package/dist/esm/src/errors/MissingTable.js +4 -4
- package/dist/esm/src/errors/NonBelongsToAssociationProvidedAsSortableDecoratorScope.js +2 -2
- package/dist/esm/src/errors/NonExistentScopeProvidedToResort.js +2 -2
- package/dist/esm/src/errors/SortableDecoratorRequiresColumnOrBelongsToAssociation.js +3 -3
- package/dist/esm/src/errors/associations/CanOnlyPassBelongsToModelParam.js +1 -1
- package/dist/esm/src/errors/associations/CannotAssociateThroughPolymorphic.js +1 -1
- package/dist/esm/src/errors/associations/CannotCreateAssociationWithThroughContext.js +1 -1
- package/dist/esm/src/errors/associations/CannotJoinPolymorphicBelongsToError.js +1 -1
- package/dist/esm/src/errors/associations/CannotPassNullOrUndefinedToRequiredBelongsTo.js +1 -1
- package/dist/esm/src/errors/associations/InvalidComputedForeignKey.js +2 -2
- package/dist/esm/src/errors/associations/JoinAttemptedOnMissingAssociation.js +4 -4
- package/dist/esm/src/errors/associations/MissingThroughAssociation.js +4 -4
- package/dist/esm/src/errors/associations/MissingThroughAssociationSource.js +10 -10
- package/dist/esm/src/errors/associations/NonLoadedAssociation.js +1 -1
- package/dist/esm/src/errors/ops/AnyRequiresArrayColumn.js +1 -1
- package/dist/esm/src/errors/schema-builder/FailedToIdentifyAssociation.js +4 -4
- package/dist/esm/src/errors/sti/STIChildMissing.js +1 -1
- package/dist/esm/src/errors/sti/StiChildIncompatibleWithSoftDeleteDecorator.js +1 -1
- package/dist/types/src/Dream.d.ts +49 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/Benchmark.html +2 -2
- package/docs/classes/CalendarDate.html +2 -2
- package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +3 -3
- package/docs/classes/Decorators.html +14 -14
- package/docs/classes/Dream.html +146 -122
- package/docs/classes/DreamApplication.html +4 -4
- package/docs/classes/DreamBin.html +2 -2
- package/docs/classes/DreamCLI.html +3 -3
- package/docs/classes/DreamImporter.html +2 -2
- 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 +3 -3
- package/docs/classes/NonLoadedAssociation.html +3 -3
- package/docs/classes/Query.html +50 -50
- package/docs/classes/Range.html +2 -2
- package/docs/classes/RecordNotFound.html +3 -3
- package/docs/classes/ValidationError.html +3 -3
- 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/Scope.html +1 -1
- package/docs/functions/SoftDelete.html +1 -1
- package/docs/functions/Validate.html +1 -1
- package/docs/functions/Validates.html +1 -1
- package/docs/functions/Virtual.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/db.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/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/validateColumn.html +1 -1
- package/docs/functions/validateTable.html +1 -1
- 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/types/Camelized.html +1 -1
- package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
- 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/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 +1 -1
|
@@ -12,29 +12,29 @@ class MissingThroughAssociationSource extends Error {
|
|
|
12
12
|
}
|
|
13
13
|
get message() {
|
|
14
14
|
return `
|
|
15
|
-
\`${this.dreamClass.
|
|
15
|
+
\`${this.dreamClass.sanitizedName}\` defines association \`${this.association.as}\` through \`${this.dreamClass.sanitizedName}\` association \`${this.association.through}\`.
|
|
16
16
|
|
|
17
|
-
\`${this.dreamClass.
|
|
17
|
+
\`${this.dreamClass.sanitizedName}\` association \`${this.association.through}\` points to \`${this.throughClass.sanitizedName}\`.
|
|
18
18
|
|
|
19
|
-
Dream expects association \`${this.association.source}\` to be defiend on \`${this.throughClass.
|
|
19
|
+
Dream expects association \`${this.association.source}\` to be defiend on \`${this.throughClass.sanitizedName}\`, but \`${this.throughClass.sanitizedName}\` does not define association \`${this.association.source}\`.
|
|
20
20
|
|
|
21
21
|
There are two possible fixes:
|
|
22
22
|
|
|
23
23
|
1. Provide an explicit \`source\` in addition to \`through\`.
|
|
24
24
|
|
|
25
|
-
class ${this.dreamClass.
|
|
25
|
+
class ${this.dreamClass.sanitizedName} {
|
|
26
26
|
...
|
|
27
|
-
@${this.dreamClass.name}.HasMany(() => ${this.throughClass.
|
|
28
|
-
public ${this.association.as}: ${this.throughClass.
|
|
27
|
+
@${this.dreamClass.name}.HasMany(() => ${this.throughClass.sanitizedName}, { through: '${this.association.through}', source: '<a valid association on ${this.throughClass.sanitizedName}>'})
|
|
28
|
+
public ${this.association.as}: ${this.throughClass.sanitizedName}[]
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
2. Define association \`${this.association.source}\` on \`${this.throughClass.
|
|
31
|
+
2. Define association \`${this.association.source}\` on \`${this.throughClass.sanitizedName}\`.
|
|
32
32
|
For example:
|
|
33
33
|
|
|
34
|
-
class ${this.throughClass.
|
|
34
|
+
class ${this.throughClass.sanitizedName} {
|
|
35
35
|
...
|
|
36
|
-
@${this.throughClass.
|
|
37
|
-
public ${this.association.source}: ${this.association.modelCB().
|
|
36
|
+
@${this.throughClass.sanitizedName}.HasMany(() => ${this.association.modelCB().name})
|
|
37
|
+
public ${this.association.source}: ${this.association.modelCB().sanitizedName}[]
|
|
38
38
|
}
|
|
39
39
|
`;
|
|
40
40
|
}
|
|
@@ -10,7 +10,7 @@ class NonLoadedAssociation extends Error {
|
|
|
10
10
|
}
|
|
11
11
|
get message() {
|
|
12
12
|
return `
|
|
13
|
-
Attempting to access \`${this.associationName}\` on an instance of \`${this.dreamClass.
|
|
13
|
+
Attempting to access \`${this.associationName}\` on an instance of \`${this.dreamClass.sanitizedName}\`,
|
|
14
14
|
but \`${this.associationName}\` has not been preloaded or loaded.
|
|
15
15
|
`;
|
|
16
16
|
}
|
|
@@ -11,7 +11,7 @@ class AnyRequiresArrayColumn extends Error {
|
|
|
11
11
|
get message() {
|
|
12
12
|
return `
|
|
13
13
|
Attempting to call where({ ${this.column}: ops.any(<some value>)} ),
|
|
14
|
-
but ${this.dreamClass.
|
|
14
|
+
but ${this.dreamClass.sanitizedName}#${this.column} is not an array in the database.
|
|
15
15
|
`;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -24,7 +24,7 @@ An unexpected error occurred while looking up an association that you have defin
|
|
|
24
24
|
|
|
25
25
|
While building the schema for your app, we failed to find a match for
|
|
26
26
|
the ${this.associationType} association "${this.associationName}" on the
|
|
27
|
-
${this.modelClass.
|
|
27
|
+
${this.modelClass.sanitizedName} model.
|
|
28
28
|
|
|
29
29
|
This method requires either a string or string array as the first argument,
|
|
30
30
|
to the ${this.associationType} decorator. However, we received the following:
|
|
@@ -36,7 +36,7 @@ to the ${this.associationType} decorator. However, we received the following:
|
|
|
36
36
|
"${typeof attemptedName}"
|
|
37
37
|
|
|
38
38
|
Details:
|
|
39
|
-
dream: ${this.modelClass.
|
|
39
|
+
dream: ${this.modelClass.sanitizedName} (${this.modelClass.globalName})
|
|
40
40
|
association type: ${this.associationType}
|
|
41
41
|
association name: ${this.associationName}
|
|
42
42
|
".
|
|
@@ -53,7 +53,7 @@ An unexpected error occurred while looking up an association that you have defin
|
|
|
53
53
|
|
|
54
54
|
While building the schema for your app, we failed to find a match for
|
|
55
55
|
the ${this.associationType} association "${this.associationName}"
|
|
56
|
-
on ${this.modelClass.
|
|
56
|
+
on ${this.modelClass.sanitizedName}, using the global model name "${attemptedName}".
|
|
57
57
|
|
|
58
58
|
Usually, this is because the global name for
|
|
59
59
|
the model is not what you anticipated, which often happens when you are
|
|
@@ -65,7 +65,7 @@ first argument to an association, since it can help to catch these
|
|
|
65
65
|
familiar gotchas.
|
|
66
66
|
|
|
67
67
|
Details:
|
|
68
|
-
dream: ${this.modelClass.
|
|
68
|
+
dream: ${this.modelClass.sanitizedName} (${this.modelClass.globalName})
|
|
69
69
|
association type: ${this.associationType}
|
|
70
70
|
association name: ${this.associationName}
|
|
71
71
|
attempted model name: ${attemptedName}
|
|
@@ -13,7 +13,7 @@ class STIChildMissing extends Error {
|
|
|
13
13
|
get message() {
|
|
14
14
|
return `
|
|
15
15
|
Missing STI child class
|
|
16
|
-
Base Dream class: ${this.baseDreamClass.
|
|
16
|
+
Base Dream class: ${this.baseDreamClass.sanitizedName}
|
|
17
17
|
Type specified in DB record: ${this.extendingDreamClassName}
|
|
18
18
|
Table: ${this.baseDreamClass.table}
|
|
19
19
|
Primary key value: ${this.primaryKeyValue}
|
|
@@ -10,7 +10,7 @@ class StiChildIncompatibleWithSoftDeleteDecorator extends Error {
|
|
|
10
10
|
return `
|
|
11
11
|
@SoftDelete decorator cannot be applied to STI children.
|
|
12
12
|
Apply @SoftDelete to the base STI class instead.
|
|
13
|
-
STI child class: ${this.childStiDreamClass.
|
|
13
|
+
STI child class: ${this.childStiDreamClass.sanitizedName}
|
|
14
14
|
`;
|
|
15
15
|
}
|
|
16
16
|
}
|
package/dist/esm/src/Dream.js
CHANGED
|
@@ -311,6 +311,43 @@ export default class Dream {
|
|
|
311
311
|
static get stiBaseClassOrOwnClass() {
|
|
312
312
|
return this.sti.baseClass || this;
|
|
313
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* @internal
|
|
316
|
+
*
|
|
317
|
+
* Returns either the base STI class name, or else this class name
|
|
318
|
+
*
|
|
319
|
+
* NOTE: This is necessary due to changes in esbuild strategy WRT esm,
|
|
320
|
+
* compiled class names can contain a prefixing underscore if they contain
|
|
321
|
+
* private fields.
|
|
322
|
+
*
|
|
323
|
+
* This can create confusion when the class name is used as an attribute,
|
|
324
|
+
* as is done in the case of polymorphic associations, which use the class
|
|
325
|
+
* name as the "type" value for the polymorphic association.
|
|
326
|
+
*
|
|
327
|
+
* As such, any time the class name is being used as a value, it should be
|
|
328
|
+
* done using this value, rather than going to the class name directly.
|
|
329
|
+
*
|
|
330
|
+
* see https://github.com/evanw/esbuild/issues/1260 for more information
|
|
331
|
+
*
|
|
332
|
+
* @returns string
|
|
333
|
+
*/
|
|
334
|
+
static get stiBaseClassOrOwnClassName() {
|
|
335
|
+
return this.stiBaseClassOrOwnClass.sanitizedName;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* @internal
|
|
339
|
+
*
|
|
340
|
+
* Returns the class name, replacing prefixed underscores, since esbuild
|
|
341
|
+
* will translate some class names to have underscore prefixes, which can
|
|
342
|
+
* cause unexpected behavior.
|
|
343
|
+
*
|
|
344
|
+
* see https://github.com/evanw/esbuild/issues/1260 for more information
|
|
345
|
+
*
|
|
346
|
+
* @returns string
|
|
347
|
+
*/
|
|
348
|
+
static get sanitizedName() {
|
|
349
|
+
return this.name.replace(/^_/, '');
|
|
350
|
+
}
|
|
314
351
|
/**
|
|
315
352
|
* @internal
|
|
316
353
|
*
|
|
@@ -321,6 +358,26 @@ export default class Dream {
|
|
|
321
358
|
get stiBaseClassOrOwnClass() {
|
|
322
359
|
return this.constructor.stiBaseClassOrOwnClass;
|
|
323
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* @internal
|
|
363
|
+
*
|
|
364
|
+
* Shadows .stiBaseClassOrOwnClassName. Returns a string
|
|
365
|
+
*
|
|
366
|
+
* @returns A string
|
|
367
|
+
*/
|
|
368
|
+
get stiBaseClassOrOwnClassName() {
|
|
369
|
+
return this.constructor.stiBaseClassOrOwnClassName;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* @internal
|
|
373
|
+
*
|
|
374
|
+
* Shadows .sanitizedName. Returns a string
|
|
375
|
+
*
|
|
376
|
+
* @returns A string
|
|
377
|
+
*/
|
|
378
|
+
get sanitizedConstructorName() {
|
|
379
|
+
return this.constructor.sanitizedName;
|
|
380
|
+
}
|
|
324
381
|
/**
|
|
325
382
|
* @internal
|
|
326
383
|
*
|
|
@@ -1856,7 +1913,7 @@ export default class Dream {
|
|
|
1856
1913
|
}
|
|
1857
1914
|
if (belongsToAssociationMetaData.polymorphic) {
|
|
1858
1915
|
const foreignKeyTypeField = belongsToAssociationMetaData.foreignKeyTypeField();
|
|
1859
|
-
returnValues[foreignKeyTypeField] = associatedObject?.
|
|
1916
|
+
returnValues[foreignKeyTypeField] = associatedObject?.stiBaseClassOrOwnClassName;
|
|
1860
1917
|
setAttributeOnDreamInstance(foreignKeyTypeField, returnValues[foreignKeyTypeField]);
|
|
1861
1918
|
}
|
|
1862
1919
|
}
|
|
@@ -21,7 +21,7 @@ export default function STI(dreamClass, { value } = {}) {
|
|
|
21
21
|
stiChildClass['sti'] = {
|
|
22
22
|
active: true,
|
|
23
23
|
baseClass,
|
|
24
|
-
value: value || stiChildClass.
|
|
24
|
+
value: value || stiChildClass.sanitizedName,
|
|
25
25
|
};
|
|
26
26
|
stiChildClass[STI_SCOPE_NAME] = function (query) {
|
|
27
27
|
return query.where({ type: stiChildClass['sti'].value });
|
|
@@ -38,7 +38,7 @@ export function foreignKeyTypeField(foreignKey, dream, partialAssociation) {
|
|
|
38
38
|
}
|
|
39
39
|
export function modelCBtoSingleDreamClass(dreamClass, partialAssociation) {
|
|
40
40
|
if (Array.isArray(partialAssociation.modelCB()))
|
|
41
|
-
throw new Error(`Polymorphic association ${partialAssociation.as} on model ${dreamClass.
|
|
41
|
+
throw new Error(`Polymorphic association ${partialAssociation.as} on model ${dreamClass.sanitizedName} requires an explicit foreignKey`);
|
|
42
42
|
return partialAssociation.modelCB();
|
|
43
43
|
}
|
|
44
44
|
export function applyGetterAndSetter(target, partialAssociation, { foreignKeyBase, isBelongsTo, } = {}) {
|
|
@@ -76,7 +76,7 @@ export function applyGetterAndSetter(target, partialAssociation, { foreignKeyBas
|
|
|
76
76
|
partialAssociation.primaryKeyValue(associatedModel);
|
|
77
77
|
if (partialAssociation.polymorphic)
|
|
78
78
|
this[foreignKeyTypeField(foreignKeyBase, dreamClass, partialAssociation)] =
|
|
79
|
-
associatedModel?.
|
|
79
|
+
associatedModel?.['sanitizedConstructorName'];
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
});
|
|
@@ -93,7 +93,7 @@ export function associationPrimaryKeyAccessors(partialAssociation, dreamClass) {
|
|
|
93
93
|
if (Array.isArray(associationClass)) {
|
|
94
94
|
throw new Error(`
|
|
95
95
|
Cannot lookup primaryKey on polymorphic association:
|
|
96
|
-
dream class: ${dreamClass.
|
|
96
|
+
dream class: ${dreamClass.sanitizedName}
|
|
97
97
|
association: ${this.as}
|
|
98
98
|
`);
|
|
99
99
|
}
|
|
@@ -13,7 +13,7 @@ export function afterCreateImplementation(target, key, opts = {}) {
|
|
|
13
13
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
14
14
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
15
15
|
const hookStatement = {
|
|
16
|
-
className: dreamClass.
|
|
16
|
+
className: dreamClass.sanitizedName,
|
|
17
17
|
method: key,
|
|
18
18
|
type: 'afterCreate',
|
|
19
19
|
ifChanged: opts.ifChanged,
|
|
@@ -30,7 +30,7 @@ export function afterCreateCommitImplementation(target, key, opts = {}) {
|
|
|
30
30
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
31
31
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
32
32
|
const hookStatement = {
|
|
33
|
-
className: dreamClass.
|
|
33
|
+
className: dreamClass.sanitizedName,
|
|
34
34
|
method: key,
|
|
35
35
|
type: 'afterCreateCommit',
|
|
36
36
|
ifChanged: opts.ifChanged,
|
|
@@ -13,7 +13,7 @@ export function afterDestroyImplementation(target, key) {
|
|
|
13
13
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
14
14
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
15
15
|
const hookStatement = {
|
|
16
|
-
className: dreamClass.
|
|
16
|
+
className: dreamClass.sanitizedName,
|
|
17
17
|
method: key,
|
|
18
18
|
type: 'afterDestroy',
|
|
19
19
|
};
|
|
@@ -28,7 +28,7 @@ export function afterDestroyCommitImplementation(target, key) {
|
|
|
28
28
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
29
29
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
30
30
|
const hookStatement = {
|
|
31
|
-
className: dreamClass.
|
|
31
|
+
className: dreamClass.sanitizedName,
|
|
32
32
|
method: key,
|
|
33
33
|
type: 'afterDestroyCommit',
|
|
34
34
|
};
|
|
@@ -13,7 +13,7 @@ export function afterSaveImplementation(target, key, opts = {}) {
|
|
|
13
13
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
14
14
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
15
15
|
const hookStatement = {
|
|
16
|
-
className: dreamClass.
|
|
16
|
+
className: dreamClass.sanitizedName,
|
|
17
17
|
method: key,
|
|
18
18
|
type: 'afterSave',
|
|
19
19
|
ifChanged: opts.ifChanged,
|
|
@@ -30,7 +30,7 @@ export function afterSaveCommitImplementation(target, key, opts = {}) {
|
|
|
30
30
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
31
31
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
32
32
|
const hookStatement = {
|
|
33
|
-
className: dreamClass.
|
|
33
|
+
className: dreamClass.sanitizedName,
|
|
34
34
|
method: key,
|
|
35
35
|
type: 'afterSaveCommit',
|
|
36
36
|
ifChanged: opts.ifChanged,
|
|
@@ -13,7 +13,7 @@ export function afterUpdateImplementation(target, key, opts = {}) {
|
|
|
13
13
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
14
14
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
15
15
|
const hookStatement = {
|
|
16
|
-
className: dreamClass.
|
|
16
|
+
className: dreamClass.sanitizedName,
|
|
17
17
|
method: key,
|
|
18
18
|
type: 'afterUpdate',
|
|
19
19
|
ifChanged: opts.ifChanged,
|
|
@@ -30,7 +30,7 @@ export function afterUpdateCommitImplementation(target, key, opts = {}) {
|
|
|
30
30
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
31
31
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
32
32
|
const hookStatement = {
|
|
33
|
-
className: dreamClass.
|
|
33
|
+
className: dreamClass.sanitizedName,
|
|
34
34
|
method: key,
|
|
35
35
|
type: 'afterUpdateCommit',
|
|
36
36
|
ifChanged: opts.ifChanged,
|
|
@@ -13,7 +13,7 @@ export function beforeCreateImplementation(target, key, opts = {}) {
|
|
|
13
13
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
14
14
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
15
15
|
const hookStatement = {
|
|
16
|
-
className: dreamClass.
|
|
16
|
+
className: dreamClass.sanitizedName,
|
|
17
17
|
method: key,
|
|
18
18
|
type: 'beforeCreate',
|
|
19
19
|
ifChanging: opts.ifChanging,
|
|
@@ -13,7 +13,7 @@ export function beforeDestroyImplementation(target, key) {
|
|
|
13
13
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
14
14
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
15
15
|
const hookStatement = {
|
|
16
|
-
className: dreamClass.
|
|
16
|
+
className: dreamClass.sanitizedName,
|
|
17
17
|
method: key,
|
|
18
18
|
type: 'beforeDestroy',
|
|
19
19
|
};
|
|
@@ -13,7 +13,7 @@ export function beforeSaveImplementation(target, key, opts = {}) {
|
|
|
13
13
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
14
14
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
15
15
|
const hookStatement = {
|
|
16
|
-
className: dreamClass.
|
|
16
|
+
className: dreamClass.sanitizedName,
|
|
17
17
|
method: key,
|
|
18
18
|
type: 'beforeSave',
|
|
19
19
|
ifChanging: opts.ifChanging,
|
|
@@ -13,7 +13,7 @@ export function beforeUpdateImplementation(target, key, opts = {}) {
|
|
|
13
13
|
if (!Object.getOwnPropertyDescriptor(dreamClass, 'hooks'))
|
|
14
14
|
dreamClass['hooks'] = blankHooksFactory(dreamClass);
|
|
15
15
|
const hookStatement = {
|
|
16
|
-
className: dreamClass.
|
|
16
|
+
className: dreamClass.sanitizedName,
|
|
17
17
|
method: key,
|
|
18
18
|
type: 'beforeUpdate',
|
|
19
19
|
ifChanging: opts.ifChanging,
|
|
@@ -365,7 +365,7 @@ export default class Query extends ConnectedToDB {
|
|
|
365
365
|
async findOrFail(primaryKey) {
|
|
366
366
|
const record = await this.find(primaryKey);
|
|
367
367
|
if (!record)
|
|
368
|
-
throw new RecordNotFound(this.dreamInstance
|
|
368
|
+
throw new RecordNotFound(this.dreamInstance['sanitizedConstructorName']);
|
|
369
369
|
return record;
|
|
370
370
|
}
|
|
371
371
|
/**
|
|
@@ -400,7 +400,7 @@ export default class Query extends ConnectedToDB {
|
|
|
400
400
|
async findOrFailBy(whereStatement) {
|
|
401
401
|
const record = await this.findBy(whereStatement);
|
|
402
402
|
if (!record)
|
|
403
|
-
throw new RecordNotFound(this.dreamInstance
|
|
403
|
+
throw new RecordNotFound(this.dreamInstance['sanitizedConstructorName']);
|
|
404
404
|
return record;
|
|
405
405
|
}
|
|
406
406
|
/**
|
|
@@ -1420,7 +1420,7 @@ export default class Query extends ConnectedToDB {
|
|
|
1420
1420
|
async firstOrFail() {
|
|
1421
1421
|
const record = await this.first();
|
|
1422
1422
|
if (!record)
|
|
1423
|
-
throw new RecordNotFound(this.dreamInstance
|
|
1423
|
+
throw new RecordNotFound(this.dreamInstance['sanitizedConstructorName']);
|
|
1424
1424
|
return record;
|
|
1425
1425
|
}
|
|
1426
1426
|
/**
|
|
@@ -1459,7 +1459,7 @@ export default class Query extends ConnectedToDB {
|
|
|
1459
1459
|
async lastOrFail() {
|
|
1460
1460
|
const record = await this.last();
|
|
1461
1461
|
if (!record)
|
|
1462
|
-
throw new RecordNotFound(this.dreamInstance
|
|
1462
|
+
throw new RecordNotFound(this.dreamInstance['sanitizedConstructorName']);
|
|
1463
1463
|
return record;
|
|
1464
1464
|
}
|
|
1465
1465
|
/**
|
|
@@ -1754,7 +1754,7 @@ export default class Query extends ConnectedToDB {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
async preloadPolymorphicAssociationModel(dreams, association, associatedDreamClass, associatedDreams) {
|
|
1756
1756
|
const relevantAssociatedModels = dreams.filter((dream) => {
|
|
1757
|
-
return dream[association.foreignKeyTypeField()] === associatedDreamClass['
|
|
1757
|
+
return dream[association.foreignKeyTypeField()] === associatedDreamClass['stiBaseClassOrOwnClassName'];
|
|
1758
1758
|
});
|
|
1759
1759
|
if (relevantAssociatedModels.length) {
|
|
1760
1760
|
dreams.forEach((dream) => {
|
|
@@ -1777,7 +1777,7 @@ export default class Query extends ConnectedToDB {
|
|
|
1777
1777
|
for (const loadedAssociation of loadedAssociations) {
|
|
1778
1778
|
dreams
|
|
1779
1779
|
.filter((dream) => {
|
|
1780
|
-
return (dream[association.foreignKeyTypeField()] === loadedAssociation['
|
|
1780
|
+
return (dream[association.foreignKeyTypeField()] === loadedAssociation['stiBaseClassOrOwnClassName'] &&
|
|
1781
1781
|
dream[association.foreignKey()] === association.primaryKeyValue(loadedAssociation));
|
|
1782
1782
|
})
|
|
1783
1783
|
.forEach((dream) => {
|
|
@@ -2070,8 +2070,8 @@ export default class Query extends ConnectedToDB {
|
|
|
2070
2070
|
if (association.polymorphic) {
|
|
2071
2071
|
join = join.on((eb) => this.whereStatementToExpressionWrapper(eb, this.aliasWhereStatement({
|
|
2072
2072
|
[association.foreignKeyTypeField()]: throughClass
|
|
2073
|
-
? throughClass['
|
|
2074
|
-
: dreamClass['
|
|
2073
|
+
? throughClass['stiBaseClassOrOwnClassName']
|
|
2074
|
+
: dreamClass['stiBaseClassOrOwnClassName'],
|
|
2075
2075
|
}, currentAssociationTableOrAlias)));
|
|
2076
2076
|
}
|
|
2077
2077
|
if (timeToApplyThroughAssociations) {
|
|
@@ -25,7 +25,7 @@ export default async function createAssociation(dream, txn = null, associationNa
|
|
|
25
25
|
...opts,
|
|
26
26
|
};
|
|
27
27
|
if (hasAssociation.polymorphic) {
|
|
28
|
-
modifiedOpts[hasAssociation.foreignKeyTypeField()] = dream['
|
|
28
|
+
modifiedOpts[hasAssociation.foreignKeyTypeField()] = dream['stiBaseClassOrOwnClassName'];
|
|
29
29
|
}
|
|
30
30
|
if (txn) {
|
|
31
31
|
hasresult = await associationClass.txn(txn).create(modifiedOpts);
|
|
@@ -51,7 +51,7 @@ export async function runHook(statement, dream, txn) {
|
|
|
51
51
|
Attempting to run ${statement.method} as part of the ${statement.type}
|
|
52
52
|
Dream model hook sequence, but we encountered a method that does not exist.
|
|
53
53
|
|
|
54
|
-
Please make sure "${statement.method}" is defined on ${dream
|
|
54
|
+
Please make sure "${statement.method}" is defined on ${dream['sanitizedConstructorName']}
|
|
55
55
|
`);
|
|
56
56
|
}
|
|
57
57
|
await dream[statement.method](txn);
|
|
@@ -20,7 +20,7 @@ export default async function saveDream(dream, txn = null, { skipHooks = false }
|
|
|
20
20
|
// need to check validations after running before hooks, or else
|
|
21
21
|
// model hooks that might make a model valid cannot run
|
|
22
22
|
if (dream.isInvalid)
|
|
23
|
-
throw new ValidationError(dream
|
|
23
|
+
throw new ValidationError(dream['sanitizedConstructorName'], dream.errors);
|
|
24
24
|
if (alreadyPersisted && !dream.isDirty)
|
|
25
25
|
return dream;
|
|
26
26
|
let query;
|
|
@@ -25,7 +25,7 @@ export default function sqlResultToDreamInstance(dreamClass, sqlResult) {
|
|
|
25
25
|
export function findExtendingDreamClass(dreamClass, type) {
|
|
26
26
|
if (!dreamClass['extendedBy'])
|
|
27
27
|
return undefined;
|
|
28
|
-
const extendingDreamClass = dreamClass['extendedBy'].find(extendingDreamClass => extendingDreamClass.
|
|
28
|
+
const extendingDreamClass = dreamClass['extendedBy'].find(extendingDreamClass => extendingDreamClass.sanitizedName === type);
|
|
29
29
|
if (extendingDreamClass)
|
|
30
30
|
return extendingDreamClass;
|
|
31
31
|
return dreamClass['extendedBy']
|
|
@@ -10,7 +10,7 @@ Cannot call "undestroy" on a non-SoftDelete model. Ensure that your
|
|
|
10
10
|
model has @SoftDelete applied before calling "undestroy":
|
|
11
11
|
|
|
12
12
|
@SoftDelete()
|
|
13
|
-
class ${this.dreamClass.
|
|
13
|
+
class ${this.dreamClass.sanitizedName} extends ApplicationModel {
|
|
14
14
|
...
|
|
15
15
|
}
|
|
16
16
|
`;
|
|
@@ -10,7 +10,7 @@ export default class CannotDefineAssociationWithBothDependentAndPassthrough exte
|
|
|
10
10
|
return `
|
|
11
11
|
Cannot define association with both "dependent" and "DreamConst.passthrough".
|
|
12
12
|
Error found when trying to parse "${this.associationName}" on the
|
|
13
|
-
${this.dreamClass.
|
|
13
|
+
${this.dreamClass.sanitizedName} dream class.
|
|
14
14
|
`;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -10,7 +10,7 @@ export default class CannotDefineAssociationWithBothDependentAndRequiredOnClause
|
|
|
10
10
|
return `
|
|
11
11
|
Cannot define association with both "dependent" and "DreamConst.required".
|
|
12
12
|
Error found when trying to parse "${this.associationName}" on the
|
|
13
|
-
${this.dreamClass.
|
|
13
|
+
${this.dreamClass.sanitizedName} dream class.
|
|
14
14
|
`;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -10,7 +10,7 @@ export default class CannotPassUndefinedAsAValueToAWhereClause extends Error {
|
|
|
10
10
|
return `
|
|
11
11
|
Cannot pass undefined as a value to a where clause.
|
|
12
12
|
|
|
13
|
-
dream class: ${this.dreamClass.
|
|
13
|
+
dream class: ${this.dreamClass.sanitizedName}
|
|
14
14
|
key receiving an undefined value: ${this.key}
|
|
15
15
|
`;
|
|
16
16
|
}
|
|
@@ -6,7 +6,7 @@ export default class CreateOrFindByFailedToCreateAndFind extends Error {
|
|
|
6
6
|
}
|
|
7
7
|
get message() {
|
|
8
8
|
return `
|
|
9
|
-
Failed to create instance of ${this.dreamClass.
|
|
9
|
+
Failed to create instance of ${this.dreamClass.sanitizedName} and no matching model exists.
|
|
10
10
|
|
|
11
11
|
The likely cause is that one of the \`createWith\` fields violates
|
|
12
12
|
a uniqueness constraint.
|
|
@@ -13,7 +13,7 @@ export default class DoNotSetEncryptedFieldsDirectly extends Error {
|
|
|
13
13
|
Do not set @Encrypted columns directly. Instead, set their accessors, so that
|
|
14
14
|
those fields can be encrypted by Dream internally.
|
|
15
15
|
|
|
16
|
-
Dream class: ${this.dreamClass.
|
|
16
|
+
Dream class: ${this.dreamClass.sanitizedName}
|
|
17
17
|
Problematic setter: ${this.encryptedColumnName}
|
|
18
18
|
Setter to be used instead: ${this.encryptedProperty}`;
|
|
19
19
|
}
|
|
@@ -12,7 +12,7 @@ Whenever the using SoftDelete decorator, you must have either a deletedAt column
|
|
|
12
12
|
or else another column defined, along with an ovrriding getter on your model, like so:
|
|
13
13
|
|
|
14
14
|
@SoftDelete()
|
|
15
|
-
class ${this.dreamClass.
|
|
15
|
+
class ${this.dreamClass.sanitizedName} extends ApplicationModel {
|
|
16
16
|
public get deletedAtField() {
|
|
17
17
|
return 'customDeletedAtField' as const
|
|
18
18
|
}
|
|
@@ -7,14 +7,14 @@ export default class MissingSerializersDefinition extends Error {
|
|
|
7
7
|
get message() {
|
|
8
8
|
return `
|
|
9
9
|
Missing serializers definition on the following class
|
|
10
|
-
Dream class: ${this.dreamClass.
|
|
10
|
+
Dream class: ${this.dreamClass.sanitizedName}
|
|
11
11
|
|
|
12
|
-
Try something like this in your ${this.dreamClass.
|
|
12
|
+
Try something like this in your ${this.dreamClass.sanitizedName}'s serializer getter:
|
|
13
13
|
|
|
14
|
-
class ${this.dreamClass.
|
|
15
|
-
public get serializers(): DreamSerializers<${this.dreamClass.
|
|
14
|
+
class ${this.dreamClass.sanitizedName} {
|
|
15
|
+
public get serializers(): DreamSerializers<${this.dreamClass.sanitizedName}> {
|
|
16
16
|
return {
|
|
17
|
-
default: '${this.dreamClass.
|
|
17
|
+
default: '${this.dreamClass.sanitizedName}Serializer'
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
...
|
|
@@ -9,14 +9,14 @@ export default class MissingTable extends Error {
|
|
|
9
9
|
get message() {
|
|
10
10
|
return `
|
|
11
11
|
Missing table definition on the following dream class:
|
|
12
|
-
Dream class: ${this.dreamClass.
|
|
12
|
+
Dream class: ${this.dreamClass.sanitizedName}
|
|
13
13
|
|
|
14
|
-
Try something like this in your ${this.dreamClass.
|
|
14
|
+
Try something like this in your ${this.dreamClass.sanitizedName}'s table getter:
|
|
15
15
|
|
|
16
|
-
class ${this.dreamClass.
|
|
16
|
+
class ${this.dreamClass.sanitizedName} {
|
|
17
17
|
...
|
|
18
18
|
public get table() {
|
|
19
|
-
return '${pluralize(snakeify(this.dreamClass.
|
|
19
|
+
return '${pluralize(snakeify(this.dreamClass.sanitizedName))}'
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
`;
|
|
@@ -10,10 +10,10 @@ export default class NonBelongsToAssociationProvidedAsSortableDecoratorScope ext
|
|
|
10
10
|
return `
|
|
11
11
|
Only BelongsTo associations are supported as scopes for the @Sortable decorator.
|
|
12
12
|
received:
|
|
13
|
-
dream model class: ${this.dreamClass.
|
|
13
|
+
dream model class: ${this.dreamClass.sanitizedName}
|
|
14
14
|
scope: ${this.scope}
|
|
15
15
|
|
|
16
|
-
BelongsTo scopes on ${this.dreamClass.
|
|
16
|
+
BelongsTo scopes on ${this.dreamClass.sanitizedName} are:
|
|
17
17
|
${this.dreamClass['associationMetadataByType'].belongsTo.map(assoc => assoc.as).join('\n ')}
|
|
18
18
|
`;
|
|
19
19
|
}
|
|
@@ -10,10 +10,10 @@ export default class NonExistentScopeProvidedToResort extends Error {
|
|
|
10
10
|
return `
|
|
11
11
|
Only BelongsTo scopes are supported by the #resort method
|
|
12
12
|
received:
|
|
13
|
-
dream model class: ${this.dreamClass.
|
|
13
|
+
dream model class: ${this.dreamClass.sanitizedName}
|
|
14
14
|
scope: ${this.scopes.join(', ')}
|
|
15
15
|
|
|
16
|
-
BelongsTo scopes on ${this.dreamClass.
|
|
16
|
+
BelongsTo scopes on ${this.dreamClass.sanitizedName} are:
|
|
17
17
|
${this.dreamClass['sortableFields'].map(conf => conf.positionField).join('\n ')}
|
|
18
18
|
`;
|
|
19
19
|
}
|
|
@@ -10,13 +10,13 @@ export default class SortableDecoratorRequiresColumnOrBelongsToAssociation exten
|
|
|
10
10
|
return `
|
|
11
11
|
Only Column or BelongsTo scopes are supported by the @Sortable decorator.
|
|
12
12
|
received:
|
|
13
|
-
dream model class: ${this.dreamClass.
|
|
13
|
+
dream model class: ${this.dreamClass.sanitizedName}
|
|
14
14
|
scope: ${this.attributeOrScope}
|
|
15
15
|
|
|
16
|
-
Columns on ${this.dreamClass.
|
|
16
|
+
Columns on ${this.dreamClass.sanitizedName} are:
|
|
17
17
|
${[...this.dreamClass.columns()].join('\n ')}
|
|
18
18
|
|
|
19
|
-
BelongsTo scopes on ${this.dreamClass.
|
|
19
|
+
BelongsTo scopes on ${this.dreamClass.sanitizedName} are:
|
|
20
20
|
${this.dreamClass['associationMetadataByType'].belongsTo.map(assoc => assoc.as).join('\n ')}
|
|
21
21
|
`;
|
|
22
22
|
}
|