@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,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnsupportedValueFromComparisonFunction = void 0;
|
|
4
|
+
exports.default = sortBy;
|
|
5
|
+
function sortBy(array, valueToCompare) {
|
|
6
|
+
const arrayClone = [...array];
|
|
7
|
+
return arrayClone.sort((a, b) => {
|
|
8
|
+
const aPrime = valueToCompare(a);
|
|
9
|
+
const bPrime = valueToCompare(b);
|
|
10
|
+
if (typeof aPrime === 'string' && typeof bPrime === 'string')
|
|
11
|
+
return aPrime.localeCompare(bPrime);
|
|
12
|
+
if (typeof aPrime === 'number' && typeof bPrime === 'number')
|
|
13
|
+
return aPrime - bPrime;
|
|
14
|
+
if (typeof aPrime === 'bigint' && typeof bPrime === 'bigint')
|
|
15
|
+
return aPrime.toString().localeCompare(bPrime.toString());
|
|
16
|
+
throw new UnsupportedValueFromComparisonFunction(aPrime, bPrime);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
class UnsupportedValueFromComparisonFunction extends Error {
|
|
20
|
+
aPrime;
|
|
21
|
+
bPrime;
|
|
22
|
+
constructor(aPrime, bPrime) {
|
|
23
|
+
super();
|
|
24
|
+
this.aPrime = aPrime;
|
|
25
|
+
this.bPrime = bPrime;
|
|
26
|
+
}
|
|
27
|
+
get message() {
|
|
28
|
+
return `Value incompatible with compare: ${this.aPrime}, ${this.bPrime}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.UnsupportedValueFromComparisonFunction = UnsupportedValueFromComparisonFunction;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = sqlAttributes;
|
|
4
|
+
const luxon_1 = require("luxon");
|
|
5
|
+
const CalendarDate_js_1 = require("./CalendarDate.js");
|
|
6
|
+
const isDateTimeColumn_js_1 = require("./db/types/isDateTimeColumn.js");
|
|
7
|
+
const typechecks_js_1 = require("./typechecks.js");
|
|
8
|
+
function sqlAttributes(dream) {
|
|
9
|
+
const attributes = dream.dirtyAttributes();
|
|
10
|
+
return Object.keys(attributes).reduce((result, key) => {
|
|
11
|
+
let val = attributes[key];
|
|
12
|
+
if ((0, typechecks_js_1.isString)(val) && (0, isDateTimeColumn_js_1.default)(dream.constructor, key))
|
|
13
|
+
val = luxon_1.DateTime.fromISO(val, { zone: 'UTC' });
|
|
14
|
+
if (val instanceof luxon_1.DateTime || val instanceof CalendarDate_js_1.default) {
|
|
15
|
+
// Converting toJSDate resulted in the correct timezone, but even with process.env.TZ=UTC,
|
|
16
|
+
// Kysely inserted into the database with the machine timezone, which can shift the date
|
|
17
|
+
// (e.g., toJSDate resulted in a JS Date that formats as "1987-04-07T00:00:00.000Z", but
|
|
18
|
+
// Kysely inserted "1907-04-06" into the database). By converting to an SQL string before
|
|
19
|
+
// handing off to Kysely, we bypass Javascript dates altogether, sending the string into the
|
|
20
|
+
// database for storage as a date or datetime.
|
|
21
|
+
result[key] = val.toSQL();
|
|
22
|
+
}
|
|
23
|
+
else if (val !== undefined) {
|
|
24
|
+
result[key] = val;
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}, {});
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = sspawn;
|
|
4
|
+
exports.ssspawn = ssspawn;
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
function sspawn(command, opts = {}) {
|
|
7
|
+
return new Promise((accept, reject) => {
|
|
8
|
+
ssspawn(command, opts).on('close', code => {
|
|
9
|
+
if (code !== 0)
|
|
10
|
+
reject(new Error(code?.toString()));
|
|
11
|
+
accept({});
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function ssspawn(command, opts = {}) {
|
|
16
|
+
return (0, child_process_1.spawn)(command, {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
shell: true,
|
|
19
|
+
...opts,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const pascalize_js_1 = require("./pascalize.js");
|
|
5
|
+
function default_1(str) {
|
|
6
|
+
return str
|
|
7
|
+
.split('/')
|
|
8
|
+
.map(part => (0, pascalize_js_1.default)(part))
|
|
9
|
+
.join('/');
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = stringCase;
|
|
4
|
+
const luxon_1 = require("luxon");
|
|
5
|
+
const typechecks_js_1 = require("./typechecks.js");
|
|
6
|
+
const CalendarDate_js_1 = require("./CalendarDate.js");
|
|
7
|
+
function stringCase(target, stringCaser) {
|
|
8
|
+
if ((0, typechecks_js_1.isString)(target))
|
|
9
|
+
return stringCaser(target);
|
|
10
|
+
return recursiveStringCase(target, stringCaser);
|
|
11
|
+
}
|
|
12
|
+
function recursiveStringCase(target, stringCaser) {
|
|
13
|
+
if (target === null)
|
|
14
|
+
return null;
|
|
15
|
+
if (target === undefined)
|
|
16
|
+
return undefined;
|
|
17
|
+
if ((0, typechecks_js_1.isString)(target))
|
|
18
|
+
return target;
|
|
19
|
+
if (Array.isArray(target))
|
|
20
|
+
return target.map(s => recursiveStringCase(s, stringCaser));
|
|
21
|
+
if ((0, typechecks_js_1.isObject)(target)) {
|
|
22
|
+
if (target instanceof luxon_1.DateTime)
|
|
23
|
+
return target;
|
|
24
|
+
if (target instanceof CalendarDate_js_1.default)
|
|
25
|
+
return target;
|
|
26
|
+
if (target?.isDreamInstance)
|
|
27
|
+
return target;
|
|
28
|
+
return Object.keys(target).reduce((stringCasedObject, targetKey) => {
|
|
29
|
+
stringCasedObject[stringCaser(targetKey)] = recursiveStringCase(target[targetKey], stringCaser);
|
|
30
|
+
return stringCasedObject;
|
|
31
|
+
}, {});
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isString = isString;
|
|
4
|
+
exports.isObject = isObject;
|
|
5
|
+
function isString(x) {
|
|
6
|
+
return typeof x === 'string' || x instanceof String;
|
|
7
|
+
}
|
|
8
|
+
function isObject(x) {
|
|
9
|
+
if (x === null)
|
|
10
|
+
return false;
|
|
11
|
+
if (isString(x))
|
|
12
|
+
return false;
|
|
13
|
+
if (Array.isArray(x))
|
|
14
|
+
return false;
|
|
15
|
+
return typeof x === 'object';
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = uniq;
|
|
4
|
+
function uniq(arr, toKey = undefined) {
|
|
5
|
+
if (toKey)
|
|
6
|
+
return uniqWith(arr, toKey);
|
|
7
|
+
else if (arr[0]?.isDreamInstance)
|
|
8
|
+
return uniqWith(arr, dreamKey);
|
|
9
|
+
else
|
|
10
|
+
return Array.from(new Set(arr));
|
|
11
|
+
}
|
|
12
|
+
function dreamKey(dream) {
|
|
13
|
+
return `${dream.constructor.globalName}:${dream.primaryKeyValue}`;
|
|
14
|
+
}
|
|
15
|
+
function uniqWith(arr, toKey) {
|
|
16
|
+
const map = arr.reduce((acc, val) => {
|
|
17
|
+
acc[toKey(val)] ||= val;
|
|
18
|
+
return acc;
|
|
19
|
+
}, {});
|
|
20
|
+
return Object.values(map);
|
|
21
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.debug = exports.compact = exports.generateDream = exports.capitalize = exports.camelize = exports.CalendarDate = exports.Benchmark = exports.ValidationError = exports.RecordNotFound = exports.GlobalNameNotSet = exports.CreateOrFindByFailedToCreateAndFind = exports.NonLoadedAssociation = exports.Encrypt = exports.DreamConst = exports.Query = exports.DreamTransaction = exports.Dream = exports.DreamApplication = exports.lookupClassByGlobalName = exports.DreamImporter = exports.Virtual = exports.Validates = exports.Validate = exports.STI = exports.Sortable = exports.SoftDelete = exports.Scope = exports.ReplicaSafe = exports.BeforeUpdate = exports.BeforeSave = exports.BeforeDestroy = exports.BeforeCreate = exports.AfterUpdateCommit = exports.AfterUpdate = exports.AfterSaveCommit = exports.AfterSave = exports.AfterDestroyCommit = exports.AfterDestroy = exports.AfterCreateCommit = exports.AfterCreate = exports.Decorators = exports.validateTable = exports.validateColumn = exports.DreamMigrationHelpers = exports.db = exports.pgErrorType = exports.dreamDbConnections = exports.closeAllDbConnections = exports.DreamCLI = exports.DreamBin = void 0;
|
|
4
|
+
exports.DreamSerializer = exports.Attribute = exports.RendersOne = exports.RendersMany = exports.ops = exports.openapiShorthandPrimitiveTypes = exports.openapiPrimitiveTypes = exports.uniq = exports.uncapitalize = exports.standardizeFullyQualifiedModelName = exports.sortBy = exports.snakeify = exports.serializerNameFromFullyQualifiedModelName = exports.round = exports.range = exports.Range = exports.sharedPathPrefix = exports.relativeDreamPath = exports.dreamPath = exports.pascalize = exports.loadRepl = exports.isEmpty = exports.inferSerializerFromDreamOrViewModel = exports.inferSerializerFromDreamClassOrViewModelClass = exports.hyphenize = exports.globalClassNameFromFullyQualifiedModelName = exports.Env = void 0;
|
|
5
|
+
var index_js_1 = require("./bin/index.js");
|
|
6
|
+
Object.defineProperty(exports, "DreamBin", { enumerable: true, get: function () { return index_js_1.default; } });
|
|
7
|
+
var index_js_2 = require("./cli/index.js");
|
|
8
|
+
Object.defineProperty(exports, "DreamCLI", { enumerable: true, get: function () { return index_js_2.default; } });
|
|
9
|
+
var DreamDbConnection_js_1 = require("./db/DreamDbConnection.js");
|
|
10
|
+
Object.defineProperty(exports, "closeAllDbConnections", { enumerable: true, get: function () { return DreamDbConnection_js_1.closeAllDbConnections; } });
|
|
11
|
+
Object.defineProperty(exports, "dreamDbConnections", { enumerable: true, get: function () { return DreamDbConnection_js_1.dreamDbConnections; } });
|
|
12
|
+
var errors_js_1 = require("./db/errors.js");
|
|
13
|
+
Object.defineProperty(exports, "pgErrorType", { enumerable: true, get: function () { return errors_js_1.pgErrorType; } });
|
|
14
|
+
var index_js_3 = require("./db/index.js");
|
|
15
|
+
Object.defineProperty(exports, "db", { enumerable: true, get: function () { return index_js_3.default; } });
|
|
16
|
+
var DreamMigrationHelpers_js_1 = require("./db/migration-helpers/DreamMigrationHelpers.js");
|
|
17
|
+
Object.defineProperty(exports, "DreamMigrationHelpers", { enumerable: true, get: function () { return DreamMigrationHelpers_js_1.default; } });
|
|
18
|
+
var validateColumn_js_1 = require("./db/validators/validateColumn.js");
|
|
19
|
+
Object.defineProperty(exports, "validateColumn", { enumerable: true, get: function () { return validateColumn_js_1.default; } });
|
|
20
|
+
var validateTable_js_1 = require("./db/validators/validateTable.js");
|
|
21
|
+
Object.defineProperty(exports, "validateTable", { enumerable: true, get: function () { return validateTable_js_1.default; } });
|
|
22
|
+
var Decorators_js_1 = require("./decorators/Decorators.js");
|
|
23
|
+
Object.defineProperty(exports, "Decorators", { enumerable: true, get: function () { return Decorators_js_1.default; } });
|
|
24
|
+
var AfterCreate_js_1 = require("./decorators/hooks/AfterCreate.js");
|
|
25
|
+
Object.defineProperty(exports, "AfterCreate", { enumerable: true, get: function () { return AfterCreate_js_1.default; } });
|
|
26
|
+
var AfterCreateCommit_js_1 = require("./decorators/hooks/AfterCreateCommit.js");
|
|
27
|
+
Object.defineProperty(exports, "AfterCreateCommit", { enumerable: true, get: function () { return AfterCreateCommit_js_1.default; } });
|
|
28
|
+
var AfterDestroy_js_1 = require("./decorators/hooks/AfterDestroy.js");
|
|
29
|
+
Object.defineProperty(exports, "AfterDestroy", { enumerable: true, get: function () { return AfterDestroy_js_1.default; } });
|
|
30
|
+
var AfterDestroyCommit_js_1 = require("./decorators/hooks/AfterDestroyCommit.js");
|
|
31
|
+
Object.defineProperty(exports, "AfterDestroyCommit", { enumerable: true, get: function () { return AfterDestroyCommit_js_1.default; } });
|
|
32
|
+
var AfterSave_js_1 = require("./decorators/hooks/AfterSave.js");
|
|
33
|
+
Object.defineProperty(exports, "AfterSave", { enumerable: true, get: function () { return AfterSave_js_1.default; } });
|
|
34
|
+
var AfterSaveCommit_js_1 = require("./decorators/hooks/AfterSaveCommit.js");
|
|
35
|
+
Object.defineProperty(exports, "AfterSaveCommit", { enumerable: true, get: function () { return AfterSaveCommit_js_1.default; } });
|
|
36
|
+
var AfterUpdate_js_1 = require("./decorators/hooks/AfterUpdate.js");
|
|
37
|
+
Object.defineProperty(exports, "AfterUpdate", { enumerable: true, get: function () { return AfterUpdate_js_1.default; } });
|
|
38
|
+
var AfterUpdateCommit_js_1 = require("./decorators/hooks/AfterUpdateCommit.js");
|
|
39
|
+
Object.defineProperty(exports, "AfterUpdateCommit", { enumerable: true, get: function () { return AfterUpdateCommit_js_1.default; } });
|
|
40
|
+
var BeforeCreate_js_1 = require("./decorators/hooks/BeforeCreate.js");
|
|
41
|
+
Object.defineProperty(exports, "BeforeCreate", { enumerable: true, get: function () { return BeforeCreate_js_1.default; } });
|
|
42
|
+
var BeforeDestroy_js_1 = require("./decorators/hooks/BeforeDestroy.js");
|
|
43
|
+
Object.defineProperty(exports, "BeforeDestroy", { enumerable: true, get: function () { return BeforeDestroy_js_1.default; } });
|
|
44
|
+
var BeforeSave_js_1 = require("./decorators/hooks/BeforeSave.js");
|
|
45
|
+
Object.defineProperty(exports, "BeforeSave", { enumerable: true, get: function () { return BeforeSave_js_1.default; } });
|
|
46
|
+
var BeforeUpdate_js_1 = require("./decorators/hooks/BeforeUpdate.js");
|
|
47
|
+
Object.defineProperty(exports, "BeforeUpdate", { enumerable: true, get: function () { return BeforeUpdate_js_1.default; } });
|
|
48
|
+
var ReplicaSafe_js_1 = require("./decorators/ReplicaSafe.js");
|
|
49
|
+
Object.defineProperty(exports, "ReplicaSafe", { enumerable: true, get: function () { return ReplicaSafe_js_1.default; } });
|
|
50
|
+
var Scope_js_1 = require("./decorators/Scope.js");
|
|
51
|
+
Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return Scope_js_1.default; } });
|
|
52
|
+
var SoftDelete_js_1 = require("./decorators/SoftDelete.js");
|
|
53
|
+
Object.defineProperty(exports, "SoftDelete", { enumerable: true, get: function () { return SoftDelete_js_1.default; } });
|
|
54
|
+
var Sortable_js_1 = require("./decorators/sortable/Sortable.js");
|
|
55
|
+
Object.defineProperty(exports, "Sortable", { enumerable: true, get: function () { return Sortable_js_1.default; } });
|
|
56
|
+
var STI_js_1 = require("./decorators/STI.js");
|
|
57
|
+
Object.defineProperty(exports, "STI", { enumerable: true, get: function () { return STI_js_1.default; } });
|
|
58
|
+
var Validate_js_1 = require("./decorators/validations/Validate.js");
|
|
59
|
+
Object.defineProperty(exports, "Validate", { enumerable: true, get: function () { return Validate_js_1.default; } });
|
|
60
|
+
var Validates_js_1 = require("./decorators/validations/Validates.js");
|
|
61
|
+
Object.defineProperty(exports, "Validates", { enumerable: true, get: function () { return Validates_js_1.default; } });
|
|
62
|
+
var Virtual_js_1 = require("./decorators/Virtual.js");
|
|
63
|
+
Object.defineProperty(exports, "Virtual", { enumerable: true, get: function () { return Virtual_js_1.default; } });
|
|
64
|
+
var DreamImporter_js_1 = require("./dream-application/helpers/DreamImporter.js");
|
|
65
|
+
Object.defineProperty(exports, "DreamImporter", { enumerable: true, get: function () { return DreamImporter_js_1.default; } });
|
|
66
|
+
var lookupClassByGlobalName_js_1 = require("./dream-application/helpers/lookupClassByGlobalName.js");
|
|
67
|
+
Object.defineProperty(exports, "lookupClassByGlobalName", { enumerable: true, get: function () { return lookupClassByGlobalName_js_1.default; } });
|
|
68
|
+
var index_js_4 = require("./dream-application/index.js");
|
|
69
|
+
Object.defineProperty(exports, "DreamApplication", { enumerable: true, get: function () { return index_js_4.default; } });
|
|
70
|
+
var Dream_js_1 = require("./Dream.js");
|
|
71
|
+
Object.defineProperty(exports, "Dream", { enumerable: true, get: function () { return Dream_js_1.default; } });
|
|
72
|
+
var DreamTransaction_js_1 = require("./dream/DreamTransaction.js");
|
|
73
|
+
Object.defineProperty(exports, "DreamTransaction", { enumerable: true, get: function () { return DreamTransaction_js_1.default; } });
|
|
74
|
+
var Query_js_1 = require("./dream/Query.js");
|
|
75
|
+
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return Query_js_1.default; } });
|
|
76
|
+
var types_js_1 = require("./dream/types.js");
|
|
77
|
+
Object.defineProperty(exports, "DreamConst", { enumerable: true, get: function () { return types_js_1.DreamConst; } });
|
|
78
|
+
var index_js_5 = require("./encrypt/index.js");
|
|
79
|
+
Object.defineProperty(exports, "Encrypt", { enumerable: true, get: function () { return index_js_5.default; } });
|
|
80
|
+
var NonLoadedAssociation_js_1 = require("./errors/associations/NonLoadedAssociation.js");
|
|
81
|
+
Object.defineProperty(exports, "NonLoadedAssociation", { enumerable: true, get: function () { return NonLoadedAssociation_js_1.default; } });
|
|
82
|
+
var CreateOrFindByFailedToCreateAndFind_js_1 = require("./errors/CreateOrFindByFailedToCreateAndFind.js");
|
|
83
|
+
Object.defineProperty(exports, "CreateOrFindByFailedToCreateAndFind", { enumerable: true, get: function () { return CreateOrFindByFailedToCreateAndFind_js_1.default; } });
|
|
84
|
+
var GlobalNameNotSet_js_1 = require("./errors/dream-application/GlobalNameNotSet.js");
|
|
85
|
+
Object.defineProperty(exports, "GlobalNameNotSet", { enumerable: true, get: function () { return GlobalNameNotSet_js_1.default; } });
|
|
86
|
+
var RecordNotFound_js_1 = require("./errors/RecordNotFound.js");
|
|
87
|
+
Object.defineProperty(exports, "RecordNotFound", { enumerable: true, get: function () { return RecordNotFound_js_1.default; } });
|
|
88
|
+
var ValidationError_js_1 = require("./errors/ValidationError.js");
|
|
89
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return ValidationError_js_1.default; } });
|
|
90
|
+
var benchmark_js_1 = require("./helpers/benchmark.js");
|
|
91
|
+
Object.defineProperty(exports, "Benchmark", { enumerable: true, get: function () { return benchmark_js_1.default; } });
|
|
92
|
+
var CalendarDate_js_1 = require("./helpers/CalendarDate.js");
|
|
93
|
+
Object.defineProperty(exports, "CalendarDate", { enumerable: true, get: function () { return CalendarDate_js_1.default; } });
|
|
94
|
+
var camelize_js_1 = require("./helpers/camelize.js");
|
|
95
|
+
Object.defineProperty(exports, "camelize", { enumerable: true, get: function () { return camelize_js_1.default; } });
|
|
96
|
+
var capitalize_js_1 = require("./helpers/capitalize.js");
|
|
97
|
+
Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return capitalize_js_1.default; } });
|
|
98
|
+
var generateDream_js_1 = require("./helpers/cli/generateDream.js");
|
|
99
|
+
Object.defineProperty(exports, "generateDream", { enumerable: true, get: function () { return generateDream_js_1.default; } });
|
|
100
|
+
var compact_js_1 = require("./helpers/compact.js");
|
|
101
|
+
Object.defineProperty(exports, "compact", { enumerable: true, get: function () { return compact_js_1.default; } });
|
|
102
|
+
var debug_js_1 = require("./helpers/debug.js");
|
|
103
|
+
Object.defineProperty(exports, "debug", { enumerable: true, get: function () { return debug_js_1.default; } });
|
|
104
|
+
var Env_js_1 = require("./helpers/Env.js");
|
|
105
|
+
Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return Env_js_1.default; } });
|
|
106
|
+
var globalClassNameFromFullyQualifiedModelName_js_1 = require("./helpers/globalClassNameFromFullyQualifiedModelName.js");
|
|
107
|
+
Object.defineProperty(exports, "globalClassNameFromFullyQualifiedModelName", { enumerable: true, get: function () { return globalClassNameFromFullyQualifiedModelName_js_1.default; } });
|
|
108
|
+
var hyphenize_js_1 = require("./helpers/hyphenize.js");
|
|
109
|
+
Object.defineProperty(exports, "hyphenize", { enumerable: true, get: function () { return hyphenize_js_1.default; } });
|
|
110
|
+
var inferSerializerFromDreamOrViewModel_js_1 = require("./helpers/inferSerializerFromDreamOrViewModel.js");
|
|
111
|
+
Object.defineProperty(exports, "inferSerializerFromDreamClassOrViewModelClass", { enumerable: true, get: function () { return inferSerializerFromDreamOrViewModel_js_1.inferSerializerFromDreamClassOrViewModelClass; } });
|
|
112
|
+
Object.defineProperty(exports, "inferSerializerFromDreamOrViewModel", { enumerable: true, get: function () { return inferSerializerFromDreamOrViewModel_js_1.default; } });
|
|
113
|
+
var isEmpty_js_1 = require("./helpers/isEmpty.js");
|
|
114
|
+
Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return isEmpty_js_1.default; } });
|
|
115
|
+
var loadRepl_js_1 = require("./helpers/loadRepl.js");
|
|
116
|
+
Object.defineProperty(exports, "loadRepl", { enumerable: true, get: function () { return loadRepl_js_1.default; } });
|
|
117
|
+
var pascalize_js_1 = require("./helpers/pascalize.js");
|
|
118
|
+
Object.defineProperty(exports, "pascalize", { enumerable: true, get: function () { return pascalize_js_1.default; } });
|
|
119
|
+
var dreamPath_js_1 = require("./helpers/path/dreamPath.js");
|
|
120
|
+
Object.defineProperty(exports, "dreamPath", { enumerable: true, get: function () { return dreamPath_js_1.default; } });
|
|
121
|
+
var relativeDreamPath_js_1 = require("./helpers/path/relativeDreamPath.js");
|
|
122
|
+
Object.defineProperty(exports, "relativeDreamPath", { enumerable: true, get: function () { return relativeDreamPath_js_1.default; } });
|
|
123
|
+
var sharedPathPrefix_js_1 = require("./helpers/path/sharedPathPrefix.js");
|
|
124
|
+
Object.defineProperty(exports, "sharedPathPrefix", { enumerable: true, get: function () { return sharedPathPrefix_js_1.default; } });
|
|
125
|
+
var range_js_1 = require("./helpers/range.js");
|
|
126
|
+
Object.defineProperty(exports, "Range", { enumerable: true, get: function () { return range_js_1.Range; } });
|
|
127
|
+
Object.defineProperty(exports, "range", { enumerable: true, get: function () { return range_js_1.default; } });
|
|
128
|
+
var round_js_1 = require("./helpers/round.js");
|
|
129
|
+
Object.defineProperty(exports, "round", { enumerable: true, get: function () { return round_js_1.default; } });
|
|
130
|
+
var serializerNameFromFullyQualifiedModelName_js_1 = require("./helpers/serializerNameFromFullyQualifiedModelName.js");
|
|
131
|
+
Object.defineProperty(exports, "serializerNameFromFullyQualifiedModelName", { enumerable: true, get: function () { return serializerNameFromFullyQualifiedModelName_js_1.default; } });
|
|
132
|
+
var snakeify_js_1 = require("./helpers/snakeify.js");
|
|
133
|
+
Object.defineProperty(exports, "snakeify", { enumerable: true, get: function () { return snakeify_js_1.default; } });
|
|
134
|
+
var sortBy_js_1 = require("./helpers/sortBy.js");
|
|
135
|
+
Object.defineProperty(exports, "sortBy", { enumerable: true, get: function () { return sortBy_js_1.default; } });
|
|
136
|
+
var standardizeFullyQualifiedModelName_js_1 = require("./helpers/standardizeFullyQualifiedModelName.js");
|
|
137
|
+
Object.defineProperty(exports, "standardizeFullyQualifiedModelName", { enumerable: true, get: function () { return standardizeFullyQualifiedModelName_js_1.default; } });
|
|
138
|
+
var uncapitalize_js_1 = require("./helpers/uncapitalize.js");
|
|
139
|
+
Object.defineProperty(exports, "uncapitalize", { enumerable: true, get: function () { return uncapitalize_js_1.default; } });
|
|
140
|
+
var uniq_js_1 = require("./helpers/uniq.js");
|
|
141
|
+
Object.defineProperty(exports, "uniq", { enumerable: true, get: function () { return uniq_js_1.default; } });
|
|
142
|
+
var types_js_2 = require("./openapi/types.js");
|
|
143
|
+
Object.defineProperty(exports, "openapiPrimitiveTypes", { enumerable: true, get: function () { return types_js_2.openapiPrimitiveTypes; } });
|
|
144
|
+
Object.defineProperty(exports, "openapiShorthandPrimitiveTypes", { enumerable: true, get: function () { return types_js_2.openapiShorthandPrimitiveTypes; } });
|
|
145
|
+
var index_js_6 = require("./ops/index.js");
|
|
146
|
+
Object.defineProperty(exports, "ops", { enumerable: true, get: function () { return index_js_6.default; } });
|
|
147
|
+
var RendersMany_js_1 = require("./serializer/decorators/associations/RendersMany.js");
|
|
148
|
+
Object.defineProperty(exports, "RendersMany", { enumerable: true, get: function () { return RendersMany_js_1.default; } });
|
|
149
|
+
var RendersOne_js_1 = require("./serializer/decorators/associations/RendersOne.js");
|
|
150
|
+
Object.defineProperty(exports, "RendersOne", { enumerable: true, get: function () { return RendersOne_js_1.default; } });
|
|
151
|
+
var attribute_js_1 = require("./serializer/decorators/attribute.js");
|
|
152
|
+
Object.defineProperty(exports, "Attribute", { enumerable: true, get: function () { return attribute_js_1.default; } });
|
|
153
|
+
var index_js_7 = require("./serializer/index.js");
|
|
154
|
+
Object.defineProperty(exports, "DreamSerializer", { enumerable: true, get: function () { return index_js_7.default; } });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.openapiShorthandPrimitiveTypes = exports.openapiPrimitiveTypes = void 0;
|
|
4
|
+
exports.openapiPrimitiveTypes = [
|
|
5
|
+
'string',
|
|
6
|
+
'boolean',
|
|
7
|
+
'number',
|
|
8
|
+
'date',
|
|
9
|
+
'date-time',
|
|
10
|
+
'double',
|
|
11
|
+
'integer',
|
|
12
|
+
'null',
|
|
13
|
+
];
|
|
14
|
+
exports.openapiShorthandPrimitiveTypes = [
|
|
15
|
+
...exports.openapiPrimitiveTypes,
|
|
16
|
+
'decimal',
|
|
17
|
+
'string[]',
|
|
18
|
+
'boolean[]',
|
|
19
|
+
'number[]',
|
|
20
|
+
'date[]',
|
|
21
|
+
'date-time[]',
|
|
22
|
+
'decimal[]',
|
|
23
|
+
'double[]',
|
|
24
|
+
'integer[]',
|
|
25
|
+
'json',
|
|
26
|
+
];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class CurriedOpsStatement {
|
|
4
|
+
factoryFn;
|
|
5
|
+
constructor(factoryFn) {
|
|
6
|
+
this.factoryFn = factoryFn;
|
|
7
|
+
}
|
|
8
|
+
toOpsStatement(dreamClass, fieldName) {
|
|
9
|
+
return this.factoryFn(dreamClass, fieldName);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.default = CurriedOpsStatement;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const kysely_1 = require("kysely");
|
|
4
|
+
const AnyRequiresArrayColumn_js_1 = require("../errors/ops/AnyRequiresArrayColumn.js");
|
|
5
|
+
const isDatabaseArrayColumn_js_1 = require("../helpers/db/types/isDatabaseArrayColumn.js");
|
|
6
|
+
const curried_ops_statement_js_1 = require("./curried-ops-statement.js");
|
|
7
|
+
const ops_statement_js_1 = require("./ops-statement.js");
|
|
8
|
+
const ops = {
|
|
9
|
+
expression: (operator, value) => new ops_statement_js_1.default(operator, value),
|
|
10
|
+
in: (arr) => new ops_statement_js_1.default('in', arr),
|
|
11
|
+
any: (value) => new curried_ops_statement_js_1.default(function (dreamClass, fieldName) {
|
|
12
|
+
const column = fieldName.replace(/^.*\./, '');
|
|
13
|
+
if (!(0, isDatabaseArrayColumn_js_1.default)(dreamClass, column))
|
|
14
|
+
throw new AnyRequiresArrayColumn_js_1.default(dreamClass, column);
|
|
15
|
+
const castType = dreamClass['cachedTypeFor'](column);
|
|
16
|
+
return new ops_statement_js_1.default('@>', (0, kysely_1.sql) `ARRAY[${kysely_1.sql.join([value])}]::${kysely_1.sql.raw(castType)}`);
|
|
17
|
+
}),
|
|
18
|
+
like: (like) => new ops_statement_js_1.default('like', like),
|
|
19
|
+
ilike: (ilike) => new ops_statement_js_1.default('ilike', ilike),
|
|
20
|
+
match: (match, { caseInsensitive = false } = {}) => new ops_statement_js_1.default(caseInsensitive ? '~*' : '~', match),
|
|
21
|
+
// current
|
|
22
|
+
equal: (equal) => new ops_statement_js_1.default('=', equal),
|
|
23
|
+
lessThan: (lessThan) => new ops_statement_js_1.default('<', lessThan),
|
|
24
|
+
lessThanOrEqualTo: (lessThanOrEqualTo) => new ops_statement_js_1.default('<=', lessThanOrEqualTo),
|
|
25
|
+
greaterThan: (greaterThan) => new ops_statement_js_1.default('>', greaterThan),
|
|
26
|
+
greaterThanOrEqualTo: (greaterThanOrEqualTo) => new ops_statement_js_1.default('>=', greaterThanOrEqualTo),
|
|
27
|
+
similarity: (similarity, { score = 0.3 } = {}) => new ops_statement_js_1.default('%', similarity, { score }),
|
|
28
|
+
wordSimilarity: (similarity, { score = 0.5 } = {}) => new ops_statement_js_1.default('<%', similarity, { score }),
|
|
29
|
+
strictWordSimilarity: (similarity, { score = 0.6 } = {}) => new ops_statement_js_1.default('<<%', similarity, { score }),
|
|
30
|
+
not: {
|
|
31
|
+
in: (arr) => new ops_statement_js_1.default('not in', arr),
|
|
32
|
+
like: (like) => new ops_statement_js_1.default('not like', like),
|
|
33
|
+
ilike: (ilike) => new ops_statement_js_1.default('not ilike', ilike),
|
|
34
|
+
match: (match, { caseInsensitive = false } = {}) => new ops_statement_js_1.default(caseInsensitive ? '!~*' : '!~', match),
|
|
35
|
+
equal: (equal) => new ops_statement_js_1.default('!=', equal),
|
|
36
|
+
lessThan: (lessThan) => new ops_statement_js_1.default('>=', lessThan),
|
|
37
|
+
lessThanOrEqualTo: (lessThanOrEqualTo) => new ops_statement_js_1.default('>', lessThanOrEqualTo),
|
|
38
|
+
greaterThan: (greaterThan) => new ops_statement_js_1.default('<=', greaterThan),
|
|
39
|
+
greaterThanOrEqualTo: (greaterThanOrEqualTo) => new ops_statement_js_1.default('<', greaterThanOrEqualTo),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
exports.default = ops;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_js_1 = require("../dream/types.js");
|
|
4
|
+
const ScoreMustBeANormalNumber_js_1 = require("../errors/ops/ScoreMustBeANormalNumber.js");
|
|
5
|
+
class OpsStatement {
|
|
6
|
+
operator;
|
|
7
|
+
value;
|
|
8
|
+
extraArgs;
|
|
9
|
+
constructor(operator, value, extraArgs) {
|
|
10
|
+
this.operator = operator;
|
|
11
|
+
this.value = value;
|
|
12
|
+
this.extraArgs = extraArgs;
|
|
13
|
+
if (typeof extraArgs?.score === 'number' &&
|
|
14
|
+
(extraArgs.score < 0 || extraArgs.score > 1)) {
|
|
15
|
+
throw new ScoreMustBeANormalNumber_js_1.default(extraArgs.score);
|
|
16
|
+
}
|
|
17
|
+
this.operator = operator;
|
|
18
|
+
this.value = value;
|
|
19
|
+
if (extraArgs) {
|
|
20
|
+
this.extraArgs = Object.freeze({ ...extraArgs });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
get isOpsStatement() {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
get shouldBypassWhereStatement() {
|
|
27
|
+
return types_js_1.TRIGRAM_OPERATORS.includes(this.operator);
|
|
28
|
+
}
|
|
29
|
+
get minTrigramScore() {
|
|
30
|
+
if (types_js_1.TRIGRAM_OPERATORS.includes(this.operator)) {
|
|
31
|
+
return this.extraArgs?.score;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.default = OpsStatement;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = RendersMany;
|
|
4
|
+
const shared_js_1 = require("./shared.js");
|
|
5
|
+
/**
|
|
6
|
+
* Establishes a One to Many relationship between
|
|
7
|
+
* the base serializer and the child serializer
|
|
8
|
+
*
|
|
9
|
+
* This relationship is similar to a RendersOne relationship,
|
|
10
|
+
* except that it will an array of serialized records. It is generally
|
|
11
|
+
* used to correspond with a HasMany association
|
|
12
|
+
* on the models being driven through the serializer.
|
|
13
|
+
*
|
|
14
|
+
* If no argument is provided to RendersMany, it will infer the serializer
|
|
15
|
+
* by looking to the default serializer of the model
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* class User extends ApplicationModel {
|
|
19
|
+
* @Deco.HasOne('Settings')
|
|
20
|
+
* public settings: Settings
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* class Post extends ApplicationModel {
|
|
24
|
+
* @Deco.BelongsTo('User')
|
|
25
|
+
* public user: User
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* class UserSerializer {
|
|
29
|
+
* @RendersMany()
|
|
30
|
+
* public posts: Post[]
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* An explicit serializer can also be provided:
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* class UserSerializer {
|
|
38
|
+
* @RendersMany(() => PostSummarySerializer)
|
|
39
|
+
* public posts: Post[]
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
function RendersMany(serializableClassOrClasses = null, opts) {
|
|
44
|
+
return function (_, context) {
|
|
45
|
+
const key = context.name;
|
|
46
|
+
context.addInitializer(function () {
|
|
47
|
+
const target = this;
|
|
48
|
+
const serializerClass = target.constructor;
|
|
49
|
+
if (!serializerClass['globallyInitializingDecorators']) {
|
|
50
|
+
/**
|
|
51
|
+
* Modern Javascript applies implicit accessors to instance properties
|
|
52
|
+
* that don't have an accessor explicitly defined in the class definition.
|
|
53
|
+
* The instance accessors shadow prototype accessors.
|
|
54
|
+
* `addInitializer` is called by Decorators after an instance has been fully
|
|
55
|
+
* constructed. We leverage this opportunity to delete the instance accessors
|
|
56
|
+
* so that the prototype accessors applied by this decorator can be reached.
|
|
57
|
+
*/
|
|
58
|
+
delete this[key];
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if ((0, shared_js_1.isSerializable)(serializableClassOrClasses)) {
|
|
62
|
+
opts ||= {};
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
opts = (serializableClassOrClasses || {});
|
|
66
|
+
serializableClassOrClasses = null;
|
|
67
|
+
}
|
|
68
|
+
serializerClass.associationStatements = [
|
|
69
|
+
...(serializerClass.associationStatements || []),
|
|
70
|
+
{
|
|
71
|
+
type: 'RendersMany',
|
|
72
|
+
field: key,
|
|
73
|
+
optional: opts.optional || false,
|
|
74
|
+
dreamOrSerializerClass: serializableClassOrClasses,
|
|
75
|
+
serializerKey: opts.serializerKey,
|
|
76
|
+
source: opts.source || key,
|
|
77
|
+
through: opts.through || null,
|
|
78
|
+
path: opts.path || null,
|
|
79
|
+
exportedAs: opts.exportedAs || null,
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = RendersOne;
|
|
4
|
+
const shared_js_1 = require("./shared.js");
|
|
5
|
+
/**
|
|
6
|
+
* Establishes a One to One relationship between
|
|
7
|
+
* the base serializer and the child serializer
|
|
8
|
+
*
|
|
9
|
+
* This relationship is similar to a RendersMany relationship,
|
|
10
|
+
* except that it will only render one item. It is generally
|
|
11
|
+
* used to correspond with HasOne and BelongsTo associations
|
|
12
|
+
* on the models being driven through the serializer.
|
|
13
|
+
*
|
|
14
|
+
* If no argument is provided to RendersOne, it will infer the serializer
|
|
15
|
+
* by looking to the default serializer of the model
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* class User extends ApplicationModel {
|
|
19
|
+
* @Deco.HasOne('Settings')
|
|
20
|
+
* public settings: Settings
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* class Settings extends ApplicationModel {
|
|
24
|
+
* @Deco.BelongsTo('User')
|
|
25
|
+
* public user: User
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* class UserSerializer {
|
|
29
|
+
* @RendersOne()
|
|
30
|
+
* public settings: Settings
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* An explicit serializer can also be provided:
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* class UserSerializer {
|
|
38
|
+
* @RendersOne(() => SettingsSummarySerializer)
|
|
39
|
+
* public settings: Settings
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @param opts.flatten - whether or not to flatten the association's attributes into this serializer when rendering. Defaults to false.
|
|
44
|
+
*/
|
|
45
|
+
function RendersOne(serializableClassOrClasses = null, opts) {
|
|
46
|
+
return function (_, context) {
|
|
47
|
+
const key = context.name;
|
|
48
|
+
context.addInitializer(function () {
|
|
49
|
+
const target = this;
|
|
50
|
+
const serializerClass = target.constructor;
|
|
51
|
+
if (!serializerClass['globallyInitializingDecorators']) {
|
|
52
|
+
/**
|
|
53
|
+
* Modern Javascript applies implicit accessors to instance properties
|
|
54
|
+
* that don't have an accessor explicitly defined in the class definition.
|
|
55
|
+
* The instance accessors shadow prototype accessors.
|
|
56
|
+
* `addInitializer` is called by Decorators after an instance has been fully
|
|
57
|
+
* constructed. We leverage this opportunity to delete the instance accessors
|
|
58
|
+
* so that the prototype accessors applied by this decorator can be reached.
|
|
59
|
+
*/
|
|
60
|
+
delete this[key];
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if ((0, shared_js_1.isSerializable)(serializableClassOrClasses)) {
|
|
64
|
+
opts ||= {};
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
opts = (serializableClassOrClasses || {});
|
|
68
|
+
serializableClassOrClasses = null;
|
|
69
|
+
}
|
|
70
|
+
serializerClass.associationStatements = [
|
|
71
|
+
...(serializerClass.associationStatements || []),
|
|
72
|
+
{
|
|
73
|
+
type: 'RendersOne',
|
|
74
|
+
field: key,
|
|
75
|
+
flatten: opts.flatten || false,
|
|
76
|
+
optional: opts.optional || false,
|
|
77
|
+
dreamOrSerializerClass: serializableClassOrClasses,
|
|
78
|
+
serializerKey: opts.serializerKey,
|
|
79
|
+
source: opts.source || key,
|
|
80
|
+
through: opts.through || null,
|
|
81
|
+
path: opts.path || null,
|
|
82
|
+
exportedAs: opts.exportedAs || null,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSerializable = isSerializable;
|
|
4
|
+
const hasSerializersGetter_js_1 = require("../helpers/hasSerializersGetter.js");
|
|
5
|
+
const maybeSerializableToDreamSerializerCallbackFunction_js_1 = require("../helpers/maybeSerializableToDreamSerializerCallbackFunction.js");
|
|
6
|
+
function isSerializable(dreamOrSerializerClass) {
|
|
7
|
+
return (Array.isArray(dreamOrSerializerClass) ||
|
|
8
|
+
(0, hasSerializersGetter_js_1.default)(dreamOrSerializerClass) ||
|
|
9
|
+
!!(0, maybeSerializableToDreamSerializerCallbackFunction_js_1.default)(dreamOrSerializerClass));
|
|
10
|
+
}
|