@rvoh/dream 0.31.0 → 0.31.2
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/README.md +17 -17
- package/dist/cjs/src/Dream.js +17 -18
- package/dist/cjs/src/bin/helpers/sync.js +11 -4
- package/dist/cjs/src/bin/index.js +18 -19
- package/dist/cjs/src/cli/logger/DreamCliLogger.js +12 -46
- package/dist/cjs/src/cli/logger/loggable/DreamCliLoggable.js +1 -3
- package/dist/cjs/src/cli/logger/loggable/DreamCliLoggableText.js +2 -2
- package/dist/cjs/src/decorators/Decorators.js +28 -28
- package/dist/cjs/src/decorators/field/association/BelongsTo.js +2 -2
- package/dist/cjs/src/decorators/field/association/HasMany.js +2 -2
- package/dist/cjs/src/decorators/field/association/HasOne.js +2 -2
- package/dist/cjs/src/decorators/field/association/shared.js +8 -8
- package/dist/cjs/src/decorators/field/lifecycle/AfterCreateCommit.js +1 -1
- package/dist/cjs/src/decorators/field/lifecycle/AfterDestroyCommit.js +1 -1
- package/dist/cjs/src/decorators/field/lifecycle/AfterSaveCommit.js +1 -1
- package/dist/cjs/src/decorators/field/lifecycle/AfterUpdateCommit.js +1 -1
- package/dist/cjs/src/decorators/field/validation/Validates.js +1 -1
- package/dist/cjs/src/dream/DreamClassTransactionBuilder.js +2 -2
- package/dist/cjs/src/dream/Query.js +7 -7
- 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/cli/generateDreamContent.js +2 -2
- package/dist/cjs/src/helpers/db/primaryKeyType.js +2 -2
- package/dist/cjs/src/helpers/db/runMigration.js +5 -5
- 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/sspawn.js +29 -3
- 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/decorators/associations/RendersMany.js +2 -2
- package/dist/cjs/src/serializer/decorators/associations/RendersOne.js +2 -2
- package/dist/cjs/src/serializer/index.js +2 -2
- package/dist/esm/src/Dream.js +18 -19
- package/dist/esm/src/bin/helpers/sync.js +11 -4
- package/dist/esm/src/bin/index.js +18 -19
- package/dist/esm/src/cli/logger/DreamCliLogger.js +12 -46
- package/dist/esm/src/cli/logger/loggable/DreamCliLoggable.js +1 -3
- package/dist/esm/src/cli/logger/loggable/DreamCliLoggableText.js +2 -2
- package/dist/esm/src/decorators/Decorators.js +28 -28
- package/dist/esm/src/decorators/field/association/BelongsTo.js +2 -2
- package/dist/esm/src/decorators/field/association/HasMany.js +2 -2
- package/dist/esm/src/decorators/field/association/HasOne.js +2 -2
- package/dist/esm/src/decorators/field/association/shared.js +6 -6
- package/dist/esm/src/decorators/field/lifecycle/AfterCreateCommit.js +1 -1
- package/dist/esm/src/decorators/field/lifecycle/AfterDestroyCommit.js +1 -1
- package/dist/esm/src/decorators/field/lifecycle/AfterSaveCommit.js +1 -1
- package/dist/esm/src/decorators/field/lifecycle/AfterUpdateCommit.js +1 -1
- package/dist/esm/src/decorators/field/validation/Validates.js +1 -1
- package/dist/esm/src/dream/DreamClassTransactionBuilder.js +2 -2
- package/dist/esm/src/dream/Query.js +3 -3
- 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/cli/generateDreamContent.js +2 -2
- package/dist/esm/src/helpers/db/primaryKeyType.js +1 -1
- package/dist/esm/src/helpers/db/runMigration.js +5 -5
- 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/sspawn.js +29 -3
- 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/decorators/associations/RendersMany.js +2 -2
- package/dist/esm/src/serializer/decorators/associations/RendersOne.js +2 -2
- package/dist/esm/src/serializer/index.js +1 -1
- package/dist/types/src/Dream.d.ts +28 -28
- package/dist/types/src/cli/logger/DreamCliLogger.d.ts +5 -20
- package/dist/types/src/cli/logger/loggable/DreamCliLoggable.d.ts +2 -4
- package/dist/types/src/cli/logger/loggable/DreamCliLoggableText.d.ts +2 -3
- 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 +28 -28
- 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 +2 -2
- package/dist/types/src/decorators/field/lifecycle/AfterDestroyCommit.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 +2 -2
- package/dist/types/src/decorators/field/lifecycle/AfterUpdate.d.ts +1 -1
- package/dist/types/src/decorators/field/lifecycle/AfterUpdateCommit.d.ts +2 -2
- 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 +8 -6
- 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 +7 -49
- 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/sspawn.d.ts +6 -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 +3 -3
- package/dist/types/src/serializer/decorators/associations/RendersOne.d.ts +3 -3
- 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 +42 -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 +38 -38
- package/docs/classes/Dream.html +140 -139
- 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 +51 -51
- 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 +2 -2
- package/docs/functions/RendersOne.html +2 -2
- 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/index.html +5 -5
- 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 -3
- package/dist/cjs/src/cli/logger/helpers/createSpinner.js +0 -14
- package/dist/cjs/src/cli/logger/loggable/DreamCliLoggableSpinner.js +0 -31
- package/dist/cjs/src/cli/logger/loggable/spinners.js +0 -1185
- 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/cli/logger/helpers/createSpinner.js +0 -11
- package/dist/esm/src/cli/logger/loggable/DreamCliLoggableSpinner.js +0 -28
- package/dist/esm/src/cli/logger/loggable/spinners.js +0 -1183
- 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/cli/logger/helpers/createSpinner.d.ts +0 -2
- package/dist/types/src/cli/logger/loggable/DreamCliLoggableSpinner.d.ts +0 -21
- package/dist/types/src/cli/logger/loggable/spinners.d.ts +0 -355
- 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,4 +1,4 @@
|
|
|
1
|
-
import { AssociationTableNames } from '../../db/reflections.js';
|
|
2
1
|
import Dream from '../../Dream.js';
|
|
2
|
+
import { AssociationTableNames } from '../../types/db.js';
|
|
3
3
|
export default function sqlResultToDreamInstance<DreamClass extends typeof Dream, DreamInstance extends InstanceType<DreamClass> = InstanceType<DreamClass>, Schema extends DreamInstance['schema'] = DreamInstance['schema'], DB extends DreamInstance['DB'] = DreamInstance['DB'], TableName extends AssociationTableNames<DB, Schema> & keyof DB = InstanceType<DreamClass>['table'], Table extends DB[TableName] = DB[TableName]>(dreamClass: DreamClass, sqlResult: any): InstanceType<DreamClass> | Dream;
|
|
4
4
|
export declare function findExtendingDreamClass(dreamClass: typeof Dream, type: string): typeof Dream | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CompiledQuery } from 'kysely';
|
|
2
2
|
import Dream from '../Dream.js';
|
|
3
|
-
import { primaryKeyTypes } from '../dream/
|
|
3
|
+
import { primaryKeyTypes } from '../dream/constants.js';
|
|
4
4
|
import { EncryptOptions } from '../encrypt/index.js';
|
|
5
5
|
import DreamSerializer from '../serializer/index.js';
|
|
6
6
|
export default class DreamApplication {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HasManyStatement } from '../../decorators/field/association/HasMany.js';
|
|
2
|
-
import { HasOneStatement } from '../../decorators/field/association/HasOne.js';
|
|
3
1
|
import Dream from '../../Dream.js';
|
|
2
|
+
import { HasManyStatement } from '../../types/associations/hasMany.js';
|
|
3
|
+
import { HasOneStatement } from '../../types/associations/hasOne.js';
|
|
4
4
|
export default class CanOnlyPassBelongsToModelParam extends Error {
|
|
5
5
|
dreamClass: typeof Dream;
|
|
6
6
|
association: HasManyStatement<any, any, any, any> | HasOneStatement<any, any, any, any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HasManyStatement } from '../../decorators/field/association/HasMany.js';
|
|
2
|
-
import { HasOneStatement } from '../../decorators/field/association/HasOne.js';
|
|
3
1
|
import Dream from '../../Dream.js';
|
|
2
|
+
import { HasManyStatement } from '../../types/associations/hasMany.js';
|
|
3
|
+
import { HasOneStatement } from '../../types/associations/hasOne.js';
|
|
4
4
|
export default class CannotAssociateThroughPolymorphic extends Error {
|
|
5
5
|
dreamClass: typeof Dream;
|
|
6
6
|
association: HasManyStatement<any, any, any, any> | HasOneStatement<any, any, any, any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HasManyStatement } from '../../decorators/field/association/HasMany.js';
|
|
2
|
-
import { HasOneStatement } from '../../decorators/field/association/HasOne.js';
|
|
3
1
|
import Dream from '../../Dream.js';
|
|
2
|
+
import { HasManyStatement } from '../../types/associations/hasMany.js';
|
|
3
|
+
import { HasOneStatement } from '../../types/associations/hasOne.js';
|
|
4
4
|
export default class CannotCreateAssociationWithThroughContext extends Error {
|
|
5
5
|
dreamClass: typeof Dream;
|
|
6
6
|
association: HasManyStatement<any, any, any, any> | HasOneStatement<any, any, any, any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BelongsToStatement } from '../../decorators/field/association/BelongsTo.js';
|
|
2
1
|
import Dream from '../../Dream.js';
|
|
2
|
+
import { BelongsToStatement } from '../../types/associations/belongsTo.js';
|
|
3
3
|
export default class CannotJoinPolymorphicBelongsToError extends Error {
|
|
4
4
|
dreamClass: typeof Dream;
|
|
5
5
|
association: BelongsToStatement<any, any, any, any>;
|
package/dist/types/src/errors/associations/CannotPassNullOrUndefinedToRequiredBelongsTo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BelongsToStatement } from '../../decorators/field/association/BelongsTo.js';
|
|
2
1
|
import Dream from '../../Dream.js';
|
|
2
|
+
import { BelongsToStatement } from '../../types/associations/belongsTo.js';
|
|
3
3
|
export default class CannotPassNullOrUndefinedToRequiredBelongsTo extends Error {
|
|
4
4
|
dreamClass: typeof Dream;
|
|
5
5
|
association: BelongsToStatement<any, any, any, any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PartialAssociationStatement } from '../../decorators/field/association/shared.js';
|
|
2
1
|
import Dream from '../../Dream.js';
|
|
2
|
+
import { PartialAssociationStatement } from '../../types/associations/shared.js';
|
|
3
3
|
export declare class InvalidComputedForeignKey extends Error {
|
|
4
4
|
dreamClass: typeof Dream;
|
|
5
5
|
partialAssociation: PartialAssociationStatement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HasManyStatement } from '../../
|
|
2
|
-
import { HasOneStatement } from '../../
|
|
1
|
+
import { HasManyStatement } from '../../types/associations/hasMany.js';
|
|
2
|
+
import { HasOneStatement } from '../../types/associations/hasOne.js';
|
|
3
3
|
export default class MissingRequiredAssociationOnClause extends Error {
|
|
4
4
|
private association;
|
|
5
5
|
private column;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HasManyStatement } from '../../decorators/field/association/HasMany.js';
|
|
2
|
-
import { HasOneStatement } from '../../decorators/field/association/HasOne.js';
|
|
3
1
|
import Dream from '../../Dream.js';
|
|
2
|
+
import { HasManyStatement } from '../../types/associations/hasMany.js';
|
|
3
|
+
import { HasOneStatement } from '../../types/associations/hasOne.js';
|
|
4
4
|
export default class MissingThroughAssociation extends Error {
|
|
5
5
|
dreamClass: typeof Dream;
|
|
6
6
|
association: HasManyStatement<any, any, any, any> | HasOneStatement<any, any, any, any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HasManyStatement } from '../../decorators/field/association/HasMany.js';
|
|
2
|
-
import { HasOneStatement } from '../../decorators/field/association/HasOne.js';
|
|
3
1
|
import Dream from '../../Dream.js';
|
|
2
|
+
import { HasManyStatement } from '../../types/associations/hasMany.js';
|
|
3
|
+
import { HasOneStatement } from '../../types/associations/hasOne.js';
|
|
4
4
|
export default class MissingThroughAssociationSource extends Error {
|
|
5
5
|
dreamClass: typeof Dream;
|
|
6
6
|
throughClass: typeof Dream;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PrimaryKeyType } from '../../dream
|
|
1
|
+
import { PrimaryKeyType } from '../../types/dream.js';
|
|
2
2
|
export default function generateMigrationContent({ table, columnsWithTypes, primaryKeyType, createOrAlter, }?: {
|
|
3
3
|
table?: string;
|
|
4
4
|
columnsWithTypes?: string[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DbConnectionType } from '../../db
|
|
1
|
+
import { DbConnectionType } from '../../types/db.js';
|
|
2
2
|
export default function createDb(connection: DbConnectionType, dbName?: string | null): Promise<false | undefined>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DbConnectionType } from '../../db
|
|
1
|
+
import { DbConnectionType } from '../../types/db.js';
|
|
2
2
|
export default function dropDb(connection: DbConnectionType, dbName?: string | null): Promise<false | undefined>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PrimaryKeyType } from '../../dream
|
|
1
|
+
import { PrimaryKeyType } from '../../types/dream.js';
|
|
2
2
|
export default function foreignKeyTypeFromPrimaryKey(primaryKey: PrimaryKeyType): "bigint" | "integer" | "uuid";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import Dream from '../Dream.js';
|
|
2
|
-
import { SerializableDreamClassOrViewModelClass, SerializableDreamOrViewModel } from '../dream
|
|
2
|
+
import { SerializableDreamClassOrViewModelClass, SerializableDreamOrViewModel } from '../types/dream.js';
|
|
3
3
|
export default function inferSerializerFromDreamOrViewModel(obj: Dream | SerializableDreamOrViewModel, serializerKey?: string | undefined): typeof import("../index.js").DreamSerializer | null;
|
|
4
4
|
export declare function inferSerializerFromDreamClassOrViewModelClass(classDef: SerializableDreamClassOrViewModelClass, serializerKey?: string | undefined): typeof import("../index.js").DreamSerializer | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function isEmpty(value:
|
|
1
|
+
export default function isEmpty(value: unknown[] | Record<string, unknown> | Set<unknown> | Map<unknown, unknown>): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RelaxedJoinStatement } from '../dream
|
|
1
|
+
import { RelaxedJoinStatement } from '../types/dream.js';
|
|
2
2
|
export default function objectPathsToArrays(obj: RelaxedJoinStatement): string[][];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a copy of array containing strings, numbers, bigints, and/or IdTypes, sorted in ascending order.
|
|
3
|
+
* To sort other types use {@link sortBy}.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { sort } from '@rvoh/dream'
|
|
7
|
+
*
|
|
8
|
+
* sort([2, 1, 3])
|
|
9
|
+
* // [1, 2, 3]
|
|
10
|
+
*
|
|
11
|
+
* sort(['world', 'Hello', 'hello', 'World'])
|
|
12
|
+
* // ['hello', 'Hello', 'world', 'World']
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export default function sort<ArrayType extends string[] | number[] | bigint[]>(array: ArrayType): ArrayType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export default function sortBy<T>(array: T[], valueToCompare: (value: T) =>
|
|
1
|
+
export default function sortBy<T>(array: T[], valueToCompare: (value: T) => number): T[];
|
|
2
|
+
export default function sortBy<T>(array: T[], valueToCompare: (value: T) => string): T[];
|
|
3
3
|
export declare class UnsupportedValueFromComparisonFunction extends Error {
|
|
4
4
|
private aPrime;
|
|
5
5
|
private bPrime;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export default function sspawn(command: string, opts?:
|
|
2
|
-
|
|
1
|
+
export default function sspawn(command: string, opts?: Record<string, unknown> & {
|
|
2
|
+
onStdout?: (str: string) => void;
|
|
3
|
+
}): Promise<unknown>;
|
|
4
|
+
export declare function ssspawn(command: string, opts?: Record<string, unknown> & {
|
|
5
|
+
onStdout?: (str: string) => void;
|
|
6
|
+
}): import("child_process").ChildProcessWithoutNullStreams;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NotReadonlyHead, NotReadonlyTail, ReadonlyHead, ReadonlyTail } from '
|
|
1
|
+
import { NotReadonlyHead, NotReadonlyTail, ReadonlyHead, ReadonlyTail } from '../types/utils.js';
|
|
2
2
|
type RecursivelyStringCaseObjectKeysInTuple<T extends any[], StringCaseType extends StringCasingOptions> = T['length'] extends 0 ? [] : [
|
|
3
3
|
RecursiveStringCase<NotReadonlyHead<T>, StringCaseType>,
|
|
4
4
|
...RecursivelyStringCaseObjectKeysInTuple<NotReadonlyTail<T>, StringCaseType>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function uniq<
|
|
1
|
+
export default function uniq<ArrayType extends any[], ElementType extends ArrayType extends (infer U)[] ? U : never>(arr: ArrayType, toKey?: ((a: ElementType) => string | number | bigint) | undefined): ArrayType;
|
|
@@ -11,15 +11,13 @@ export { default as SoftDelete } from './decorators/class/SoftDelete.js';
|
|
|
11
11
|
export { default as STI } from './decorators/class/STI.js';
|
|
12
12
|
export { type DecoratorContext } from './decorators/DecoratorContextType.js';
|
|
13
13
|
export { default as Decorators } from './decorators/Decorators.js';
|
|
14
|
-
export { type WhereStatementForDream, type WhereStatementForDreamClass, } from './decorators/field/association/shared.js';
|
|
15
|
-
export { type ValidationType } from './decorators/field/validation/shared.js';
|
|
16
14
|
export { default as DreamImporter } from './dream-application/helpers/DreamImporter.js';
|
|
17
15
|
export { default as lookupClassByGlobalName } from './dream-application/helpers/lookupClassByGlobalName.js';
|
|
18
16
|
export { default as DreamApplication, type DreamApplicationInitOptions, type DreamApplicationOpts, type DreamLogger, type DreamLogLevel, } from './dream-application/index.js';
|
|
19
17
|
export { default as Dream } from './Dream.js';
|
|
18
|
+
export { DreamConst, openapiPrimitiveTypes, openapiShorthandPrimitiveTypes, type primaryKeyTypes, type TRIGRAM_OPERATORS, } from './dream/constants.js';
|
|
20
19
|
export { default as DreamTransaction } from './dream/DreamTransaction.js';
|
|
21
20
|
export { default as Query } from './dream/Query.js';
|
|
22
|
-
export { DreamConst, type DreamAssociationMetadata, type DreamAttributes, type DreamClassColumn, type DreamColumn, type DreamColumnNames, type DreamOrViewModelSerializerKey, type DreamParamSafeAttributes, type DreamParamSafeColumnNames, type DreamSerializerKey, type DreamSerializers, type DreamTableSchema, type DreamVirtualColumns, type IdType, type PrimaryKeyType, type primaryKeyTypes, type SerializableClassOrSerializerCallback, type SerializableDreamClassOrViewModelClass, type SerializableDreamOrViewModel, type Timestamp, type TRIGRAM_OPERATORS, type UpdateableAssociationProperties, type UpdateableProperties, type ViewModelSerializerKey, } from './dream/types.js';
|
|
23
21
|
export { default as Encrypt, type EncryptAlgorithm, type EncryptOptions } from './encrypt/index.js';
|
|
24
22
|
export { default as NonLoadedAssociation } from './errors/associations/NonLoadedAssociation.js';
|
|
25
23
|
export { default as CreateOrFindByFailedToCreateAndFind } from './errors/CreateOrFindByFailedToCreateAndFind.js';
|
|
@@ -49,15 +47,19 @@ export { Range, default as range } from './helpers/range.js';
|
|
|
49
47
|
export { default as round, type RoundingPrecision } from './helpers/round.js';
|
|
50
48
|
export { default as serializerNameFromFullyQualifiedModelName } from './helpers/serializerNameFromFullyQualifiedModelName.js';
|
|
51
49
|
export { default as snakeify } from './helpers/snakeify.js';
|
|
50
|
+
export { default as sort } from './helpers/sort.js';
|
|
52
51
|
export { default as sortBy } from './helpers/sortBy.js';
|
|
53
52
|
export { default as standardizeFullyQualifiedModelName } from './helpers/standardizeFullyQualifiedModelName.js';
|
|
54
53
|
export { type Camelized, type Hyphenized, type Pascalized, type Snakeified } from './helpers/stringCasing.js';
|
|
55
54
|
export { default as uncapitalize } from './helpers/uncapitalize.js';
|
|
56
55
|
export { default as uniq } from './helpers/uniq.js';
|
|
57
|
-
export { openapiPrimitiveTypes, openapiShorthandPrimitiveTypes, type CommonOpenapiSchemaObjectFields, type OpenapiAllTypes, type OpenapiFormats, type OpenapiNumberFormats, type OpenapiPrimitiveTypes, type OpenapiSchemaArray, type OpenapiSchemaArrayShorthand, type OpenapiSchemaBase, type OpenapiSchemaBody, type OpenapiSchemaBodyShorthand, type OpenapiSchemaCommonFields, type OpenapiSchemaExpressionAllOf, type OpenapiSchemaExpressionAnyOf, type OpenapiSchemaExpressionOneOf, type OpenapiSchemaExpressionRef, type OpenapiSchemaExpressionRefSchemaShorthand, type OpenapiSchemaInteger, type OpenapiSchemaNull, type OpenapiSchemaNumber, type OpenapiSchemaObject, type OpenapiSchemaObjectAllOf, type OpenapiSchemaObjectAllOfShorthand, type OpenapiSchemaObjectAnyOf, type OpenapiSchemaObjectAnyOfShorthand, type OpenapiSchemaObjectBase, type OpenapiSchemaObjectBaseShorthand, type OpenapiSchemaObjectOneOf, type OpenapiSchemaObjectOneOfShorthand, type OpenapiSchemaObjectShorthand, type OpenapiSchemaPartialSegment, type OpenapiSchemaPrimitiveGeneric, type OpenapiSchemaProperties, type OpenapiSchemaPropertiesShorthand, type OpenapiSchemaShorthandExpressionAllOf, type OpenapiSchemaShorthandExpressionAnyOf, type OpenapiSchemaShorthandExpressionOneOf, type OpenapiSchemaShorthandExpressionSerializableRef, type OpenapiSchemaShorthandExpressionSerializerRef, type OpenapiSchemaShorthandPrimitiveGeneric, type OpenapiSchemaString, type OpenapiShorthandAllTypes, type OpenapiShorthandPrimitiveTypes, type OpenapiTypeField, type OpenapiTypeFieldObject, } from './openapi/types.js';
|
|
58
56
|
export { default as ops } from './ops/index.js';
|
|
59
57
|
export { default as RendersMany } from './serializer/decorators/associations/RendersMany.js';
|
|
60
58
|
export { default as RendersOne } from './serializer/decorators/associations/RendersOne.js';
|
|
61
59
|
export { type DreamSerializerAssociationStatement } from './serializer/decorators/associations/shared.js';
|
|
62
60
|
export { default as Attribute, type AttributeStatement, type SerializableTypes, } from './serializer/decorators/attribute.js';
|
|
63
61
|
export { default as DreamSerializer } from './serializer/index.js';
|
|
62
|
+
export { type WhereStatementForDream, type WhereStatementForDreamClass } from './types/associations/shared.js';
|
|
63
|
+
export { type DreamAssociationMetadata, type DreamAttributes, type DreamClassColumn, type DreamColumn, type DreamColumnNames, type DreamOrViewModelSerializerKey, type DreamParamSafeAttributes, type DreamParamSafeColumnNames, type DreamSerializerKey, type DreamSerializers, type DreamTableSchema, type DreamVirtualColumns, type IdType, type PrimaryKeyType, type SerializableClassOrSerializerCallback, type SerializableDreamClassOrViewModelClass, type SerializableDreamOrViewModel, type Timestamp, type UpdateableAssociationProperties, type UpdateableProperties, type ViewModelSerializerKey, } from './types/dream.js';
|
|
64
|
+
export { type CommonOpenapiSchemaObjectFields, type OpenapiAllTypes, type OpenapiFormats, type OpenapiNumberFormats, type OpenapiPrimitiveTypes, type OpenapiSchemaArray, type OpenapiSchemaArrayShorthand, type OpenapiSchemaBase, type OpenapiSchemaBody, type OpenapiSchemaBodyShorthand, type OpenapiSchemaCommonFields, type OpenapiSchemaExpressionAllOf, type OpenapiSchemaExpressionAnyOf, type OpenapiSchemaExpressionOneOf, type OpenapiSchemaExpressionRef, type OpenapiSchemaExpressionRefSchemaShorthand, type OpenapiSchemaInteger, type OpenapiSchemaNull, type OpenapiSchemaNumber, type OpenapiSchemaObject, type OpenapiSchemaObjectAllOf, type OpenapiSchemaObjectAllOfShorthand, type OpenapiSchemaObjectAnyOf, type OpenapiSchemaObjectAnyOfShorthand, type OpenapiSchemaObjectBase, type OpenapiSchemaObjectBaseShorthand, type OpenapiSchemaObjectOneOf, type OpenapiSchemaObjectOneOfShorthand, type OpenapiSchemaObjectShorthand, type OpenapiSchemaPartialSegment, type OpenapiSchemaPrimitiveGeneric, type OpenapiSchemaProperties, type OpenapiSchemaPropertiesShorthand, type OpenapiSchemaShorthandExpressionAllOf, type OpenapiSchemaShorthandExpressionAnyOf, type OpenapiSchemaShorthandExpressionOneOf, type OpenapiSchemaShorthandExpressionSerializableRef, type OpenapiSchemaShorthandExpressionSerializerRef, type OpenapiSchemaShorthandPrimitiveGeneric, type OpenapiSchemaString, type OpenapiShorthandAllTypes, type OpenapiShorthandPrimitiveTypes, type OpenapiTypeField, type OpenapiTypeFieldObject, } from './types/openapi.js';
|
|
65
|
+
export { type ValidationType } from './types/validation.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComparisonOperatorExpression as KyselyComparisonOperatorExpression } from 'kysely';
|
|
2
|
-
import { TrigramOperator } from '../dream
|
|
2
|
+
import { TrigramOperator } from '../types/dream.js';
|
|
3
3
|
import CurriedOpsStatement from './curried-ops-statement.js';
|
|
4
4
|
import OpsStatement from './ops-statement.js';
|
|
5
5
|
type ArrayOperatorType = 'in' | 'not in';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SerializableClassOrClasses } from '../../../dream
|
|
1
|
+
import { SerializableClassOrClasses } from '../../../types/dream.js';
|
|
2
2
|
import { RendersOneOrManyOpts } from './shared.js';
|
|
3
3
|
/**
|
|
4
4
|
* Establishes a One to Many relationship between
|
|
@@ -14,12 +14,12 @@ import { RendersOneOrManyOpts } from './shared.js';
|
|
|
14
14
|
*
|
|
15
15
|
* ```ts
|
|
16
16
|
* class User extends ApplicationModel {
|
|
17
|
-
* @
|
|
17
|
+
* @deco.HasOne('Settings')
|
|
18
18
|
* public settings: Settings
|
|
19
19
|
* }
|
|
20
20
|
*
|
|
21
21
|
* class Post extends ApplicationModel {
|
|
22
|
-
* @
|
|
22
|
+
* @deco.BelongsTo('User')
|
|
23
23
|
* public user: User
|
|
24
24
|
* }
|
|
25
25
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SerializableClassOrClasses } from '../../../dream
|
|
1
|
+
import { SerializableClassOrClasses } from '../../../types/dream.js';
|
|
2
2
|
import { RendersOneOrManyOpts } from './shared.js';
|
|
3
3
|
/**
|
|
4
4
|
* Establishes a One to One relationship between
|
|
@@ -14,12 +14,12 @@ import { RendersOneOrManyOpts } from './shared.js';
|
|
|
14
14
|
*
|
|
15
15
|
* ```ts
|
|
16
16
|
* class User extends ApplicationModel {
|
|
17
|
-
* @
|
|
17
|
+
* @deco.HasOne('Settings')
|
|
18
18
|
* public settings: Settings
|
|
19
19
|
* }
|
|
20
20
|
*
|
|
21
21
|
* class Settings extends ApplicationModel {
|
|
22
|
-
* @
|
|
22
|
+
* @deco.BelongsTo('User')
|
|
23
23
|
* public user: User
|
|
24
24
|
* }
|
|
25
25
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DreamConst
|
|
1
|
+
import { DreamConst } from '../../../dream/constants.js';
|
|
2
|
+
import { SerializableClassOrClasses } from '../../../types/dream.js';
|
|
2
3
|
export type SerializableAssociationType = 'RendersOne' | 'RendersMany';
|
|
3
4
|
export interface DreamSerializerAssociationStatement {
|
|
4
5
|
field: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Dream from '../../Dream.js';
|
|
2
2
|
import { RoundingPrecision } from '../../helpers/round.js';
|
|
3
|
-
import { OpenapiSchemaBodyShorthand, OpenapiShorthandPrimitiveTypes } from '../../openapi
|
|
3
|
+
import { OpenapiSchemaBodyShorthand, OpenapiShorthandPrimitiveTypes } from '../../types/openapi.js';
|
|
4
4
|
export default function Attribute(): any;
|
|
5
5
|
export default function Attribute(manualOpenapiOptions: OpenapiSchemaBodyShorthand, renderOptions?: AttributeRenderOptions): any;
|
|
6
6
|
export default function Attribute<DreamClass extends typeof Dream>(dreamClass: DreamClass, openApiAndRenderOptions?: AutomaticOpenapiAndRenderOptions): any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Dream from '../../../Dream.js';
|
|
2
|
-
import { DreamClassColumnNames } from '../../../dream
|
|
3
|
-
import { OpenapiSchemaBody } from '../../../openapi
|
|
2
|
+
import { DreamClassColumnNames } from '../../../types/dream.js';
|
|
3
|
+
import { OpenapiSchemaBody } from '../../../types/openapi.js';
|
|
4
4
|
export declare function dreamAttributeOpenapiShape<DreamClass extends typeof Dream>(dreamClass: DreamClass, column: DreamClassColumnNames<DreamClass>): OpenapiSchemaBody;
|
|
5
5
|
export declare class UseCustomOpenapiForJson extends Error {
|
|
6
6
|
get message(): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SerializableClassOrSerializerCallback } from '../../../dream
|
|
1
|
+
import { SerializableClassOrSerializerCallback } from '../../../types/dream.js';
|
|
2
2
|
export default function (dreamOrSerializerClass: SerializableClassOrSerializerCallback): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DreamSerializerCallback, SerializableClassOrClasses } from '../../../dream
|
|
1
|
+
import { DreamSerializerCallback, SerializableClassOrClasses } from '../../../types/dream.js';
|
|
2
2
|
export default function (dreamOrSerializerClass: SerializableClassOrClasses | null): DreamSerializerCallback | null;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import Dream from '../../Dream.ts'
|
|
2
|
+
import { AssociationTableNames } from '../db.js'
|
|
3
|
+
import {
|
|
4
|
+
DefaultScopeName,
|
|
5
|
+
DefaultScopeNameForTable,
|
|
6
|
+
DreamColumnNames,
|
|
7
|
+
GlobalModelNames,
|
|
8
|
+
TableColumnNames,
|
|
9
|
+
TableNameForGlobalModelName,
|
|
10
|
+
} from '../dream.js'
|
|
11
|
+
|
|
12
|
+
export interface BelongsToStatement<
|
|
13
|
+
BaseInstance extends Dream,
|
|
14
|
+
DB,
|
|
15
|
+
Schema,
|
|
16
|
+
TableName extends AssociationTableNames<DB, Schema> & keyof DB,
|
|
17
|
+
> {
|
|
18
|
+
modelCB: () => typeof Dream | (typeof Dream)[]
|
|
19
|
+
globalAssociationNameOrNames: string[]
|
|
20
|
+
type: 'BelongsTo'
|
|
21
|
+
as: string
|
|
22
|
+
primaryKey: (associationInstance?: Dream) => keyof DB[TableName] & string
|
|
23
|
+
primaryKeyValue: (associationInstance: Dream | null) => any
|
|
24
|
+
primaryKeyOverride?: (keyof DB[TableName] & string) | null
|
|
25
|
+
foreignKey: () => DreamColumnNames<BaseInstance> & string
|
|
26
|
+
foreignKeyTypeField: () => DreamColumnNames<BaseInstance> & string
|
|
27
|
+
optional: boolean
|
|
28
|
+
distinct: null
|
|
29
|
+
polymorphic: boolean
|
|
30
|
+
withoutDefaultScopes?: DefaultScopeName<BaseInstance>[]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface NonPolymorphicBelongsToOptions<
|
|
34
|
+
BaseInstance extends Dream,
|
|
35
|
+
AssociationGlobalNameOrNames extends
|
|
36
|
+
| GlobalModelNames<BaseInstance>
|
|
37
|
+
| readonly GlobalModelNames<BaseInstance>[],
|
|
38
|
+
AssociationGlobalName = AssociationGlobalNameOrNames extends Readonly<any[]>
|
|
39
|
+
? AssociationGlobalNameOrNames[0] & string
|
|
40
|
+
: AssociationGlobalNameOrNames & string,
|
|
41
|
+
AssociationTableName extends AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> &
|
|
42
|
+
keyof BaseInstance['DB'] = TableNameForGlobalModelName<
|
|
43
|
+
BaseInstance,
|
|
44
|
+
AssociationGlobalName & GlobalModelNames<BaseInstance>
|
|
45
|
+
> &
|
|
46
|
+
AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> &
|
|
47
|
+
keyof BaseInstance['DB'],
|
|
48
|
+
> {
|
|
49
|
+
foreignKey?: DreamColumnNames<BaseInstance>
|
|
50
|
+
primaryKeyOverride?: TableColumnNames<BaseInstance['DB'], AssociationTableName> | null
|
|
51
|
+
optional?: boolean
|
|
52
|
+
withoutDefaultScopes?: DefaultScopeNameForTable<BaseInstance['schema'], AssociationTableName>[]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface PolymorphicBelongsToOptions<
|
|
56
|
+
BaseInstance extends Dream,
|
|
57
|
+
AssociationGlobalNameOrNames extends
|
|
58
|
+
| GlobalModelNames<BaseInstance>
|
|
59
|
+
| readonly GlobalModelNames<BaseInstance>[],
|
|
60
|
+
AssociationGlobalName = AssociationGlobalNameOrNames extends Readonly<any[]>
|
|
61
|
+
? AssociationGlobalNameOrNames[0] & string
|
|
62
|
+
: AssociationGlobalNameOrNames & string,
|
|
63
|
+
AssociationTableName extends AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> &
|
|
64
|
+
keyof BaseInstance['DB'] = TableNameForGlobalModelName<
|
|
65
|
+
BaseInstance,
|
|
66
|
+
AssociationGlobalName & GlobalModelNames<BaseInstance>
|
|
67
|
+
> &
|
|
68
|
+
AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> &
|
|
69
|
+
keyof BaseInstance['DB'],
|
|
70
|
+
> {
|
|
71
|
+
foreignKey: DreamColumnNames<BaseInstance>
|
|
72
|
+
primaryKeyOverride?: TableColumnNames<BaseInstance['DB'], AssociationTableName> | null
|
|
73
|
+
optional?: boolean
|
|
74
|
+
polymorphic: boolean
|
|
75
|
+
withoutDefaultScopes?: DefaultScopeNameForTable<BaseInstance['schema'], AssociationTableName>[]
|
|
76
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import Dream from '../../Dream.ts'
|
|
2
|
+
import { AssociationTableNames } from '../db.js'
|
|
3
|
+
import {
|
|
4
|
+
GlobalModelNames,
|
|
5
|
+
GlobalModelNameTableMap,
|
|
6
|
+
TableColumnNames,
|
|
7
|
+
TableNameForGlobalModelName,
|
|
8
|
+
} from '../dream.js'
|
|
9
|
+
import {
|
|
10
|
+
HasOptions,
|
|
11
|
+
HasStatement,
|
|
12
|
+
HasThroughOptions,
|
|
13
|
+
OrderStatement,
|
|
14
|
+
PolymorphicHasOptions,
|
|
15
|
+
} from './shared.js'
|
|
16
|
+
|
|
17
|
+
export type HasManyStatement<
|
|
18
|
+
BaseInstance extends Dream,
|
|
19
|
+
DB,
|
|
20
|
+
Schema,
|
|
21
|
+
ForeignTableName extends AssociationTableNames<DB, Schema> & keyof DB,
|
|
22
|
+
> = HasStatement<BaseInstance, DB, Schema, ForeignTableName, 'HasMany'> & {
|
|
23
|
+
distinct?: TableColumnNames<DB, ForeignTableName>
|
|
24
|
+
order?: OrderStatement<DB, Schema, ForeignTableName>
|
|
25
|
+
}
|
|
26
|
+
interface HasManyOnlyOptions<
|
|
27
|
+
BaseInstance extends Dream,
|
|
28
|
+
AssociationGlobalNameOrNames extends
|
|
29
|
+
| GlobalModelNames<BaseInstance>
|
|
30
|
+
| readonly GlobalModelNames<BaseInstance>[],
|
|
31
|
+
AssociationGlobalName = AssociationGlobalNameOrNames extends any[]
|
|
32
|
+
? AssociationGlobalNameOrNames[0] & string
|
|
33
|
+
: AssociationGlobalNameOrNames & string,
|
|
34
|
+
AssociationTableName = TableNameForGlobalModelName<
|
|
35
|
+
BaseInstance,
|
|
36
|
+
AssociationGlobalName & GlobalModelNames<BaseInstance>
|
|
37
|
+
>,
|
|
38
|
+
> {
|
|
39
|
+
distinct?:
|
|
40
|
+
| TableColumnNames<
|
|
41
|
+
BaseInstance['DB'],
|
|
42
|
+
AssociationTableName &
|
|
43
|
+
AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> &
|
|
44
|
+
keyof BaseInstance['DB']
|
|
45
|
+
>
|
|
46
|
+
| boolean
|
|
47
|
+
|
|
48
|
+
order?:
|
|
49
|
+
| OrderStatement<
|
|
50
|
+
BaseInstance['DB'],
|
|
51
|
+
BaseInstance['schema'],
|
|
52
|
+
AssociationTableName &
|
|
53
|
+
AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> &
|
|
54
|
+
keyof BaseInstance['DB']
|
|
55
|
+
>
|
|
56
|
+
| OrderStatement<
|
|
57
|
+
BaseInstance['DB'],
|
|
58
|
+
BaseInstance['schema'],
|
|
59
|
+
AssociationTableName &
|
|
60
|
+
AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> &
|
|
61
|
+
keyof BaseInstance['DB']
|
|
62
|
+
>[]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type HasManyOptions<
|
|
66
|
+
BaseInstance extends Dream,
|
|
67
|
+
AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>,
|
|
68
|
+
> = HasOptions<BaseInstance, AssociationGlobalName> & HasManyOnlyOptions<BaseInstance, AssociationGlobalName>
|
|
69
|
+
|
|
70
|
+
export type PolymorphicHasManyOptions<
|
|
71
|
+
BaseInstance extends Dream,
|
|
72
|
+
AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>,
|
|
73
|
+
> = PolymorphicHasOptions<BaseInstance, AssociationGlobalName> &
|
|
74
|
+
HasManyOnlyOptions<BaseInstance, AssociationGlobalName>
|
|
75
|
+
|
|
76
|
+
export type HasManyThroughOptions<
|
|
77
|
+
BaseInstance extends Dream,
|
|
78
|
+
AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>,
|
|
79
|
+
> = HasThroughOptions<BaseInstance, AssociationGlobalName> &
|
|
80
|
+
HasManyOnlyOptions<BaseInstance, AssociationGlobalName>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Dream from '../../Dream.ts'
|
|
2
|
+
import { AssociationTableNames } from '../db.js'
|
|
3
|
+
import { GlobalModelNameTableMap } from '../dream.js'
|
|
4
|
+
import { HasOptions, HasStatement, HasThroughOptions, PolymorphicHasOptions } from './shared.js'
|
|
5
|
+
|
|
6
|
+
export type HasOneStatement<
|
|
7
|
+
BaseInstance extends Dream,
|
|
8
|
+
DB,
|
|
9
|
+
Schema,
|
|
10
|
+
ForeignTableName extends AssociationTableNames<DB, Schema> & keyof DB,
|
|
11
|
+
> = HasStatement<BaseInstance, DB, Schema, ForeignTableName, 'HasOne'>
|
|
12
|
+
|
|
13
|
+
export type HasOneOptions<
|
|
14
|
+
BaseInstance extends Dream,
|
|
15
|
+
AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>,
|
|
16
|
+
> = HasOptions<BaseInstance, AssociationGlobalName>
|
|
17
|
+
|
|
18
|
+
export type PolymorphicHasOneOptions<
|
|
19
|
+
BaseInstance extends Dream,
|
|
20
|
+
AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>,
|
|
21
|
+
> = PolymorphicHasOptions<BaseInstance, AssociationGlobalName>
|
|
22
|
+
|
|
23
|
+
export type HasOneThroughOptions<
|
|
24
|
+
BaseInstance extends Dream,
|
|
25
|
+
AssociationGlobalName extends keyof GlobalModelNameTableMap<BaseInstance>,
|
|
26
|
+
> = HasThroughOptions<BaseInstance, AssociationGlobalName>
|