@rvoh/dream 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +382 -0
- package/boilerplate/app/models/ApplicationModel.ts +14 -0
- package/boilerplate/app/serializers/.gitkeep +0 -0
- package/boilerplate/bin/esm.js +19 -0
- package/boilerplate/cli/helpers/initializeDreamApplication.ts +6 -0
- package/boilerplate/cli/index.ts +22 -0
- package/boilerplate/conf/inflections.ts +5 -0
- package/boilerplate/conf/loadEnv.ts +4 -0
- package/boilerplate/conf/repl.ts +11 -0
- package/boilerplate/eslint.config.js +21 -0
- package/boilerplate/package.json +42 -0
- package/boilerplate/tsconfig.build.json +41 -0
- package/boilerplate/tsconfig.json +12 -0
- package/boilerplate/types/db.ts +5 -0
- package/boilerplate/types/dream.ts +3 -0
- package/dist/cjs/boilerplate/package.json +42 -0
- package/dist/cjs/src/Dream.js +2984 -0
- package/dist/cjs/src/bin/helpers/sync.js +109 -0
- package/dist/cjs/src/bin/index.js +107 -0
- package/dist/cjs/src/cli/index.js +155 -0
- package/dist/cjs/src/db/ConnectedToDB.js +43 -0
- package/dist/cjs/src/db/ConnectionConfRetriever.js +22 -0
- package/dist/cjs/src/db/DreamDbConnection.js +77 -0
- package/dist/cjs/src/db/dataTypes.js +58 -0
- package/dist/cjs/src/db/errors.js +17 -0
- package/dist/cjs/src/db/index.js +12 -0
- package/dist/cjs/src/db/migration-helpers/DreamMigrationHelpers.js +193 -0
- package/dist/cjs/src/db/reflections.js +2 -0
- package/dist/cjs/src/db/types.js +2 -0
- package/dist/cjs/src/db/validators/validateColumn.js +11 -0
- package/dist/cjs/src/db/validators/validateTable.js +9 -0
- package/dist/cjs/src/db/validators/validateTableAlias.js +55 -0
- package/dist/cjs/src/decorators/DecoratorContextType.js +2 -0
- package/dist/cjs/src/decorators/Decorators.js +326 -0
- package/dist/cjs/src/decorators/Encrypted.js +83 -0
- package/dist/cjs/src/decorators/ReplicaSafe.js +12 -0
- package/dist/cjs/src/decorators/STI.js +35 -0
- package/dist/cjs/src/decorators/Scope.js +31 -0
- package/dist/cjs/src/decorators/SoftDelete.js +54 -0
- package/dist/cjs/src/decorators/Virtual.js +28 -0
- package/dist/cjs/src/decorators/associations/BelongsTo.js +77 -0
- package/dist/cjs/src/decorators/associations/HasMany.js +100 -0
- package/dist/cjs/src/decorators/associations/HasOne.js +96 -0
- package/dist/cjs/src/decorators/associations/associationToGetterSetterProp.js +6 -0
- package/dist/cjs/src/decorators/associations/shared.js +132 -0
- package/dist/cjs/src/decorators/helpers/freezeBaseClassArrayMap.js +10 -0
- package/dist/cjs/src/decorators/hooks/AfterCreate.js +26 -0
- package/dist/cjs/src/decorators/hooks/AfterCreateCommit.js +43 -0
- package/dist/cjs/src/decorators/hooks/AfterDestroy.js +25 -0
- package/dist/cjs/src/decorators/hooks/AfterDestroyCommit.js +40 -0
- package/dist/cjs/src/decorators/hooks/AfterSave.js +26 -0
- package/dist/cjs/src/decorators/hooks/AfterSaveCommit.js +43 -0
- package/dist/cjs/src/decorators/hooks/AfterUpdate.js +26 -0
- package/dist/cjs/src/decorators/hooks/AfterUpdateCommit.js +43 -0
- package/dist/cjs/src/decorators/hooks/BeforeCreate.js +26 -0
- package/dist/cjs/src/decorators/hooks/BeforeDestroy.js +25 -0
- package/dist/cjs/src/decorators/hooks/BeforeSave.js +26 -0
- package/dist/cjs/src/decorators/hooks/BeforeUpdate.js +26 -0
- package/dist/cjs/src/decorators/hooks/shared.js +23 -0
- package/dist/cjs/src/decorators/sortable/Sortable.js +160 -0
- package/dist/cjs/src/decorators/sortable/helpers/applySortableScopeToQuery.js +17 -0
- package/dist/cjs/src/decorators/sortable/helpers/clearCachedSortableValues.js +11 -0
- package/dist/cjs/src/decorators/sortable/helpers/decrementScopedRecordsGreaterThanPosition.js +26 -0
- package/dist/cjs/src/decorators/sortable/helpers/getColumnForSortableScope.js +18 -0
- package/dist/cjs/src/decorators/sortable/helpers/isSortedCorrectly.js +7 -0
- package/dist/cjs/src/decorators/sortable/helpers/positionIsInvalid.js +11 -0
- package/dist/cjs/src/decorators/sortable/helpers/resortAllRecords.js +38 -0
- package/dist/cjs/src/decorators/sortable/helpers/scopeArray.js +10 -0
- package/dist/cjs/src/decorators/sortable/helpers/setPosition.js +158 -0
- package/dist/cjs/src/decorators/sortable/helpers/sortableCacheKeyName.js +7 -0
- package/dist/cjs/src/decorators/sortable/helpers/sortableCacheValuesName.js +7 -0
- package/dist/cjs/src/decorators/sortable/helpers/sortableQueryExcludingDream.js +10 -0
- package/dist/cjs/src/decorators/sortable/hooks/afterSortableCreate.js +18 -0
- package/dist/cjs/src/decorators/sortable/hooks/afterSortableDestroy.js +14 -0
- package/dist/cjs/src/decorators/sortable/hooks/afterSortableUpdate.js +31 -0
- package/dist/cjs/src/decorators/sortable/hooks/beforeSortableSave.js +65 -0
- package/dist/cjs/src/decorators/validations/Validate.js +22 -0
- package/dist/cjs/src/decorators/validations/Validates.js +70 -0
- package/dist/cjs/src/decorators/validations/shared.js +2 -0
- package/dist/cjs/src/dream/DreamClassTransactionBuilder.js +592 -0
- package/dist/cjs/src/dream/DreamInstanceTransactionBuilder.js +480 -0
- package/dist/cjs/src/dream/DreamTransaction.js +26 -0
- package/dist/cjs/src/dream/LeftJoinLoadBuilder.js +77 -0
- package/dist/cjs/src/dream/LoadBuilder.js +68 -0
- package/dist/cjs/src/dream/Query.js +2618 -0
- package/dist/cjs/src/dream/internal/applyScopeBypassingSettingsToQuery.js +11 -0
- package/dist/cjs/src/dream/internal/associations/associationQuery.js +23 -0
- package/dist/cjs/src/dream/internal/associations/associationUpdateQuery.js +36 -0
- package/dist/cjs/src/dream/internal/associations/createAssociation.js +55 -0
- package/dist/cjs/src/dream/internal/associations/destroyAssociation.js +17 -0
- package/dist/cjs/src/dream/internal/associations/undestroyAssociation.js +12 -0
- package/dist/cjs/src/dream/internal/checkSingleValidation.js +52 -0
- package/dist/cjs/src/dream/internal/destroyAssociatedRecords.js +21 -0
- package/dist/cjs/src/dream/internal/destroyDream.js +72 -0
- package/dist/cjs/src/dream/internal/destroyOptions.js +32 -0
- package/dist/cjs/src/dream/internal/ensureSTITypeFieldIsSet.js +10 -0
- package/dist/cjs/src/dream/internal/executeDatabaseQuery.js +24 -0
- package/dist/cjs/src/dream/internal/extractAssociationMetadataFromAssociationName.js +8 -0
- package/dist/cjs/src/dream/internal/orderByDirection.js +15 -0
- package/dist/cjs/src/dream/internal/reload.js +21 -0
- package/dist/cjs/src/dream/internal/runHooksFor.js +99 -0
- package/dist/cjs/src/dream/internal/runValidations.js +16 -0
- package/dist/cjs/src/dream/internal/safelyRunCommitHooks.js +15 -0
- package/dist/cjs/src/dream/internal/saveDream.js +67 -0
- package/dist/cjs/src/dream/internal/scopeHelpers.js +13 -0
- package/dist/cjs/src/dream/internal/shouldBypassDefaultScope.js +12 -0
- package/dist/cjs/src/dream/internal/similarity/SimilarityBuilder.js +331 -0
- package/dist/cjs/src/dream/internal/similarity/similaritySelectSql.js +21 -0
- package/dist/cjs/src/dream/internal/similarity/similarityWhereSql.js +21 -0
- package/dist/cjs/src/dream/internal/softDeleteDream.js +22 -0
- package/dist/cjs/src/dream/internal/sqlResultToDreamInstance.js +38 -0
- package/dist/cjs/src/dream/internal/undestroyDream.js +90 -0
- package/dist/cjs/src/dream/types.js +98 -0
- package/dist/cjs/src/dream-application/cache.js +13 -0
- package/dist/cjs/src/dream-application/helpers/DreamImporter.js +52 -0
- package/dist/cjs/src/dream-application/helpers/globalModelKeyFromPath.js +10 -0
- package/dist/cjs/src/dream-application/helpers/globalSerializerKeyFromPath.js +17 -0
- package/dist/cjs/src/dream-application/helpers/globalServiceKeyFromPath.js +11 -0
- package/dist/cjs/src/dream-application/helpers/importers/importModels.js +81 -0
- package/dist/cjs/src/dream-application/helpers/importers/importSerializers.js +63 -0
- package/dist/cjs/src/dream-application/helpers/importers/importServices.js +43 -0
- package/dist/cjs/src/dream-application/helpers/lookupClassByGlobalName.js +17 -0
- package/dist/cjs/src/dream-application/helpers/lookupModelByGlobalName.js +13 -0
- package/dist/cjs/src/dream-application/helpers/lookupModelByGlobalNameOrNames.js +10 -0
- package/dist/cjs/src/dream-application/index.js +284 -0
- package/dist/cjs/src/encrypt/InternalEncrypt.js +32 -0
- package/dist/cjs/src/encrypt/algorithms/aes-gcm/decryptAESGCM.js +26 -0
- package/dist/cjs/src/encrypt/algorithms/aes-gcm/encryptAESGCM.js +12 -0
- package/dist/cjs/src/encrypt/algorithms/aes-gcm/generateKeyAESGCM.js +7 -0
- package/dist/cjs/src/encrypt/algorithms/aes-gcm/validateKeyAESGCM.js +11 -0
- package/dist/cjs/src/encrypt/index.js +95 -0
- package/dist/cjs/src/errors/AttemptingToMarshalInvalidArrayType.js +20 -0
- package/dist/cjs/src/errors/CannotCallUndestroyOnANonSoftDeleteModel.js +21 -0
- package/dist/cjs/src/errors/CannotDefineAssociationWithBothDependentAndPassthrough.js +19 -0
- package/dist/cjs/src/errors/CannotDefineAssociationWithBothDependentAndRequiredOnClause.js +19 -0
- package/dist/cjs/src/errors/CannotNegateSimilarityClause.js +22 -0
- package/dist/cjs/src/errors/CannotPassAdditionalFieldsToPluckEachAfterCallback.js +22 -0
- package/dist/cjs/src/errors/CannotPassUndefinedAsAValueToAWhereClause.js +20 -0
- package/dist/cjs/src/errors/CannotReloadUnsavedDream.js +16 -0
- package/dist/cjs/src/errors/ConstructorOnlyForInternalUse.js +9 -0
- package/dist/cjs/src/errors/CreateOrFindByFailedToCreateAndFind.js +18 -0
- package/dist/cjs/src/errors/DoNotSetEncryptedFieldsDirectly.js +23 -0
- package/dist/cjs/src/errors/InvalidColumnName.js +19 -0
- package/dist/cjs/src/errors/InvalidDecimalFieldPassedToGenerator.js +19 -0
- package/dist/cjs/src/errors/InvalidTableAlias.js +30 -0
- package/dist/cjs/src/errors/InvalidTableName.js +23 -0
- package/dist/cjs/src/errors/LeftJoinPreloadIncompatibleWithFindEach.js +12 -0
- package/dist/cjs/src/errors/MissingDB.js +10 -0
- package/dist/cjs/src/errors/MissingDeletedAtFieldForSoftDelete.js +24 -0
- package/dist/cjs/src/errors/MissingRequiredCallbackFunctionToPluckEach.js +22 -0
- package/dist/cjs/src/errors/MissingSerializersDefinition.js +26 -0
- package/dist/cjs/src/errors/MissingTable.js +27 -0
- package/dist/cjs/src/errors/NoUpdateAllOnJoins.js +13 -0
- package/dist/cjs/src/errors/NoUpdateOnAssociationQuery.js +10 -0
- package/dist/cjs/src/errors/NonBelongsToAssociationProvidedAsSortableDecoratorScope.js +23 -0
- package/dist/cjs/src/errors/NonExistentScopeProvidedToResort.js +23 -0
- package/dist/cjs/src/errors/PrototypePollutingAssignment.js +13 -0
- package/dist/cjs/src/errors/RecordNotFound.js +15 -0
- package/dist/cjs/src/errors/SortableDecoratorRequiresColumnOrBelongsToAssociation.js +26 -0
- package/dist/cjs/src/errors/ValidationError.js +19 -0
- package/dist/cjs/src/errors/associations/CanOnlyPassBelongsToModelParam.js +20 -0
- package/dist/cjs/src/errors/associations/CannotAssociateThroughPolymorphic.js +19 -0
- package/dist/cjs/src/errors/associations/CannotCreateAssociationWithThroughContext.js +19 -0
- package/dist/cjs/src/errors/associations/CannotJoinPolymorphicBelongsToError.js +27 -0
- package/dist/cjs/src/errors/associations/CannotPassNullOrUndefinedToRequiredBelongsTo.js +19 -0
- package/dist/cjs/src/errors/associations/InvalidComputedForeignKey.js +64 -0
- package/dist/cjs/src/errors/associations/JoinAttemptedOnMissingAssociation.js +27 -0
- package/dist/cjs/src/errors/associations/MissingRequiredAssociationOnClause.js +19 -0
- package/dist/cjs/src/errors/associations/MissingRequiredPassthroughForAssociationOnClause.js +16 -0
- package/dist/cjs/src/errors/associations/MissingThroughAssociation.js +27 -0
- package/dist/cjs/src/errors/associations/MissingThroughAssociationSource.js +42 -0
- package/dist/cjs/src/errors/associations/NonLoadedAssociation.js +18 -0
- package/dist/cjs/src/errors/dream-application/DreamApplicationInitMissingCallToLoadModels.js +18 -0
- package/dist/cjs/src/errors/dream-application/DreamApplicationInitMissingMissingProjectRoot.js +19 -0
- package/dist/cjs/src/errors/dream-application/GlobalNameNotSet.js +14 -0
- package/dist/cjs/src/errors/dream-application/SerializerNameConflict.js +15 -0
- package/dist/cjs/src/errors/encrypt/MissingColumnEncryptionOpts.js +27 -0
- package/dist/cjs/src/errors/encrypt/MissingEncryptionKey.js +12 -0
- package/dist/cjs/src/errors/environment/MissingRequiredEnvironmentVariable.js +13 -0
- package/dist/cjs/src/errors/ops/AnyRequiresArrayColumn.js +18 -0
- package/dist/cjs/src/errors/ops/ScoreMustBeANormalNumber.js +17 -0
- package/dist/cjs/src/errors/schema-builder/FailedToIdentifyAssociation.js +80 -0
- package/dist/cjs/src/errors/serializers/FailedToRenderThroughAssociationForSerializer.js +17 -0
- package/dist/cjs/src/errors/sortable/CannotCallSortableOnSTIChild.js +18 -0
- package/dist/cjs/src/errors/sti/STIChildMissing.js +23 -0
- package/dist/cjs/src/errors/sti/StiChildCannotDefineNewAssociations.js +20 -0
- package/dist/cjs/src/errors/sti/StiChildIncompatibleWithReplicaSafeDecorator.js +17 -0
- package/dist/cjs/src/errors/sti/StiChildIncompatibleWithSoftDeleteDecorator.js +17 -0
- package/dist/cjs/src/global-cli/dream.js +46 -0
- package/dist/cjs/src/global-cli/file-builders/DreamtsBuilder.js +69 -0
- package/dist/cjs/src/global-cli/file-builders/EnvBuilder.js +27 -0
- package/dist/cjs/src/global-cli/file-builders/EslintConfBuilder.js +29 -0
- package/dist/cjs/src/global-cli/file-builders/PackagejsonBuilder.js +9 -0
- package/dist/cjs/src/global-cli/helpers/argAndValue.js +15 -0
- package/dist/cjs/src/global-cli/helpers/autogeneratedFileMessage.js +71 -0
- package/dist/cjs/src/global-cli/helpers/buildNewDreamApp.js +63 -0
- package/dist/cjs/src/global-cli/helpers/copyRecursive.js +20 -0
- package/dist/cjs/src/global-cli/helpers/filterObjectByKey.js +23 -0
- package/dist/cjs/src/global-cli/helpers/generateEncryptionKey.js +26 -0
- package/dist/cjs/src/global-cli/helpers/globalCliSnakeify.js +1 -0
- package/dist/cjs/src/global-cli/helpers/initDreamAppIntoExistingProject.js +85 -0
- package/dist/cjs/src/global-cli/helpers/log.js +28 -0
- package/dist/cjs/src/global-cli/helpers/logo.js +81 -0
- package/dist/cjs/src/global-cli/helpers/primaryKeyTypes.js +13 -0
- package/dist/cjs/src/global-cli/helpers/prompt.js +33 -0
- package/dist/cjs/src/global-cli/helpers/select.js +113 -0
- package/dist/cjs/src/global-cli/helpers/sleep.js +10 -0
- package/dist/cjs/src/global-cli/helpers/sspawn.js +21 -0
- package/dist/cjs/src/global-cli/helpers/welcomeMessage.js +41 -0
- package/dist/cjs/src/global-cli/init.js +56 -0
- package/dist/cjs/src/global-cli/new.js +10 -0
- package/dist/cjs/src/helpers/CalendarDate.js +172 -0
- package/dist/cjs/src/helpers/Env.js +78 -0
- package/dist/cjs/src/helpers/EnvInternal.js +5 -0
- package/dist/cjs/src/helpers/allNestedObjectKeys.js +12 -0
- package/dist/cjs/src/helpers/benchmark.js +18 -0
- package/dist/cjs/src/helpers/camelize.js +15 -0
- package/dist/cjs/src/helpers/capitalize.js +6 -0
- package/dist/cjs/src/helpers/cli/SchemaBuilder.js +378 -0
- package/dist/cjs/src/helpers/cli/generateDream.js +48 -0
- package/dist/cjs/src/helpers/cli/generateDreamContent.js +107 -0
- package/dist/cjs/src/helpers/cli/generateFactory.js +26 -0
- package/dist/cjs/src/helpers/cli/generateFactoryContent.js +58 -0
- package/dist/cjs/src/helpers/cli/generateMigration.js +56 -0
- package/dist/cjs/src/helpers/cli/generateMigrationContent.js +196 -0
- package/dist/cjs/src/helpers/cli/generateSerializer.js +26 -0
- package/dist/cjs/src/helpers/cli/generateSerializerContent.js +130 -0
- package/dist/cjs/src/helpers/cli/generateStiMigrationContent.js +7 -0
- package/dist/cjs/src/helpers/cli/generateUnitSpec.js +26 -0
- package/dist/cjs/src/helpers/cli/generateUnitSpecContent.js +10 -0
- package/dist/cjs/src/helpers/cloneDeepSafe.js +69 -0
- package/dist/cjs/src/helpers/compact.js +14 -0
- package/dist/cjs/src/helpers/customPgParsers.js +39 -0
- package/dist/cjs/src/helpers/db/cachedTypeForAttribute.js +6 -0
- package/dist/cjs/src/helpers/db/createDb.js +20 -0
- package/dist/cjs/src/helpers/db/dropDb.js +36 -0
- package/dist/cjs/src/helpers/db/foreignKeyTypeFromPrimaryKey.js +11 -0
- package/dist/cjs/src/helpers/db/loadPgClient.js +20 -0
- package/dist/cjs/src/helpers/db/primaryKeyType.js +23 -0
- package/dist/cjs/src/helpers/db/runMigration.js +97 -0
- package/dist/cjs/src/helpers/db/truncateDb.js +27 -0
- package/dist/cjs/src/helpers/db/types/isDatabaseArrayColumn.js +6 -0
- package/dist/cjs/src/helpers/db/types/isDateColumn.js +6 -0
- package/dist/cjs/src/helpers/db/types/isDateTimeColumn.js +6 -0
- package/dist/cjs/src/helpers/db/types/isJsonColumn.js +6 -0
- package/dist/cjs/src/helpers/debug.js +11 -0
- package/dist/cjs/src/helpers/dreamOrPsychicCoreDevelopment.js +10 -0
- package/dist/cjs/src/helpers/filterObjectByKey.js +14 -0
- package/dist/cjs/src/helpers/getFiles.js +20 -0
- package/dist/cjs/src/helpers/globalClassNameFromFullyQualifiedModelName.js +7 -0
- package/dist/cjs/src/helpers/hyphenize.js +11 -0
- package/dist/cjs/src/helpers/inferSerializerFromDreamOrViewModel.js +16 -0
- package/dist/cjs/src/helpers/isEmpty.js +8 -0
- package/dist/cjs/src/helpers/loadEnv.js +37 -0
- package/dist/cjs/src/helpers/loadRepl.js +25 -0
- package/dist/cjs/src/helpers/migrationVersion.js +6 -0
- package/dist/cjs/src/helpers/namespaceColumn.js +8 -0
- package/dist/cjs/src/helpers/objectPathsToArrays.js +19 -0
- package/dist/cjs/src/helpers/pascalize.js +12 -0
- package/dist/cjs/src/helpers/pascalizePath.js +10 -0
- package/dist/cjs/src/helpers/path/dreamFileAndDirPaths.js +16 -0
- package/dist/cjs/src/helpers/path/dreamPath.js +25 -0
- package/dist/cjs/src/helpers/path/relativeDreamPath.js +50 -0
- package/dist/cjs/src/helpers/path/sharedPathPrefix.js +14 -0
- package/dist/cjs/src/helpers/propertyNameFromFullyQualifiedModelName.js +8 -0
- package/dist/cjs/src/helpers/protectAgainstPollutingAssignment.js +14 -0
- package/dist/cjs/src/helpers/range.js +20 -0
- package/dist/cjs/src/helpers/round.js +7 -0
- package/dist/cjs/src/helpers/serializerNameFromFullyQualifiedModelName.js +13 -0
- package/dist/cjs/src/helpers/snakeify.js +14 -0
- package/dist/cjs/src/helpers/sortBy.js +31 -0
- package/dist/cjs/src/helpers/sqlAttributes.js +28 -0
- package/dist/cjs/src/helpers/sspawn.js +21 -0
- package/dist/cjs/src/helpers/standardizeFullyQualifiedModelName.js +10 -0
- package/dist/cjs/src/helpers/stringCasing.js +34 -0
- package/dist/cjs/src/helpers/typechecks.js +16 -0
- package/dist/cjs/src/helpers/typeutils.js +2 -0
- package/dist/cjs/src/helpers/uncapitalize.js +6 -0
- package/dist/cjs/src/helpers/uniq.js +21 -0
- package/dist/cjs/src/index.js +154 -0
- package/dist/cjs/src/openapi/types.js +26 -0
- package/dist/cjs/src/ops/curried-ops-statement.js +12 -0
- package/dist/cjs/src/ops/index.js +42 -0
- package/dist/cjs/src/ops/ops-statement.js +38 -0
- package/dist/cjs/src/serializer/decorators/associations/RendersMany.js +84 -0
- package/dist/cjs/src/serializer/decorators/associations/RendersOne.js +87 -0
- package/dist/cjs/src/serializer/decorators/associations/shared.js +10 -0
- package/dist/cjs/src/serializer/decorators/attribute.js +161 -0
- package/dist/cjs/src/serializer/decorators/helpers/dreamAttributeOpenapiShape.js +78 -0
- package/dist/cjs/src/serializer/decorators/helpers/hasSerializersGetter.js +11 -0
- package/dist/cjs/src/serializer/decorators/helpers/maybeSerializableToDreamSerializerCallbackFunction.js +20 -0
- package/dist/cjs/src/serializer/index.js +271 -0
- package/dist/esm/boilerplate/package.json +42 -0
- package/dist/esm/src/Dream.js +2981 -0
- package/dist/esm/src/bin/helpers/sync.js +106 -0
- package/dist/esm/src/bin/index.js +104 -0
- package/dist/esm/src/cli/index.js +152 -0
- package/dist/esm/src/db/ConnectedToDB.js +40 -0
- package/dist/esm/src/db/ConnectionConfRetriever.js +19 -0
- package/dist/esm/src/db/DreamDbConnection.js +72 -0
- package/dist/esm/src/db/dataTypes.js +53 -0
- package/dist/esm/src/db/errors.js +13 -0
- package/dist/esm/src/db/index.js +9 -0
- package/dist/esm/src/db/migration-helpers/DreamMigrationHelpers.js +190 -0
- package/dist/esm/src/db/reflections.js +1 -0
- package/dist/esm/src/db/types.js +1 -0
- package/dist/esm/src/db/validators/validateColumn.js +8 -0
- package/dist/esm/src/db/validators/validateTable.js +6 -0
- package/dist/esm/src/db/validators/validateTableAlias.js +52 -0
- package/dist/esm/src/decorators/DecoratorContextType.js +1 -0
- package/dist/esm/src/decorators/Decorators.js +323 -0
- package/dist/esm/src/decorators/Encrypted.js +80 -0
- package/dist/esm/src/decorators/ReplicaSafe.js +9 -0
- package/dist/esm/src/decorators/STI.js +31 -0
- package/dist/esm/src/decorators/Scope.js +27 -0
- package/dist/esm/src/decorators/SoftDelete.js +50 -0
- package/dist/esm/src/decorators/Virtual.js +25 -0
- package/dist/esm/src/decorators/associations/BelongsTo.js +74 -0
- package/dist/esm/src/decorators/associations/HasMany.js +97 -0
- package/dist/esm/src/decorators/associations/HasOne.js +93 -0
- package/dist/esm/src/decorators/associations/associationToGetterSetterProp.js +3 -0
- package/dist/esm/src/decorators/associations/shared.js +123 -0
- package/dist/esm/src/decorators/helpers/freezeBaseClassArrayMap.js +7 -0
- package/dist/esm/src/decorators/hooks/AfterCreate.js +22 -0
- package/dist/esm/src/decorators/hooks/AfterCreateCommit.js +39 -0
- package/dist/esm/src/decorators/hooks/AfterDestroy.js +21 -0
- package/dist/esm/src/decorators/hooks/AfterDestroyCommit.js +36 -0
- package/dist/esm/src/decorators/hooks/AfterSave.js +22 -0
- package/dist/esm/src/decorators/hooks/AfterSaveCommit.js +39 -0
- package/dist/esm/src/decorators/hooks/AfterUpdate.js +22 -0
- package/dist/esm/src/decorators/hooks/AfterUpdateCommit.js +39 -0
- package/dist/esm/src/decorators/hooks/BeforeCreate.js +22 -0
- package/dist/esm/src/decorators/hooks/BeforeDestroy.js +21 -0
- package/dist/esm/src/decorators/hooks/BeforeSave.js +22 -0
- package/dist/esm/src/decorators/hooks/BeforeUpdate.js +22 -0
- package/dist/esm/src/decorators/hooks/shared.js +20 -0
- package/dist/esm/src/decorators/sortable/Sortable.js +157 -0
- package/dist/esm/src/decorators/sortable/helpers/applySortableScopeToQuery.js +14 -0
- package/dist/esm/src/decorators/sortable/helpers/clearCachedSortableValues.js +8 -0
- package/dist/esm/src/decorators/sortable/helpers/decrementScopedRecordsGreaterThanPosition.js +23 -0
- package/dist/esm/src/decorators/sortable/helpers/getColumnForSortableScope.js +15 -0
- package/dist/esm/src/decorators/sortable/helpers/isSortedCorrectly.js +4 -0
- package/dist/esm/src/decorators/sortable/helpers/positionIsInvalid.js +8 -0
- package/dist/esm/src/decorators/sortable/helpers/resortAllRecords.js +35 -0
- package/dist/esm/src/decorators/sortable/helpers/scopeArray.js +7 -0
- package/dist/esm/src/decorators/sortable/helpers/setPosition.js +154 -0
- package/dist/esm/src/decorators/sortable/helpers/sortableCacheKeyName.js +4 -0
- package/dist/esm/src/decorators/sortable/helpers/sortableCacheValuesName.js +4 -0
- package/dist/esm/src/decorators/sortable/helpers/sortableQueryExcludingDream.js +7 -0
- package/dist/esm/src/decorators/sortable/hooks/afterSortableCreate.js +15 -0
- package/dist/esm/src/decorators/sortable/hooks/afterSortableDestroy.js +11 -0
- package/dist/esm/src/decorators/sortable/hooks/afterSortableUpdate.js +28 -0
- package/dist/esm/src/decorators/sortable/hooks/beforeSortableSave.js +62 -0
- package/dist/esm/src/decorators/validations/Validate.js +19 -0
- package/dist/esm/src/decorators/validations/Validates.js +64 -0
- package/dist/esm/src/decorators/validations/shared.js +1 -0
- package/dist/esm/src/dream/DreamClassTransactionBuilder.js +589 -0
- package/dist/esm/src/dream/DreamInstanceTransactionBuilder.js +477 -0
- package/dist/esm/src/dream/DreamTransaction.js +23 -0
- package/dist/esm/src/dream/LeftJoinLoadBuilder.js +74 -0
- package/dist/esm/src/dream/LoadBuilder.js +65 -0
- package/dist/esm/src/dream/Query.js +2615 -0
- package/dist/esm/src/dream/internal/applyScopeBypassingSettingsToQuery.js +8 -0
- package/dist/esm/src/dream/internal/associations/associationQuery.js +20 -0
- package/dist/esm/src/dream/internal/associations/associationUpdateQuery.js +33 -0
- package/dist/esm/src/dream/internal/associations/createAssociation.js +52 -0
- package/dist/esm/src/dream/internal/associations/destroyAssociation.js +14 -0
- package/dist/esm/src/dream/internal/associations/undestroyAssociation.js +9 -0
- package/dist/esm/src/dream/internal/checkSingleValidation.js +49 -0
- package/dist/esm/src/dream/internal/destroyAssociatedRecords.js +18 -0
- package/dist/esm/src/dream/internal/destroyDream.js +69 -0
- package/dist/esm/src/dream/internal/destroyOptions.js +27 -0
- package/dist/esm/src/dream/internal/ensureSTITypeFieldIsSet.js +7 -0
- package/dist/esm/src/dream/internal/executeDatabaseQuery.js +21 -0
- package/dist/esm/src/dream/internal/extractAssociationMetadataFromAssociationName.js +5 -0
- package/dist/esm/src/dream/internal/orderByDirection.js +12 -0
- package/dist/esm/src/dream/internal/reload.js +18 -0
- package/dist/esm/src/dream/internal/runHooksFor.js +95 -0
- package/dist/esm/src/dream/internal/runValidations.js +13 -0
- package/dist/esm/src/dream/internal/safelyRunCommitHooks.js +12 -0
- package/dist/esm/src/dream/internal/saveDream.js +64 -0
- package/dist/esm/src/dream/internal/scopeHelpers.js +9 -0
- package/dist/esm/src/dream/internal/shouldBypassDefaultScope.js +9 -0
- package/dist/esm/src/dream/internal/similarity/SimilarityBuilder.js +327 -0
- package/dist/esm/src/dream/internal/similarity/similaritySelectSql.js +18 -0
- package/dist/esm/src/dream/internal/similarity/similarityWhereSql.js +18 -0
- package/dist/esm/src/dream/internal/softDeleteDream.js +19 -0
- package/dist/esm/src/dream/internal/sqlResultToDreamInstance.js +34 -0
- package/dist/esm/src/dream/internal/undestroyDream.js +87 -0
- package/dist/esm/src/dream/types.js +95 -0
- package/dist/esm/src/dream-application/cache.js +9 -0
- package/dist/esm/src/dream-application/helpers/DreamImporter.js +49 -0
- package/dist/esm/src/dream-application/helpers/globalModelKeyFromPath.js +7 -0
- package/dist/esm/src/dream-application/helpers/globalSerializerKeyFromPath.js +14 -0
- package/dist/esm/src/dream-application/helpers/globalServiceKeyFromPath.js +8 -0
- package/dist/esm/src/dream-application/helpers/importers/importModels.js +75 -0
- package/dist/esm/src/dream-application/helpers/importers/importSerializers.js +57 -0
- package/dist/esm/src/dream-application/helpers/importers/importServices.js +37 -0
- package/dist/esm/src/dream-application/helpers/lookupClassByGlobalName.js +14 -0
- package/dist/esm/src/dream-application/helpers/lookupModelByGlobalName.js +10 -0
- package/dist/esm/src/dream-application/helpers/lookupModelByGlobalNameOrNames.js +7 -0
- package/dist/esm/src/dream-application/index.js +281 -0
- package/dist/esm/src/encrypt/InternalEncrypt.js +29 -0
- package/dist/esm/src/encrypt/algorithms/aes-gcm/decryptAESGCM.js +23 -0
- package/dist/esm/src/encrypt/algorithms/aes-gcm/encryptAESGCM.js +9 -0
- package/dist/esm/src/encrypt/algorithms/aes-gcm/generateKeyAESGCM.js +4 -0
- package/dist/esm/src/encrypt/algorithms/aes-gcm/validateKeyAESGCM.js +8 -0
- package/dist/esm/src/encrypt/index.js +92 -0
- package/dist/esm/src/errors/AttemptingToMarshalInvalidArrayType.js +17 -0
- package/dist/esm/src/errors/CannotCallUndestroyOnANonSoftDeleteModel.js +18 -0
- package/dist/esm/src/errors/CannotDefineAssociationWithBothDependentAndPassthrough.js +16 -0
- package/dist/esm/src/errors/CannotDefineAssociationWithBothDependentAndRequiredOnClause.js +16 -0
- package/dist/esm/src/errors/CannotNegateSimilarityClause.js +19 -0
- package/dist/esm/src/errors/CannotPassAdditionalFieldsToPluckEachAfterCallback.js +19 -0
- package/dist/esm/src/errors/CannotPassUndefinedAsAValueToAWhereClause.js +17 -0
- package/dist/esm/src/errors/CannotReloadUnsavedDream.js +13 -0
- package/dist/esm/src/errors/ConstructorOnlyForInternalUse.js +6 -0
- package/dist/esm/src/errors/CreateOrFindByFailedToCreateAndFind.js +15 -0
- package/dist/esm/src/errors/DoNotSetEncryptedFieldsDirectly.js +20 -0
- package/dist/esm/src/errors/InvalidColumnName.js +16 -0
- package/dist/esm/src/errors/InvalidDecimalFieldPassedToGenerator.js +16 -0
- package/dist/esm/src/errors/InvalidTableAlias.js +27 -0
- package/dist/esm/src/errors/InvalidTableName.js +20 -0
- package/dist/esm/src/errors/LeftJoinPreloadIncompatibleWithFindEach.js +9 -0
- package/dist/esm/src/errors/MissingDB.js +7 -0
- package/dist/esm/src/errors/MissingDeletedAtFieldForSoftDelete.js +21 -0
- package/dist/esm/src/errors/MissingRequiredCallbackFunctionToPluckEach.js +19 -0
- package/dist/esm/src/errors/MissingSerializersDefinition.js +23 -0
- package/dist/esm/src/errors/MissingTable.js +24 -0
- package/dist/esm/src/errors/NoUpdateAllOnJoins.js +10 -0
- package/dist/esm/src/errors/NoUpdateOnAssociationQuery.js +7 -0
- package/dist/esm/src/errors/NonBelongsToAssociationProvidedAsSortableDecoratorScope.js +20 -0
- package/dist/esm/src/errors/NonExistentScopeProvidedToResort.js +20 -0
- package/dist/esm/src/errors/PrototypePollutingAssignment.js +10 -0
- package/dist/esm/src/errors/RecordNotFound.js +12 -0
- package/dist/esm/src/errors/SortableDecoratorRequiresColumnOrBelongsToAssociation.js +23 -0
- package/dist/esm/src/errors/ValidationError.js +16 -0
- package/dist/esm/src/errors/associations/CanOnlyPassBelongsToModelParam.js +17 -0
- package/dist/esm/src/errors/associations/CannotAssociateThroughPolymorphic.js +16 -0
- package/dist/esm/src/errors/associations/CannotCreateAssociationWithThroughContext.js +16 -0
- package/dist/esm/src/errors/associations/CannotJoinPolymorphicBelongsToError.js +24 -0
- package/dist/esm/src/errors/associations/CannotPassNullOrUndefinedToRequiredBelongsTo.js +16 -0
- package/dist/esm/src/errors/associations/InvalidComputedForeignKey.js +58 -0
- package/dist/esm/src/errors/associations/JoinAttemptedOnMissingAssociation.js +24 -0
- package/dist/esm/src/errors/associations/MissingRequiredAssociationOnClause.js +16 -0
- package/dist/esm/src/errors/associations/MissingRequiredPassthroughForAssociationOnClause.js +13 -0
- package/dist/esm/src/errors/associations/MissingThroughAssociation.js +24 -0
- package/dist/esm/src/errors/associations/MissingThroughAssociationSource.js +39 -0
- package/dist/esm/src/errors/associations/NonLoadedAssociation.js +15 -0
- package/dist/esm/src/errors/dream-application/DreamApplicationInitMissingCallToLoadModels.js +15 -0
- package/dist/esm/src/errors/dream-application/DreamApplicationInitMissingMissingProjectRoot.js +16 -0
- package/dist/esm/src/errors/dream-application/GlobalNameNotSet.js +11 -0
- package/dist/esm/src/errors/dream-application/SerializerNameConflict.js +12 -0
- package/dist/esm/src/errors/encrypt/MissingColumnEncryptionOpts.js +24 -0
- package/dist/esm/src/errors/encrypt/MissingEncryptionKey.js +9 -0
- package/dist/esm/src/errors/environment/MissingRequiredEnvironmentVariable.js +10 -0
- package/dist/esm/src/errors/ops/AnyRequiresArrayColumn.js +15 -0
- package/dist/esm/src/errors/ops/ScoreMustBeANormalNumber.js +14 -0
- package/dist/esm/src/errors/schema-builder/FailedToIdentifyAssociation.js +77 -0
- package/dist/esm/src/errors/serializers/FailedToRenderThroughAssociationForSerializer.js +14 -0
- package/dist/esm/src/errors/sortable/CannotCallSortableOnSTIChild.js +15 -0
- package/dist/esm/src/errors/sti/STIChildMissing.js +20 -0
- package/dist/esm/src/errors/sti/StiChildCannotDefineNewAssociations.js +17 -0
- package/dist/esm/src/errors/sti/StiChildIncompatibleWithReplicaSafeDecorator.js +14 -0
- package/dist/esm/src/errors/sti/StiChildIncompatibleWithSoftDeleteDecorator.js +14 -0
- package/dist/esm/src/global-cli/dream.js +44 -0
- package/dist/esm/src/global-cli/file-builders/DreamtsBuilder.js +66 -0
- package/dist/esm/src/global-cli/file-builders/EnvBuilder.js +24 -0
- package/dist/esm/src/global-cli/file-builders/EslintConfBuilder.js +26 -0
- package/dist/esm/src/global-cli/file-builders/PackagejsonBuilder.js +6 -0
- package/dist/esm/src/global-cli/helpers/argAndValue.js +12 -0
- package/dist/esm/src/global-cli/helpers/autogeneratedFileMessage.js +68 -0
- package/dist/esm/src/global-cli/helpers/buildNewDreamApp.js +60 -0
- package/dist/esm/src/global-cli/helpers/copyRecursive.js +17 -0
- package/dist/esm/src/global-cli/helpers/filterObjectByKey.js +20 -0
- package/dist/esm/src/global-cli/helpers/generateEncryptionKey.js +23 -0
- package/dist/esm/src/global-cli/helpers/globalCliSnakeify.js +1 -0
- package/dist/esm/src/global-cli/helpers/initDreamAppIntoExistingProject.js +82 -0
- package/dist/esm/src/global-cli/helpers/log.js +24 -0
- package/dist/esm/src/global-cli/helpers/logo.js +77 -0
- package/dist/esm/src/global-cli/helpers/primaryKeyTypes.js +10 -0
- package/dist/esm/src/global-cli/helpers/prompt.js +30 -0
- package/dist/esm/src/global-cli/helpers/select.js +110 -0
- package/dist/esm/src/global-cli/helpers/sleep.js +7 -0
- package/dist/esm/src/global-cli/helpers/sspawn.js +17 -0
- package/dist/esm/src/global-cli/helpers/welcomeMessage.js +38 -0
- package/dist/esm/src/global-cli/init.js +53 -0
- package/dist/esm/src/global-cli/new.js +7 -0
- package/dist/esm/src/helpers/CalendarDate.js +169 -0
- package/dist/esm/src/helpers/Env.js +75 -0
- package/dist/esm/src/helpers/EnvInternal.js +3 -0
- package/dist/esm/src/helpers/allNestedObjectKeys.js +9 -0
- package/dist/esm/src/helpers/benchmark.js +15 -0
- package/dist/esm/src/helpers/camelize.js +11 -0
- package/dist/esm/src/helpers/capitalize.js +3 -0
- package/dist/esm/src/helpers/cli/SchemaBuilder.js +375 -0
- package/dist/esm/src/helpers/cli/generateDream.js +45 -0
- package/dist/esm/src/helpers/cli/generateDreamContent.js +104 -0
- package/dist/esm/src/helpers/cli/generateFactory.js +23 -0
- package/dist/esm/src/helpers/cli/generateFactoryContent.js +55 -0
- package/dist/esm/src/helpers/cli/generateMigration.js +53 -0
- package/dist/esm/src/helpers/cli/generateMigrationContent.js +193 -0
- package/dist/esm/src/helpers/cli/generateSerializer.js +23 -0
- package/dist/esm/src/helpers/cli/generateSerializerContent.js +127 -0
- package/dist/esm/src/helpers/cli/generateStiMigrationContent.js +4 -0
- package/dist/esm/src/helpers/cli/generateUnitSpec.js +23 -0
- package/dist/esm/src/helpers/cli/generateUnitSpecContent.js +7 -0
- package/dist/esm/src/helpers/cloneDeepSafe.js +64 -0
- package/dist/esm/src/helpers/compact.js +11 -0
- package/dist/esm/src/helpers/customPgParsers.js +31 -0
- package/dist/esm/src/helpers/db/cachedTypeForAttribute.js +3 -0
- package/dist/esm/src/helpers/db/createDb.js +17 -0
- package/dist/esm/src/helpers/db/dropDb.js +33 -0
- package/dist/esm/src/helpers/db/foreignKeyTypeFromPrimaryKey.js +8 -0
- package/dist/esm/src/helpers/db/loadPgClient.js +17 -0
- package/dist/esm/src/helpers/db/primaryKeyType.js +20 -0
- package/dist/esm/src/helpers/db/runMigration.js +94 -0
- package/dist/esm/src/helpers/db/truncateDb.js +24 -0
- package/dist/esm/src/helpers/db/types/isDatabaseArrayColumn.js +3 -0
- package/dist/esm/src/helpers/db/types/isDateColumn.js +3 -0
- package/dist/esm/src/helpers/db/types/isDateTimeColumn.js +3 -0
- package/dist/esm/src/helpers/db/types/isJsonColumn.js +3 -0
- package/dist/esm/src/helpers/debug.js +8 -0
- package/dist/esm/src/helpers/dreamOrPsychicCoreDevelopment.js +7 -0
- package/dist/esm/src/helpers/filterObjectByKey.js +11 -0
- package/dist/esm/src/helpers/getFiles.js +17 -0
- package/dist/esm/src/helpers/globalClassNameFromFullyQualifiedModelName.js +4 -0
- package/dist/esm/src/helpers/hyphenize.js +8 -0
- package/dist/esm/src/helpers/inferSerializerFromDreamOrViewModel.js +12 -0
- package/dist/esm/src/helpers/isEmpty.js +5 -0
- package/dist/esm/src/helpers/loadEnv.js +35 -0
- package/dist/esm/src/helpers/loadRepl.js +22 -0
- package/dist/esm/src/helpers/migrationVersion.js +3 -0
- package/dist/esm/src/helpers/namespaceColumn.js +5 -0
- package/dist/esm/src/helpers/objectPathsToArrays.js +16 -0
- package/dist/esm/src/helpers/pascalize.js +9 -0
- package/dist/esm/src/helpers/pascalizePath.js +7 -0
- package/dist/esm/src/helpers/path/dreamFileAndDirPaths.js +13 -0
- package/dist/esm/src/helpers/path/dreamPath.js +22 -0
- package/dist/esm/src/helpers/path/relativeDreamPath.js +46 -0
- package/dist/esm/src/helpers/path/sharedPathPrefix.js +11 -0
- package/dist/esm/src/helpers/propertyNameFromFullyQualifiedModelName.js +5 -0
- package/dist/esm/src/helpers/protectAgainstPollutingAssignment.js +11 -0
- package/dist/esm/src/helpers/range.js +15 -0
- package/dist/esm/src/helpers/round.js +4 -0
- package/dist/esm/src/helpers/serializerNameFromFullyQualifiedModelName.js +10 -0
- package/dist/esm/src/helpers/snakeify.js +10 -0
- package/dist/esm/src/helpers/sortBy.js +26 -0
- package/dist/esm/src/helpers/sqlAttributes.js +25 -0
- package/dist/esm/src/helpers/sspawn.js +17 -0
- package/dist/esm/src/helpers/standardizeFullyQualifiedModelName.js +7 -0
- package/dist/esm/src/helpers/stringCasing.js +31 -0
- package/dist/esm/src/helpers/typechecks.js +12 -0
- package/dist/esm/src/helpers/typeutils.js +1 -0
- package/dist/esm/src/helpers/uncapitalize.js +3 -0
- package/dist/esm/src/helpers/uniq.js +18 -0
- package/dist/esm/src/index.js +73 -0
- package/dist/esm/src/openapi/types.js +23 -0
- package/dist/esm/src/ops/curried-ops-statement.js +9 -0
- package/dist/esm/src/ops/index.js +40 -0
- package/dist/esm/src/ops/ops-statement.js +35 -0
- package/dist/esm/src/serializer/decorators/associations/RendersMany.js +81 -0
- package/dist/esm/src/serializer/decorators/associations/RendersOne.js +84 -0
- package/dist/esm/src/serializer/decorators/associations/shared.js +7 -0
- package/dist/esm/src/serializer/decorators/attribute.js +158 -0
- package/dist/esm/src/serializer/decorators/helpers/dreamAttributeOpenapiShape.js +73 -0
- package/dist/esm/src/serializer/decorators/helpers/hasSerializersGetter.js +8 -0
- package/dist/esm/src/serializer/decorators/helpers/maybeSerializableToDreamSerializerCallbackFunction.js +17 -0
- package/dist/esm/src/serializer/index.js +268 -0
- package/dist/types/src/Dream.d.ts +2211 -0
- package/dist/types/src/bin/helpers/sync.d.ts +2 -0
- package/dist/types/src/bin/index.d.ts +20 -0
- package/dist/types/src/cli/index.d.ts +20 -0
- package/dist/types/src/db/ConnectedToDB.d.ts +26 -0
- package/dist/types/src/db/ConnectionConfRetriever.d.ts +6 -0
- package/dist/types/src/db/DreamDbConnection.d.ts +10 -0
- package/dist/types/src/db/dataTypes.d.ts +6 -0
- package/dist/types/src/db/errors.d.ts +6 -0
- package/dist/types/src/db/index.d.ts +5 -0
- package/dist/types/src/db/migration-helpers/DreamMigrationHelpers.d.ts +116 -0
- package/dist/types/src/db/reflections.d.ts +5 -0
- package/dist/types/src/db/types.d.ts +1 -0
- package/dist/types/src/db/validators/validateColumn.d.ts +1 -0
- package/dist/types/src/db/validators/validateTable.d.ts +1 -0
- package/dist/types/src/db/validators/validateTableAlias.d.ts +1 -0
- package/dist/types/src/decorators/DecoratorContextType.d.ts +13 -0
- package/dist/types/src/decorators/Decorators.d.ts +214 -0
- package/dist/types/src/decorators/Encrypted.d.ts +5 -0
- package/dist/types/src/decorators/ReplicaSafe.d.ts +1 -0
- package/dist/types/src/decorators/STI.d.ts +5 -0
- package/dist/types/src/decorators/Scope.d.ts +11 -0
- package/dist/types/src/decorators/SoftDelete.d.ts +37 -0
- package/dist/types/src/decorators/Virtual.d.ts +6 -0
- package/dist/types/src/decorators/associations/BelongsTo.d.ts +33 -0
- package/dist/types/src/decorators/associations/HasMany.d.ts +19 -0
- package/dist/types/src/decorators/associations/HasOne.d.ts +11 -0
- package/dist/types/src/decorators/associations/associationToGetterSetterProp.d.ts +5 -0
- package/dist/types/src/decorators/associations/shared.d.ts +118 -0
- package/dist/types/src/decorators/helpers/freezeBaseClassArrayMap.d.ts +1 -0
- package/dist/types/src/decorators/hooks/AfterCreate.d.ts +4 -0
- package/dist/types/src/decorators/hooks/AfterCreateCommit.d.ts +21 -0
- package/dist/types/src/decorators/hooks/AfterDestroy.d.ts +3 -0
- package/dist/types/src/decorators/hooks/AfterDestroyCommit.d.ts +18 -0
- package/dist/types/src/decorators/hooks/AfterSave.d.ts +4 -0
- package/dist/types/src/decorators/hooks/AfterSaveCommit.d.ts +21 -0
- package/dist/types/src/decorators/hooks/AfterUpdate.d.ts +4 -0
- package/dist/types/src/decorators/hooks/AfterUpdateCommit.d.ts +21 -0
- package/dist/types/src/decorators/hooks/BeforeCreate.d.ts +4 -0
- package/dist/types/src/decorators/hooks/BeforeDestroy.d.ts +3 -0
- package/dist/types/src/decorators/hooks/BeforeSave.d.ts +4 -0
- package/dist/types/src/decorators/hooks/BeforeUpdate.d.ts +4 -0
- package/dist/types/src/decorators/hooks/shared.d.ts +34 -0
- package/dist/types/src/decorators/sortable/Sortable.d.ts +9 -0
- package/dist/types/src/decorators/sortable/helpers/applySortableScopeToQuery.d.ts +9 -0
- package/dist/types/src/decorators/sortable/helpers/clearCachedSortableValues.d.ts +2 -0
- package/dist/types/src/decorators/sortable/helpers/decrementScopedRecordsGreaterThanPosition.d.ts +8 -0
- package/dist/types/src/decorators/sortable/helpers/getColumnForSortableScope.d.ts +2 -0
- package/dist/types/src/decorators/sortable/helpers/isSortedCorrectly.d.ts +1 -0
- package/dist/types/src/decorators/sortable/helpers/positionIsInvalid.d.ts +8 -0
- package/dist/types/src/decorators/sortable/helpers/resortAllRecords.d.ts +2 -0
- package/dist/types/src/decorators/sortable/helpers/scopeArray.d.ts +1 -0
- package/dist/types/src/decorators/sortable/helpers/setPosition.d.ts +14 -0
- package/dist/types/src/decorators/sortable/helpers/sortableCacheKeyName.d.ts +1 -0
- package/dist/types/src/decorators/sortable/helpers/sortableCacheValuesName.d.ts +1 -0
- package/dist/types/src/decorators/sortable/helpers/sortableQueryExcludingDream.d.ts +9 -0
- package/dist/types/src/decorators/sortable/hooks/afterSortableCreate.d.ts +10 -0
- package/dist/types/src/decorators/sortable/hooks/afterSortableDestroy.d.ts +8 -0
- package/dist/types/src/decorators/sortable/hooks/afterSortableUpdate.d.ts +10 -0
- package/dist/types/src/decorators/sortable/hooks/beforeSortableSave.d.ts +8 -0
- package/dist/types/src/decorators/validations/Validate.d.ts +1 -0
- package/dist/types/src/decorators/validations/Validates.d.ts +18 -0
- package/dist/types/src/decorators/validations/shared.d.ts +19 -0
- package/dist/types/src/dream/DreamClassTransactionBuilder.d.ts +549 -0
- package/dist/types/src/dream/DreamInstanceTransactionBuilder.d.ts +316 -0
- package/dist/types/src/dream/DreamTransaction.d.ts +15 -0
- package/dist/types/src/dream/LeftJoinLoadBuilder.d.ts +48 -0
- package/dist/types/src/dream/LoadBuilder.d.ts +47 -0
- package/dist/types/src/dream/Query.d.ts +1132 -0
- package/dist/types/src/dream/internal/applyScopeBypassingSettingsToQuery.d.ts +13 -0
- package/dist/types/src/dream/internal/associations/associationQuery.d.ts +9 -0
- package/dist/types/src/dream/internal/associations/associationUpdateQuery.d.ts +9 -0
- package/dist/types/src/dream/internal/associations/createAssociation.d.ts +4 -0
- package/dist/types/src/dream/internal/associations/destroyAssociation.d.ts +11 -0
- package/dist/types/src/dream/internal/associations/undestroyAssociation.d.ts +10 -0
- package/dist/types/src/dream/internal/checkSingleValidation.d.ts +3 -0
- package/dist/types/src/dream/internal/destroyAssociatedRecords.d.ts +10 -0
- package/dist/types/src/dream/internal/destroyDream.d.ts +19 -0
- package/dist/types/src/dream/internal/destroyOptions.d.ts +46 -0
- package/dist/types/src/dream/internal/ensureSTITypeFieldIsSet.d.ts +2 -0
- package/dist/types/src/dream/internal/executeDatabaseQuery.d.ts +1 -0
- package/dist/types/src/dream/internal/extractAssociationMetadataFromAssociationName.d.ts +4 -0
- package/dist/types/src/dream/internal/orderByDirection.d.ts +2 -0
- package/dist/types/src/dream/internal/reload.d.ts +3 -0
- package/dist/types/src/dream/internal/runHooksFor.d.ts +8 -0
- package/dist/types/src/dream/internal/runValidations.d.ts +2 -0
- package/dist/types/src/dream/internal/safelyRunCommitHooks.d.ts +7 -0
- package/dist/types/src/dream/internal/saveDream.d.ts +5 -0
- package/dist/types/src/dream/internal/scopeHelpers.d.ts +7 -0
- package/dist/types/src/dream/internal/shouldBypassDefaultScope.d.ts +4 -0
- package/dist/types/src/dream/internal/similarity/SimilarityBuilder.d.ts +38 -0
- package/dist/types/src/dream/internal/similarity/similaritySelectSql.d.ts +11 -0
- package/dist/types/src/dream/internal/similarity/similarityWhereSql.d.ts +10 -0
- package/dist/types/src/dream/internal/softDeleteDream.d.ts +3 -0
- package/dist/types/src/dream/internal/sqlResultToDreamInstance.d.ts +4 -0
- package/dist/types/src/dream/internal/undestroyDream.d.ts +16 -0
- package/dist/types/src/dream/types.d.ts +184 -0
- package/dist/types/src/dream-application/cache.d.ts +3 -0
- package/dist/types/src/dream-application/helpers/DreamImporter.d.ts +8 -0
- package/dist/types/src/dream-application/helpers/globalModelKeyFromPath.d.ts +1 -0
- package/dist/types/src/dream-application/helpers/globalSerializerKeyFromPath.d.ts +1 -0
- package/dist/types/src/dream-application/helpers/globalServiceKeyFromPath.d.ts +1 -0
- package/dist/types/src/dream-application/helpers/importers/importModels.d.ts +5 -0
- package/dist/types/src/dream-application/helpers/importers/importSerializers.d.ts +5 -0
- package/dist/types/src/dream-application/helpers/importers/importServices.d.ts +4 -0
- package/dist/types/src/dream-application/helpers/lookupClassByGlobalName.d.ts +1 -0
- package/dist/types/src/dream-application/helpers/lookupModelByGlobalName.d.ts +1 -0
- package/dist/types/src/dream-application/helpers/lookupModelByGlobalNameOrNames.d.ts +1 -0
- package/dist/types/src/dream-application/index.d.ts +143 -0
- package/dist/types/src/encrypt/InternalEncrypt.d.ts +6 -0
- package/dist/types/src/encrypt/algorithms/aes-gcm/decryptAESGCM.d.ts +2 -0
- package/dist/types/src/encrypt/algorithms/aes-gcm/encryptAESGCM.d.ts +2 -0
- package/dist/types/src/encrypt/algorithms/aes-gcm/generateKeyAESGCM.d.ts +2 -0
- package/dist/types/src/encrypt/algorithms/aes-gcm/validateKeyAESGCM.d.ts +2 -0
- package/dist/types/src/encrypt/index.d.ts +26 -0
- package/dist/types/src/errors/AttemptingToMarshalInvalidArrayType.d.ts +5 -0
- package/dist/types/src/errors/CannotCallUndestroyOnANonSoftDeleteModel.d.ts +6 -0
- package/dist/types/src/errors/CannotDefineAssociationWithBothDependentAndPassthrough.d.ts +7 -0
- package/dist/types/src/errors/CannotDefineAssociationWithBothDependentAndRequiredOnClause.d.ts +7 -0
- package/dist/types/src/errors/CannotNegateSimilarityClause.d.ts +7 -0
- package/dist/types/src/errors/CannotPassAdditionalFieldsToPluckEachAfterCallback.d.ts +6 -0
- package/dist/types/src/errors/CannotPassUndefinedAsAValueToAWhereClause.d.ts +7 -0
- package/dist/types/src/errors/CannotReloadUnsavedDream.d.ts +6 -0
- package/dist/types/src/errors/ConstructorOnlyForInternalUse.d.ts +3 -0
- package/dist/types/src/errors/CreateOrFindByFailedToCreateAndFind.d.ts +6 -0
- package/dist/types/src/errors/DoNotSetEncryptedFieldsDirectly.d.ts +8 -0
- package/dist/types/src/errors/InvalidColumnName.d.ts +6 -0
- package/dist/types/src/errors/InvalidDecimalFieldPassedToGenerator.d.ts +5 -0
- package/dist/types/src/errors/InvalidTableAlias.d.ts +5 -0
- package/dist/types/src/errors/InvalidTableName.d.ts +6 -0
- package/dist/types/src/errors/LeftJoinPreloadIncompatibleWithFindEach.d.ts +3 -0
- package/dist/types/src/errors/MissingDB.d.ts +3 -0
- package/dist/types/src/errors/MissingDeletedAtFieldForSoftDelete.d.ts +6 -0
- package/dist/types/src/errors/MissingRequiredCallbackFunctionToPluckEach.d.ts +6 -0
- package/dist/types/src/errors/MissingSerializersDefinition.d.ts +6 -0
- package/dist/types/src/errors/MissingTable.d.ts +6 -0
- package/dist/types/src/errors/NoUpdateAllOnJoins.d.ts +3 -0
- package/dist/types/src/errors/NoUpdateOnAssociationQuery.d.ts +3 -0
- package/dist/types/src/errors/NonBelongsToAssociationProvidedAsSortableDecoratorScope.d.ts +7 -0
- package/dist/types/src/errors/NonExistentScopeProvidedToResort.d.ts +7 -0
- package/dist/types/src/errors/PrototypePollutingAssignment.d.ts +5 -0
- package/dist/types/src/errors/RecordNotFound.d.ts +5 -0
- package/dist/types/src/errors/SortableDecoratorRequiresColumnOrBelongsToAssociation.d.ts +7 -0
- package/dist/types/src/errors/ValidationError.d.ts +11 -0
- package/dist/types/src/errors/associations/CanOnlyPassBelongsToModelParam.d.ts +9 -0
- package/dist/types/src/errors/associations/CannotAssociateThroughPolymorphic.d.ts +12 -0
- package/dist/types/src/errors/associations/CannotCreateAssociationWithThroughContext.d.ts +12 -0
- package/dist/types/src/errors/associations/CannotJoinPolymorphicBelongsToError.d.ts +15 -0
- package/dist/types/src/errors/associations/CannotPassNullOrUndefinedToRequiredBelongsTo.d.ts +8 -0
- package/dist/types/src/errors/associations/InvalidComputedForeignKey.d.ts +19 -0
- package/dist/types/src/errors/associations/JoinAttemptedOnMissingAssociation.d.ts +10 -0
- package/dist/types/src/errors/associations/MissingRequiredAssociationOnClause.d.ts +8 -0
- package/dist/types/src/errors/associations/MissingRequiredPassthroughForAssociationOnClause.d.ts +5 -0
- package/dist/types/src/errors/associations/MissingThroughAssociation.d.ts +12 -0
- package/dist/types/src/errors/associations/MissingThroughAssociationSource.d.ts +14 -0
- package/dist/types/src/errors/associations/NonLoadedAssociation.d.ts +10 -0
- package/dist/types/src/errors/dream-application/DreamApplicationInitMissingCallToLoadModels.d.ts +3 -0
- package/dist/types/src/errors/dream-application/DreamApplicationInitMissingMissingProjectRoot.d.ts +3 -0
- package/dist/types/src/errors/dream-application/GlobalNameNotSet.d.ts +5 -0
- package/dist/types/src/errors/dream-application/SerializerNameConflict.d.ts +5 -0
- package/dist/types/src/errors/encrypt/MissingColumnEncryptionOpts.d.ts +3 -0
- package/dist/types/src/errors/encrypt/MissingEncryptionKey.d.ts +3 -0
- package/dist/types/src/errors/environment/MissingRequiredEnvironmentVariable.d.ts +5 -0
- package/dist/types/src/errors/ops/AnyRequiresArrayColumn.d.ts +7 -0
- package/dist/types/src/errors/ops/ScoreMustBeANormalNumber.d.ts +5 -0
- package/dist/types/src/errors/schema-builder/FailedToIdentifyAssociation.d.ts +9 -0
- package/dist/types/src/errors/serializers/FailedToRenderThroughAssociationForSerializer.d.ts +6 -0
- package/dist/types/src/errors/sortable/CannotCallSortableOnSTIChild.d.ts +6 -0
- package/dist/types/src/errors/sti/STIChildMissing.d.ts +8 -0
- package/dist/types/src/errors/sti/StiChildCannotDefineNewAssociations.d.ts +7 -0
- package/dist/types/src/errors/sti/StiChildIncompatibleWithReplicaSafeDecorator.d.ts +6 -0
- package/dist/types/src/errors/sti/StiChildIncompatibleWithSoftDeleteDecorator.d.ts +6 -0
- package/dist/types/src/global-cli/dream.d.ts +2 -0
- package/dist/types/src/global-cli/file-builders/DreamtsBuilder.d.ts +4 -0
- package/dist/types/src/global-cli/file-builders/EnvBuilder.d.ts +6 -0
- package/dist/types/src/global-cli/file-builders/EslintConfBuilder.d.ts +3 -0
- package/dist/types/src/global-cli/file-builders/PackagejsonBuilder.d.ts +3 -0
- package/dist/types/src/global-cli/helpers/argAndValue.d.ts +1 -0
- package/dist/types/src/global-cli/helpers/autogeneratedFileMessage.d.ts +1 -0
- package/dist/types/src/global-cli/helpers/buildNewDreamApp.d.ts +2 -0
- package/dist/types/src/global-cli/helpers/copyRecursive.d.ts +1 -0
- package/dist/types/src/global-cli/helpers/filterObjectByKey.d.ts +1 -0
- package/dist/types/src/global-cli/helpers/generateEncryptionKey.d.ts +1 -0
- package/dist/types/src/global-cli/helpers/globalCliSnakeify.d.ts +0 -0
- package/dist/types/src/global-cli/helpers/initDreamAppIntoExistingProject.d.ts +2 -0
- package/dist/types/src/global-cli/helpers/log.d.ts +10 -0
- package/dist/types/src/global-cli/helpers/logo.d.ts +2 -0
- package/dist/types/src/global-cli/helpers/primaryKeyTypes.d.ts +22 -0
- package/dist/types/src/global-cli/helpers/prompt.d.ts +8 -0
- package/dist/types/src/global-cli/helpers/select.d.ts +17 -0
- package/dist/types/src/global-cli/helpers/sleep.d.ts +1 -0
- package/dist/types/src/global-cli/helpers/sspawn.d.ts +2 -0
- package/dist/types/src/global-cli/helpers/welcomeMessage.d.ts +1 -0
- package/dist/types/src/global-cli/init.d.ts +2 -0
- package/dist/types/src/global-cli/new.d.ts +2 -0
- package/dist/types/src/helpers/CalendarDate.d.ts +51 -0
- package/dist/types/src/helpers/Env.d.ts +37 -0
- package/dist/types/src/helpers/EnvInternal.d.ts +6 -0
- package/dist/types/src/helpers/allNestedObjectKeys.d.ts +1 -0
- package/dist/types/src/helpers/benchmark.d.ts +6 -0
- package/dist/types/src/helpers/camelize.d.ts +3 -0
- package/dist/types/src/helpers/capitalize.d.ts +1 -0
- package/dist/types/src/helpers/cli/SchemaBuilder.d.ts +17 -0
- package/dist/types/src/helpers/cli/generateDream.d.ts +8 -0
- package/dist/types/src/helpers/cli/generateDreamContent.d.ts +6 -0
- package/dist/types/src/helpers/cli/generateFactory.d.ts +4 -0
- package/dist/types/src/helpers/cli/generateFactoryContent.d.ts +4 -0
- package/dist/types/src/helpers/cli/generateMigration.d.ts +6 -0
- package/dist/types/src/helpers/cli/generateMigrationContent.d.ts +7 -0
- package/dist/types/src/helpers/cli/generateSerializer.d.ts +5 -0
- package/dist/types/src/helpers/cli/generateSerializerContent.d.ts +5 -0
- package/dist/types/src/helpers/cli/generateStiMigrationContent.d.ts +6 -0
- package/dist/types/src/helpers/cli/generateUnitSpec.d.ts +3 -0
- package/dist/types/src/helpers/cli/generateUnitSpecContent.d.ts +3 -0
- package/dist/types/src/helpers/cloneDeepSafe.d.ts +18 -0
- package/dist/types/src/helpers/compact.d.ts +19 -0
- package/dist/types/src/helpers/customPgParsers.d.ts +9 -0
- package/dist/types/src/helpers/db/cachedTypeForAttribute.d.ts +2 -0
- package/dist/types/src/helpers/db/createDb.d.ts +2 -0
- package/dist/types/src/helpers/db/dropDb.d.ts +2 -0
- package/dist/types/src/helpers/db/foreignKeyTypeFromPrimaryKey.d.ts +2 -0
- package/dist/types/src/helpers/db/loadPgClient.d.ts +3 -0
- package/dist/types/src/helpers/db/primaryKeyType.d.ts +1 -0
- package/dist/types/src/helpers/db/runMigration.d.ts +6 -0
- package/dist/types/src/helpers/db/truncateDb.d.ts +1 -0
- package/dist/types/src/helpers/db/types/isDatabaseArrayColumn.d.ts +2 -0
- package/dist/types/src/helpers/db/types/isDateColumn.d.ts +2 -0
- package/dist/types/src/helpers/db/types/isDateTimeColumn.d.ts +2 -0
- package/dist/types/src/helpers/db/types/isJsonColumn.d.ts +2 -0
- package/dist/types/src/helpers/debug.d.ts +4 -0
- package/dist/types/src/helpers/dreamOrPsychicCoreDevelopment.d.ts +1 -0
- package/dist/types/src/helpers/filterObjectByKey.d.ts +1 -0
- package/dist/types/src/helpers/getFiles.d.ts +1 -0
- package/dist/types/src/helpers/globalClassNameFromFullyQualifiedModelName.d.ts +1 -0
- package/dist/types/src/helpers/hyphenize.d.ts +2 -0
- package/dist/types/src/helpers/inferSerializerFromDreamOrViewModel.d.ts +4 -0
- package/dist/types/src/helpers/isEmpty.d.ts +1 -0
- package/dist/types/src/helpers/loadEnv.d.ts +1 -0
- package/dist/types/src/helpers/loadRepl.d.ts +2 -0
- package/dist/types/src/helpers/migrationVersion.d.ts +1 -0
- package/dist/types/src/helpers/namespaceColumn.d.ts +1 -0
- package/dist/types/src/helpers/objectPathsToArrays.d.ts +2 -0
- package/dist/types/src/helpers/pascalize.d.ts +2 -0
- package/dist/types/src/helpers/pascalizePath.d.ts +1 -0
- package/dist/types/src/helpers/path/dreamFileAndDirPaths.d.ts +5 -0
- package/dist/types/src/helpers/path/dreamPath.d.ts +3 -0
- package/dist/types/src/helpers/path/relativeDreamPath.d.ts +3 -0
- package/dist/types/src/helpers/path/sharedPathPrefix.d.ts +1 -0
- package/dist/types/src/helpers/propertyNameFromFullyQualifiedModelName.d.ts +1 -0
- package/dist/types/src/helpers/protectAgainstPollutingAssignment.d.ts +1 -0
- package/dist/types/src/helpers/range.d.ts +7 -0
- package/dist/types/src/helpers/round.d.ts +2 -0
- package/dist/types/src/helpers/serializerNameFromFullyQualifiedModelName.d.ts +1 -0
- package/dist/types/src/helpers/snakeify.d.ts +3 -0
- package/dist/types/src/helpers/sortBy.d.ts +8 -0
- package/dist/types/src/helpers/sqlAttributes.d.ts +4 -0
- package/dist/types/src/helpers/sspawn.d.ts +2 -0
- package/dist/types/src/helpers/standardizeFullyQualifiedModelName.d.ts +1 -0
- package/dist/types/src/helpers/stringCasing.d.ts +28 -0
- package/dist/types/src/helpers/typechecks.d.ts +2 -0
- package/dist/types/src/helpers/typeutils.d.ts +115 -0
- package/dist/types/src/helpers/uncapitalize.d.ts +1 -0
- package/dist/types/src/helpers/uniq.d.ts +1 -0
- package/dist/types/src/index.d.ts +78 -0
- package/dist/types/src/openapi/types.d.ts +139 -0
- package/dist/types/src/ops/curried-ops-statement.d.ts +7 -0
- package/dist/types/src/ops/index.d.ts +49 -0
- package/dist/types/src/ops/ops-statement.d.ts +14 -0
- package/dist/types/src/serializer/decorators/associations/RendersMany.d.ts +42 -0
- package/dist/types/src/serializer/decorators/associations/RendersOne.d.ts +46 -0
- package/dist/types/src/serializer/decorators/associations/shared.d.ts +23 -0
- package/dist/types/src/serializer/decorators/attribute.d.ts +29 -0
- package/dist/types/src/serializer/decorators/helpers/dreamAttributeOpenapiShape.d.ts +7 -0
- package/dist/types/src/serializer/decorators/helpers/hasSerializersGetter.d.ts +2 -0
- package/dist/types/src/serializer/decorators/helpers/maybeSerializableToDreamSerializerCallbackFunction.d.ts +2 -0
- package/dist/types/src/serializer/index.d.ts +56 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +92 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1448 -0
- package/docs/classes/Benchmark.html +4 -0
- package/docs/classes/CalendarDate.html +34 -0
- package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +12 -0
- package/docs/classes/Decorators.html +81 -0
- package/docs/classes/Dream.html +896 -0
- package/docs/classes/DreamApplication.html +37 -0
- package/docs/classes/DreamBin.html +11 -0
- package/docs/classes/DreamCLI.html +7 -0
- package/docs/classes/DreamImporter.html +6 -0
- package/docs/classes/DreamMigrationHelpers.html +32 -0
- package/docs/classes/DreamSerializer.html +19 -0
- package/docs/classes/DreamTransaction.html +5 -0
- package/docs/classes/Encrypt.html +8 -0
- package/docs/classes/Env.html +20 -0
- package/docs/classes/GlobalNameNotSet.html +12 -0
- package/docs/classes/NonLoadedAssociation.html +14 -0
- package/docs/classes/Query.html +383 -0
- package/docs/classes/Range.html +5 -0
- package/docs/classes/RecordNotFound.html +13 -0
- package/docs/classes/ValidationError.html +14 -0
- package/docs/functions/AfterCreate.html +1 -0
- package/docs/functions/AfterCreateCommit.html +13 -0
- package/docs/functions/AfterDestroy.html +1 -0
- package/docs/functions/AfterDestroyCommit.html +13 -0
- package/docs/functions/AfterSave.html +1 -0
- package/docs/functions/AfterSaveCommit.html +13 -0
- package/docs/functions/AfterUpdate.html +1 -0
- package/docs/functions/AfterUpdateCommit.html +13 -0
- package/docs/functions/Attribute.html +1 -0
- package/docs/functions/BeforeCreate.html +1 -0
- package/docs/functions/BeforeDestroy.html +1 -0
- package/docs/functions/BeforeSave.html +1 -0
- package/docs/functions/BeforeUpdate.html +1 -0
- package/docs/functions/RendersMany.html +16 -0
- package/docs/functions/RendersOne.html +16 -0
- package/docs/functions/ReplicaSafe.html +1 -0
- package/docs/functions/STI.html +1 -0
- package/docs/functions/Scope.html +1 -0
- package/docs/functions/SoftDelete.html +19 -0
- package/docs/functions/Sortable.html +1 -0
- package/docs/functions/Validate.html +1 -0
- package/docs/functions/Validates.html +1 -0
- package/docs/functions/Virtual.html +1 -0
- package/docs/functions/camelize.html +1 -0
- package/docs/functions/capitalize.html +1 -0
- package/docs/functions/closeAllDbConnections.html +1 -0
- package/docs/functions/compact.html +1 -0
- package/docs/functions/db.html +1 -0
- package/docs/functions/debug.html +1 -0
- package/docs/functions/dreamDbConnections.html +1 -0
- package/docs/functions/dreamPath.html +1 -0
- package/docs/functions/generateDream.html +1 -0
- package/docs/functions/globalClassNameFromFullyQualifiedModelName.html +1 -0
- package/docs/functions/hyphenize.html +1 -0
- package/docs/functions/inferSerializerFromDreamClassOrViewModelClass.html +1 -0
- package/docs/functions/inferSerializerFromDreamOrViewModel.html +1 -0
- package/docs/functions/isEmpty.html +1 -0
- package/docs/functions/loadRepl.html +1 -0
- package/docs/functions/lookupClassByGlobalName.html +1 -0
- package/docs/functions/pascalize.html +1 -0
- package/docs/functions/pgErrorType.html +1 -0
- package/docs/functions/range-1.html +1 -0
- package/docs/functions/relativeDreamPath.html +1 -0
- package/docs/functions/round.html +1 -0
- package/docs/functions/serializerNameFromFullyQualifiedModelName.html +1 -0
- package/docs/functions/sharedPathPrefix.html +1 -0
- package/docs/functions/snakeify.html +1 -0
- package/docs/functions/sortBy.html +1 -0
- package/docs/functions/standardizeFullyQualifiedModelName.html +1 -0
- package/docs/functions/uncapitalize.html +1 -0
- package/docs/functions/uniq.html +1 -0
- package/docs/functions/validateColumn.html +1 -0
- package/docs/functions/validateTable.html +1 -0
- package/docs/index.html +123 -0
- package/docs/interfaces/AttributeStatement.html +6 -0
- package/docs/interfaces/DecoratorContext.html +8 -0
- package/docs/interfaces/DreamApplicationInitOptions.html +2 -0
- package/docs/interfaces/DreamApplicationOpts.html +8 -0
- package/docs/interfaces/DreamSerializerAssociationStatement.html +11 -0
- package/docs/interfaces/EncryptOptions.html +3 -0
- package/docs/interfaces/OpenapiSchemaProperties.html +1 -0
- package/docs/interfaces/OpenapiSchemaPropertiesShorthand.html +1 -0
- package/docs/interfaces/OpenapiTypeFieldObject.html +1 -0
- package/docs/modules.html +163 -0
- package/docs/types/Camelized.html +1 -0
- package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -0
- package/docs/types/DreamAssociationMetadata.html +1 -0
- package/docs/types/DreamAttributes.html +1 -0
- package/docs/types/DreamClassColumn.html +1 -0
- package/docs/types/DreamColumn.html +1 -0
- package/docs/types/DreamColumnNames.html +1 -0
- package/docs/types/DreamLogLevel.html +1 -0
- package/docs/types/DreamLogger.html +1 -0
- package/docs/types/DreamOrViewModelSerializerKey.html +1 -0
- package/docs/types/DreamParamSafeAttributes.html +1 -0
- package/docs/types/DreamParamSafeColumnNames.html +1 -0
- package/docs/types/DreamSerializerKey.html +1 -0
- package/docs/types/DreamSerializers.html +1 -0
- package/docs/types/DreamTableSchema.html +1 -0
- package/docs/types/DreamVirtualColumns.html +1 -0
- package/docs/types/EncryptAlgorithm.html +1 -0
- package/docs/types/Hyphenized.html +1 -0
- package/docs/types/IdType.html +1 -0
- package/docs/types/OpenapiAllTypes.html +1 -0
- package/docs/types/OpenapiFormats.html +1 -0
- package/docs/types/OpenapiNumberFormats.html +1 -0
- package/docs/types/OpenapiPrimitiveTypes.html +1 -0
- package/docs/types/OpenapiSchemaArray.html +1 -0
- package/docs/types/OpenapiSchemaArrayShorthand.html +1 -0
- package/docs/types/OpenapiSchemaBase.html +1 -0
- package/docs/types/OpenapiSchemaBody.html +1 -0
- package/docs/types/OpenapiSchemaBodyShorthand.html +1 -0
- package/docs/types/OpenapiSchemaCommonFields.html +1 -0
- package/docs/types/OpenapiSchemaExpressionAllOf.html +1 -0
- package/docs/types/OpenapiSchemaExpressionAnyOf.html +1 -0
- package/docs/types/OpenapiSchemaExpressionOneOf.html +1 -0
- package/docs/types/OpenapiSchemaExpressionRef.html +1 -0
- package/docs/types/OpenapiSchemaExpressionRefSchemaShorthand.html +1 -0
- package/docs/types/OpenapiSchemaInteger.html +1 -0
- package/docs/types/OpenapiSchemaNull.html +1 -0
- package/docs/types/OpenapiSchemaNumber.html +1 -0
- package/docs/types/OpenapiSchemaObject.html +1 -0
- package/docs/types/OpenapiSchemaObjectAllOf.html +1 -0
- package/docs/types/OpenapiSchemaObjectAllOfShorthand.html +1 -0
- package/docs/types/OpenapiSchemaObjectAnyOf.html +1 -0
- package/docs/types/OpenapiSchemaObjectAnyOfShorthand.html +1 -0
- package/docs/types/OpenapiSchemaObjectBase.html +1 -0
- package/docs/types/OpenapiSchemaObjectBaseShorthand.html +1 -0
- package/docs/types/OpenapiSchemaObjectOneOf.html +1 -0
- package/docs/types/OpenapiSchemaObjectOneOfShorthand.html +1 -0
- package/docs/types/OpenapiSchemaObjectShorthand.html +1 -0
- package/docs/types/OpenapiSchemaPartialSegment.html +1 -0
- package/docs/types/OpenapiSchemaPrimitiveGeneric.html +1 -0
- package/docs/types/OpenapiSchemaShorthandExpressionAllOf.html +1 -0
- package/docs/types/OpenapiSchemaShorthandExpressionAnyOf.html +1 -0
- package/docs/types/OpenapiSchemaShorthandExpressionOneOf.html +1 -0
- package/docs/types/OpenapiSchemaShorthandExpressionSerializableRef.html +1 -0
- package/docs/types/OpenapiSchemaShorthandExpressionSerializerRef.html +1 -0
- package/docs/types/OpenapiSchemaShorthandPrimitiveGeneric.html +1 -0
- package/docs/types/OpenapiSchemaString.html +1 -0
- package/docs/types/OpenapiShorthandAllTypes.html +1 -0
- package/docs/types/OpenapiShorthandPrimitiveTypes.html +1 -0
- package/docs/types/OpenapiTypeField.html +1 -0
- package/docs/types/Pascalized.html +1 -0
- package/docs/types/PrimaryKeyType.html +1 -0
- package/docs/types/RoundingPrecision.html +1 -0
- package/docs/types/SerializableClassOrSerializerCallback.html +1 -0
- package/docs/types/SerializableDreamClassOrViewModelClass.html +1 -0
- package/docs/types/SerializableDreamOrViewModel.html +1 -0
- package/docs/types/SerializableTypes.html +1 -0
- package/docs/types/Snakeified.html +1 -0
- package/docs/types/Timestamp.html +1 -0
- package/docs/types/UpdateableAssociationProperties.html +1 -0
- package/docs/types/UpdateableProperties.html +1 -0
- package/docs/types/ValidationType.html +1 -0
- package/docs/types/ViewModelSerializerKey.html +1 -0
- package/docs/types/WhereStatementForDream.html +1 -0
- package/docs/types/WhereStatementForDreamClass.html +1 -0
- package/docs/variables/DreamConst.html +1 -0
- package/docs/variables/TRIGRAM_OPERATORS.html +1 -0
- package/docs/variables/openapiPrimitiveTypes-1.html +1 -0
- package/docs/variables/openapiShorthandPrimitiveTypes-1.html +1 -0
- package/docs/variables/ops.html +1 -0
- package/docs/variables/primaryKeyTypes.html +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const kysely_1 = require("kysely");
|
|
4
|
+
class DreamMigrationHelpers {
|
|
5
|
+
/**
|
|
6
|
+
* Unique indexes cannot be populated by the same value even within a transaction,
|
|
7
|
+
* but deferrable unique constraints can.
|
|
8
|
+
*
|
|
9
|
+
* The Sortable decorator requires deferrable unique constraints rather than unique
|
|
10
|
+
* indexes.
|
|
11
|
+
*
|
|
12
|
+
* @param db - The Kysely database object passed into the migration up/down function
|
|
13
|
+
* @param constraintName - The name of the constraint to create
|
|
14
|
+
* @param opts.table - The name of the table
|
|
15
|
+
* @param opts.columns[] - The names of the columns to include in the constraint
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
static async addDeferrableUniqueConstraint(db, constraintName, { table, columns, }) {
|
|
19
|
+
await this.dropConstraint(db, constraintName, { table });
|
|
20
|
+
await (0, kysely_1.sql) `
|
|
21
|
+
ALTER TABLE ${kysely_1.sql.table(table)}
|
|
22
|
+
ADD CONSTRAINT ${kysely_1.sql.table(constraintName)}
|
|
23
|
+
UNIQUE (${kysely_1.sql.raw(columns.join(', '))})
|
|
24
|
+
DEFERRABLE INITIALLY DEFERRED;
|
|
25
|
+
`.execute(db);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Add a value to an enum.
|
|
29
|
+
*
|
|
30
|
+
* Note that this always includes "IF NOT EXISTS", so is safe to re-run multiple times.
|
|
31
|
+
*
|
|
32
|
+
* @param db - The Kysely database object passed into the migration up/down function
|
|
33
|
+
* @param opt.enumName - The name of the enum to modify
|
|
34
|
+
* @param opt.value - The name of the value to add to the enum
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
static async addEnumValue(db, { enumName, value }) {
|
|
38
|
+
await (0, kysely_1.sql) `ALTER TYPE ${kysely_1.sql.raw(enumName)} ADD VALUE IF NOT EXISTS '${kysely_1.sql.raw(value)}';`.execute(db);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a database extension.
|
|
42
|
+
*
|
|
43
|
+
* ```
|
|
44
|
+
* // Add the case insensitive extension
|
|
45
|
+
* await DreamMigrationHelpers.createExtension(db, 'citext')
|
|
46
|
+
*
|
|
47
|
+
* // Add the pg trigram extension
|
|
48
|
+
* await DreamMigrationHelpers.createExtension(db, 'pg_trgm')
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param db - The Kysely database object passed into the migration up/down function
|
|
52
|
+
* @param extensionName - The name of the database extension to add
|
|
53
|
+
* @param opt.ifNotExists - Only add the extension if it doesn't already exist
|
|
54
|
+
* @param opt.publicSchema - Create using the public schema
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
static async createExtension(db, extensionName, { ifNotExists = true, publicSchema = true } = {}) {
|
|
58
|
+
const ifNotExistsText = ifNotExists ? ' IF NOT EXISTS ' : ' ';
|
|
59
|
+
const publicSchemaText = publicSchema ? ' WITH SCHEMA public' : '';
|
|
60
|
+
await (0, kysely_1.sql) `
|
|
61
|
+
CREATE EXTENSION${kysely_1.sql.raw(ifNotExistsText)}"${kysely_1.sql.raw(extensionName)}"${kysely_1.sql.raw(publicSchemaText)};
|
|
62
|
+
`.execute(db);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a gin index
|
|
66
|
+
*
|
|
67
|
+
* @param db - The Kysely database object passed into the migration up/down function
|
|
68
|
+
* @param indexName - The name of the constraint to create
|
|
69
|
+
* @param opts.table - The name of the table
|
|
70
|
+
* @param opts.column - The name of the column to index
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
static async createGinIndex(db, indexName, { table, column }) {
|
|
74
|
+
await (0, kysely_1.sql) `
|
|
75
|
+
CREATE INDEX IF NOT EXISTS ${kysely_1.sql.raw(indexName)} ON ${kysely_1.sql.raw(table)} USING GIN (${kysely_1.sql.raw(`${column} gin_trgm_ops`)});
|
|
76
|
+
`.execute(db);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Drop a constraint
|
|
80
|
+
*
|
|
81
|
+
* Note that this always includes "IF NOT EXISTS", so is safe to re-run multiple times.
|
|
82
|
+
*
|
|
83
|
+
* @param db - The Kysely database object passed into the migration up/down function
|
|
84
|
+
* @param constraintName - The name of the constraint to create
|
|
85
|
+
* @param opts.table - The name of the table
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
static async dropConstraint(db, constraintName, { table }) {
|
|
89
|
+
await (0, kysely_1.sql) `
|
|
90
|
+
ALTER TABLE ${kysely_1.sql.table(table)} DROP CONSTRAINT IF EXISTS ${kysely_1.sql.table(constraintName)};
|
|
91
|
+
`.execute(db);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Drop a value from an enum and replace it (or optionally remove it from array columns)
|
|
95
|
+
*
|
|
96
|
+
* @param db - The Kysely database object passed into the migration up/down function
|
|
97
|
+
* @param opt.enumName - The name of the enum to modify
|
|
98
|
+
* @param opt.value - The name of the value to drop from the enum
|
|
99
|
+
* @param opt.replacements[] - Details about which table and column to change and which value to replace the dropped value with (or remove it if the column is an array)
|
|
100
|
+
*
|
|
101
|
+
*/
|
|
102
|
+
static async dropEnumValue(db, { enumName, value, replacements }) {
|
|
103
|
+
// temporarily set all table columns depending on this enum to an acceptable alternate type
|
|
104
|
+
for (const tableAndColumnToChange of replacements) {
|
|
105
|
+
const tableAndColumnToChangeAsArray = tableAndColumnToChange;
|
|
106
|
+
const isArray = tableAndColumnToChangeAsArray.array || false;
|
|
107
|
+
await db.schema
|
|
108
|
+
.alterTable(tableAndColumnToChange.table)
|
|
109
|
+
.alterColumn(tableAndColumnToChange.column, col => col.setDataType(computedTemporaryType(isArray)))
|
|
110
|
+
.execute();
|
|
111
|
+
}
|
|
112
|
+
// collect enum values before dropping type
|
|
113
|
+
const allEnumValues = await getEnumValues(db, enumName);
|
|
114
|
+
// drop type and re-create it without the enum value
|
|
115
|
+
// we are trying to drop
|
|
116
|
+
await db.schema.dropType(enumName).execute();
|
|
117
|
+
await db.schema
|
|
118
|
+
.createType(enumName)
|
|
119
|
+
.asEnum(allEnumValues.filter(val => val !== value))
|
|
120
|
+
.execute();
|
|
121
|
+
for (const tableAndColumnToChange of replacements) {
|
|
122
|
+
const isArray = tableAndColumnToChange.array || false;
|
|
123
|
+
if (isArray) {
|
|
124
|
+
await replaceArrayValues(db, value, tableAndColumnToChange);
|
|
125
|
+
await updateTableColumnToNewEnumArrayType(db, enumName, tableAndColumnToChange);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
await replaceNonArrayValues(db, value, tableAndColumnToChange);
|
|
129
|
+
await updateTableColumnToNewEnumType(db, enumName, tableAndColumnToChange);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.default = DreamMigrationHelpers;
|
|
135
|
+
async function getEnumValues(db, enumName) {
|
|
136
|
+
const response = await (0, kysely_1.sql) `SELECT unnest(enum_range(NULL::${kysely_1.sql.raw(enumName)}))`.execute(db);
|
|
137
|
+
return response.rows.map(row => row.unnest);
|
|
138
|
+
}
|
|
139
|
+
// finds any records in the specified table
|
|
140
|
+
// who's targeted column is an array containing
|
|
141
|
+
// the enum value we are trying to drop,
|
|
142
|
+
// and updates their values to a safe value
|
|
143
|
+
// provided by the user
|
|
144
|
+
async function replaceArrayValues(db, value, tableAndColumnToChange) {
|
|
145
|
+
const { column, table } = tableAndColumnToChange;
|
|
146
|
+
await db
|
|
147
|
+
.updateTable(table)
|
|
148
|
+
.set({
|
|
149
|
+
[column]: tableAndColumnToChange.behavior === 'remove'
|
|
150
|
+
? kysely_1.sql.raw(`array_remove(${column}, '${value}')`)
|
|
151
|
+
: kysely_1.sql.raw(`array_replace(${column}, '${value}', '${tableAndColumnToChange.replaceWith}')`),
|
|
152
|
+
})
|
|
153
|
+
.where(kysely_1.sql.raw(`'${value}'`), '=', kysely_1.sql.raw(`ANY(${column})`))
|
|
154
|
+
.execute();
|
|
155
|
+
}
|
|
156
|
+
// finds any records in the specified table
|
|
157
|
+
// who's targeted column is the enum value
|
|
158
|
+
// we are trying to drop, and updates their
|
|
159
|
+
// values to a safe value provided by
|
|
160
|
+
// the user
|
|
161
|
+
async function replaceNonArrayValues(db, value, tableAndColumnToChange) {
|
|
162
|
+
const { table, column, replaceWith } = tableAndColumnToChange;
|
|
163
|
+
await db
|
|
164
|
+
.updateTable(table)
|
|
165
|
+
.set({ [column]: replaceWith })
|
|
166
|
+
.where(column, '=', value)
|
|
167
|
+
.execute();
|
|
168
|
+
}
|
|
169
|
+
// updates the table's targeted column to the newly-created enum array
|
|
170
|
+
async function updateTableColumnToNewEnumArrayType(db, enumName, tableAndColumnToChange) {
|
|
171
|
+
const { table, column } = tableAndColumnToChange;
|
|
172
|
+
await (0, kysely_1.sql) `
|
|
173
|
+
ALTER TABLE ${kysely_1.sql.raw(table)}
|
|
174
|
+
ALTER ${kysely_1.sql.raw(column)}
|
|
175
|
+
TYPE ${kysely_1.sql.raw(enumName)}[]
|
|
176
|
+
USING ${kysely_1.sql.raw(column)}::${kysely_1.sql.raw(enumName)}[];
|
|
177
|
+
`.execute(db);
|
|
178
|
+
}
|
|
179
|
+
// updates the table's targeted column to the newly-created enum
|
|
180
|
+
async function updateTableColumnToNewEnumType(db, enumName, tableAndColumnToChange) {
|
|
181
|
+
const { table, column } = tableAndColumnToChange;
|
|
182
|
+
await (0, kysely_1.sql) `
|
|
183
|
+
ALTER TABLE ${kysely_1.sql.raw(table)}
|
|
184
|
+
ALTER ${kysely_1.sql.raw(column)}
|
|
185
|
+
TYPE ${kysely_1.sql.raw(enumName)}
|
|
186
|
+
USING ${kysely_1.sql.raw(column)}::${kysely_1.sql.raw(enumName)};
|
|
187
|
+
`.execute(db);
|
|
188
|
+
}
|
|
189
|
+
function computedTemporaryType(array) {
|
|
190
|
+
if (array)
|
|
191
|
+
return (0, kysely_1.sql) `text[]`;
|
|
192
|
+
return 'text';
|
|
193
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = validateColumn;
|
|
4
|
+
const InvalidColumnName_js_1 = require("../../errors/InvalidColumnName.js");
|
|
5
|
+
function validateColumn(schema, tableName, columnName) {
|
|
6
|
+
if (!Object.prototype.hasOwnProperty.call(schema, tableName))
|
|
7
|
+
throw new InvalidColumnName_js_1.default(tableName, columnName);
|
|
8
|
+
if (!Object.prototype.hasOwnProperty.call(schema[tableName]?.columns, columnName))
|
|
9
|
+
throw new InvalidColumnName_js_1.default(tableName, columnName);
|
|
10
|
+
return columnName;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = validateTable;
|
|
4
|
+
const InvalidTableName_js_1 = require("../../errors/InvalidTableName.js");
|
|
5
|
+
function validateTable(schema, tableName) {
|
|
6
|
+
if (!Object.prototype.hasOwnProperty.call(schema, tableName))
|
|
7
|
+
throw new InvalidTableName_js_1.default(schema, tableName);
|
|
8
|
+
return tableName;
|
|
9
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = validateTableAlias;
|
|
4
|
+
const InvalidTableAlias_js_1 = require("../../errors/InvalidTableAlias.js");
|
|
5
|
+
function validateTableAlias(tableAlias) {
|
|
6
|
+
if (!/^[a-zA-Z0-9_]*$/.test(tableAlias) || SINGLE_WORD_SQL_KEYWORDS.includes(tableAlias.toUpperCase()))
|
|
7
|
+
throw new InvalidTableAlias_js_1.default(tableAlias);
|
|
8
|
+
return tableAlias;
|
|
9
|
+
}
|
|
10
|
+
const SINGLE_WORD_SQL_KEYWORDS = [
|
|
11
|
+
'ADD',
|
|
12
|
+
'ALL',
|
|
13
|
+
'ALTER',
|
|
14
|
+
'AND',
|
|
15
|
+
'ANY',
|
|
16
|
+
'AS',
|
|
17
|
+
'ASC',
|
|
18
|
+
'BACKUP',
|
|
19
|
+
'BETWEEN',
|
|
20
|
+
'CASE',
|
|
21
|
+
'CHECK',
|
|
22
|
+
'COLUMN',
|
|
23
|
+
'CONSTRAINT',
|
|
24
|
+
'CREATE',
|
|
25
|
+
'DATABASE',
|
|
26
|
+
'DEFAULT',
|
|
27
|
+
'DELETE',
|
|
28
|
+
'DESC',
|
|
29
|
+
'DISTINCT',
|
|
30
|
+
'DROP',
|
|
31
|
+
'EXEC',
|
|
32
|
+
'EXISTS',
|
|
33
|
+
'FROM',
|
|
34
|
+
'HAVING',
|
|
35
|
+
'IN',
|
|
36
|
+
'INDEX',
|
|
37
|
+
'JOIN',
|
|
38
|
+
'LIKE',
|
|
39
|
+
'LIMIT',
|
|
40
|
+
'NOT',
|
|
41
|
+
'OR',
|
|
42
|
+
'PROCEDURE',
|
|
43
|
+
'ROWNUM',
|
|
44
|
+
'SELECT',
|
|
45
|
+
'SET',
|
|
46
|
+
'TABLE',
|
|
47
|
+
'TOP',
|
|
48
|
+
'TRUNCATE',
|
|
49
|
+
'UNION',
|
|
50
|
+
'UNIQUE',
|
|
51
|
+
'UPDATE',
|
|
52
|
+
'VALUES',
|
|
53
|
+
'VIEW',
|
|
54
|
+
'WHERE',
|
|
55
|
+
];
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const BelongsTo_js_1 = require("./associations/BelongsTo.js");
|
|
4
|
+
const HasMany_js_1 = require("./associations/HasMany.js");
|
|
5
|
+
const HasOne_js_1 = require("./associations/HasOne.js");
|
|
6
|
+
const AfterCreate_js_1 = require("./hooks/AfterCreate.js");
|
|
7
|
+
const AfterCreateCommit_js_1 = require("./hooks/AfterCreateCommit.js");
|
|
8
|
+
const AfterDestroy_js_1 = require("./hooks/AfterDestroy.js");
|
|
9
|
+
const AfterDestroyCommit_js_1 = require("./hooks/AfterDestroyCommit.js");
|
|
10
|
+
const AfterSave_js_1 = require("./hooks/AfterSave.js");
|
|
11
|
+
const AfterSaveCommit_js_1 = require("./hooks/AfterSaveCommit.js");
|
|
12
|
+
const AfterUpdate_js_1 = require("./hooks/AfterUpdate.js");
|
|
13
|
+
const AfterUpdateCommit_js_1 = require("./hooks/AfterUpdateCommit.js");
|
|
14
|
+
const BeforeCreate_js_1 = require("./hooks/BeforeCreate.js");
|
|
15
|
+
const BeforeDestroy_js_1 = require("./hooks/BeforeDestroy.js");
|
|
16
|
+
const BeforeSave_js_1 = require("./hooks/BeforeSave.js");
|
|
17
|
+
const BeforeUpdate_js_1 = require("./hooks/BeforeUpdate.js");
|
|
18
|
+
const Sortable_js_1 = require("./sortable/Sortable.js");
|
|
19
|
+
class Decorators {
|
|
20
|
+
/**
|
|
21
|
+
* Establishes a "BelongsTo" association between the base dream
|
|
22
|
+
* and the child dream, where the base dream has a foreign key
|
|
23
|
+
* which points back to the child dream.
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* class UserSettings extends ApplicationModel {
|
|
27
|
+
* @Deco.BelongsTo('User')
|
|
28
|
+
* public user: User
|
|
29
|
+
* public userId: DreamColumn<UserSettings, 'userId'>
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* class User extends ApplicationModel {
|
|
33
|
+
* @Deco.HasOne('UserSettings')
|
|
34
|
+
* public userSettings: UserSettings
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
*
|
|
39
|
+
*
|
|
40
|
+
* @param modelCB - a function that immediately returns the dream class you are associating with this dream class
|
|
41
|
+
* @param options - the options you want to use to apply to this association
|
|
42
|
+
* @returns A BelongsTo decorator
|
|
43
|
+
*/
|
|
44
|
+
BelongsTo(globalAssociationNameOrNames, options = {}) {
|
|
45
|
+
return (0, BelongsTo_js_1.default)(globalAssociationNameOrNames, options);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* Establishes a "HasMany" association between the base dream
|
|
50
|
+
* and the child dream, where the child dream has a foreign key
|
|
51
|
+
* which points back to the base dream.
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* class User extends ApplicationModel {
|
|
55
|
+
* @Deco.HasMany('Post')
|
|
56
|
+
* public posts: Post[]
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* class Post extends ApplicationModel {
|
|
60
|
+
* @Deco.BelongsTo('User')
|
|
61
|
+
* public user: User
|
|
62
|
+
* public userId: DreamColumn<Post, 'userId'>
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @param modelCB - a function that immediately returns the dream class you are associating with this dream class
|
|
67
|
+
* @param options - the options you want to use to apply to this association
|
|
68
|
+
* @returns A HasMany decorator
|
|
69
|
+
*/
|
|
70
|
+
HasMany(globalAssociationNameOrNames, options = {}) {
|
|
71
|
+
return (0, HasMany_js_1.default)(globalAssociationNameOrNames, options);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Establishes a "HasOne" association between the base dream
|
|
75
|
+
* and the child dream, where the child dream has a foreign key
|
|
76
|
+
* which points back to the base dream.
|
|
77
|
+
*
|
|
78
|
+
* ```ts
|
|
79
|
+
* class User extends ApplicationModel {
|
|
80
|
+
* @Deco.HasOne('UserSettings')
|
|
81
|
+
* public userSettings: UserSettings
|
|
82
|
+
* }
|
|
83
|
+
*
|
|
84
|
+
* class UserSettings extends ApplicationModel {
|
|
85
|
+
* @Deco.BelongsTo('User')
|
|
86
|
+
* public user: User
|
|
87
|
+
* public userId: DreamColumn<UserSettings, 'userId'>
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @param modelCB - A function that immediately returns the dream class you are associating with this dream class
|
|
92
|
+
* @param options - The options you want to use to apply to this association
|
|
93
|
+
* @returns A HasOne decorator
|
|
94
|
+
*/
|
|
95
|
+
HasOne(globalAssociationNameOrNames, options = {}) {
|
|
96
|
+
return (0, HasOne_js_1.default)(globalAssociationNameOrNames, options);
|
|
97
|
+
}
|
|
98
|
+
//////////////
|
|
99
|
+
// end: HasOne
|
|
100
|
+
//////////////
|
|
101
|
+
/**
|
|
102
|
+
* Shortcut to the Sortable decorator, which also provides extra type protection which cannot be provided
|
|
103
|
+
* with the Sortable decorator.
|
|
104
|
+
*
|
|
105
|
+
* @param scope - The column, association, or combination there-of which you would like to restrict the incrementing logic to
|
|
106
|
+
* @returns A Sortable decorator
|
|
107
|
+
*/
|
|
108
|
+
Sortable(opts) {
|
|
109
|
+
return (0, Sortable_js_1.default)(opts);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Shortcut to the BeforeCreate decorator
|
|
113
|
+
*
|
|
114
|
+
* ```ts
|
|
115
|
+
* class User {
|
|
116
|
+
* User.BeforeCreate()
|
|
117
|
+
* public doSomething() {
|
|
118
|
+
* console.log('hi!')
|
|
119
|
+
* }
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @returns The BeforeCreate decorator
|
|
124
|
+
*
|
|
125
|
+
*/
|
|
126
|
+
BeforeCreate(opts) {
|
|
127
|
+
return (0, BeforeCreate_js_1.default)(opts);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Shortcut to the BeforeSave decorator
|
|
131
|
+
*
|
|
132
|
+
* ```ts
|
|
133
|
+
* class User {
|
|
134
|
+
* User.BeforeSave()
|
|
135
|
+
* public doSomething() {
|
|
136
|
+
* console.log('hi!')
|
|
137
|
+
* }
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @returns The BeforeSave decorator
|
|
142
|
+
*
|
|
143
|
+
*/
|
|
144
|
+
BeforeSave(opts) {
|
|
145
|
+
return (0, BeforeSave_js_1.default)(opts);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Shortcut to the BeforeUpdate decorator
|
|
149
|
+
*
|
|
150
|
+
* ```ts
|
|
151
|
+
* class User {
|
|
152
|
+
* User.BeforeUpdate()
|
|
153
|
+
* public doSomething() {
|
|
154
|
+
* console.log('hi!')
|
|
155
|
+
* }
|
|
156
|
+
* }
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @returns The BeforeUpdate decorator
|
|
160
|
+
*
|
|
161
|
+
*/
|
|
162
|
+
BeforeUpdate(opts) {
|
|
163
|
+
return (0, BeforeUpdate_js_1.default)(opts);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Shortcut to the BeforeDestroy decorator
|
|
167
|
+
*
|
|
168
|
+
* ```ts
|
|
169
|
+
* class User {
|
|
170
|
+
* User.BeforeDestroy()
|
|
171
|
+
* public doSomething() {
|
|
172
|
+
* console.log('hi!')
|
|
173
|
+
* }
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* @returns The BeforeDestroy decorator
|
|
178
|
+
*/
|
|
179
|
+
BeforeDestroy() {
|
|
180
|
+
return (0, BeforeDestroy_js_1.default)();
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Shortcut to the AfterCreate decorator
|
|
184
|
+
*
|
|
185
|
+
* ```ts
|
|
186
|
+
* class User {
|
|
187
|
+
* User.AfterCreate()
|
|
188
|
+
* public doSomething() {
|
|
189
|
+
* console.log('hi!')
|
|
190
|
+
* }
|
|
191
|
+
* }
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* @returns The AfterCreate decorator
|
|
195
|
+
*
|
|
196
|
+
*/
|
|
197
|
+
AfterCreate(opts) {
|
|
198
|
+
return (0, AfterCreate_js_1.default)(opts);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Shortcut to the AfterCreateCommit decorator
|
|
202
|
+
*
|
|
203
|
+
* ```ts
|
|
204
|
+
* class User {
|
|
205
|
+
* User.AfterCreateCommit()
|
|
206
|
+
* public doSomething() {
|
|
207
|
+
* console.log('hi!')
|
|
208
|
+
* }
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* @returns The AfterCreateCommit decorator
|
|
213
|
+
*/
|
|
214
|
+
AfterCreateCommit(opts) {
|
|
215
|
+
return (0, AfterCreateCommit_js_1.default)(opts);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Shortcut to the AfterSave decorator
|
|
219
|
+
*
|
|
220
|
+
* ```ts
|
|
221
|
+
* class User {
|
|
222
|
+
* User.AfterSave()
|
|
223
|
+
* public doSomething() {
|
|
224
|
+
* console.log('hi!')
|
|
225
|
+
* }
|
|
226
|
+
* }
|
|
227
|
+
* ```
|
|
228
|
+
*
|
|
229
|
+
* @returns The AfterSave decorator
|
|
230
|
+
*
|
|
231
|
+
*/
|
|
232
|
+
AfterSave(opts) {
|
|
233
|
+
return (0, AfterSave_js_1.default)(opts);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Shortcut to the AfterSaveCommit decorator
|
|
237
|
+
*
|
|
238
|
+
* ```ts
|
|
239
|
+
* class User {
|
|
240
|
+
* User.AfterSaveCommit()
|
|
241
|
+
* public doSomething() {
|
|
242
|
+
* console.log('hi!')
|
|
243
|
+
* }
|
|
244
|
+
* }
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* @returns The AfterSaveCommit decorator
|
|
248
|
+
*
|
|
249
|
+
*/
|
|
250
|
+
AfterSaveCommit(opts) {
|
|
251
|
+
return (0, AfterSaveCommit_js_1.default)(opts);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Shortcut to the AfterUpdate decorator
|
|
255
|
+
*
|
|
256
|
+
* ```ts
|
|
257
|
+
* class User {
|
|
258
|
+
* User.AfterUpdate()
|
|
259
|
+
* public doSomething() {
|
|
260
|
+
* console.log('hi!')
|
|
261
|
+
* }
|
|
262
|
+
* }
|
|
263
|
+
* ```
|
|
264
|
+
*
|
|
265
|
+
* @returns The AfterUpdate decorator
|
|
266
|
+
*
|
|
267
|
+
*/
|
|
268
|
+
AfterUpdate(opts) {
|
|
269
|
+
return (0, AfterUpdate_js_1.default)(opts);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Shortcut to the AfterUpdateCommit decorator
|
|
273
|
+
*
|
|
274
|
+
* ```ts
|
|
275
|
+
* class User {
|
|
276
|
+
* User.AfterUpdateCommit()
|
|
277
|
+
* public doSomething() {
|
|
278
|
+
* console.log('hi!')
|
|
279
|
+
* }
|
|
280
|
+
* }
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* @returns The AfterUpdateCommit decorator
|
|
284
|
+
*
|
|
285
|
+
*/
|
|
286
|
+
AfterUpdateCommit(opts) {
|
|
287
|
+
return (0, AfterUpdateCommit_js_1.default)(opts);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Shortcut to the AfterDestroy decorator
|
|
291
|
+
*
|
|
292
|
+
* ```ts
|
|
293
|
+
* class User {
|
|
294
|
+
* User.AfterDestroy()
|
|
295
|
+
* public doSomething() {
|
|
296
|
+
* console.log('hi!')
|
|
297
|
+
* }
|
|
298
|
+
* }
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
* @returns The AfterDestroy decorator
|
|
302
|
+
*
|
|
303
|
+
*/
|
|
304
|
+
AfterDestroy() {
|
|
305
|
+
return (0, AfterDestroy_js_1.default)();
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Shortcut to the AfterDestroyCommit decorator
|
|
309
|
+
*
|
|
310
|
+
* ```ts
|
|
311
|
+
* class User {
|
|
312
|
+
* User.AfterDestroyCommit()
|
|
313
|
+
* public doSomething() {
|
|
314
|
+
* console.log('hi!')
|
|
315
|
+
* }
|
|
316
|
+
* }
|
|
317
|
+
* ```
|
|
318
|
+
*
|
|
319
|
+
* @returns The AfterDestroyCommit decorator
|
|
320
|
+
*
|
|
321
|
+
*/
|
|
322
|
+
AfterDestroyCommit() {
|
|
323
|
+
return (0, AfterDestroyCommit_js_1.default)();
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
exports.default = Decorators;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = Encrypted;
|
|
4
|
+
const InternalEncrypt_js_1 = require("../encrypt/InternalEncrypt.js");
|
|
5
|
+
const DoNotSetEncryptedFieldsDirectly_js_1 = require("../errors/DoNotSetEncryptedFieldsDirectly.js");
|
|
6
|
+
const pascalize_js_1 = require("../helpers/pascalize.js");
|
|
7
|
+
function Encrypted(encryptedColumnName) {
|
|
8
|
+
return function (_, context) {
|
|
9
|
+
const key = context.name;
|
|
10
|
+
const encryptedKey = encryptedColumnName || `encrypted${(0, pascalize_js_1.default)(key)}`;
|
|
11
|
+
context.addInitializer(function () {
|
|
12
|
+
const dreamClass = this.constructor;
|
|
13
|
+
if (!dreamClass['globallyInitializingDecorators']) {
|
|
14
|
+
/**
|
|
15
|
+
* Modern Javascript applies implicit accessors to instance properties
|
|
16
|
+
* that don't have an accessor explicitly defined in the class definition.
|
|
17
|
+
* The instance accessors shadow prototype accessors.
|
|
18
|
+
* `addInitializer` is called by Decorators after an instance has been fully
|
|
19
|
+
* constructed. We leverage this opportunity to delete the instance accessors
|
|
20
|
+
* so that the prototype accessors applied by this decorator can be reached.
|
|
21
|
+
*/
|
|
22
|
+
delete this[key];
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!Object.getOwnPropertyDescriptor(dreamClass, 'virtualAttributes')) {
|
|
26
|
+
// This pattern allows `virtualAttributes` on a base STI class and on
|
|
27
|
+
// child STI classes. The new `virtualAttributes` property will be created
|
|
28
|
+
// on the child STI class, but it will include all the `virtualAttributes`
|
|
29
|
+
// already declared on the base STI class.
|
|
30
|
+
dreamClass['virtualAttributes'] = [...dreamClass['virtualAttributes']];
|
|
31
|
+
}
|
|
32
|
+
;
|
|
33
|
+
dreamClass['virtualAttributes'].push({
|
|
34
|
+
property: key,
|
|
35
|
+
type: 'string',
|
|
36
|
+
});
|
|
37
|
+
if (!Object.getOwnPropertyDescriptor(dreamClass, 'explicitUnsafeParamColumns')) {
|
|
38
|
+
// This pattern allows `explicitUnsafeParamColumns` on a base STI class and on
|
|
39
|
+
// child STI classes. The new `explicitUnsafeParamColumns` property will be created
|
|
40
|
+
// on the child STI class, but it will include all the `explicitUnsafeParamColumns`
|
|
41
|
+
// already declared on the base STI class.
|
|
42
|
+
dreamClass['explicitUnsafeParamColumns'] = [...dreamClass['explicitUnsafeParamColumns']];
|
|
43
|
+
}
|
|
44
|
+
;
|
|
45
|
+
dreamClass['explicitUnsafeParamColumns'].push(encryptedKey);
|
|
46
|
+
const dreamPrototype = Object.getPrototypeOf(this);
|
|
47
|
+
Object.defineProperty(dreamPrototype, key, {
|
|
48
|
+
get() {
|
|
49
|
+
return InternalEncrypt_js_1.default.decryptColumn(this.getAttribute(encryptedKey));
|
|
50
|
+
},
|
|
51
|
+
set(val) {
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* Modern Javascript sets all properties that do not have an explicit
|
|
55
|
+
* assignment within the constructor to undefined in an implicit constructor.
|
|
56
|
+
* Since the Dream constructor sets the value of properties of instances of
|
|
57
|
+
* classes that extend Dream (e.g. when passing attributes to #new or #create
|
|
58
|
+
* or when loading a model via one of the #find methods or #all), we need to
|
|
59
|
+
* prevent those properties from being set back to undefined. Since all
|
|
60
|
+
* properties corresponding to a database column get a setter, we achieve this
|
|
61
|
+
* protection by including a guard in the setters that returns if this
|
|
62
|
+
* property is set.
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
if (this.columnSetterGuardActivated)
|
|
66
|
+
return;
|
|
67
|
+
this.setAttribute(encryptedKey, InternalEncrypt_js_1.default.encryptColumn(val));
|
|
68
|
+
},
|
|
69
|
+
configurable: false,
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(dreamPrototype, encryptedKey, {
|
|
72
|
+
get() {
|
|
73
|
+
return this.currentAttributes[encryptedKey];
|
|
74
|
+
},
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
76
|
+
set(_) {
|
|
77
|
+
throw new DoNotSetEncryptedFieldsDirectly_js_1.default(dreamClass, encryptedKey, key);
|
|
78
|
+
},
|
|
79
|
+
configurable: false,
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
}
|