@rvoh/dream 0.29.3 → 0.29.5
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/db/DreamDbConnection.js +7 -1
- package/dist/cjs/src/db/errors.js +10 -3
- 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 +40 -20
- 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/dream-application/index.js +6 -0
- 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/cjs/src/helpers/db/loadPgClient.js +6 -0
- package/dist/esm/src/Dream.js +58 -1
- package/dist/esm/src/db/DreamDbConnection.js +7 -1
- package/dist/esm/src/db/errors.js +10 -3
- 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 +40 -20
- 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/dream-application/index.js +6 -0
- 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/esm/src/helpers/db/loadPgClient.js +6 -0
- package/dist/types/src/Dream.d.ts +49 -0
- package/dist/types/src/dream/Query.d.ts +11 -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 +2 -2
|
@@ -12,10 +12,10 @@ class NonExistentScopeProvidedToResort extends Error {
|
|
|
12
12
|
return `
|
|
13
13
|
Only BelongsTo scopes are supported by the #resort method
|
|
14
14
|
received:
|
|
15
|
-
dream model class: ${this.dreamClass.
|
|
15
|
+
dream model class: ${this.dreamClass.sanitizedName}
|
|
16
16
|
scope: ${this.scopes.join(', ')}
|
|
17
17
|
|
|
18
|
-
BelongsTo scopes on ${this.dreamClass.
|
|
18
|
+
BelongsTo scopes on ${this.dreamClass.sanitizedName} are:
|
|
19
19
|
${this.dreamClass['sortableFields'].map(conf => conf.positionField).join('\n ')}
|
|
20
20
|
`;
|
|
21
21
|
}
|
|
@@ -12,13 +12,13 @@ class SortableDecoratorRequiresColumnOrBelongsToAssociation extends Error {
|
|
|
12
12
|
return `
|
|
13
13
|
Only Column or BelongsTo scopes are supported by the @Sortable decorator.
|
|
14
14
|
received:
|
|
15
|
-
dream model class: ${this.dreamClass.
|
|
15
|
+
dream model class: ${this.dreamClass.sanitizedName}
|
|
16
16
|
scope: ${this.attributeOrScope}
|
|
17
17
|
|
|
18
|
-
Columns on ${this.dreamClass.
|
|
18
|
+
Columns on ${this.dreamClass.sanitizedName} are:
|
|
19
19
|
${[...this.dreamClass.columns()].join('\n ')}
|
|
20
20
|
|
|
21
|
-
BelongsTo scopes on ${this.dreamClass.
|
|
21
|
+
BelongsTo scopes on ${this.dreamClass.sanitizedName} are:
|
|
22
22
|
${this.dreamClass['associationMetadataByType'].belongsTo.map(assoc => assoc.as).join('\n ')}
|
|
23
23
|
`;
|
|
24
24
|
}
|
|
@@ -11,7 +11,7 @@ class CanOnlyPassBelongsToModelParam extends Error {
|
|
|
11
11
|
get message() {
|
|
12
12
|
return `
|
|
13
13
|
Can only pass BelongsTo associated models as params
|
|
14
|
-
Dream class: ${this.dreamClass.
|
|
14
|
+
Dream class: ${this.dreamClass.sanitizedName}
|
|
15
15
|
Association: ${this.association.as}
|
|
16
16
|
Association type: ${this.association.type}
|
|
17
17
|
`;
|
|
@@ -11,7 +11,7 @@ class CannotAssociateThroughPolymorphic extends Error {
|
|
|
11
11
|
get message() {
|
|
12
12
|
return `
|
|
13
13
|
Cannot join through a polymorphic association
|
|
14
|
-
Dream class: ${this.dreamClass.
|
|
14
|
+
Dream class: ${this.dreamClass.sanitizedName}
|
|
15
15
|
Association: ${this.association.as}
|
|
16
16
|
`;
|
|
17
17
|
}
|
|
@@ -11,7 +11,7 @@ class CannotCreateAssociationWithThroughContext extends Error {
|
|
|
11
11
|
get message() {
|
|
12
12
|
return `
|
|
13
13
|
'createAssociation' is not supported for through associations.
|
|
14
|
-
Dream class: ${this.dreamClass.
|
|
14
|
+
Dream class: ${this.dreamClass.sanitizedName}
|
|
15
15
|
Association: ${this.association.as}
|
|
16
16
|
`;
|
|
17
17
|
}
|
|
@@ -15,7 +15,7 @@ class CannotJoinPolymorphicBelongsToError extends Error {
|
|
|
15
15
|
get message() {
|
|
16
16
|
return `
|
|
17
17
|
Cannot join on a polymorphic BelongsTo
|
|
18
|
-
Dream class: ${this.dreamClass.
|
|
18
|
+
Dream class: ${this.dreamClass.sanitizedName}
|
|
19
19
|
Association: ${this.association.as}
|
|
20
20
|
Inner Join statements:
|
|
21
21
|
${JSON.stringify(this.innerJoinStatements, null, 2)}
|
|
@@ -11,7 +11,7 @@ class CannotPassNullOrUndefinedToRequiredBelongsTo extends Error {
|
|
|
11
11
|
get message() {
|
|
12
12
|
return `
|
|
13
13
|
Cannot pass null or undefined as a value to a required association.
|
|
14
|
-
Dream class: ${this.dreamClass.
|
|
14
|
+
Dream class: ${this.dreamClass.sanitizedName}
|
|
15
15
|
Association: ${this.association.as}
|
|
16
16
|
`;
|
|
17
17
|
}
|
|
@@ -18,7 +18,7 @@ class InvalidComputedForeignKey extends Error {
|
|
|
18
18
|
get message() {
|
|
19
19
|
return `
|
|
20
20
|
Add an explicit foreignKey declaration to this association declaration:
|
|
21
|
-
Dream class: ${this.dreamClass.
|
|
21
|
+
Dream class: ${this.dreamClass.sanitizedName}
|
|
22
22
|
Association: ${this.partialAssociation.as}
|
|
23
23
|
Dream tried ${this.computedForeignKey} automatically, but it isn't a column in table ${this.table}.
|
|
24
24
|
`;
|
|
@@ -41,7 +41,7 @@ class ExplicitForeignKeyRequired extends Error {
|
|
|
41
41
|
return `
|
|
42
42
|
${this.explicitForeignKey} is not a valid column on table ${this.table}.
|
|
43
43
|
Fix the foreignKey declaration on:
|
|
44
|
-
Dream class: ${this.dreamClass.
|
|
44
|
+
Dream class: ${this.dreamClass.sanitizedName}
|
|
45
45
|
Association: ${this.partialAssociation.as}
|
|
46
46
|
`;
|
|
47
47
|
}
|
|
@@ -10,15 +10,15 @@ class JoinAttemptedOnMissingAssociation extends Error {
|
|
|
10
10
|
}
|
|
11
11
|
get message() {
|
|
12
12
|
return `
|
|
13
|
-
A joins call has been attempted on \`${this.dreamClass.
|
|
14
|
-
but \`${this.dreamClass.
|
|
13
|
+
A joins call has been attempted on \`${this.dreamClass.sanitizedName}\` association \`${this.associationName}\`,
|
|
14
|
+
but \`${this.dreamClass.sanitizedName}\` does not define association \`${this.associationName}\`.
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
Either \`${this.associationName}\` is a typo in the joins statement, or association \`${this.associationName}\` needs to be defined on \`${this.dreamClass.name}\`, for example:
|
|
18
18
|
|
|
19
|
-
class ${this.dreamClass.
|
|
19
|
+
class ${this.dreamClass.sanitizedName} {
|
|
20
20
|
...
|
|
21
|
-
@${this.dreamClass.
|
|
21
|
+
@${this.dreamClass.sanitizedName}.HasMany('SomeModelClass')
|
|
22
22
|
public ${this.associationName}: SomeModelClass[]
|
|
23
23
|
}
|
|
24
24
|
`;
|
|
@@ -10,15 +10,15 @@ class MissingThroughAssociation extends Error {
|
|
|
10
10
|
}
|
|
11
11
|
get message() {
|
|
12
12
|
return `
|
|
13
|
-
\`${this.dreamClass.
|
|
13
|
+
\`${this.dreamClass.sanitizedName}\` defines through association \`${this.association.through}\`, but \`${this.dreamClass.name}\` does not define association \`${this.association.through}\`.
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
To fix, define association \`${this.association.through}\` on \`${this.dreamClass.
|
|
16
|
+
To fix, define association \`${this.association.through}\` on \`${this.dreamClass.sanitizedName}\`.
|
|
17
17
|
For example:
|
|
18
18
|
|
|
19
|
-
class ${this.dreamClass.
|
|
19
|
+
class ${this.dreamClass.sanitizedName} {
|
|
20
20
|
...
|
|
21
|
-
@${this.dreamClass.
|
|
21
|
+
@${this.dreamClass.sanitizedName}.HasMany('TheJoinModelClass')
|
|
22
22
|
public ${this.association.through}: TheJoinModelClass[]
|
|
23
23
|
}
|
|
24
24
|
`;
|
|
@@ -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
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = loadPgClient;
|
|
4
|
+
// after building for esm, importing pg using the following:
|
|
5
|
+
//
|
|
6
|
+
// import * as pg from 'pg'
|
|
7
|
+
//
|
|
8
|
+
// will crash. This is difficult to discover, since it only happens
|
|
9
|
+
// when being imported from our esm build.
|
|
4
10
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5
11
|
// @ts-ignore
|
|
6
12
|
const pg_1 = require("pg");
|
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
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
// after building for esm, importing pg using the following:
|
|
2
|
+
//
|
|
3
|
+
// import * as pg from 'pg'
|
|
4
|
+
//
|
|
5
|
+
// will crash. This is difficult to discover, since it only happens
|
|
6
|
+
// when being imported from our esm build.
|
|
2
7
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
8
|
// @ts-ignore
|
|
4
9
|
import pg from 'pg';
|
|
10
|
+
import { CamelCasePlugin, Kysely, PostgresDialect } from 'kysely';
|
|
5
11
|
import DreamApplication from '../dream-application/index.js';
|
|
6
12
|
import ConnectionConfRetriever from './ConnectionConfRetriever.js';
|
|
7
13
|
let connections = {};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// after building for esm, importing pg using the following:
|
|
2
|
+
//
|
|
3
|
+
// import * as pg from 'pg'
|
|
4
|
+
//
|
|
5
|
+
// will crash. This is difficult to discover, since it only happens
|
|
6
|
+
// when being imported from our esm build.
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import pg from 'pg';
|
|
3
10
|
export const PG_ERRORS = {
|
|
4
11
|
23505: 'UNIQUE_CONSTRAINT_VIOLATION',
|
|
5
12
|
};
|
|
@@ -7,7 +14,7 @@ function pgErrorFromCode(code) {
|
|
|
7
14
|
return PG_ERRORS[code] || null;
|
|
8
15
|
}
|
|
9
16
|
export function pgErrorType(error) {
|
|
10
|
-
if (error instanceof DatabaseError)
|
|
17
|
+
if (error instanceof pg.DatabaseError)
|
|
11
18
|
return pgErrorFromCode(error.code);
|
|
12
19
|
return null;
|
|
13
20
|
}
|
|
@@ -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,
|