@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
|
@@ -29,13 +29,13 @@ class Decorators {
|
|
|
29
29
|
*
|
|
30
30
|
* ```ts
|
|
31
31
|
* class UserSettings extends ApplicationModel {
|
|
32
|
-
* @
|
|
32
|
+
* @deco.BelongsTo('User')
|
|
33
33
|
* public user: User
|
|
34
34
|
* public userId: DreamColumn<UserSettings, 'userId'>
|
|
35
35
|
* }
|
|
36
36
|
*
|
|
37
37
|
* class User extends ApplicationModel {
|
|
38
|
-
* @
|
|
38
|
+
* @deco.HasOne('UserSettings')
|
|
39
39
|
* public userSettings: UserSettings
|
|
40
40
|
* }
|
|
41
41
|
* ```
|
|
@@ -57,12 +57,12 @@ class Decorators {
|
|
|
57
57
|
*
|
|
58
58
|
* ```ts
|
|
59
59
|
* class User extends ApplicationModel {
|
|
60
|
-
* @
|
|
60
|
+
* @deco.HasMany('Post')
|
|
61
61
|
* public posts: Post[]
|
|
62
62
|
* }
|
|
63
63
|
*
|
|
64
64
|
* class Post extends ApplicationModel {
|
|
65
|
-
* @
|
|
65
|
+
* @deco.BelongsTo('User')
|
|
66
66
|
* public user: User
|
|
67
67
|
* public userId: DreamColumn<Post, 'userId'>
|
|
68
68
|
* }
|
|
@@ -82,12 +82,12 @@ class Decorators {
|
|
|
82
82
|
*
|
|
83
83
|
* ```ts
|
|
84
84
|
* class User extends ApplicationModel {
|
|
85
|
-
* @
|
|
85
|
+
* @deco.HasOne('UserSettings')
|
|
86
86
|
* public userSettings: UserSettings
|
|
87
87
|
* }
|
|
88
88
|
*
|
|
89
89
|
* class UserSettings extends ApplicationModel {
|
|
90
|
-
* @
|
|
90
|
+
* @deco.BelongsTo('User')
|
|
91
91
|
* public user: User
|
|
92
92
|
* public userId: DreamColumn<UserSettings, 'userId'>
|
|
93
93
|
* }
|
|
@@ -110,14 +110,14 @@ class Decorators {
|
|
|
110
110
|
*
|
|
111
111
|
* ```ts
|
|
112
112
|
* class User {
|
|
113
|
-
* @
|
|
113
|
+
* @deco.Encrypted()
|
|
114
114
|
* // automatically sets `encryptedSsn` to the encrypted value that
|
|
115
115
|
* // `ssn` is set to in new/create/update, e.g., `await user.update({ ssn })`
|
|
116
116
|
* public ssn: string
|
|
117
117
|
*
|
|
118
118
|
* // automatically sets `myEncryptedPhone` to the encrypted value that
|
|
119
119
|
* // `phone` is set to new/create/update, e.g., `await user.update({ phone })`
|
|
120
|
-
* @
|
|
120
|
+
* @deco.Encrypted('myEncryptedPhone)
|
|
121
121
|
* public phone: string
|
|
122
122
|
* }
|
|
123
123
|
* ```
|
|
@@ -134,7 +134,7 @@ class Decorators {
|
|
|
134
134
|
*
|
|
135
135
|
* ```ts
|
|
136
136
|
* class Collar {
|
|
137
|
-
* @
|
|
137
|
+
* @deco.Scope({ default: true })
|
|
138
138
|
* public static hideHiddenCollars(query: Query<Collar>) {
|
|
139
139
|
* return query.where({ hidden: false })
|
|
140
140
|
* }
|
|
@@ -156,7 +156,7 @@ class Decorators {
|
|
|
156
156
|
*
|
|
157
157
|
* ```ts
|
|
158
158
|
* class Balloon {
|
|
159
|
-
* @
|
|
159
|
+
* @deco.Sortable({ scope: 'user' })
|
|
160
160
|
* public position: DreamColumn<Balloon, 'position'>
|
|
161
161
|
* }
|
|
162
162
|
* ```
|
|
@@ -174,7 +174,7 @@ class Decorators {
|
|
|
174
174
|
*
|
|
175
175
|
* ```ts
|
|
176
176
|
* class Sandbag {
|
|
177
|
-
* @
|
|
177
|
+
* @deco.Validate()
|
|
178
178
|
* public validateWeight(this: Sandbag) {
|
|
179
179
|
* if (!this.weight) return
|
|
180
180
|
*
|
|
@@ -199,7 +199,7 @@ class Decorators {
|
|
|
199
199
|
*
|
|
200
200
|
* ```ts
|
|
201
201
|
* class Balloon {
|
|
202
|
-
* @
|
|
202
|
+
* @deco.Validates('numericality', { min: 0, max: 100 })
|
|
203
203
|
* public volume: DreamColumn<Balloon, 'volume'>
|
|
204
204
|
* }
|
|
205
205
|
* ```
|
|
@@ -233,7 +233,7 @@ class Decorators {
|
|
|
233
233
|
*
|
|
234
234
|
* ```ts
|
|
235
235
|
* class BodyMeasurement {
|
|
236
|
-
* @
|
|
236
|
+
* @deco.Virtual()
|
|
237
237
|
* public get lbs() {
|
|
238
238
|
* const self: User = this
|
|
239
239
|
* return gramsToLbs(self.getAttribute('grams') ?? 0)
|
|
@@ -244,7 +244,7 @@ class Decorators {
|
|
|
244
244
|
* self.setAttribute('grams', lbsToGrams(lbs))
|
|
245
245
|
* }
|
|
246
246
|
*
|
|
247
|
-
* @
|
|
247
|
+
* @deco.Virtual()
|
|
248
248
|
* public get kilograms() {
|
|
249
249
|
* const self: User = this
|
|
250
250
|
* return gramsToKilograms(self.getAttribute('grams') ?? 0)
|
|
@@ -260,10 +260,10 @@ class Decorators {
|
|
|
260
260
|
*
|
|
261
261
|
* ```ts
|
|
262
262
|
* class User {
|
|
263
|
-
* @
|
|
263
|
+
* @deco.Virtual()
|
|
264
264
|
* public password: string
|
|
265
265
|
*
|
|
266
|
-
* @
|
|
266
|
+
* @deco.BeforeSave()
|
|
267
267
|
* public hasPassword() {
|
|
268
268
|
* this.setAttribute('hashedPassword', preferredHashingAlgorithm(this.password))
|
|
269
269
|
* }
|
|
@@ -280,7 +280,7 @@ class Decorators {
|
|
|
280
280
|
*
|
|
281
281
|
* ```ts
|
|
282
282
|
* class User {
|
|
283
|
-
* @
|
|
283
|
+
* @deco.BeforeCreate()
|
|
284
284
|
* public doSomething() {
|
|
285
285
|
* console.log('hi!')
|
|
286
286
|
* }
|
|
@@ -298,7 +298,7 @@ class Decorators {
|
|
|
298
298
|
*
|
|
299
299
|
* ```ts
|
|
300
300
|
* class User {
|
|
301
|
-
* @
|
|
301
|
+
* @deco.BeforeSave()
|
|
302
302
|
* public doSomething() {
|
|
303
303
|
* console.log('hi!')
|
|
304
304
|
* }
|
|
@@ -316,7 +316,7 @@ class Decorators {
|
|
|
316
316
|
*
|
|
317
317
|
* ```ts
|
|
318
318
|
* class User {
|
|
319
|
-
* @
|
|
319
|
+
* @deco.BeforeUpdate()
|
|
320
320
|
* public doSomething() {
|
|
321
321
|
* console.log('hi!')
|
|
322
322
|
* }
|
|
@@ -334,7 +334,7 @@ class Decorators {
|
|
|
334
334
|
*
|
|
335
335
|
* ```ts
|
|
336
336
|
* class User {
|
|
337
|
-
* @
|
|
337
|
+
* @deco.BeforeDestroy()
|
|
338
338
|
* public doSomething() {
|
|
339
339
|
* console.log('hi!')
|
|
340
340
|
* }
|
|
@@ -351,7 +351,7 @@ class Decorators {
|
|
|
351
351
|
*
|
|
352
352
|
* ```ts
|
|
353
353
|
* class User {
|
|
354
|
-
* @
|
|
354
|
+
* @deco.AfterCreate()
|
|
355
355
|
* public doSomething() {
|
|
356
356
|
* console.log('hi!')
|
|
357
357
|
* }
|
|
@@ -369,7 +369,7 @@ class Decorators {
|
|
|
369
369
|
*
|
|
370
370
|
* ```ts
|
|
371
371
|
* class User {
|
|
372
|
-
* @
|
|
372
|
+
* @deco.AfterCreateCommit()
|
|
373
373
|
* public doSomething() {
|
|
374
374
|
* console.log('hi!')
|
|
375
375
|
* }
|
|
@@ -386,7 +386,7 @@ class Decorators {
|
|
|
386
386
|
*
|
|
387
387
|
* ```ts
|
|
388
388
|
* class User {
|
|
389
|
-
* @
|
|
389
|
+
* @deco.AfterSave()
|
|
390
390
|
* public doSomething() {
|
|
391
391
|
* console.log('hi!')
|
|
392
392
|
* }
|
|
@@ -404,7 +404,7 @@ class Decorators {
|
|
|
404
404
|
*
|
|
405
405
|
* ```ts
|
|
406
406
|
* class User {
|
|
407
|
-
* @
|
|
407
|
+
* @deco.AfterSaveCommit()
|
|
408
408
|
* public doSomething() {
|
|
409
409
|
* console.log('hi!')
|
|
410
410
|
* }
|
|
@@ -422,7 +422,7 @@ class Decorators {
|
|
|
422
422
|
*
|
|
423
423
|
* ```ts
|
|
424
424
|
* class User {
|
|
425
|
-
* @
|
|
425
|
+
* @deco.AfterUpdate()
|
|
426
426
|
* public doSomething() {
|
|
427
427
|
* console.log('hi!')
|
|
428
428
|
* }
|
|
@@ -440,7 +440,7 @@ class Decorators {
|
|
|
440
440
|
*
|
|
441
441
|
* ```ts
|
|
442
442
|
* class User {
|
|
443
|
-
* @
|
|
443
|
+
* @deco.AfterUpdateCommit()
|
|
444
444
|
* public doSomething() {
|
|
445
445
|
* console.log('hi!')
|
|
446
446
|
* }
|
|
@@ -458,7 +458,7 @@ class Decorators {
|
|
|
458
458
|
*
|
|
459
459
|
* ```ts
|
|
460
460
|
* class User {
|
|
461
|
-
* @
|
|
461
|
+
* @deco.AfterDestroy()
|
|
462
462
|
* public doSomething() {
|
|
463
463
|
* console.log('hi!')
|
|
464
464
|
* }
|
|
@@ -476,7 +476,7 @@ class Decorators {
|
|
|
476
476
|
*
|
|
477
477
|
* ```ts
|
|
478
478
|
* class User {
|
|
479
|
-
* @
|
|
479
|
+
* @deco.AfterDestroyCommit()
|
|
480
480
|
* public doSomething() {
|
|
481
481
|
* console.log('hi!')
|
|
482
482
|
* }
|
|
@@ -11,13 +11,13 @@ const shared_js_1 = require("./shared.js");
|
|
|
11
11
|
*
|
|
12
12
|
* ```ts
|
|
13
13
|
* class UserSettings extends ApplicationModel {
|
|
14
|
-
* @
|
|
14
|
+
* @deco.BelongsTo('User')
|
|
15
15
|
* public user: User
|
|
16
16
|
* public userId: DreamColumn<UserSettings, 'userId'>
|
|
17
17
|
* }
|
|
18
18
|
*
|
|
19
19
|
* class User extends ApplicationModel {
|
|
20
|
-
* @
|
|
20
|
+
* @deco.HasOne('UserSettings')
|
|
21
21
|
* public userSettings: UserSettings
|
|
22
22
|
* }
|
|
23
23
|
* ```
|
|
@@ -10,12 +10,12 @@ const shared_js_1 = require("./shared.js");
|
|
|
10
10
|
*
|
|
11
11
|
* ```ts
|
|
12
12
|
* class User extends ApplicationModel {
|
|
13
|
-
* @
|
|
13
|
+
* @deco.HasMany('Post')
|
|
14
14
|
* public posts: Post[]
|
|
15
15
|
* }
|
|
16
16
|
*
|
|
17
17
|
* class Post extends ApplicationModel {
|
|
18
|
-
* @
|
|
18
|
+
* @deco.BelongsTo('User')
|
|
19
19
|
* public user: User
|
|
20
20
|
* public userId: DreamColumn<Post, 'userId'>
|
|
21
21
|
* }
|
|
@@ -10,12 +10,12 @@ const shared_js_1 = require("./shared.js");
|
|
|
10
10
|
*
|
|
11
11
|
* ```ts
|
|
12
12
|
* class User extends ApplicationModel {
|
|
13
|
-
* @
|
|
13
|
+
* @deco.HasOne('UserSettings')
|
|
14
14
|
* public userSettings: UserSettings
|
|
15
15
|
* }
|
|
16
16
|
*
|
|
17
17
|
* class UserSettings extends ApplicationModel {
|
|
18
|
-
* @
|
|
18
|
+
* @deco.BelongsTo('User')
|
|
19
19
|
* public user: User
|
|
20
20
|
* public userId: DreamColumn<UserSettings, 'userId'>
|
|
21
21
|
* }
|
|
@@ -8,7 +8,7 @@ exports.applyGetterAndSetter = applyGetterAndSetter;
|
|
|
8
8
|
exports.associationPrimaryKeyAccessors = associationPrimaryKeyAccessors;
|
|
9
9
|
exports.validateHasStatementArgs = validateHasStatementArgs;
|
|
10
10
|
const pluralize_esm_1 = require("pluralize-esm");
|
|
11
|
-
const
|
|
11
|
+
const constants_js_1 = require("../../../dream/constants.js");
|
|
12
12
|
const InvalidComputedForeignKey_js_1 = require("../../../errors/associations/InvalidComputedForeignKey.js");
|
|
13
13
|
const NonLoadedAssociation_js_1 = require("../../../errors/associations/NonLoadedAssociation.js");
|
|
14
14
|
const CannotDefineAssociationWithBothDependentAndPassthrough_js_1 = require("../../../errors/CannotDefineAssociationWithBothDependentAndPassthrough.js");
|
|
@@ -30,6 +30,11 @@ function blankAssociationsFactory(dreamClass, { freeze = false, } = {}) {
|
|
|
30
30
|
return (0, freezeBaseClassArrayMap_js_1.default)(associationsMap);
|
|
31
31
|
return associationsMap;
|
|
32
32
|
}
|
|
33
|
+
// function hydratedSourceValue(dream: Dream | typeof Dream | undefined, sourceName: string) {
|
|
34
|
+
// if (!dream) return
|
|
35
|
+
// if (!sourceName) return
|
|
36
|
+
// return (dream as any)[sourceName] || (dream as any)[singular(sourceName)]
|
|
37
|
+
// }
|
|
33
38
|
function finalForeignKey(foreignKey, dreamClass, partialAssociation) {
|
|
34
39
|
let computedForeignKey = foreignKey;
|
|
35
40
|
if (!computedForeignKey) {
|
|
@@ -118,15 +123,10 @@ association: ${this.as}
|
|
|
118
123
|
};
|
|
119
124
|
}
|
|
120
125
|
function validateHasStatementArgs({ dreamClass, dependent, methodName, on, }) {
|
|
121
|
-
const hasPassthroughOn = Object.values(on || {}).find(val => val ===
|
|
122
|
-
const hasRequiredOn = Object.values(on || {}).find(val => val ===
|
|
126
|
+
const hasPassthroughOn = Object.values(on || {}).find(val => val === constants_js_1.DreamConst.passthrough);
|
|
127
|
+
const hasRequiredOn = Object.values(on || {}).find(val => val === constants_js_1.DreamConst.required);
|
|
123
128
|
if (dependent && hasPassthroughOn)
|
|
124
129
|
throw new CannotDefineAssociationWithBothDependentAndPassthrough_js_1.default(dreamClass, methodName);
|
|
125
130
|
if (dependent && hasRequiredOn)
|
|
126
131
|
throw new CannotDefineAssociationWithBothDependentAndRequiredOnClause_js_1.default(dreamClass, methodName);
|
|
127
132
|
}
|
|
128
|
-
// function hydratedSourceValue(dream: Dream | typeof Dream | undefined, sourceName: string) {
|
|
129
|
-
// if (!dream) return
|
|
130
|
-
// if (!sourceName) return
|
|
131
|
-
// return (dream as any)[sourceName] || (dream as any)[singular(sourceName)]
|
|
132
|
-
// }
|
|
@@ -56,7 +56,7 @@ function extractValidationOptionsFromArgs(type, args) {
|
|
|
56
56
|
When validating using "length", the second argument must be a number representing
|
|
57
57
|
the min length, or else an object expressing both min and max length, like so:
|
|
58
58
|
|
|
59
|
-
@
|
|
59
|
+
@deco.Validates('length', { min: 4, max: 32 })
|
|
60
60
|
`);
|
|
61
61
|
}
|
|
62
62
|
case 'requiredBelongsTo':
|
|
@@ -515,10 +515,10 @@ class DreamClassTransactionBuilder {
|
|
|
515
515
|
*
|
|
516
516
|
* ```ts
|
|
517
517
|
* class Post {
|
|
518
|
-
* @
|
|
518
|
+
* @deco.HasMany('LocalizedText')
|
|
519
519
|
* public localizedTexts: LocalizedText[]
|
|
520
520
|
*
|
|
521
|
-
* @
|
|
521
|
+
* @deco.HasOne('LocalizedText', {
|
|
522
522
|
* where: { locale: DreamConst.passthrough },
|
|
523
523
|
* })
|
|
524
524
|
* public currentLocalizedText: LocalizedText
|
|
@@ -37,13 +37,13 @@ const uniq_js_1 = require("../helpers/uniq.js");
|
|
|
37
37
|
const curried_ops_statement_js_1 = require("../ops/curried-ops-statement.js");
|
|
38
38
|
const index_js_1 = require("../ops/index.js");
|
|
39
39
|
const ops_statement_js_1 = require("../ops/ops-statement.js");
|
|
40
|
+
const constants_js_1 = require("./constants.js");
|
|
40
41
|
const executeDatabaseQuery_js_1 = require("./internal/executeDatabaseQuery.js");
|
|
41
42
|
const extractAssociationMetadataFromAssociationName_js_1 = require("./internal/extractAssociationMetadataFromAssociationName.js");
|
|
42
43
|
const orderByDirection_js_1 = require("./internal/orderByDirection.js");
|
|
43
44
|
const shouldBypassDefaultScope_js_1 = require("./internal/shouldBypassDefaultScope.js");
|
|
44
45
|
const SimilarityBuilder_js_1 = require("./internal/similarity/SimilarityBuilder.js");
|
|
45
46
|
const sqlResultToDreamInstance_js_1 = require("./internal/sqlResultToDreamInstance.js");
|
|
46
|
-
const types_js_1 = require("./types.js");
|
|
47
47
|
class Query extends ConnectedToDB_js_1.default {
|
|
48
48
|
/**
|
|
49
49
|
* @internal
|
|
@@ -763,10 +763,10 @@ class Query extends ConnectedToDB_js_1.default {
|
|
|
763
763
|
*
|
|
764
764
|
* ```ts
|
|
765
765
|
* class Post {
|
|
766
|
-
* @
|
|
766
|
+
* @deco.HasMany('LocalizedText')
|
|
767
767
|
* public localizedTexts: LocalizedText[]
|
|
768
768
|
*
|
|
769
|
-
* @
|
|
769
|
+
* @deco.HasOne('LocalizedText', {
|
|
770
770
|
* on: { locale: DreamConst.passthrough },
|
|
771
771
|
* })
|
|
772
772
|
* public currentLocalizedText: LocalizedText
|
|
@@ -2229,7 +2229,7 @@ class Query extends ConnectedToDB_js_1.default {
|
|
|
2229
2229
|
throwUnlessAllRequiredWhereClausesProvided(association, namespace, joinOnStatements) {
|
|
2230
2230
|
const whereStatement = association.on;
|
|
2231
2231
|
const columnsRequiringWhereStatements = Object.keys(whereStatement).reduce((agg, column) => {
|
|
2232
|
-
if (whereStatement[column] ===
|
|
2232
|
+
if (whereStatement[column] === constants_js_1.DreamConst.required)
|
|
2233
2233
|
agg.push(column);
|
|
2234
2234
|
return agg;
|
|
2235
2235
|
}, []);
|
|
@@ -2280,7 +2280,7 @@ class Query extends ConnectedToDB_js_1.default {
|
|
|
2280
2280
|
}
|
|
2281
2281
|
whereStatementToExpressionWrapper(eb, whereStatement, { negate = false, disallowSimilarityOperator = true, } = {}) {
|
|
2282
2282
|
const clauses = (0, compact_js_1.default)(Object.keys(whereStatement)
|
|
2283
|
-
.filter(key => whereStatement[key] !==
|
|
2283
|
+
.filter(key => whereStatement[key] !== constants_js_1.DreamConst.required)
|
|
2284
2284
|
.map(attr => {
|
|
2285
2285
|
const val = whereStatement[attr];
|
|
2286
2286
|
if (val?.isOpsStatement &&
|
|
@@ -2357,10 +2357,10 @@ class Query extends ConnectedToDB_js_1.default {
|
|
|
2357
2357
|
let a2 = null;
|
|
2358
2358
|
let b2 = null;
|
|
2359
2359
|
let c2 = null;
|
|
2360
|
-
if (val instanceof Function && val !==
|
|
2360
|
+
if (val instanceof Function && val !== constants_js_1.DreamConst.passthrough) {
|
|
2361
2361
|
val = val();
|
|
2362
2362
|
}
|
|
2363
|
-
else if (val ===
|
|
2363
|
+
else if (val === constants_js_1.DreamConst.passthrough) {
|
|
2364
2364
|
const column = attr.split('.').pop();
|
|
2365
2365
|
if (this.passthroughOnStatement[column] === undefined)
|
|
2366
2366
|
throw new MissingRequiredPassthroughForAssociationOnClause_js_1.default(column);
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.openapiShorthandPrimitiveTypes = exports.openapiPrimitiveTypes = void 0;
|
|
3
|
+
exports.openapiShorthandPrimitiveTypes = exports.openapiPrimitiveTypes = exports.DreamConst = exports.TRIGRAM_OPERATORS = exports.primaryKeyTypes = void 0;
|
|
4
|
+
exports.primaryKeyTypes = ['bigserial', 'bigint', 'uuid', 'integer'];
|
|
5
|
+
exports.TRIGRAM_OPERATORS = ['%', '<%', '<<%'];
|
|
6
|
+
class RequiredAttribute {
|
|
7
|
+
constructor() { }
|
|
8
|
+
}
|
|
9
|
+
class PassthroughAttribute {
|
|
10
|
+
constructor() { }
|
|
11
|
+
}
|
|
12
|
+
exports.DreamConst = {
|
|
13
|
+
passthrough: PassthroughAttribute,
|
|
14
|
+
required: RequiredAttribute,
|
|
15
|
+
};
|
|
4
16
|
exports.openapiPrimitiveTypes = [
|
|
5
17
|
'string',
|
|
6
18
|
'boolean',
|
|
@@ -8,7 +8,7 @@ const validateTable_js_1 = require("../../../db/validators/validateTable.js");
|
|
|
8
8
|
const validateTableAlias_js_1 = require("../../../db/validators/validateTableAlias.js");
|
|
9
9
|
const namespaceColumn_js_1 = require("../../../helpers/namespaceColumn.js");
|
|
10
10
|
const typechecks_js_1 = require("../../../helpers/typechecks.js");
|
|
11
|
-
const
|
|
11
|
+
const constants_js_1 = require("../../constants.js");
|
|
12
12
|
const similaritySelectSql_js_1 = require("./similaritySelectSql.js");
|
|
13
13
|
const similarityWhereSql_js_1 = require("./similarityWhereSql.js");
|
|
14
14
|
class SimilarityBuilder extends ConnectedToDB_js_1.default {
|
|
@@ -185,7 +185,7 @@ class SimilarityBuilder extends ConnectedToDB_js_1.default {
|
|
|
185
185
|
Object.keys(tableValues).forEach(columnOrAssociationName => {
|
|
186
186
|
const statementOrValueOrNestedObject = tableValues[columnOrAssociationName];
|
|
187
187
|
if (statementOrValueOrNestedObject?.isOpsStatement &&
|
|
188
|
-
|
|
188
|
+
constants_js_1.TRIGRAM_OPERATORS.includes(statementOrValueOrNestedObject?.operator)) {
|
|
189
189
|
similar.push({
|
|
190
190
|
tableName,
|
|
191
191
|
tableAlias: associationName,
|
|
@@ -292,7 +292,7 @@ class SimilarityBuilder extends ConnectedToDB_js_1.default {
|
|
|
292
292
|
statements.forEach(statement => {
|
|
293
293
|
Object.keys(statement).forEach(key => {
|
|
294
294
|
if (statement[key]?.constructor?.name === 'OpsStatement' &&
|
|
295
|
-
|
|
295
|
+
constants_js_1.TRIGRAM_OPERATORS.includes(statement[key].operator)) {
|
|
296
296
|
similar.push({
|
|
297
297
|
tableName,
|
|
298
298
|
tableAlias: tableName,
|
|
@@ -6,7 +6,7 @@ const path = require("path");
|
|
|
6
6
|
const dataTypes_js_1 = require("../../db/dataTypes.js");
|
|
7
7
|
const index_js_1 = require("../../db/index.js");
|
|
8
8
|
const index_js_2 = require("../../dream-application/index.js");
|
|
9
|
-
const
|
|
9
|
+
const constants_js_1 = require("../../dream/constants.js");
|
|
10
10
|
const FailedToIdentifyAssociation_js_1 = require("../../errors/schema-builder/FailedToIdentifyAssociation.js");
|
|
11
11
|
const autogeneratedFileMessage_js_1 = require("../../global-cli/helpers/autogeneratedFileMessage.js");
|
|
12
12
|
const camelize_js_1 = require("../camelize.js");
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
} from './db.js'`
|
|
26
26
|
: '';
|
|
27
27
|
const calendarDateImportStatement = EnvInternal_js_1.default.boolean('DREAM_CORE_DEVELOPMENT')
|
|
28
|
-
? "import CalendarDate from '../../src/helpers/CalendarDate.js'\nimport { DateTime } from '../../src/helpers/DateTime.js'"
|
|
29
|
-
: "import { CalendarDate, DateTime } from '@rvoh/dream'";
|
|
28
|
+
? "import type CalendarDate from '../../src/helpers/CalendarDate.js'\nimport { type DateTime } from '../../src/helpers/DateTime.js'"
|
|
29
|
+
: "import { type CalendarDate, type DateTime } from '@rvoh/dream'";
|
|
30
30
|
const dreamApp = index_js_2.default.getOrFail();
|
|
31
31
|
const newSchemaFileContents = `\
|
|
32
32
|
${(0, autogeneratedFileMessage_js_1.default)()}
|
|
@@ -109,13 +109,13 @@ ${tableName}: {
|
|
|
109
109
|
const whereStatement = associationMetadata.where;
|
|
110
110
|
const requiredOnClauses = whereStatement === null
|
|
111
111
|
? []
|
|
112
|
-
: Object.keys(whereStatement).filter(column => whereStatement[column] ===
|
|
112
|
+
: Object.keys(whereStatement).filter(column => whereStatement[column] === constants_js_1.DreamConst.required);
|
|
113
113
|
passthroughColumns =
|
|
114
114
|
whereStatement === null
|
|
115
115
|
? passthroughColumns
|
|
116
116
|
: [
|
|
117
117
|
...passthroughColumns,
|
|
118
|
-
...Object.keys(whereStatement).filter(column => whereStatement[column] ===
|
|
118
|
+
...Object.keys(whereStatement).filter(column => whereStatement[column] === constants_js_1.DreamConst.passthrough),
|
|
119
119
|
];
|
|
120
120
|
return `${associationName}: {
|
|
121
121
|
type: '${associationMetadata.type}',
|
|
@@ -39,7 +39,7 @@ async function generateDream({ fullyQualifiedModelName, columnsWithTypes, option
|
|
|
39
39
|
const isSTI = !!fullyQualifiedParentName;
|
|
40
40
|
if (columnsWithTypes.length || !isSTI) {
|
|
41
41
|
await (0, generateMigration_js_1.default)({
|
|
42
|
-
migrationName: fullyQualifiedModelName
|
|
42
|
+
migrationName: `Create${fullyQualifiedModelName}`,
|
|
43
43
|
columnsWithTypes,
|
|
44
44
|
fullyQualifiedModelName,
|
|
45
45
|
fullyQualifiedParentName,
|
|
@@ -38,7 +38,7 @@ function generateDreamContent({ fullyQualifiedModelName, columnsWithTypes, fully
|
|
|
38
38
|
case 'belongs_to':
|
|
39
39
|
modelImportStatements.push(associationImportStatement);
|
|
40
40
|
return `
|
|
41
|
-
@
|
|
41
|
+
@deco.BelongsTo('${fullyQualifiedAssociatedModelName}'${descriptors.includes('optional') ? ', { optional: true }' : ''})
|
|
42
42
|
public ${associationName}: ${associationModelName}${descriptors.includes('optional') ? ' | null' : ''}
|
|
43
43
|
public ${associationName}Id: DreamColumn<${modelClassName}, '${associationName}Id'>
|
|
44
44
|
`;
|
|
@@ -76,7 +76,7 @@ public ${(0, camelize_js_1.default)(attributeName)}: ${getAttributeType(attribut
|
|
|
76
76
|
return `\
|
|
77
77
|
import { ${(0, uniq_js_1.default)(dreamImports).join(', ')} } from '@rvoh/dream'${(0, uniq_js_1.default)(modelImportStatements).join('')}
|
|
78
78
|
|
|
79
|
-
const
|
|
79
|
+
const deco = new Decorators<InstanceType<typeof ${modelClassName}>>()
|
|
80
80
|
|
|
81
81
|
${isSTI ? `\n@STI(${parentModelClassName})` : ''}
|
|
82
82
|
export default class ${modelClassName} extends ${isSTI ? parentModelClassName : 'ApplicationModel'} {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = primaryKeyType;
|
|
4
4
|
const index_js_1 = require("../../dream-application/index.js");
|
|
5
|
-
const
|
|
5
|
+
const constants_js_1 = require("../../dream/constants.js");
|
|
6
6
|
function primaryKeyType() {
|
|
7
7
|
const dreamconf = index_js_1.default.getOrFail();
|
|
8
8
|
switch (dreamconf.primaryKeyType) {
|
|
@@ -17,7 +17,7 @@ ATTENTION!
|
|
|
17
17
|
|
|
18
18
|
unrecognized primary key type "${dreamconf.primaryKeyType}" found in .dream.yml.
|
|
19
19
|
please use one of the allowed primary key types:
|
|
20
|
-
${
|
|
20
|
+
${constants_js_1.primaryKeyTypes.join(', ')}
|
|
21
21
|
`);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -89,14 +89,14 @@ function migratedActionPastTense(mode) {
|
|
|
89
89
|
function logResults(results, mode) {
|
|
90
90
|
results?.forEach(it => {
|
|
91
91
|
if (it.status === 'Success') {
|
|
92
|
-
index_js_3.default.logger.
|
|
93
|
-
` migration "${it.migrationName}" was ${migratedActionPastTense(mode)} successfully`, {
|
|
92
|
+
index_js_3.default.logger.logContinueProgress((0, colorize_js_1.default)(`[db]`, { color: 'cyan' }) +
|
|
93
|
+
` migration "${it.migrationName}" was ${migratedActionPastTense(mode)} successfully`, { logPrefixColor: 'cyan' });
|
|
94
94
|
}
|
|
95
95
|
else if (it.status === 'Error') {
|
|
96
|
-
index_js_3.default.logger.
|
|
97
|
-
index_js_3.default.logger.
|
|
96
|
+
index_js_3.default.logger.logContinueProgress(JSON.stringify(it, null, 2));
|
|
97
|
+
index_js_3.default.logger.logContinueProgress((0, colorize_js_1.default)(`failed to ${migratedActionCurrentTense(mode)} migration "${it.migrationName}"`, {
|
|
98
98
|
color: 'redBright',
|
|
99
|
-
})
|
|
99
|
+
}));
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = sort;
|
|
4
|
+
const sortBy_js_1 = require("./sortBy.js");
|
|
5
|
+
/**
|
|
6
|
+
* Returns a copy of array containing strings, numbers, bigints, and/or IdTypes, sorted in ascending order.
|
|
7
|
+
* To sort other types use {@link sortBy}.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { sort } from '@rvoh/dream'
|
|
11
|
+
*
|
|
12
|
+
* sort([2, 1, 3])
|
|
13
|
+
* // [1, 2, 3]
|
|
14
|
+
*
|
|
15
|
+
* sort(['world', 'Hello', 'hello', 'World'])
|
|
16
|
+
* // ['hello', 'Hello', 'world', 'World']
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
function sort(array) {
|
|
20
|
+
if (typeof array[0] === 'bigint') {
|
|
21
|
+
return (0, sortBy_js_1.default)(array, a => String(a));
|
|
22
|
+
}
|
|
23
|
+
return (0, sortBy_js_1.default)(array, a => a);
|
|
24
|
+
}
|