@rvoh/dream 0.31.0 → 0.31.1
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 +2 -3
- package/dist/cjs/src/bin/helpers/sync.js +2 -2
- package/dist/cjs/src/cli/logger/loggable/DreamCliLoggableSpinner.js +1 -1
- package/dist/cjs/src/decorators/field/association/shared.js +8 -8
- package/dist/cjs/src/dream/Query.js +5 -5
- package/dist/cjs/src/{openapi/types.js → dream/constants.js} +13 -1
- package/dist/cjs/src/dream/internal/similarity/SimilarityBuilder.js +3 -3
- package/dist/cjs/src/helpers/cli/SchemaBuilder.js +5 -5
- package/dist/cjs/src/helpers/cli/generateDream.js +1 -1
- package/dist/cjs/src/helpers/db/primaryKeyType.js +2 -2
- package/dist/cjs/src/helpers/isEmpty.js +2 -0
- package/dist/cjs/src/helpers/sort.js +24 -0
- package/dist/cjs/src/helpers/sortBy.js +19 -2
- package/dist/cjs/src/helpers/uniq.js +6 -5
- package/dist/cjs/src/index.js +8 -7
- package/dist/cjs/src/ops/ops-statement.js +3 -3
- package/dist/cjs/src/serializer/index.js +2 -2
- package/dist/esm/src/Dream.js +3 -4
- package/dist/esm/src/bin/helpers/sync.js +2 -2
- package/dist/esm/src/cli/logger/loggable/DreamCliLoggableSpinner.js +1 -1
- package/dist/esm/src/decorators/field/association/shared.js +6 -6
- package/dist/esm/src/dream/Query.js +1 -1
- package/dist/esm/src/{openapi/types.js → dream/constants.js} +12 -0
- package/dist/esm/src/dream/internal/similarity/SimilarityBuilder.js +1 -1
- package/dist/esm/src/errors/associations/InvalidComputedForeignKey.js +1 -1
- package/dist/esm/src/helpers/cli/SchemaBuilder.js +3 -3
- package/dist/esm/src/helpers/cli/generateDream.js +1 -1
- package/dist/esm/src/helpers/db/primaryKeyType.js +1 -1
- package/dist/esm/src/helpers/isEmpty.js +2 -0
- package/dist/esm/src/helpers/sort.js +21 -0
- package/dist/esm/src/helpers/sortBy.js +19 -2
- package/dist/esm/src/helpers/uniq.js +6 -5
- package/dist/esm/src/index.js +2 -2
- package/dist/esm/src/ops/ops-statement.js +1 -1
- package/dist/esm/src/serializer/index.js +1 -1
- package/dist/types/src/Dream.d.ts +13 -13
- package/dist/types/src/cli/logger/DreamCliLogger.d.ts +1 -12
- package/dist/types/src/cli/logger/loggable/DreamCliLoggable.d.ts +1 -1
- package/dist/types/src/cli/logger/loggable/DreamCliLoggableSpinner.d.ts +1 -1
- package/dist/types/src/cli/logger/loggable/DreamCliLoggableText.d.ts +1 -1
- package/dist/types/src/cli/logger/loggable/colorize.d.ts +1 -1
- package/dist/types/src/db/ConnectedToDB.d.ts +2 -2
- package/dist/types/src/db/ConnectionConfRetriever.d.ts +1 -1
- package/dist/types/src/db/DreamDbConnection.d.ts +1 -1
- package/dist/types/src/db/dataTypes.d.ts +0 -3
- package/dist/types/src/db/index.d.ts +1 -1
- package/dist/types/src/decorators/Decorators.d.ts +6 -6
- package/dist/types/src/decorators/field/association/BelongsTo.d.ts +2 -30
- package/dist/types/src/decorators/field/association/HasMany.d.ts +2 -15
- package/dist/types/src/decorators/field/association/HasOne.d.ts +2 -7
- package/dist/types/src/decorators/field/association/associationToGetterSetterProp.d.ts +4 -4
- package/dist/types/src/decorators/field/association/shared.d.ts +1 -100
- package/dist/types/src/decorators/field/lifecycle/AfterCreate.d.ts +1 -1
- package/dist/types/src/decorators/field/lifecycle/AfterCreateCommit.d.ts +1 -1
- package/dist/types/src/decorators/field/lifecycle/AfterSave.d.ts +1 -1
- package/dist/types/src/decorators/field/lifecycle/AfterSaveCommit.d.ts +1 -1
- package/dist/types/src/decorators/field/lifecycle/AfterUpdate.d.ts +1 -1
- package/dist/types/src/decorators/field/lifecycle/AfterUpdateCommit.d.ts +1 -1
- package/dist/types/src/decorators/field/lifecycle/BeforeCreate.d.ts +1 -1
- package/dist/types/src/decorators/field/lifecycle/BeforeSave.d.ts +1 -1
- package/dist/types/src/decorators/field/lifecycle/BeforeUpdate.d.ts +1 -1
- package/dist/types/src/decorators/field/lifecycle/shared.d.ts +1 -30
- package/dist/types/src/decorators/field/validation/Validates.d.ts +1 -1
- package/dist/types/src/dream/DreamClassTransactionBuilder.d.ts +6 -4
- package/dist/types/src/dream/DreamInstanceTransactionBuilder.d.ts +4 -2
- package/dist/types/src/dream/DreamTransaction.d.ts +1 -1
- package/dist/types/src/dream/LeftJoinLoadBuilder.d.ts +3 -2
- package/dist/types/src/dream/LoadBuilder.d.ts +3 -2
- package/dist/types/src/dream/Query.d.ts +5 -47
- package/dist/types/src/dream/constants.d.ts +15 -0
- package/dist/types/src/dream/internal/applyScopeBypassingSettingsToQuery.d.ts +1 -1
- package/dist/types/src/dream/internal/associations/associationQuery.d.ts +1 -1
- package/dist/types/src/dream/internal/associations/associationUpdateQuery.d.ts +1 -1
- package/dist/types/src/dream/internal/associations/createAssociation.d.ts +1 -1
- package/dist/types/src/dream/internal/associations/destroyAssociation.d.ts +1 -1
- package/dist/types/src/dream/internal/associations/undestroyAssociation.d.ts +1 -1
- package/dist/types/src/dream/internal/checkSingleValidation.d.ts +1 -1
- package/dist/types/src/dream/internal/destroyOptions.d.ts +1 -1
- package/dist/types/src/dream/internal/orderByDirection.d.ts +1 -1
- package/dist/types/src/dream/internal/runHooksFor.d.ts +1 -1
- package/dist/types/src/dream/internal/safelyRunCommitHooks.d.ts +1 -1
- package/dist/types/src/dream/internal/scopeHelpers.d.ts +1 -1
- package/dist/types/src/dream/internal/similarity/SimilarityBuilder.d.ts +3 -3
- package/dist/types/src/dream/internal/sqlResultToDreamInstance.d.ts +1 -1
- package/dist/types/src/dream-application/index.d.ts +1 -1
- package/dist/types/src/errors/ValidationError.d.ts +1 -1
- package/dist/types/src/errors/associations/CanOnlyPassBelongsToModelParam.d.ts +2 -2
- package/dist/types/src/errors/associations/CannotAssociateThroughPolymorphic.d.ts +2 -2
- package/dist/types/src/errors/associations/CannotCreateAssociationWithThroughContext.d.ts +2 -2
- package/dist/types/src/errors/associations/CannotJoinPolymorphicBelongsToError.d.ts +1 -1
- package/dist/types/src/errors/associations/CannotPassNullOrUndefinedToRequiredBelongsTo.d.ts +1 -1
- package/dist/types/src/errors/associations/InvalidComputedForeignKey.d.ts +1 -1
- package/dist/types/src/errors/associations/MissingRequiredAssociationOnClause.d.ts +2 -2
- package/dist/types/src/errors/associations/MissingThroughAssociation.d.ts +2 -2
- package/dist/types/src/errors/associations/MissingThroughAssociationSource.d.ts +2 -2
- package/dist/types/src/helpers/cli/generateMigrationContent.d.ts +1 -1
- package/dist/types/src/helpers/cli/generateStiMigrationContent.d.ts +1 -1
- package/dist/types/src/helpers/db/createDb.d.ts +1 -1
- package/dist/types/src/helpers/db/dropDb.d.ts +1 -1
- package/dist/types/src/helpers/db/foreignKeyTypeFromPrimaryKey.d.ts +1 -1
- package/dist/types/src/helpers/inferSerializerFromDreamOrViewModel.d.ts +1 -1
- package/dist/types/src/helpers/isEmpty.d.ts +1 -1
- package/dist/types/src/helpers/objectPathsToArrays.d.ts +1 -1
- package/dist/types/src/helpers/sort.d.ts +15 -0
- package/dist/types/src/helpers/sortBy.d.ts +2 -2
- package/dist/types/src/helpers/stringCasing.d.ts +1 -1
- package/dist/types/src/helpers/uniq.d.ts +1 -1
- package/dist/types/src/index.d.ts +6 -4
- package/dist/types/src/ops/index.d.ts +1 -1
- package/dist/types/src/ops/ops-statement.d.ts +1 -1
- package/dist/types/src/serializer/decorators/associations/RendersMany.d.ts +1 -1
- package/dist/types/src/serializer/decorators/associations/RendersOne.d.ts +1 -1
- package/dist/types/src/serializer/decorators/associations/shared.d.ts +2 -1
- package/dist/types/src/serializer/decorators/attribute.d.ts +1 -1
- package/dist/types/src/serializer/decorators/helpers/dreamAttributeOpenapiShape.d.ts +2 -2
- package/dist/types/src/serializer/decorators/helpers/hasSerializersGetter.d.ts +1 -1
- package/dist/types/src/serializer/decorators/helpers/maybeSerializableToDreamSerializerCallbackFunction.d.ts +1 -1
- package/dist/types/src/types/associations/belongsTo.d.ts +76 -0
- package/dist/types/src/types/associations/hasMany.d.ts +80 -0
- package/dist/types/src/types/associations/hasOne.d.ts +26 -0
- package/dist/types/src/types/associations/shared.d.ts +453 -0
- package/dist/types/src/types/db.d.ts +14 -0
- package/dist/types/src/types/dream.d.ts +527 -0
- package/dist/types/src/types/lifecycle.d.ts +50 -0
- package/dist/types/src/types/logger.d.ts +46 -0
- package/dist/types/src/types/openapi.d.ts +243 -0
- package/dist/types/src/types/query.d.ts +127 -0
- package/dist/types/src/types/utils.d.ts +173 -0
- package/dist/types/src/types/validation.d.ts +20 -0
- package/dist/types/src/types/variadic.d.ts +447 -0
- package/docs/assets/navigation.js +1 -1
- 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 +19 -19
- package/docs/classes/Dream.html +128 -127
- package/docs/classes/DreamApplication.html +4 -4
- package/docs/classes/DreamBin.html +2 -2
- package/docs/classes/DreamCLI.html +4 -4
- package/docs/classes/DreamDbConnection.html +2 -2
- package/docs/classes/DreamGlam.html +2 -2
- 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/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/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/sort.html +6 -0
- package/docs/functions/sortBy.html +6 -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/modules.html +1 -0
- package/docs/types/Camelized.html +1 -1
- package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
- package/docs/types/DateTime.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/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 +2 -2
- package/dist/cjs/src/db/reflections.js +0 -2
- package/dist/cjs/src/db/types.js +0 -2
- package/dist/cjs/src/decorators/field/validation/shared.js +0 -2
- package/dist/cjs/src/dream/types.js +0 -98
- package/dist/cjs/src/helpers/typeutils.js +0 -2
- package/dist/esm/src/db/reflections.js +0 -1
- package/dist/esm/src/db/types.js +0 -1
- package/dist/esm/src/decorators/field/validation/shared.js +0 -1
- package/dist/esm/src/dream/types.js +0 -95
- package/dist/esm/src/helpers/typeutils.js +0 -1
- package/dist/types/src/db/reflections.d.ts +0 -5
- package/dist/types/src/db/types.d.ts +0 -1
- package/dist/types/src/decorators/field/validation/shared.d.ts +0 -19
- package/dist/types/src/dream/types.d.ts +0 -184
- package/dist/types/src/helpers/typeutils.d.ts +0 -115
- package/dist/types/src/openapi/types.d.ts +0 -139
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a copy of the array, sorted by the value returned by calling the function in the second argument on each element in the array
|
|
3
|
+
* Returns a copy of the array sorted by the return value of the function passed as the second argument.
|
|
4
|
+
* ```ts
|
|
5
|
+
* import { sortBy } from '@rvoh/dream'
|
|
6
|
+
*
|
|
7
|
+
* sortBy(['aaa', 'a', 'aa'], (str: string) => str.length)
|
|
8
|
+
* // ['a', 'aa', 'aaa']
|
|
9
|
+
*
|
|
10
|
+
* sortBy(['aaa', 'a', 'aa'], (str: string) => -str.length)
|
|
11
|
+
* // ['aaa', 'aa', 'a']
|
|
12
|
+
*
|
|
13
|
+
* sortBy([5, 3, 7], (num: number) => num)
|
|
14
|
+
* // [3, 5, 7]
|
|
15
|
+
*
|
|
16
|
+
* sortBy([5, 3, 7], (num: number) => -num)
|
|
17
|
+
* // [7, 5, 3]
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
1
20
|
export default function sortBy(array, valueToCompare) {
|
|
2
21
|
const arrayClone = [...array];
|
|
3
22
|
return arrayClone.sort((a, b) => {
|
|
@@ -7,8 +26,6 @@ export default function sortBy(array, valueToCompare) {
|
|
|
7
26
|
return aPrime.localeCompare(bPrime);
|
|
8
27
|
if (typeof aPrime === 'number' && typeof bPrime === 'number')
|
|
9
28
|
return aPrime - bPrime;
|
|
10
|
-
if (typeof aPrime === 'bigint' && typeof bPrime === 'bigint')
|
|
11
|
-
return aPrime.toString().localeCompare(bPrime.toString());
|
|
12
29
|
throw new UnsupportedValueFromComparisonFunction(aPrime, bPrime);
|
|
13
30
|
});
|
|
14
31
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
export default function uniq(arr, toKey = undefined) {
|
|
2
2
|
if (toKey)
|
|
3
3
|
return uniqWith(arr, toKey);
|
|
4
|
-
|
|
5
|
-
return uniqWith(arr, dreamKey);
|
|
6
|
-
else
|
|
7
|
-
return Array.from(new Set(arr));
|
|
4
|
+
return uniqWith(arr, a => String(a));
|
|
8
5
|
}
|
|
9
6
|
function dreamKey(dream) {
|
|
10
7
|
return `${dream.constructor.globalName}:${dream.primaryKeyValue}`;
|
|
11
8
|
}
|
|
12
9
|
function uniqWith(arr, toKey) {
|
|
13
10
|
const map = arr.reduce((acc, val) => {
|
|
14
|
-
|
|
11
|
+
// Prefix with underscore to ensure that the values cannot be interpreted as integers.
|
|
12
|
+
// If they can be interpreted as integers, then the keys are ordered not by the
|
|
13
|
+
// order in which they were added, but in ascending numerical order.
|
|
14
|
+
const key = val?.isDreamInstance ? dreamKey(val) : `_${toKey(val)}`;
|
|
15
|
+
acc[key] ||= val;
|
|
15
16
|
return acc;
|
|
16
17
|
}, {});
|
|
17
18
|
return Object.values(map);
|
package/dist/esm/src/index.js
CHANGED
|
@@ -14,9 +14,9 @@ export { default as DreamImporter } from './dream-application/helpers/DreamImpor
|
|
|
14
14
|
export { default as lookupClassByGlobalName } from './dream-application/helpers/lookupClassByGlobalName.js';
|
|
15
15
|
export { default as DreamApplication, } from './dream-application/index.js';
|
|
16
16
|
export { default as Dream } from './Dream.js';
|
|
17
|
+
export { DreamConst, openapiPrimitiveTypes, openapiShorthandPrimitiveTypes, } from './dream/constants.js';
|
|
17
18
|
export { default as DreamTransaction } from './dream/DreamTransaction.js';
|
|
18
19
|
export { default as Query } from './dream/Query.js';
|
|
19
|
-
export { DreamConst, } from './dream/types.js';
|
|
20
20
|
export { default as Encrypt } from './encrypt/index.js';
|
|
21
21
|
export { default as NonLoadedAssociation } from './errors/associations/NonLoadedAssociation.js';
|
|
22
22
|
export { default as CreateOrFindByFailedToCreateAndFind } from './errors/CreateOrFindByFailedToCreateAndFind.js';
|
|
@@ -46,11 +46,11 @@ export { Range, default as range } from './helpers/range.js';
|
|
|
46
46
|
export { default as round } from './helpers/round.js';
|
|
47
47
|
export { default as serializerNameFromFullyQualifiedModelName } from './helpers/serializerNameFromFullyQualifiedModelName.js';
|
|
48
48
|
export { default as snakeify } from './helpers/snakeify.js';
|
|
49
|
+
export { default as sort } from './helpers/sort.js';
|
|
49
50
|
export { default as sortBy } from './helpers/sortBy.js';
|
|
50
51
|
export { default as standardizeFullyQualifiedModelName } from './helpers/standardizeFullyQualifiedModelName.js';
|
|
51
52
|
export { default as uncapitalize } from './helpers/uncapitalize.js';
|
|
52
53
|
export { default as uniq } from './helpers/uniq.js';
|
|
53
|
-
export { openapiPrimitiveTypes, openapiShorthandPrimitiveTypes, } from './openapi/types.js';
|
|
54
54
|
export { default as ops } from './ops/index.js';
|
|
55
55
|
export { default as RendersMany } from './serializer/decorators/associations/RendersMany.js';
|
|
56
56
|
export { default as RendersOne } from './serializer/decorators/associations/RendersOne.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import DreamApplication from '../dream-application/index.js';
|
|
2
|
-
import { DreamConst
|
|
2
|
+
import { DreamConst } from '../dream/constants.js';
|
|
3
3
|
import GlobalNameNotSet from '../errors/dream-application/GlobalNameNotSet.js';
|
|
4
4
|
import MissingSerializer from '../errors/MissingSerializersDefinition.js';
|
|
5
5
|
import FailedToRenderThroughAssociationForSerializer from '../errors/serializers/FailedToRenderThroughAssociationForSerializer.js';
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { CompiledQuery, DeleteQueryBuilder, InsertQueryBuilder, SelectQueryBuilder, Updateable, UpdateQueryBuilder } from 'kysely';
|
|
2
|
-
import { AssociationTableNames } from './db/reflections.js';
|
|
3
|
-
import { DbConnectionType } from './db/types.js';
|
|
4
2
|
import { VirtualAttributeStatement } from './decorators/field-or-getter/Virtual.js';
|
|
5
|
-
import { AssociationStatementsMap, PassthroughOnClause, WhereStatement } from './decorators/field/association/shared.js';
|
|
6
|
-
import { HookStatement, HookStatementMap } from './decorators/field/lifecycle/shared.js';
|
|
7
3
|
import { SortableFieldConfig } from './decorators/field/sortable/Sortable.js';
|
|
8
|
-
import ValidationStatement, { ValidationType } from './decorators/field/validation/shared.js';
|
|
9
4
|
import { ScopeStatement } from './decorators/static-method/Scope.js';
|
|
10
5
|
import DreamClassTransactionBuilder from './dream/DreamClassTransactionBuilder.js';
|
|
11
6
|
import DreamInstanceTransactionBuilder from './dream/DreamInstanceTransactionBuilder.js';
|
|
@@ -13,8 +8,14 @@ import DreamTransaction from './dream/DreamTransaction.js';
|
|
|
13
8
|
import { DestroyOptions } from './dream/internal/destroyOptions.js';
|
|
14
9
|
import LeftJoinLoadBuilder from './dream/LeftJoinLoadBuilder.js';
|
|
15
10
|
import LoadBuilder from './dream/LoadBuilder.js';
|
|
16
|
-
import Query
|
|
17
|
-
import {
|
|
11
|
+
import Query from './dream/Query.js';
|
|
12
|
+
import { AssociationStatementsMap, PassthroughOnClause, WhereStatement } from './types/associations/shared.js';
|
|
13
|
+
import { AssociationTableNames, DbConnectionType } from './types/db.js';
|
|
14
|
+
import { AllDefaultScopeNames, AssociationNameToDream, AttributeKeys, DefaultOrNamedScopeName, DreamAssociationNames, DreamAssociationNamesWithoutRequiredOnClauses, DreamAttributes, DreamColumnNames, DreamParamSafeColumnNames, DreamSerializeOptions, IdType, JoinOnStatements, NextPreloadArgumentType, OrderDir, PassthroughColumnNames, PluckEachArgs, PrimaryKeyForFind, TableColumnNames, UpdateableAssociationProperties, UpdateableProperties, UpdateablePropertiesForClass } from './types/dream.js';
|
|
15
|
+
import { HookStatement, HookStatementMap } from './types/lifecycle.js';
|
|
16
|
+
import { BaseModelColumnTypes, DefaultQueryTypeOptions, FindEachOpts, QueryWithJoinedAssociationsType, QueryWithJoinedAssociationsTypeAndNoPreload } from './types/query.js';
|
|
17
|
+
import { ValidationStatement, ValidationType } from './types/validation.js';
|
|
18
|
+
import { JoinedAssociation, JoinedAssociationsTypeFromAssociations, RequiredOnClauseKeys, VariadicJoinsArgs, VariadicLeftJoinLoadArgs, VariadicLoadArgs } from './types/variadic.js';
|
|
18
19
|
export default class Dream {
|
|
19
20
|
DB: any;
|
|
20
21
|
/**
|
|
@@ -297,13 +298,12 @@ export default class Dream {
|
|
|
297
298
|
*/
|
|
298
299
|
protected get stiBaseClassOrOwnClassName(): string;
|
|
299
300
|
/**
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
* Shadows .sanitizedName. Returns a string
|
|
301
|
+
* this.constructor.name may be prefixed with an underscore during conversion to Javascript.
|
|
302
|
+
* This method returns the constructor name without a leading underscore.
|
|
303
303
|
*
|
|
304
304
|
* @returns A string
|
|
305
305
|
*/
|
|
306
|
-
|
|
306
|
+
get sanitizedConstructorName(): string;
|
|
307
307
|
/**
|
|
308
308
|
* @internal
|
|
309
309
|
*
|
|
@@ -2088,7 +2088,7 @@ export default class Dream {
|
|
|
2088
2088
|
* user.assignAttributes({ email: 'my@email', password: 'my password' })
|
|
2089
2089
|
* ```
|
|
2090
2090
|
*/
|
|
2091
|
-
assignAttributes<I extends Dream>(this: I, attributes: UpdateableProperties<I>): Partial<import("./
|
|
2091
|
+
assignAttributes<I extends Dream>(this: I, attributes: UpdateableProperties<I>): Partial<import("./types/utils.js").MergeUnionOfRecordTypes<{
|
|
2092
2092
|
[x: string]: any;
|
|
2093
2093
|
} | Partial<{
|
|
2094
2094
|
[x: string]: any;
|
|
@@ -2105,7 +2105,7 @@ export default class Dream {
|
|
|
2105
2105
|
* user.setAttributes({ email: 'my@email', password: 'my password' })
|
|
2106
2106
|
* ```
|
|
2107
2107
|
*/
|
|
2108
|
-
setAttributes<I extends Dream>(this: I, attributes: UpdateableProperties<I>): Partial<import("./
|
|
2108
|
+
setAttributes<I extends Dream>(this: I, attributes: UpdateableProperties<I>): Partial<import("./types/utils.js").MergeUnionOfRecordTypes<{
|
|
2109
2109
|
[x: string]: any;
|
|
2110
2110
|
} | Partial<{
|
|
2111
2111
|
[x: string]: any;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DreamCliLoggerLogOpts } from '../../types/logger.js';
|
|
1
2
|
import DreamCliLoggableSpinner from './loggable/DreamCliLoggableSpinner.js';
|
|
2
3
|
import DreamCliLoggableText from './loggable/DreamCliLoggableText.js';
|
|
3
4
|
export default class DreamCliLogger {
|
|
@@ -8,15 +9,3 @@ export default class DreamCliLogger {
|
|
|
8
9
|
purge(): void;
|
|
9
10
|
private clear;
|
|
10
11
|
}
|
|
11
|
-
export interface DreamCliLoggerLogOpts<IsSpinner extends boolean> {
|
|
12
|
-
permanent?: boolean;
|
|
13
|
-
spinner?: IsSpinner;
|
|
14
|
-
logPrefix?: string;
|
|
15
|
-
logPrefixColor?: DreamCliForegroundColor;
|
|
16
|
-
logPrefixBgColor?: DreamCliBgColor;
|
|
17
|
-
spinnerPrefixColor?: DreamCliForegroundColor;
|
|
18
|
-
spinnerPrefixBgColor?: DreamCliBgColor;
|
|
19
|
-
}
|
|
20
|
-
export type DreamCliColor = DreamCliForegroundColor | DreamCliBgColor;
|
|
21
|
-
export type DreamCliForegroundColor = 'black' | 'red' | 'redBright' | 'green' | 'greenBright' | 'yellow' | 'yellowBright' | 'blue' | 'blueBright' | 'magenta' | 'magentaBright' | 'cyan' | 'cyanBright' | 'white' | 'whiteBright' | 'gray';
|
|
22
|
-
export type DreamCliBgColor = 'bgBlack' | 'bgRed' | 'bgRedBright' | 'bgGreen' | 'bgGreenBright' | 'bgYellow' | 'bgYellowBright' | 'bgBlue' | 'bgBlueBright' | 'bgMagenta' | 'bgMagentaBright' | 'bgCyan' | 'bgCyanBright' | 'bgWhite' | 'bgWhiteBright';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DreamCliBgColor, DreamCliForegroundColor } from '
|
|
1
|
+
import { DreamCliBgColor, DreamCliForegroundColor } from '../../../types/logger.js';
|
|
2
2
|
import DreamCliLoggable from './DreamCliLoggable.js';
|
|
3
3
|
import spinners from './spinners.js';
|
|
4
4
|
export default class DreamCliLoggableSpinner extends DreamCliLoggable {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DreamCliBgColor, DreamCliForegroundColor } from '
|
|
1
|
+
import { DreamCliBgColor, DreamCliForegroundColor } from '../../../types/logger.js';
|
|
2
2
|
import DreamCliLoggable from './DreamCliLoggable.js';
|
|
3
3
|
export default class DreamCliLoggableText extends DreamCliLoggable {
|
|
4
4
|
private text;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DreamCliBgColor, DreamCliForegroundColor } from '
|
|
1
|
+
import { DreamCliBgColor, DreamCliForegroundColor } from '../../../types/logger.js';
|
|
2
2
|
export default function colorize(text: string, { color, bgColor }: {
|
|
3
3
|
color?: DreamCliForegroundColor;
|
|
4
4
|
bgColor?: DreamCliBgColor;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Kysely, Transaction as KyselyTransaction } from 'kysely';
|
|
2
2
|
import Dream from '../Dream.js';
|
|
3
3
|
import DreamTransaction from '../dream/DreamTransaction.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { DbConnectionType } from '../types/db.js';
|
|
5
|
+
import { DreamConstructorType, SqlCommandType } from '../types/dream.js';
|
|
6
6
|
export default class ConnectedToDB<DreamInstance extends Dream> {
|
|
7
7
|
dreamInstance: DreamInstance;
|
|
8
8
|
protected readonly dreamClass: DreamConstructorType<DreamInstance>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SingleDbCredential } from '../dream-application/index.js';
|
|
2
|
-
import { DbConnectionType } from '
|
|
2
|
+
import { DbConnectionType } from '../types/db.js';
|
|
3
3
|
export default class ConnectionConfRetriever {
|
|
4
4
|
getConnectionConf(connection: DbConnectionType): SingleDbCredential;
|
|
5
5
|
hasReplicaConfig(): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Kysely } from 'kysely';
|
|
2
|
-
import { DbConnectionType } from '
|
|
2
|
+
import { DbConnectionType } from '../types/db.js';
|
|
3
3
|
export default class DreamDbConnection {
|
|
4
4
|
static getConnection<DB>(connectionType: DbConnectionType): Kysely<DB>;
|
|
5
5
|
static dropAllConnections(): Promise<void>;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
export default function dataTypes(): readonly ["bigint", "bigserial", "bit", "bit varying", "boolean", "box", "bytea", "character", "character varying", "char", "cidr", "circle", "citext", "date", "double precision", "inet", "integer", "interval", "json", "jsonb", "line", "lseg", "macaddr", "money", "numeric", "path", "point", "polygon", "real", "smallint", "smallserial", "serial", "text", "time", "time with time zone", "timestamp", "timestamp with time zone", "timestamp without time zone", "tsquery", "tsvector", "txid_snapshot", "uuid", "xml"];
|
|
2
2
|
export declare function isPrimitiveDataType(type: string): boolean;
|
|
3
3
|
export declare const postgresDatatypes: readonly ["bigint", "bigserial", "bit", "bit varying", "boolean", "box", "bytea", "character", "character varying", "char", "cidr", "circle", "citext", "date", "double precision", "inet", "integer", "interval", "json", "jsonb", "line", "lseg", "macaddr", "money", "numeric", "path", "point", "polygon", "real", "smallint", "smallserial", "serial", "text", "time", "time with time zone", "timestamp", "timestamp with time zone", "timestamp without time zone", "tsquery", "tsvector", "txid_snapshot", "uuid", "xml"];
|
|
4
|
-
type NonArrayDbTypes = (typeof postgresDatatypes)[number];
|
|
5
|
-
export type DbTypes = NonArrayDbTypes | `${NonArrayDbTypes}[]`;
|
|
6
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Kysely } from 'kysely';
|
|
2
2
|
import Dream from '../Dream.js';
|
|
3
3
|
import '../helpers/loadEnv.js';
|
|
4
|
-
import { DbConnectionType } from '
|
|
4
|
+
import { DbConnectionType } from '../types/db.js';
|
|
5
5
|
export default function db<T extends Dream, DB extends T['DB'] = T['DB']>(connectionType?: DbConnectionType): Kysely<DB>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import Dream from '../Dream.js';
|
|
2
|
-
import { DreamColumnNames, GlobalModelNameTableMap, SortableOptions } from '../dream/types.js';
|
|
3
2
|
import { SerializableTypes } from '../serializer/decorators/attribute.js';
|
|
4
|
-
import { NonPolymorphicBelongsToOptions, PolymorphicBelongsToOptions } from '
|
|
5
|
-
import { HasManyOptions, HasManyThroughOptions, PolymorphicHasManyOptions } from '
|
|
6
|
-
import { HasOneOptions, HasOneThroughOptions, PolymorphicHasOneOptions } from '
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { NonPolymorphicBelongsToOptions, PolymorphicBelongsToOptions } from '../types/associations/belongsTo.js';
|
|
4
|
+
import { HasManyOptions, HasManyThroughOptions, PolymorphicHasManyOptions } from '../types/associations/hasMany.js';
|
|
5
|
+
import { HasOneOptions, HasOneThroughOptions, PolymorphicHasOneOptions } from '../types/associations/hasOne.js';
|
|
6
|
+
import { DreamColumnNames, GlobalModelNameTableMap, SortableOptions } from '../types/dream.js';
|
|
7
|
+
import { AfterHookOpts, BeforeHookOpts } from '../types/lifecycle.js';
|
|
8
|
+
import { ValidationType } from '../types/validation.js';
|
|
9
9
|
export default class Decorators<T extends Dream> {
|
|
10
10
|
BelongsTo<const AssociationGlobalNameOrNames extends keyof GlobalModelNameTableMap<T> | (keyof GlobalModelNameTableMap<T>)[]>(this: Decorators<T>, globalAssociationNameOrNames: AssociationGlobalNameOrNames, options?: NonPolymorphicBelongsToOptions<T, AssociationGlobalNameOrNames>): any;
|
|
11
11
|
BelongsTo<const AssociationGlobalNameOrNames extends keyof GlobalModelNameTableMap<T> | (keyof GlobalModelNameTableMap<T>)[]>(this: Decorators<T>, globalAssociationNameOrNames: AssociationGlobalNameOrNames, options?: PolymorphicBelongsToOptions<T, AssociationGlobalNameOrNames>): any;
|
|
@@ -1,33 +1,5 @@
|
|
|
1
|
-
import { AssociationTableNames } from '../../../db/reflections.js';
|
|
2
1
|
import Dream from '../../../Dream.js';
|
|
3
|
-
import {
|
|
2
|
+
import { NonPolymorphicBelongsToOptions, PolymorphicBelongsToOptions } from '../../../types/associations/belongsTo.js';
|
|
3
|
+
import { GlobalModelNameTableMap } from '../../../types/dream.js';
|
|
4
4
|
export default function BelongsTo<BaseInstance extends Dream, AssociationGlobalNameOrNames extends keyof GlobalModelNameTableMap<BaseInstance> | (keyof GlobalModelNameTableMap<BaseInstance>)[]>(globalAssociationNameOrNames: AssociationGlobalNameOrNames, opts?: NonPolymorphicBelongsToOptions<BaseInstance, AssociationGlobalNameOrNames>): any;
|
|
5
5
|
export default function BelongsTo<BaseInstance extends Dream, AssociationGlobalNameOrNames extends keyof GlobalModelNameTableMap<BaseInstance> | (keyof GlobalModelNameTableMap<BaseInstance>)[]>(globalAssociationNameOrNames: AssociationGlobalNameOrNames, opts?: PolymorphicBelongsToOptions<BaseInstance, AssociationGlobalNameOrNames>): any;
|
|
6
|
-
export interface BelongsToStatement<BaseInstance extends Dream, DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> {
|
|
7
|
-
modelCB: () => typeof Dream | (typeof Dream)[];
|
|
8
|
-
globalAssociationNameOrNames: string[];
|
|
9
|
-
type: 'BelongsTo';
|
|
10
|
-
as: string;
|
|
11
|
-
primaryKey: (associationInstance?: Dream) => keyof DB[TableName] & string;
|
|
12
|
-
primaryKeyValue: (associationInstance: Dream | null) => any;
|
|
13
|
-
primaryKeyOverride?: (keyof DB[TableName] & string) | null;
|
|
14
|
-
foreignKey: () => DreamColumnNames<BaseInstance> & string;
|
|
15
|
-
foreignKeyTypeField: () => DreamColumnNames<BaseInstance> & string;
|
|
16
|
-
optional: boolean;
|
|
17
|
-
distinct: null;
|
|
18
|
-
polymorphic: boolean;
|
|
19
|
-
withoutDefaultScopes?: DefaultScopeName<BaseInstance>[];
|
|
20
|
-
}
|
|
21
|
-
export interface NonPolymorphicBelongsToOptions<BaseInstance extends Dream, AssociationGlobalNameOrNames extends GlobalModelNames<BaseInstance> | readonly GlobalModelNames<BaseInstance>[], AssociationGlobalName = AssociationGlobalNameOrNames extends Readonly<any[]> ? AssociationGlobalNameOrNames[0] & string : AssociationGlobalNameOrNames & string, AssociationTableName extends AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB'] = TableNameForGlobalModelName<BaseInstance, AssociationGlobalName & GlobalModelNames<BaseInstance>> & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']> {
|
|
22
|
-
foreignKey?: DreamColumnNames<BaseInstance>;
|
|
23
|
-
primaryKeyOverride?: TableColumnNames<BaseInstance['DB'], AssociationTableName> | null;
|
|
24
|
-
optional?: boolean;
|
|
25
|
-
withoutDefaultScopes?: DefaultScopeNameForTable<BaseInstance['schema'], AssociationTableName>[];
|
|
26
|
-
}
|
|
27
|
-
export interface PolymorphicBelongsToOptions<BaseInstance extends Dream, AssociationGlobalNameOrNames extends GlobalModelNames<BaseInstance> | readonly GlobalModelNames<BaseInstance>[], AssociationGlobalName = AssociationGlobalNameOrNames extends Readonly<any[]> ? AssociationGlobalNameOrNames[0] & string : AssociationGlobalNameOrNames & string, AssociationTableName extends AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB'] = TableNameForGlobalModelName<BaseInstance, AssociationGlobalName & GlobalModelNames<BaseInstance>> & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']> {
|
|
28
|
-
foreignKey: DreamColumnNames<BaseInstance>;
|
|
29
|
-
primaryKeyOverride?: TableColumnNames<BaseInstance['DB'], AssociationTableName> | null;
|
|
30
|
-
optional?: boolean;
|
|
31
|
-
polymorphic: boolean;
|
|
32
|
-
withoutDefaultScopes?: DefaultScopeNameForTable<BaseInstance['schema'], AssociationTableName>[];
|
|
33
|
-
}
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
import { AssociationTableNames } from '../../../db/reflections.js';
|
|
2
1
|
import Dream from '../../../Dream.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { HasManyOptions, HasManyThroughOptions, PolymorphicHasManyOptions } from '../../../types/associations/hasMany.js';
|
|
3
|
+
import { GlobalModelNameTableMap } from '../../../types/dream.js';
|
|
5
4
|
export default function HasMany<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>>(globalAssociationNameOrNames: AssociationGlobalName, opts?: HasManyOptions<BaseInstance, AssociationGlobalName>): any;
|
|
6
5
|
export default function HasMany<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>>(globalAssociationNameOrNames: AssociationGlobalName, opts?: HasManyThroughOptions<BaseInstance, AssociationGlobalName>): any;
|
|
7
6
|
export default function HasMany<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>>(globalAssociationNameOrNames: AssociationGlobalName, opts?: PolymorphicHasManyOptions<BaseInstance, AssociationGlobalName>): any;
|
|
8
|
-
export type HasManyStatement<BaseInstance extends Dream, DB, Schema, ForeignTableName extends AssociationTableNames<DB, Schema> & keyof DB> = HasStatement<BaseInstance, DB, Schema, ForeignTableName, 'HasMany'> & {
|
|
9
|
-
distinct?: TableColumnNames<DB, ForeignTableName>;
|
|
10
|
-
order?: OrderStatement<DB, Schema, ForeignTableName>;
|
|
11
|
-
};
|
|
12
|
-
interface HasManyOnlyOptions<BaseInstance extends Dream, AssociationGlobalNameOrNames extends GlobalModelNames<BaseInstance> | readonly GlobalModelNames<BaseInstance>[], AssociationGlobalName = AssociationGlobalNameOrNames extends any[] ? AssociationGlobalNameOrNames[0] & string : AssociationGlobalNameOrNames & string, AssociationTableName = TableNameForGlobalModelName<BaseInstance, AssociationGlobalName & GlobalModelNames<BaseInstance>>> {
|
|
13
|
-
distinct?: TableColumnNames<BaseInstance['DB'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']> | boolean;
|
|
14
|
-
order?: OrderStatement<BaseInstance['DB'], BaseInstance['schema'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']> | OrderStatement<BaseInstance['DB'], BaseInstance['schema'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']>[];
|
|
15
|
-
}
|
|
16
|
-
export type HasManyOptions<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>> = HasOptions<BaseInstance, AssociationGlobalName> & HasManyOnlyOptions<BaseInstance, AssociationGlobalName>;
|
|
17
|
-
export type PolymorphicHasManyOptions<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>> = PolymorphicHasOptions<BaseInstance, AssociationGlobalName> & HasManyOnlyOptions<BaseInstance, AssociationGlobalName>;
|
|
18
|
-
export type HasManyThroughOptions<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>> = HasThroughOptions<BaseInstance, AssociationGlobalName> & HasManyOnlyOptions<BaseInstance, AssociationGlobalName>;
|
|
19
|
-
export {};
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { AssociationTableNames } from '../../../db/reflections.js';
|
|
2
1
|
import Dream from '../../../Dream.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { HasOneOptions, HasOneThroughOptions, PolymorphicHasOneOptions } from '../../../types/associations/hasOne.js';
|
|
3
|
+
import { GlobalModelNameTableMap } from '../../../types/dream.js';
|
|
5
4
|
export default function HasOne<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>>(globalAssociationName: AssociationGlobalName, opts?: HasOneOptions<BaseInstance, AssociationGlobalName>): any;
|
|
6
5
|
export default function HasOne<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>>(globalAssociationNameOrNames: AssociationGlobalName, opts?: HasOneThroughOptions<BaseInstance, AssociationGlobalName>): any;
|
|
7
6
|
export default function HasOne<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>>(globalAssociationNameOrNames: AssociationGlobalName, opts?: PolymorphicHasOneOptions<BaseInstance, AssociationGlobalName>): any;
|
|
8
|
-
export type HasOneStatement<BaseInstance extends Dream, DB, Schema, ForeignTableName extends AssociationTableNames<DB, Schema> & keyof DB> = HasStatement<BaseInstance, DB, Schema, ForeignTableName, 'HasOne'>;
|
|
9
|
-
export type HasOneOptions<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>> = HasOptions<BaseInstance, AssociationGlobalName>;
|
|
10
|
-
export type PolymorphicHasOneOptions<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>> = PolymorphicHasOptions<BaseInstance, AssociationGlobalName>;
|
|
11
|
-
export type HasOneThroughOptions<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>> = HasThroughOptions<BaseInstance, AssociationGlobalName>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BelongsToStatement } from '
|
|
2
|
-
import { HasManyStatement } from '
|
|
3
|
-
import { HasOneStatement } from '
|
|
4
|
-
import { PartialAssociationStatement } from '
|
|
1
|
+
import { BelongsToStatement } from '../../../types/associations/belongsTo.js';
|
|
2
|
+
import { HasManyStatement } from '../../../types/associations/hasMany.js';
|
|
3
|
+
import { HasOneStatement } from '../../../types/associations/hasOne.js';
|
|
4
|
+
import { PartialAssociationStatement } from '../../../types/associations/shared.js';
|
|
5
5
|
export default function associationToGetterSetterProp(association: BelongsToStatement<any, any, any, any> | HasManyStatement<any, any, any, any> | HasOneStatement<any, any, any, any> | PartialAssociationStatement): string;
|
|
@@ -1,106 +1,8 @@
|
|
|
1
|
-
import { ComparisonOperatorExpression as KyselyComparisonOperatorExpression, SelectQueryBuilder, Updateable } from 'kysely';
|
|
2
|
-
import { AssociationTableNames } from '../../../db/reflections.js';
|
|
3
1
|
import Dream from '../../../Dream.js';
|
|
4
|
-
import {
|
|
5
|
-
import CalendarDate from '../../../helpers/CalendarDate.js';
|
|
6
|
-
import { DateTime } from '../../../helpers/DateTime.js';
|
|
7
|
-
import { Range } from '../../../helpers/range.js';
|
|
8
|
-
import { Inc, MergeUnionOfRecordTypes, ReadonlyTail, UnionToIntersection } from '../../../helpers/typeutils.js';
|
|
9
|
-
import CurriedOpsStatement from '../../../ops/curried-ops-statement.js';
|
|
10
|
-
import OpsStatement, { ExtraSimilarityArgs } from '../../../ops/ops-statement.js';
|
|
11
|
-
import { BelongsToStatement } from './BelongsTo.js';
|
|
12
|
-
import { HasManyStatement } from './HasMany.js';
|
|
13
|
-
import { HasOneStatement } from './HasOne.js';
|
|
14
|
-
type MAX_JOINED_TABLES_DEPTH = 25;
|
|
15
|
-
type AssociatedBelongsToModelType<I extends Dream, AssociationName extends keyof DreamBelongsToAssociationMetadata<I>, PossibleArrayAssociationType extends I[AssociationName & keyof I] = I[AssociationName & keyof I], AssociationType extends PossibleArrayAssociationType extends (infer ElementType)[] ? ElementType : PossibleArrayAssociationType = PossibleArrayAssociationType extends (infer ElementType)[] ? ElementType : PossibleArrayAssociationType> = AssociationType;
|
|
16
|
-
export type AssociatedModelParam<I extends Dream, AssociationExists = keyof DreamBelongsToAssociationMetadata<I> extends never ? false : true, AssociationName = AssociationExists extends false ? never : keyof DreamBelongsToAssociationMetadata<I> & string, RetObj = AssociationExists extends false ? never : AssociationName extends never ? never : {
|
|
17
|
-
[K in AssociationName & keyof DreamBelongsToAssociationMetadata<I> & string]: AssociatedBelongsToModelType<I, K> | null;
|
|
18
|
-
}> = Partial<UnionToIntersection<RetObj>>;
|
|
19
|
-
export type PassthroughOnClause<PassthroughColumns extends string[]> = Partial<Record<PassthroughColumns[number], any>>;
|
|
20
|
-
type DreamSelectable<DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = Partial<{
|
|
21
|
-
[ColumnName in keyof DB[TableName]]: NonKyselySupportedSupplementalWhereClauseValues<DB, Schema, TableName, ColumnName>;
|
|
22
|
-
}>;
|
|
23
|
-
type NonKyselySupportedSupplementalWhereClauseValues<DB, Schema, TableName, Column, ColumnType = TableColumnType<Schema, TableName, Column>, EnumTypeArray extends string[] | null = TableColumnEnumTypeArray<Schema, TableName, Column>, PermanentOpsValTypes = null | readonly [], OpsValType = EnumTypeArray extends string[] ? EnumTypeArray[number] | PermanentOpsValTypes : ColumnType | PermanentOpsValTypes, PartialTypes = EnumTypeArray extends null ? ColumnType extends DateTime ? DateTime[] | Range<DateTime> | (() => Range<DateTime>) | Range<CalendarDate> | (() => Range<CalendarDate>) | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : ColumnType extends CalendarDate ? CalendarDate[] | Range<CalendarDate> | (() => Range<CalendarDate>) | Range<DateTime> | (() => Range<DateTime>) | OpsStatement<KyselyComparisonOperatorExpression, OpsValType> : ColumnType extends number ? (number | bigint)[] | Range<number> | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : ColumnType extends string ? string[] | OpsStatement<KyselyComparisonOperatorExpression, string, any> | OpsStatement<TrigramOperator, OpsValType, ExtraSimilarityArgs> : ColumnType extends IdType ? IdType[] | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : never : EnumTypeArray extends string[] ? EnumTypeArray | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : never> = PartialTypes extends never ? OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> | CurriedOpsStatement<any, any, any, OpsValType> | SelectQueryBuilder<DB, keyof DB, any> : PartialTypes | CurriedOpsStatement<any, any, any, OpsValType> | SelectQueryBuilder<DB, keyof DB, any>;
|
|
24
|
-
export type WhereStatementForDreamClass<DreamClass extends typeof Dream> = WhereStatement<InstanceType<DreamClass>['DB'], InstanceType<DreamClass>['schema'], InstanceType<DreamClass>['table']>;
|
|
25
|
-
export type WhereStatementForDream<DreamInstance extends Dream> = WhereStatement<DreamInstance['DB'], DreamInstance['schema'], DreamInstance['table']>;
|
|
26
|
-
type AssociationNameToDotReferencedColumns<DB, TableName extends keyof DB, AssociationName> = `${AssociationName & string}.${TableColumnNames<DB, TableName>}`;
|
|
27
|
-
export type ColumnNamesAccountingForJoinedAssociations<JoinedAssociations extends Readonly<JoinedAssociation[]>, DB, RootTableName extends keyof DB, RootTableAlias extends string> = JoinedAssociations['length'] extends 0 ? TableColumnNames<DB, RootTableName> : JoinedAssociationColumnNames<JoinedAssociations, DB, AssociationNameToDotReferencedColumns<DB, RootTableName & keyof DB, RootTableAlias>>;
|
|
28
|
-
type JoinedAssociationColumnNames<JoinedAssociations extends Readonly<JoinedAssociation[]>, DB, AllColumnNames, Depth extends number = 0, CurrentJoinedAssociation = Readonly<JoinedAssociations[0]>, NextTableName = CurrentJoinedAssociation extends Readonly<JoinedAssociation> ? CurrentJoinedAssociation['table'] : never, NextAssociationName = CurrentJoinedAssociation extends Readonly<JoinedAssociation> ? CurrentJoinedAssociation['alias'] : never> = JoinedAssociations['length'] extends 0 ? AllColumnNames : Depth extends MAX_JOINED_TABLES_DEPTH ? AllColumnNames : JoinedAssociationColumnNames<ReadonlyTail<JoinedAssociations>, DB, AllColumnNames | AssociationNameToDotReferencedColumns<DB, NextTableName & keyof DB, NextAssociationName>, Inc<Depth>>;
|
|
29
|
-
export type WhereStatement<DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = Partial<MergeUnionOfRecordTypes<Updateable<DB[TableName]> | DreamSelectable<DB, Schema, TableName>>>;
|
|
30
|
-
export type OnStatementForAssociation<DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB, RequiredOnClauseKeysForThisAssociation, OnStatement extends WhereStatement<DB, Schema, TableName> = WhereStatement<DB, Schema, TableName>> = RequiredOnClauseKeysForThisAssociation extends null ? WhereStatement<DB, Schema, TableName> : RequiredOnClauseKeysForThisAssociation extends string[] ? Required<Pick<OnStatement, RequiredOnClauseKeysForThisAssociation[number] & keyof OnStatement>> & Partial<Omit<OnStatement, RequiredOnClauseKeysForThisAssociation[number] & keyof OnStatement>> : never;
|
|
31
|
-
type OnStatementForAssociationDefinition<DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = Partial<MergeUnionOfRecordTypes<Updateable<DB[TableName]> | Partial<{
|
|
32
|
-
[ColumnName in keyof DB[TableName]]: NonKyselySupportedSupplementalWhereClauseValues<DB, Schema, TableName, ColumnName> | typeof DreamConst.passthrough | typeof DreamConst.required;
|
|
33
|
-
}>>>;
|
|
34
|
-
export type SelfOnStatement<BaseInstance extends Dream, DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = Partial<Record<keyof DB[TableName], DreamColumnNames<BaseInstance>>>;
|
|
35
|
-
export type WhereStatementForJoinedAssociation<JoinedAssociations extends Readonly<JoinedAssociation[]>, DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = RecursiveWhereStatementForJoinedAssociation<JoinedAssociations, DB, Schema, WhereStatement<DB, Schema, TableName>>;
|
|
36
|
-
type RecursiveWhereStatementForJoinedAssociation<JoinedAssociations extends Readonly<JoinedAssociation[]>, DB, Schema, OriginalOnStatement, Depth extends number = 0, CurrentJoinedAssociation = JoinedAssociations[0], TableName = CurrentJoinedAssociation extends JoinedAssociation ? CurrentJoinedAssociation['table'] : never, AssociationName = CurrentJoinedAssociation extends JoinedAssociation ? CurrentJoinedAssociation['alias'] : never, NonNamespacedAssociationOnStatement = TableName extends never ? never : AssociationName extends never ? never : WhereStatement<DB, Schema, TableName & AssociationTableNames<DB, Schema> & keyof DB>, NextOnStatement = NonNamespacedAssociationOnStatement extends never ? OriginalOnStatement : OriginalOnStatement & {
|
|
37
|
-
[K in keyof NonNamespacedAssociationOnStatement as `${AssociationName & string}.${K & string}`]: NonNamespacedAssociationOnStatement[K & keyof NonNamespacedAssociationOnStatement];
|
|
38
|
-
}> = JoinedAssociations['length'] extends 0 ? OriginalOnStatement : Depth extends MAX_JOINED_TABLES_DEPTH ? OriginalOnStatement : TableName extends never ? OriginalOnStatement : RecursiveWhereStatementForJoinedAssociation<ReadonlyTail<JoinedAssociations>, DB, Schema, NextOnStatement, Inc<Depth>>;
|
|
39
|
-
export type OrderStatement<DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = TableColumnNames<DB, TableName> | Partial<Record<TableColumnNames<DB, TableName>, OrderDir>>;
|
|
40
|
-
export type LimitStatement = number;
|
|
41
|
-
export type OffsetStatement = number;
|
|
42
|
-
export type OrderQueryStatement<ColumnType> = {
|
|
43
|
-
column: ColumnType & string;
|
|
44
|
-
direction: OrderDir;
|
|
45
|
-
};
|
|
46
|
-
export interface HasStatement<BaseInstance extends Dream, DB, Schema, ForeignTableName extends AssociationTableNames<DB, Schema> & keyof DB, HasType extends 'HasOne' | 'HasMany'> {
|
|
47
|
-
modelCB: () => typeof Dream;
|
|
48
|
-
as: string;
|
|
49
|
-
dependent?: DependentOptions;
|
|
50
|
-
foreignKey: () => keyof DB[ForeignTableName] & string;
|
|
51
|
-
foreignKeyTypeField: () => keyof DB[ForeignTableName] & string;
|
|
52
|
-
globalAssociationNameOrNames: string[];
|
|
53
|
-
on?: OnStatementForAssociationDefinition<DB, Schema, ForeignTableName>;
|
|
54
|
-
notOn?: WhereStatement<DB, Schema, ForeignTableName>;
|
|
55
|
-
onAny?: WhereStatement<DB, Schema, ForeignTableName>[];
|
|
56
|
-
polymorphic: boolean;
|
|
57
|
-
preloadThroughColumns?: string[] | Record<string, string>;
|
|
58
|
-
primaryKey: (associationInstance?: Dream) => DreamColumnNames<BaseInstance>;
|
|
59
|
-
primaryKeyOverride?: DreamColumnNames<BaseInstance> | null;
|
|
60
|
-
primaryKeyValue: (associationInstance: Dream) => any;
|
|
61
|
-
selfOn?: SelfOnStatement<BaseInstance, DB, Schema, ForeignTableName>;
|
|
62
|
-
selfNotOn?: SelfOnStatement<BaseInstance, DB, Schema, ForeignTableName>;
|
|
63
|
-
source: string;
|
|
64
|
-
through?: string;
|
|
65
|
-
type: HasType;
|
|
66
|
-
withoutDefaultScopes?: DefaultScopeName<BaseInstance>[];
|
|
67
|
-
}
|
|
68
|
-
interface HasOptionsBase<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>, AssociationTableName = TableNameForGlobalModelName<BaseInstance, AssociationGlobalName & keyof GlobalModelNameTableMap<BaseInstance>>> {
|
|
69
|
-
dependent?: DependentOptions;
|
|
70
|
-
foreignKey?: TableColumnNames<BaseInstance['DB'], AssociationTableName & keyof BaseInstance['DB']>;
|
|
71
|
-
on?: OnStatementForAssociationDefinition<BaseInstance['DB'], BaseInstance['schema'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']>;
|
|
72
|
-
notOn?: WhereStatement<BaseInstance['DB'], BaseInstance['schema'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']>;
|
|
73
|
-
onAny?: WhereStatement<BaseInstance['DB'], BaseInstance['schema'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']>[];
|
|
74
|
-
polymorphic?: boolean;
|
|
75
|
-
preloadThroughColumns?: string[] | Record<string, string>;
|
|
76
|
-
primaryKeyOverride?: DreamColumnNames<BaseInstance> | null;
|
|
77
|
-
selfOn?: SelfOnStatement<BaseInstance, BaseInstance['DB'], BaseInstance['schema'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']>;
|
|
78
|
-
selfNotOn?: SelfOnStatement<BaseInstance, BaseInstance['DB'], BaseInstance['schema'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']>;
|
|
79
|
-
source?: string;
|
|
80
|
-
through?: keyof BaseInstance['schema'][BaseInstance['table']]['associations'];
|
|
81
|
-
withoutDefaultScopes?: DefaultScopeNameForTable<BaseInstance['schema'], AssociationTableName & keyof BaseInstance['DB']>[];
|
|
82
|
-
}
|
|
83
|
-
export type PolymorphicOption = 'polymorphic';
|
|
84
|
-
export type ForeignKeyOption = 'foreignKey';
|
|
85
|
-
type ThroughIncompatibleOptions = 'dependent' | 'primaryKeyOverride' | 'withoutDefaultScopes' | ForeignKeyOption | PolymorphicOption;
|
|
86
|
-
type ThroughOnlyOptions = 'through' | 'source' | 'preloadThroughColumns';
|
|
87
|
-
export type HasOptions<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>> = Omit<HasOptionsBase<BaseInstance, AssociationGlobalName>, ThroughOnlyOptions | PolymorphicOption>;
|
|
88
|
-
export type PolymorphicHasOptions<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>> = HasOptionsBase<BaseInstance, AssociationGlobalName> & Required<Pick<HasOptionsBase<BaseInstance, AssociationGlobalName>, PolymorphicOption | ForeignKeyOption>>;
|
|
89
|
-
export type HasThroughOptions<BaseInstance extends Dream, AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>> = Omit<HasOptionsBase<BaseInstance, AssociationGlobalName>, ThroughIncompatibleOptions>;
|
|
90
|
-
export interface AssociationStatementsMap {
|
|
91
|
-
belongsTo: readonly BelongsToStatement<any, any, any, any>[] | BelongsToStatement<any, any, any, any>[];
|
|
92
|
-
hasMany: readonly HasManyStatement<any, any, any, any>[] | HasManyStatement<any, any, any, any>[];
|
|
93
|
-
hasOne: readonly HasOneStatement<any, any, any, any>[] | HasOneStatement<any, any, any, any>[];
|
|
94
|
-
}
|
|
2
|
+
import { AssociationStatementsMap, DependentOptions, PartialAssociationStatement } from '../../../types/associations/shared.js';
|
|
95
3
|
export declare function blankAssociationsFactory(dreamClass: typeof Dream, { freeze, }?: {
|
|
96
4
|
freeze?: boolean;
|
|
97
5
|
}): AssociationStatementsMap;
|
|
98
|
-
type DependentOptions = 'destroy';
|
|
99
|
-
type partialTypeFields = 'modelCB' | 'type' | 'polymorphic' | 'as' | 'primaryKey' | 'primaryKeyValue' | 'primaryKeyOverride';
|
|
100
|
-
type hasOneManySpecificFields = 'source' | 'through' | 'preloadThroughColumns' | 'on' | 'notOn' | 'selfOn' | 'selfNotOn';
|
|
101
|
-
type belongsToSpecificFields = 'optional';
|
|
102
|
-
export type PartialAssociationStatement = Pick<HasManyStatement<any, any, any, any>, partialTypeFields | hasOneManySpecificFields> | Pick<HasOneStatement<any, any, any, any>, partialTypeFields | hasOneManySpecificFields> | Pick<BelongsToStatement<any, any, any, any>, partialTypeFields | belongsToSpecificFields>;
|
|
103
|
-
export type AssociationStatement = HasManyStatement<any, any, any, any> | HasOneStatement<any, any, any, any> | BelongsToStatement<any, any, any, any>;
|
|
104
6
|
export declare function finalForeignKey(foreignKey: string | undefined, dreamClass: typeof Dream, partialAssociation: PartialAssociationStatement): string;
|
|
105
7
|
export declare function foreignKeyTypeField(foreignKey: any, dream: typeof Dream, partialAssociation: PartialAssociationStatement): string;
|
|
106
8
|
export declare function modelCBtoSingleDreamClass(dreamClass: typeof Dream, partialAssociation: PartialAssociationStatement): typeof Dream;
|
|
@@ -115,4 +17,3 @@ export declare function validateHasStatementArgs({ dreamClass, dependent, method
|
|
|
115
17
|
methodName: string;
|
|
116
18
|
on: object | null;
|
|
117
19
|
}): void;
|
|
118
|
-
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Dream from '../../../Dream.js';
|
|
2
|
-
import { AfterHookOpts } from '
|
|
2
|
+
import { AfterHookOpts } from '../../../types/lifecycle.js';
|
|
3
3
|
export default function AfterCreate<T extends Dream>(opts?: AfterHookOpts<T>): any;
|
|
4
4
|
export declare function afterCreateImplementation<T extends Dream>(target: T, key: string, opts?: AfterHookOpts<T>): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Dream from '../../../Dream.js';
|
|
2
|
-
import { AfterHookOpts } from '
|
|
2
|
+
import { AfterHookOpts } from '../../../types/lifecycle.js';
|
|
3
3
|
/**
|
|
4
4
|
* Calls the decorated method whenever a dream has finished
|
|
5
5
|
* being created. If the save takes place within a transaction,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Dream from '../../../Dream.js';
|
|
2
|
-
import { AfterHookOpts } from '
|
|
2
|
+
import { AfterHookOpts } from '../../../types/lifecycle.js';
|
|
3
3
|
export default function AfterSave<T extends Dream>(opts?: AfterHookOpts<T>): any;
|
|
4
4
|
export declare function afterSaveImplementation<T extends Dream>(target: T, key: string, opts?: AfterHookOpts<T>): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Dream from '../../../Dream.js';
|
|
2
|
-
import { AfterHookOpts } from '
|
|
2
|
+
import { AfterHookOpts } from '../../../types/lifecycle.js';
|
|
3
3
|
/**
|
|
4
4
|
* Calls the decorated method whenever a dream has finished
|
|
5
5
|
* being saved. If the save takes place within a transaction,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Dream from '../../../Dream.js';
|
|
2
|
-
import { AfterHookOpts } from '
|
|
2
|
+
import { AfterHookOpts } from '../../../types/lifecycle.js';
|
|
3
3
|
export default function AfterUpdate<T extends Dream>(opts?: AfterHookOpts<T>): any;
|
|
4
4
|
export declare function afterUpdateImplementation<T extends Dream>(target: T, key: string, opts?: AfterHookOpts<T>): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Dream from '../../../Dream.js';
|
|
2
|
-
import { AfterHookOpts } from '
|
|
2
|
+
import { AfterHookOpts } from '../../../types/lifecycle.js';
|
|
3
3
|
/**
|
|
4
4
|
* Calls the decorated method whenever a dream has finished
|
|
5
5
|
* being updated. If the save takes place within a transaction,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Dream from '../../../Dream.js';
|
|
2
|
-
import { BeforeHookOpts } from '
|
|
2
|
+
import { BeforeHookOpts } from '../../../types/lifecycle.js';
|
|
3
3
|
export default function BeforeCreate<T extends Dream>(opts?: BeforeHookOpts<T>): any;
|
|
4
4
|
export declare function beforeCreateImplementation<T extends Dream>(target: T, key: string, opts?: BeforeHookOpts<T>): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Dream from '../../../Dream.js';
|
|
2
|
-
import { BeforeHookOpts } from '
|
|
2
|
+
import { BeforeHookOpts } from '../../../types/lifecycle.js';
|
|
3
3
|
export default function BeforeSave<T extends Dream>(opts?: BeforeHookOpts<T>): any;
|
|
4
4
|
export declare function beforeSaveImplementation<T extends Dream>(target: T, key: string, opts?: BeforeHookOpts<T>): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Dream from '../../../Dream.js';
|
|
2
|
-
import { BeforeHookOpts } from '
|
|
2
|
+
import { BeforeHookOpts } from '../../../types/lifecycle.js';
|
|
3
3
|
export default function BeforeUpdate<T extends Dream>(opts?: BeforeHookOpts<T>): any;
|
|
4
4
|
export declare function beforeUpdateImplementation<T extends Dream>(target: T, key: string, opts?: BeforeHookOpts<T>): void;
|