@rvoh/dream 2.3.0-alpha.6 → 2.3.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/Dream.js +2 -40
- package/dist/cjs/src/cli/index.js +4 -0
- package/dist/cjs/src/dream/Query.js +14 -11
- package/dist/cjs/src/dream/QueryDriver/Base.js +0 -14
- package/dist/cjs/src/dream/QueryDriver/Kysely.js +86 -74
- package/dist/cjs/src/dream/QueryDriver/Postgres.js +10 -2
- package/dist/cjs/src/dream/internal/extractAssignableAssociationAttributes.js +9 -0
- package/dist/cjs/src/errors/db/DataIncompatibleWithDatabaseField.js +1 -3
- package/dist/cjs/src/helpers/areEqual.js +5 -0
- package/dist/cjs/src/helpers/cli/ASTBuilder.js +54 -2
- package/dist/cjs/src/helpers/cli/ASTKyselyCodegenEnhancer.js +84 -0
- package/dist/cjs/src/helpers/cli/ASTSchemaBuilder.js +17 -1
- package/dist/cjs/src/helpers/cli/generateFactoryContent.js +16 -0
- package/dist/cjs/src/helpers/cloneDeepSafe.js +21 -10
- package/dist/cjs/src/helpers/customPgParsers.js +18 -1
- package/dist/cjs/src/helpers/db/normalizeDataForDb.js +81 -0
- package/dist/cjs/src/helpers/db/types/helpers.js +5 -0
- package/dist/cjs/src/helpers/db/types/isDatetimeOrDatetimeArrayColumn.js +2 -1
- package/dist/cjs/src/helpers/sortBy.js +7 -5
- package/dist/cjs/src/helpers/sqlAttributes.js +4 -53
- package/dist/cjs/src/helpers/stringCasing.js +6 -5
- package/dist/cjs/src/helpers/toSafeObject.js +17 -0
- package/dist/cjs/src/package-exports/errors.js +2 -0
- package/dist/cjs/src/package-exports/index.js +2 -0
- package/dist/cjs/src/serializer/SerializerRenderer.js +11 -11
- package/dist/cjs/src/types/clocktime.js +1 -0
- package/dist/cjs/src/utils/datetime/BaseClockTime.js +363 -0
- package/dist/cjs/src/utils/datetime/CalendarDate.js +110 -119
- package/dist/cjs/src/utils/datetime/ClockTime.js +173 -0
- package/dist/cjs/src/utils/datetime/ClockTimeTz.js +232 -0
- package/dist/cjs/src/utils/datetime/DateTime.js +288 -193
- package/dist/cjs/src/utils/datetime/helpers/isoTimeDecimalString.js +1 -1
- package/dist/esm/src/Dream.js +2 -40
- package/dist/esm/src/cli/index.js +4 -0
- package/dist/esm/src/dream/Query.js +14 -11
- package/dist/esm/src/dream/QueryDriver/Base.js +0 -14
- package/dist/esm/src/dream/QueryDriver/Kysely.js +86 -74
- package/dist/esm/src/dream/QueryDriver/Postgres.js +10 -2
- package/dist/esm/src/dream/internal/extractAssignableAssociationAttributes.js +9 -0
- package/dist/esm/src/errors/db/DataIncompatibleWithDatabaseField.js +1 -3
- package/dist/esm/src/helpers/areEqual.js +5 -0
- package/dist/esm/src/helpers/cli/ASTBuilder.js +54 -2
- package/dist/esm/src/helpers/cli/ASTKyselyCodegenEnhancer.js +84 -0
- package/dist/esm/src/helpers/cli/ASTSchemaBuilder.js +17 -1
- package/dist/esm/src/helpers/cli/generateFactoryContent.js +16 -0
- package/dist/esm/src/helpers/cloneDeepSafe.js +21 -10
- package/dist/esm/src/helpers/customPgParsers.js +18 -1
- package/dist/esm/src/helpers/db/normalizeDataForDb.js +81 -0
- package/dist/esm/src/helpers/db/types/helpers.js +5 -0
- package/dist/esm/src/helpers/db/types/isDatetimeOrDatetimeArrayColumn.js +2 -1
- package/dist/esm/src/helpers/sortBy.js +7 -5
- package/dist/esm/src/helpers/sqlAttributes.js +4 -53
- package/dist/esm/src/helpers/stringCasing.js +6 -5
- package/dist/esm/src/helpers/toSafeObject.js +17 -0
- package/dist/esm/src/package-exports/errors.js +2 -0
- package/dist/esm/src/package-exports/index.js +2 -0
- package/dist/esm/src/serializer/SerializerRenderer.js +11 -11
- package/dist/esm/src/types/clocktime.js +1 -0
- package/dist/esm/src/utils/datetime/BaseClockTime.js +363 -0
- package/dist/esm/src/utils/datetime/CalendarDate.js +110 -119
- package/dist/esm/src/utils/datetime/ClockTime.js +173 -0
- package/dist/esm/src/utils/datetime/ClockTimeTz.js +232 -0
- package/dist/esm/src/utils/datetime/DateTime.js +288 -193
- package/dist/esm/src/utils/datetime/helpers/isoTimeDecimalString.js +1 -1
- package/dist/types/src/Dream.d.ts +29 -33
- package/dist/types/src/dream/DreamClassTransactionBuilder.d.ts +9 -10
- package/dist/types/src/dream/DreamInstanceTransactionBuilder.d.ts +16 -16
- package/dist/types/src/dream/LeftJoinLoadBuilder.d.ts +1 -1
- package/dist/types/src/dream/LoadBuilder.d.ts +1 -1
- package/dist/types/src/dream/Query.d.ts +16 -16
- package/dist/types/src/dream/QueryDriver/Base.d.ts +0 -1
- package/dist/types/src/dream/QueryDriver/Kysely.d.ts +1 -0
- package/dist/types/src/dream/internal/associations/associationQuery.d.ts +1 -1
- package/dist/types/src/dream/internal/associations/associationUpdateQuery.d.ts +1 -1
- package/dist/types/src/dream/internal/associations/destroyAssociation.d.ts +1 -1
- package/dist/types/src/dream/internal/associations/throughAssociationHasOptionsBesidesThroughAndSource.d.ts +4 -2
- package/dist/types/src/dream/internal/associations/undestroyAssociation.d.ts +1 -1
- package/dist/types/src/dream/internal/extractAssignableAssociationAttributes.d.ts +3 -0
- package/dist/types/src/dream/internal/similarity/SimilarityBuilder.d.ts +7 -7
- package/dist/types/src/errors/db/DataIncompatibleWithDatabaseField.d.ts +2 -7
- package/dist/types/src/helpers/cli/ASTBuilder.d.ts +31 -0
- package/dist/types/src/helpers/cli/ASTKyselyCodegenEnhancer.d.ts +13 -0
- package/dist/types/src/helpers/customPgParsers.d.ts +5 -0
- package/dist/types/src/helpers/db/normalizeDataForDb.d.ts +6 -0
- package/dist/types/src/helpers/db/types/helpers.d.ts +5 -0
- package/dist/types/src/helpers/sort.d.ts +2 -1
- package/dist/types/src/helpers/sortBy.d.ts +3 -0
- package/dist/types/src/helpers/toSafeObject.d.ts +8 -0
- package/dist/types/src/package-exports/errors.d.ts +2 -0
- package/dist/types/src/package-exports/index.d.ts +2 -0
- package/dist/types/src/package-exports/types.d.ts +2 -1
- package/dist/types/src/types/associations/shared.d.ts +15 -13
- package/dist/types/src/types/associations/shared.ts +81 -41
- package/dist/types/src/types/calendardate.d.ts +22 -1
- package/dist/types/src/types/calendardate.ts +33 -1
- package/dist/types/src/types/clocktime.d.ts +22 -0
- package/dist/types/src/types/clocktime.ts +59 -0
- package/dist/types/src/types/datetime.d.ts +11 -18
- package/dist/types/src/types/datetime.ts +16 -21
- package/dist/types/src/types/dream.d.ts +27 -13
- package/dist/types/src/types/dream.ts +40 -14
- package/dist/types/src/types/variadic.d.ts +10 -9
- package/dist/types/src/types/variadic.ts +30 -5
- package/dist/types/src/utils/datetime/BaseClockTime.d.ts +287 -0
- package/dist/types/src/utils/datetime/CalendarDate.d.ts +65 -47
- package/dist/types/src/utils/datetime/ClockTime.d.ts +138 -0
- package/dist/types/src/utils/datetime/ClockTimeTz.d.ts +194 -0
- package/dist/types/src/utils/datetime/DateTime.d.ts +142 -56
- package/dist/types/src/utils/datetime/helpers/isoTimeDecimalString.d.ts +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/db.DreamMigrationHelpers.html +9 -9
- package/docs/classes/db.KyselyQueryDriver.html +33 -34
- package/docs/classes/db.PostgresQueryDriver.html +34 -35
- package/docs/classes/db.QueryDriverBase.html +32 -33
- package/docs/classes/errors.CheckConstraintViolation.html +4 -6
- package/docs/classes/errors.ColumnOverflow.html +4 -6
- package/docs/classes/errors.CreateOrFindByFailedToCreateAndFind.html +3 -3
- package/docs/classes/errors.DataIncompatibleWithDatabaseField.html +4 -6
- package/docs/classes/errors.DataTypeColumnTypeMismatch.html +4 -6
- package/docs/classes/errors.GlobalNameNotSet.html +3 -3
- package/docs/classes/errors.InvalidCalendarDate.html +2 -2
- package/docs/classes/errors.InvalidClockTime.html +17 -0
- package/docs/classes/errors.InvalidClockTimeTz.html +17 -0
- package/docs/classes/errors.InvalidDateTime.html +2 -2
- package/docs/classes/errors.MissingSerializersDefinition.html +3 -3
- package/docs/classes/errors.NonLoadedAssociation.html +3 -3
- package/docs/classes/errors.NotNullViolation.html +4 -6
- package/docs/classes/errors.RecordNotFound.html +3 -3
- package/docs/classes/errors.ValidationError.html +3 -3
- package/docs/classes/index.CalendarDate.html +80 -92
- package/docs/classes/index.ClockTime.html +232 -0
- package/docs/classes/index.ClockTimeTz.html +253 -0
- package/docs/classes/index.DateTime.html +123 -129
- package/docs/classes/index.Decorators.html +19 -19
- package/docs/classes/index.Dream.html +127 -127
- package/docs/classes/index.DreamApp.html +5 -5
- package/docs/classes/index.DreamTransaction.html +2 -2
- package/docs/classes/index.Env.html +2 -2
- package/docs/classes/index.Query.html +71 -71
- package/docs/classes/system.CliFileWriter.html +2 -2
- package/docs/classes/system.DreamBin.html +2 -2
- package/docs/classes/system.DreamCLI.html +5 -5
- package/docs/classes/system.DreamImporter.html +2 -2
- package/docs/classes/system.DreamLogos.html +2 -2
- package/docs/classes/system.DreamSerializerBuilder.html +8 -8
- package/docs/classes/system.ObjectSerializerBuilder.html +8 -8
- package/docs/classes/system.PathHelpers.html +3 -3
- package/docs/classes/utils.Encrypt.html +2 -2
- package/docs/classes/utils.Range.html +2 -2
- package/docs/functions/db.closeAllDbConnections.html +1 -1
- package/docs/functions/db.dreamDbConnections.html +1 -1
- package/docs/functions/db.untypedDb.html +1 -1
- package/docs/functions/db.validateColumn.html +1 -1
- package/docs/functions/db.validateTable.html +1 -1
- package/docs/functions/errors.pgErrorType.html +1 -1
- package/docs/functions/index.DreamSerializer.html +1 -1
- package/docs/functions/index.ObjectSerializer.html +1 -1
- package/docs/functions/index.ReplicaSafe.html +1 -1
- package/docs/functions/index.STI.html +1 -1
- package/docs/functions/index.SoftDelete.html +1 -1
- package/docs/functions/utils.camelize.html +1 -1
- package/docs/functions/utils.capitalize.html +1 -1
- package/docs/functions/utils.cloneDeepSafe.html +1 -1
- package/docs/functions/utils.compact.html +1 -1
- package/docs/functions/utils.groupBy.html +1 -1
- package/docs/functions/utils.hyphenize.html +1 -1
- package/docs/functions/utils.intersection.html +1 -1
- package/docs/functions/utils.isEmpty.html +1 -1
- package/docs/functions/utils.normalizeUnicode.html +1 -1
- package/docs/functions/utils.pascalize.html +1 -1
- package/docs/functions/utils.percent.html +1 -1
- package/docs/functions/utils.range-1.html +1 -1
- package/docs/functions/utils.round.html +1 -1
- package/docs/functions/utils.sanitizeString.html +1 -1
- package/docs/functions/utils.snakeify.html +1 -1
- package/docs/functions/utils.sort.html +1 -1
- package/docs/functions/utils.sortBy.html +1 -1
- package/docs/functions/utils.sortObjectByKey.html +1 -1
- package/docs/functions/utils.sortObjectByValue.html +1 -1
- package/docs/functions/utils.uncapitalize.html +1 -1
- package/docs/functions/utils.uniq.html +1 -1
- package/docs/interfaces/openapi.OpenapiDescription.html +2 -2
- package/docs/interfaces/openapi.OpenapiSchemaProperties.html +1 -1
- package/docs/interfaces/openapi.OpenapiSchemaPropertiesShorthand.html +1 -1
- package/docs/interfaces/openapi.OpenapiTypeFieldObject.html +1 -1
- package/docs/interfaces/types.BelongsToStatement.html +2 -2
- package/docs/interfaces/types.DecoratorContext.html +2 -2
- package/docs/interfaces/types.DreamAppInitOptions.html +2 -2
- package/docs/interfaces/types.DreamAppOpts.html +2 -2
- package/docs/interfaces/types.DurationObject.html +5 -5
- package/docs/interfaces/types.EncryptOptions.html +2 -2
- package/docs/interfaces/types.InternalAnyTypedSerializerRendersMany.html +2 -2
- package/docs/interfaces/types.InternalAnyTypedSerializerRendersOne.html +2 -2
- package/docs/interfaces/types.SerializerRendererOpts.html +2 -2
- package/docs/modules/db.html +1 -1
- package/docs/modules/errors.html +3 -1
- package/docs/modules/index.html +3 -1
- package/docs/modules/openapi.html +1 -1
- package/docs/modules/system.html +1 -1
- package/docs/modules/types.html +3 -1
- package/docs/modules/utils.html +1 -1
- package/docs/types/openapi.CommonOpenapiSchemaObjectFields.html +1 -1
- package/docs/types/openapi.OpenapiAllTypes.html +1 -1
- package/docs/types/openapi.OpenapiFormats.html +1 -1
- package/docs/types/openapi.OpenapiNumberFormats.html +1 -1
- package/docs/types/openapi.OpenapiPrimitiveBaseTypes.html +1 -1
- package/docs/types/openapi.OpenapiPrimitiveTypes.html +1 -1
- package/docs/types/openapi.OpenapiSchemaArray.html +1 -1
- package/docs/types/openapi.OpenapiSchemaArrayShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBase.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBody.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBodyShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaCommonFields.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaInteger.html +1 -1
- package/docs/types/openapi.OpenapiSchemaNull.html +1 -1
- package/docs/types/openapi.OpenapiSchemaNumber.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObject.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAllOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAnyOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectBase.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectBaseShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectOneOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaPrimitiveGeneric.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
- package/docs/types/openapi.OpenapiSchemaString.html +1 -1
- package/docs/types/openapi.OpenapiShorthandAllTypes.html +1 -1
- package/docs/types/openapi.OpenapiShorthandPrimitiveBaseTypes.html +1 -1
- package/docs/types/openapi.OpenapiShorthandPrimitiveTypes.html +1 -1
- package/docs/types/openapi.OpenapiTypeField.html +1 -1
- package/docs/types/system.DreamAppAllowedPackageManagersEnum.html +1 -1
- package/docs/types/types.CalendarDateDurationUnit.html +1 -1
- package/docs/types/types.CalendarDateObject.html +2 -0
- package/docs/types/types.Camelized.html +1 -1
- package/docs/types/types.ClockTimeObject.html +2 -0
- package/docs/types/types.DbConnectionType.html +1 -1
- package/docs/types/types.DbTypes.html +1 -1
- package/docs/types/types.DreamAssociationMetadata.html +1 -1
- package/docs/types/types.DreamAttributes.html +1 -1
- package/docs/types/types.DreamClassAssociationAndStatement.html +1 -1
- package/docs/types/types.DreamClassColumn.html +1 -1
- package/docs/types/types.DreamColumn.html +1 -1
- package/docs/types/types.DreamColumnNames.html +1 -1
- package/docs/types/types.DreamLogLevel.html +1 -1
- package/docs/types/types.DreamLogger.html +1 -1
- package/docs/types/types.DreamModelSerializerType.html +1 -1
- package/docs/types/types.DreamOrViewModelClassSerializerKey.html +1 -1
- package/docs/types/types.DreamOrViewModelSerializerKey.html +1 -1
- package/docs/types/types.DreamParamSafeAttributes.html +1 -1
- package/docs/types/types.DreamParamSafeColumnNames.html +1 -1
- package/docs/types/types.DreamSerializable.html +1 -1
- package/docs/types/types.DreamSerializableArray.html +1 -1
- package/docs/types/types.DreamSerializerKey.html +1 -1
- package/docs/types/types.DreamSerializers.html +1 -1
- package/docs/types/types.DreamVirtualColumns.html +1 -1
- package/docs/types/types.DurationUnit.html +2 -4
- package/docs/types/types.EncryptAlgorithm.html +1 -1
- package/docs/types/types.HasManyStatement.html +1 -1
- package/docs/types/types.HasOneStatement.html +1 -1
- package/docs/types/types.Hyphenized.html +1 -1
- package/docs/types/types.Pascalized.html +1 -1
- package/docs/types/types.PrimaryKeyType.html +1 -1
- package/docs/types/types.RoundingPrecision.html +1 -1
- package/docs/types/types.SerializerCasing.html +1 -1
- package/docs/types/types.SimpleObjectSerializerType.html +1 -1
- package/docs/types/types.Snakeified.html +1 -1
- package/docs/types/types.StrictInterface.html +1 -1
- package/docs/types/types.UpdateableAssociationProperties.html +1 -1
- package/docs/types/types.UpdateableProperties.html +1 -1
- package/docs/types/types.ValidationType.html +1 -1
- package/docs/types/types.ViewModel.html +1 -1
- package/docs/types/types.ViewModelClass.html +1 -1
- package/docs/types/types.WeekdayName.html +1 -1
- package/docs/types/types.WhereStatementForDream.html +1 -1
- package/docs/types/types.WhereStatementForDreamClass.html +1 -1
- package/docs/variables/index.DreamConst.html +1 -1
- package/docs/variables/index.ops.html +1 -1
- package/docs/variables/openapi.openapiPrimitiveTypes-1.html +1 -1
- package/docs/variables/openapi.openapiShorthandPrimitiveTypes-1.html +1 -1
- package/docs/variables/system.DreamAppAllowedPackageManagersEnumValues.html +1 -1
- package/docs/variables/system.primaryKeyTypes.html +1 -1
- package/package.json +2 -2
- package/dist/cjs/src/helpers/db/types/isDateOrDateArrayColumn.js +0 -3
- package/dist/cjs/src/helpers/db/types/isTextOrTextArrayColumn.js +0 -3
- package/dist/esm/src/helpers/db/types/isDateOrDateArrayColumn.js +0 -3
- package/dist/esm/src/helpers/db/types/isTextOrTextArrayColumn.js +0 -3
- package/dist/types/src/helpers/db/types/isDateOrDateArrayColumn.d.ts +0 -2
- package/dist/types/src/helpers/db/types/isTextOrTextArrayColumn.d.ts +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeleteQueryBuilder, SelectQueryBuilder, UpdateQueryBuilder } from 'kysely';
|
|
2
2
|
import Dream from '../Dream.js';
|
|
3
|
-
import { ColumnNamesAccountingForJoinedAssociations, LimitStatement, OffsetStatement, OrderQueryStatement, PassthroughOnClause, WhereStatement, WhereStatementForJoinedAssociation } from '../types/associations/shared.js';
|
|
3
|
+
import { ColumnNamesAccountingForJoinedAssociations, InternalWhereStatement, LimitStatement, OffsetStatement, OrderQueryStatement, PassthroughOnClause, WhereStatement, WhereStatementForJoinedAssociation } from '../types/associations/shared.js';
|
|
4
4
|
import { DbConnectionType } from '../types/db.js';
|
|
5
5
|
import { AllDefaultScopeNames, DefaultScopeName, DreamColumnNames, DreamConstructorType, DreamSerializerKey, DreamTableSchema, OrderDir, PassthroughColumnNames, PluckEachArgs, PrimaryKeyForFind, RelaxedJoinAndStatement, RelaxedJoinStatement, RelaxedPreloadOnStatement, RelaxedPreloadStatement, TableColumnNames, TableOrAssociationName } from '../types/dream.js';
|
|
6
6
|
import { CursorPaginatedDreamQueryOptions, CursorPaginatedDreamQueryResult, DefaultQueryTypeOptions, ExtendQueryType, LoadForModifierFn, NamespacedOrBaseModelColumnTypes, PaginatedDreamQueryOptions, PaginatedDreamQueryResult, QueryToKyselyDBType, QueryToKyselyTableNamesType } from '../types/query.js';
|
|
@@ -259,7 +259,7 @@ export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Re
|
|
|
259
259
|
* @param whereStatement - The where statement used to locate the record
|
|
260
260
|
* @returns Either the first record found matching the attributes, or else null
|
|
261
261
|
*/
|
|
262
|
-
findBy
|
|
262
|
+
findBy(whereStatement: WhereStatement<DreamInstance>): Promise<DreamInstance | null>;
|
|
263
263
|
/**
|
|
264
264
|
* Finds a record matching the Query and the
|
|
265
265
|
* specified where statement. If not found, an exception
|
|
@@ -273,7 +273,7 @@ export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Re
|
|
|
273
273
|
* @param whereStatement - The where statement used to locate the record
|
|
274
274
|
* @returns The first record found matching the attributes
|
|
275
275
|
*/
|
|
276
|
-
findOrFailBy
|
|
276
|
+
findOrFailBy(whereStatement: WhereStatement<DreamInstance>): Promise<DreamInstance>;
|
|
277
277
|
/**
|
|
278
278
|
* Finds all records matching the Query in batches,
|
|
279
279
|
* and then calls the provided callback for each found record.
|
|
@@ -319,7 +319,7 @@ export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Re
|
|
|
319
319
|
* @param args - A chain of association names and and/andNot/andAny clauses
|
|
320
320
|
* @returns A cloned Query with the joinLoad statement applied
|
|
321
321
|
*/
|
|
322
|
-
leftJoinPreload<Q extends Query<DreamInstance, any>, DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], TableName extends DreamInstance['table'], const Arr extends readonly unknown[], const LastArg extends VariadicLeftJoinLoadArgs<DB, Schema, TableName, Arr>, Incompatible extends Q['queryTypeOpts'] extends Readonly<{
|
|
322
|
+
leftJoinPreload<Q extends Query<DreamInstance, any>, DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], TableName extends DreamInstance['table'], const Arr extends readonly unknown[], const LastArg extends VariadicLeftJoinLoadArgs<DreamInstance, DB, Schema, TableName, Arr>, Incompatible extends Q['queryTypeOpts'] extends Readonly<{
|
|
323
323
|
allowLeftJoinPreload: false;
|
|
324
324
|
}> ? true : false, const JoinedAssociationsCandidate = JoinedAssociationsTypeFromAssociations<DB, Schema, TableName, Incompatible extends true ? [] : [...Arr, LastArg]>, const JoinedAssociations extends readonly JoinedAssociation[] = JoinedAssociationsCandidate extends readonly JoinedAssociation[] ? JoinedAssociationsCandidate : never, RetQuery = Query<DreamInstance, ExtendQueryType<QueryTypeOpts, Readonly<{
|
|
325
325
|
joinedAssociations: JoinedAssociations;
|
|
@@ -345,7 +345,7 @@ export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Re
|
|
|
345
345
|
allowPreload: false;
|
|
346
346
|
}> ? true : false, RetQuery = Query<DreamInstance, ExtendQueryType<QueryTypeOpts, Readonly<{
|
|
347
347
|
allowLeftJoinPreload: false;
|
|
348
|
-
}>>>>(this: Q, ...args: Incompatible extends true ? 'preload is incompatible with leftJoinPreload'[] : [...Arr, VariadicLoadArgs<DB, Schema, TableName, Arr>]): RetQuery;
|
|
348
|
+
}>>>>(this: Q, ...args: Incompatible extends true ? 'preload is incompatible with leftJoinPreload'[] : [...Arr, VariadicLoadArgs<DreamInstance, DB, Schema, TableName, Arr>]): RetQuery;
|
|
349
349
|
/**
|
|
350
350
|
* Recursively preloads all Dream associations referenced by `rendersOne` and `rendersMany`
|
|
351
351
|
* in a DreamSerializer. This traverses the entire content tree of serializers to automatically
|
|
@@ -404,7 +404,7 @@ export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Re
|
|
|
404
404
|
* @param args - A chain of association names and and/andNot/andAny clauses
|
|
405
405
|
* @returns A cloned Query with the joins clause applied
|
|
406
406
|
*/
|
|
407
|
-
innerJoin<DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], TableName extends DreamInstance['table'], const Arr extends readonly unknown[], const LastArg extends VariadicJoinsArgs<DB, Schema, TableName, Arr>, const JoinedAssociationsCandidate = JoinedAssociationsTypeFromAssociations<DB, Schema, TableName, [
|
|
407
|
+
innerJoin<DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], TableName extends DreamInstance['table'], const Arr extends readonly unknown[], const LastArg extends VariadicJoinsArgs<DreamInstance, DB, Schema, TableName, Arr>, const JoinedAssociationsCandidate = JoinedAssociationsTypeFromAssociations<DB, Schema, TableName, [
|
|
408
408
|
...Arr,
|
|
409
409
|
LastArg
|
|
410
410
|
]>, const JoinedAssociations extends readonly JoinedAssociation[] = JoinedAssociationsCandidate extends readonly JoinedAssociation[] ? JoinedAssociationsCandidate : never, RetQuery = Query<DreamInstance, ExtendQueryType<QueryTypeOpts, Readonly<{
|
|
@@ -416,7 +416,7 @@ export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Re
|
|
|
416
416
|
* @param args - A chain of association names and and/andNot/andAny clauses
|
|
417
417
|
* @returns A cloned Query with the joins clause applied
|
|
418
418
|
*/
|
|
419
|
-
leftJoin<DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], TableName extends DreamInstance['table'], const Arr extends readonly unknown[], const LastArg extends VariadicJoinsArgs<DB, Schema, TableName, Arr>, const JoinedAssociationsCandidate = JoinedAssociationsTypeFromAssociations<DB, Schema, TableName, [
|
|
419
|
+
leftJoin<DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], TableName extends DreamInstance['table'], const Arr extends readonly unknown[], const LastArg extends VariadicJoinsArgs<DreamInstance, DB, Schema, TableName, Arr>, const JoinedAssociationsCandidate = JoinedAssociationsTypeFromAssociations<DB, Schema, TableName, [
|
|
420
420
|
...Arr,
|
|
421
421
|
LastArg
|
|
422
422
|
]>, const JoinedAssociations extends readonly JoinedAssociation[] = JoinedAssociationsCandidate extends readonly JoinedAssociation[] ? JoinedAssociationsCandidate : never, RetQuery = Query<DreamInstance, ExtendQueryType<QueryTypeOpts, Readonly<{
|
|
@@ -527,7 +527,7 @@ export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Re
|
|
|
527
527
|
* @param whereStatement - Where statement to apply to the Query
|
|
528
528
|
* @returns A cloned Query with the where clause applied
|
|
529
529
|
*/
|
|
530
|
-
where<DB extends DreamInstance['DB'], Schema extends DreamInstance['schema']>(whereStatement: WhereStatementForJoinedAssociation<QueryTypeOpts['joinedAssociations'], DB, Schema, QueryTypeOpts['rootTableName']> | null): Query<DreamInstance, QueryTypeOpts>;
|
|
530
|
+
where<DB extends DreamInstance['DB'], Schema extends DreamInstance['schema']>(whereStatement: WhereStatementForJoinedAssociation<DreamInstance, QueryTypeOpts['joinedAssociations'], DB, Schema, QueryTypeOpts['rootTableName']> | null): Query<DreamInstance, QueryTypeOpts>;
|
|
531
531
|
/**
|
|
532
532
|
* Accepts a list of where statements, each of
|
|
533
533
|
* which is combined via `OR`
|
|
@@ -540,7 +540,7 @@ export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Re
|
|
|
540
540
|
* @param whereStatements - a list of where statements to `OR` together
|
|
541
541
|
* @returns A cloned Query with the whereAny clause applied
|
|
542
542
|
*/
|
|
543
|
-
whereAny<DB extends DreamInstance['DB'], Schema extends DreamInstance['schema']>(whereStatements: WhereStatementForJoinedAssociation<QueryTypeOpts['joinedAssociations'], DB, Schema, QueryTypeOpts['rootTableName']>[] | null): Query<DreamInstance, QueryTypeOpts>;
|
|
543
|
+
whereAny<DB extends DreamInstance['DB'], Schema extends DreamInstance['schema']>(whereStatements: WhereStatementForJoinedAssociation<DreamInstance, QueryTypeOpts['joinedAssociations'], DB, Schema, QueryTypeOpts['rootTableName']>[] | null): Query<DreamInstance, QueryTypeOpts>;
|
|
544
544
|
/**
|
|
545
545
|
* Applies a whereNot statement to the Query instance
|
|
546
546
|
*
|
|
@@ -552,7 +552,7 @@ export default class Query<DreamInstance extends Dream, QueryTypeOpts extends Re
|
|
|
552
552
|
* @param whereStatement - A where statement to negate and apply to the Query
|
|
553
553
|
* @returns A cloned Query with the whereNot clause applied
|
|
554
554
|
*/
|
|
555
|
-
whereNot<DB extends DreamInstance['DB'], Schema extends DreamInstance['schema']>(whereStatement: WhereStatementForJoinedAssociation<QueryTypeOpts['joinedAssociations'], DB, Schema, QueryTypeOpts['rootTableName']> | null): Query<DreamInstance, QueryTypeOpts>;
|
|
555
|
+
whereNot<DB extends DreamInstance['DB'], Schema extends DreamInstance['schema']>(whereStatement: WhereStatementForJoinedAssociation<DreamInstance, QueryTypeOpts['joinedAssociations'], DB, Schema, QueryTypeOpts['rootTableName']> | null): Query<DreamInstance, QueryTypeOpts>;
|
|
556
556
|
/**
|
|
557
557
|
* @internal
|
|
558
558
|
*
|
|
@@ -1164,21 +1164,21 @@ export interface QueryOpts<DreamInstance extends Dream, ColumnType extends Dream
|
|
|
1164
1164
|
baseSqlAlias?: TableOrAssociationName<Schema> | undefined;
|
|
1165
1165
|
baseSelectQuery?: Query<any, any> | null | undefined;
|
|
1166
1166
|
passthroughOnStatement?: PassthroughOnClause<PassthroughColumns> | null | undefined;
|
|
1167
|
-
where?: readonly
|
|
1168
|
-
whereNot?: readonly
|
|
1167
|
+
where?: readonly InternalWhereStatement<DreamInstance, DB, Schema, any>[] | null | undefined;
|
|
1168
|
+
whereNot?: readonly InternalWhereStatement<DreamInstance, DB, Schema, any>[] | null | undefined;
|
|
1169
1169
|
limit?: LimitStatement | null | undefined;
|
|
1170
1170
|
offset?: OffsetStatement | null | undefined;
|
|
1171
|
-
or?:
|
|
1171
|
+
or?: InternalWhereStatement<DreamInstance, DB, Schema, any>[][] | null | undefined;
|
|
1172
1172
|
order?: OrderQueryStatement<ColumnType>[] | null | undefined;
|
|
1173
1173
|
loadFromJoins?: boolean | undefined;
|
|
1174
1174
|
preloadStatements?: RelaxedPreloadStatement | undefined;
|
|
1175
|
-
preloadOnStatements?: RelaxedPreloadOnStatement<DB, Schema> | undefined;
|
|
1175
|
+
preloadOnStatements?: RelaxedPreloadOnStatement<DreamInstance, DB, Schema> | undefined;
|
|
1176
1176
|
distinctColumn?: ColumnType | null | undefined;
|
|
1177
1177
|
innerJoinDreamClasses?: readonly (typeof Dream)[] | undefined;
|
|
1178
1178
|
innerJoinStatements?: RelaxedJoinStatement | undefined;
|
|
1179
|
-
innerJoinAndStatements?: RelaxedJoinAndStatement<DB, Schema> | undefined;
|
|
1179
|
+
innerJoinAndStatements?: RelaxedJoinAndStatement<DreamInstance, DB, Schema> | undefined;
|
|
1180
1180
|
leftJoinStatements?: RelaxedJoinStatement | undefined;
|
|
1181
|
-
leftJoinAndStatements?: RelaxedJoinAndStatement<DB, Schema> | undefined;
|
|
1181
|
+
leftJoinAndStatements?: RelaxedJoinAndStatement<DreamInstance, DB, Schema> | undefined;
|
|
1182
1182
|
bypassAllDefaultScopes?: boolean | undefined;
|
|
1183
1183
|
bypassAllDefaultScopesExceptOnAssociations?: boolean | undefined;
|
|
1184
1184
|
defaultScopesToBypass?: AllDefaultScopeNames<DreamInstance>[] | undefined;
|
|
@@ -318,6 +318,7 @@ export default class KyselyQueryDriver<DreamInstance extends Dream> extends Quer
|
|
|
318
318
|
private inArrayWithoutNullExpressionBuilder;
|
|
319
319
|
private notInArrayWithNullExpressionBuilder;
|
|
320
320
|
private dreamWhereStatementToExpressionBuilderParts;
|
|
321
|
+
private normalizedWhereValue;
|
|
321
322
|
private recursivelyJoin;
|
|
322
323
|
/**
|
|
323
324
|
* @internal
|
|
@@ -3,7 +3,7 @@ import { AssociationNameToDream, DreamAssociationNames, JoinAndStatements } from
|
|
|
3
3
|
import DreamTransaction from '../../DreamTransaction.js';
|
|
4
4
|
import Query from '../../Query.js';
|
|
5
5
|
export default function associationQuery<DreamInstance extends Dream, DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], AssociationName extends DreamAssociationNames<DreamInstance>, AssociationDream extends AssociationNameToDream<DreamInstance, AssociationName>, AssociationTableName extends AssociationDream['table'], AssociationQuery = Query<AssociationNameToDream<DreamInstance, AssociationName>>>(dream: DreamInstance, txn: (DreamTransaction<Dream> | null) | undefined, associationName: AssociationName, { joinAndStatements, bypassAllDefaultScopes, defaultScopesToBypass, }: {
|
|
6
|
-
joinAndStatements: JoinAndStatements<DB, Schema, AssociationTableName, null>;
|
|
6
|
+
joinAndStatements: JoinAndStatements<AssociationDream, DB, Schema, AssociationTableName, null>;
|
|
7
7
|
bypassAllDefaultScopes: boolean;
|
|
8
8
|
defaultScopesToBypass: string[];
|
|
9
9
|
}): AssociationQuery;
|
|
@@ -3,7 +3,7 @@ import { AssociationNameToDream, DreamAssociationNames, JoinAndStatements } from
|
|
|
3
3
|
import DreamTransaction from '../../DreamTransaction.js';
|
|
4
4
|
import Query from '../../Query.js';
|
|
5
5
|
export default function associationUpdateQuery<DreamInstance extends Dream, DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], AssociationName extends DreamAssociationNames<DreamInstance>, AssociationDream extends AssociationNameToDream<DreamInstance, AssociationName>, AssociationTableName extends AssociationDream['table'], AssociationQuery = Query<AssociationNameToDream<DreamInstance, AssociationName>>>(dream: DreamInstance, txn: (DreamTransaction<Dream> | null) | undefined, associationName: AssociationName, { joinAndStatements, bypassAllDefaultScopes, defaultScopesToBypass, }: {
|
|
6
|
-
joinAndStatements: JoinAndStatements<DB, Schema, AssociationTableName, null>;
|
|
6
|
+
joinAndStatements: JoinAndStatements<AssociationDream, DB, Schema, AssociationTableName, null>;
|
|
7
7
|
bypassAllDefaultScopes: boolean;
|
|
8
8
|
defaultScopesToBypass: string[];
|
|
9
9
|
}): AssociationQuery;
|
|
@@ -2,7 +2,7 @@ import Dream from '../../../Dream.js';
|
|
|
2
2
|
import { AssociationNameToDream, DreamAssociationNames, JoinAndStatements } from '../../../types/dream.js';
|
|
3
3
|
import DreamTransaction from '../../DreamTransaction.js';
|
|
4
4
|
export default function destroyAssociation<DreamInstance extends Dream, DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], AssociationName extends DreamAssociationNames<DreamInstance>, AssociationDream extends AssociationNameToDream<DreamInstance, AssociationName>, AssociationTableName extends AssociationDream['table']>(dream: DreamInstance, txn: (DreamTransaction<Dream> | null) | undefined, associationName: AssociationName, { joinAndStatements, bypassAllDefaultScopes, defaultScopesToBypass, cascade, reallyDestroy, skipHooks, }: {
|
|
5
|
-
joinAndStatements: JoinAndStatements<DB, Schema, AssociationTableName, null>;
|
|
5
|
+
joinAndStatements: JoinAndStatements<AssociationDream, DB, Schema, AssociationTableName, null>;
|
|
6
6
|
bypassAllDefaultScopes: boolean;
|
|
7
7
|
defaultScopesToBypass: string[];
|
|
8
8
|
cascade: boolean;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { HasManyStatement } from '../../../types/associations/hasMany.js';
|
|
2
2
|
import { HasOneStatement } from '../../../types/associations/hasOne.js';
|
|
3
|
-
export default function throughAssociationHasOptionsBesidesThroughAndSource(throughAssociation: HasOneStatement<any, any, any, any> | HasManyStatement<any, any, any, any> | undefined): Partial<import("../../../types/utils.js").MergeUnionOfRecordTypes<{
|
|
3
|
+
export default function throughAssociationHasOptionsBesidesThroughAndSource(throughAssociation: HasOneStatement<any, any, any, any> | HasManyStatement<any, any, any, any> | undefined): Partial<import("../../../types/utils.js").MergeUnionOfRecordTypes<Partial<{
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
} | Partial<{
|
|
5
|
+
}> | Partial<{
|
|
6
6
|
[x: string]: any;
|
|
7
7
|
}>>> | Partial<import("../../../types/utils.js").MergeUnionOfRecordTypes<{
|
|
8
8
|
[x: string]: any;
|
|
9
9
|
} | Partial<{
|
|
10
10
|
[x: string]: any;
|
|
11
|
+
}> | Partial<{
|
|
12
|
+
[x: string]: any;
|
|
11
13
|
}>>>[] | import("../../../types/associations/shared.js").OrderStatement<any, any, any> | undefined;
|
|
@@ -2,7 +2,7 @@ import Dream from '../../../Dream.js';
|
|
|
2
2
|
import { AssociationNameToDream, DreamAssociationNames, JoinAndStatements } from '../../../types/dream.js';
|
|
3
3
|
import DreamTransaction from '../../DreamTransaction.js';
|
|
4
4
|
export default function undestroyAssociation<DreamInstance extends Dream, DB extends DreamInstance['DB'], Schema extends DreamInstance['schema'], AssociationName extends DreamAssociationNames<DreamInstance>, AssociationDream extends AssociationNameToDream<DreamInstance, AssociationName>, AssociationTableName extends AssociationDream['table']>(dream: DreamInstance, txn: (DreamTransaction<Dream> | null) | undefined, associationName: AssociationName, { joinAndStatements, bypassAllDefaultScopes, defaultScopesToBypass, cascade, skipHooks, }: {
|
|
5
|
-
joinAndStatements: JoinAndStatements<DB, Schema, AssociationTableName, null>;
|
|
5
|
+
joinAndStatements: JoinAndStatements<AssociationDream, DB, Schema, AssociationTableName, null>;
|
|
6
6
|
bypassAllDefaultScopes: boolean;
|
|
7
7
|
defaultScopesToBypass: string[];
|
|
8
8
|
cascade: boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import Dream from '../../Dream.js';
|
|
2
|
+
import { BelongsToStatement, HasManyStatement, HasOneStatement } from '../../package-exports/types.js';
|
|
3
|
+
export default function extractAssignableAssociationAttributes(association: BelongsToStatement<any, any, any, any> | HasManyStatement<any, any, any, any> | HasOneStatement<any, any, any, any>, dreamInstance: Dream): Record<string, unknown>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SelectQueryBuilder, UpdateQueryBuilder } from 'kysely';
|
|
2
2
|
import ConnectedToDB from '../../../db/ConnectedToDB.js';
|
|
3
3
|
import Dream from '../../../Dream.js';
|
|
4
|
-
import {
|
|
4
|
+
import { InternalWhereStatement } from '../../../types/associations/shared.js';
|
|
5
5
|
import { DbConnectionType } from '../../../types/db.js';
|
|
6
6
|
import { JoinAndStatements, RelaxedJoinAndStatement, SimilarityStatement } from '../../../types/dream.js';
|
|
7
7
|
import DreamTransaction from '../../DreamTransaction.js';
|
|
8
8
|
export default class SimilarityBuilder<DreamInstance extends Dream, DB extends DreamInstance['DB'] = DreamInstance['DB'], Schema extends DreamInstance['schema'] = DreamInstance['schema']> extends ConnectedToDB<DreamInstance> {
|
|
9
|
-
readonly whereStatement: readonly
|
|
10
|
-
readonly whereNotStatement: readonly
|
|
11
|
-
readonly joinAndStatements: JoinAndStatements<DB, Schema, any, any>;
|
|
9
|
+
readonly whereStatement: readonly InternalWhereStatement<DreamInstance, DB, Schema, any>[];
|
|
10
|
+
readonly whereNotStatement: readonly InternalWhereStatement<DreamInstance, DB, Schema, any>[];
|
|
11
|
+
readonly joinAndStatements: JoinAndStatements<DreamInstance, DB, Schema, any, any>;
|
|
12
12
|
constructor(dreamInstance: DreamInstance, opts?: SimilarityBuilderOpts<DreamInstance>);
|
|
13
13
|
select<T extends SimilarityBuilder<DreamInstance>>(this: T, kyselyQuery: SelectQueryBuilder<DB, any, object>, { bypassOrder }?: {
|
|
14
14
|
bypassOrder?: boolean;
|
|
@@ -28,9 +28,9 @@ export default class SimilarityBuilder<DreamInstance extends Dream, DB extends D
|
|
|
28
28
|
private rankSQLAlias;
|
|
29
29
|
}
|
|
30
30
|
export interface SimilarityBuilderOpts<DreamInstance extends Dream, DB extends DreamInstance['DB'] = DreamInstance['DB'], Schema extends DreamInstance['schema'] = DreamInstance['schema']> {
|
|
31
|
-
where?:
|
|
32
|
-
whereNot?:
|
|
33
|
-
joinAndStatements?: RelaxedJoinAndStatement<DB, Schema> | undefined;
|
|
31
|
+
where?: InternalWhereStatement<DreamInstance, DB, Schema, any>[] | undefined;
|
|
32
|
+
whereNot?: InternalWhereStatement<DreamInstance, DB, Schema, any>[] | undefined;
|
|
33
|
+
joinAndStatements?: RelaxedJoinAndStatement<DreamInstance, DB, Schema> | undefined;
|
|
34
34
|
transaction?: DreamTransaction<Dream> | null | undefined;
|
|
35
35
|
connection?: DbConnectionType | undefined;
|
|
36
36
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import Dream from '../../Dream.js';
|
|
2
1
|
export default class DataIncompatibleWithDatabaseField extends Error {
|
|
3
|
-
|
|
4
|
-
error: Error;
|
|
5
|
-
constructor({ dream, error }: {
|
|
6
|
-
dream: Dream;
|
|
7
|
-
error: Error;
|
|
8
|
-
});
|
|
2
|
+
private error;
|
|
3
|
+
constructor(error: Error);
|
|
9
4
|
get message(): string;
|
|
10
5
|
}
|
|
@@ -116,6 +116,37 @@ export default class ASTBuilder {
|
|
|
116
116
|
* returns an array of global names for all serializers in the app
|
|
117
117
|
*/
|
|
118
118
|
protected globalSerializerNames(): string[];
|
|
119
|
+
/**
|
|
120
|
+
* @internal
|
|
121
|
+
*
|
|
122
|
+
* checks if a database type is a date type (with optional array suffix)
|
|
123
|
+
*/
|
|
124
|
+
protected isDateDbType(dbType: string): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* @internal
|
|
127
|
+
*
|
|
128
|
+
* checks if a database type is a time without time zone type (with optional array suffix)
|
|
129
|
+
*/
|
|
130
|
+
protected isTimeWithoutTimeZoneDbType(dbType: string): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* @internal
|
|
133
|
+
*
|
|
134
|
+
* checks if a database type is a time with time zone type (with optional array suffix)
|
|
135
|
+
*/
|
|
136
|
+
protected isTimeWithTimeZoneDbType(dbType: string): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* @internal
|
|
139
|
+
*
|
|
140
|
+
* checks if a database type is any time type (with or without time zone, with optional array suffix)
|
|
141
|
+
*/
|
|
142
|
+
protected isTimeDbType(dbType: string): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* @internal
|
|
145
|
+
*
|
|
146
|
+
* checks if a TypeScript type node represents a string-like type
|
|
147
|
+
* (string keyword, string type reference, or string literal)
|
|
148
|
+
*/
|
|
149
|
+
protected isStringLikeType(node: ts.TypeNode, sourceFile: ts.SourceFile): boolean;
|
|
119
150
|
}
|
|
120
151
|
export interface SchemaData {
|
|
121
152
|
[key: string]: TableData;
|
|
@@ -32,6 +32,19 @@ export default class ASTKyselyCodegenEnhancer extends ASTConnectionBuilder {
|
|
|
32
32
|
* the DateTime or CalendarDate class, depending on the db type.
|
|
33
33
|
*/
|
|
34
34
|
private replaceTimestampExport;
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*
|
|
38
|
+
* Replaces string types with TimeWithZone or TimeWithoutZone for TIME columns
|
|
39
|
+
* based on the schema metadata from dream.ts
|
|
40
|
+
*/
|
|
41
|
+
private replaceTimeFieldsInInterfaces;
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*
|
|
45
|
+
* Helper to replace string type references with ClockTime or ClockTimeTz type references
|
|
46
|
+
*/
|
|
47
|
+
private replaceStringWithClockTimeType;
|
|
35
48
|
/**
|
|
36
49
|
* @internal
|
|
37
50
|
*
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { Kysely } from 'kysely';
|
|
2
2
|
import CalendarDate from '../utils/datetime/CalendarDate.js';
|
|
3
|
+
import ClockTime from '../utils/datetime/ClockTime.js';
|
|
4
|
+
import ClockTimeTz from '../utils/datetime/ClockTimeTz.js';
|
|
3
5
|
import { DateTime } from '../utils/datetime/DateTime.js';
|
|
4
6
|
export declare function findEnumArrayOids(kyselyDb: Kysely<any>): Promise<number[]>;
|
|
5
7
|
export declare function findCitextArrayOid(kyselyDb: Kysely<any>): Promise<number | undefined>;
|
|
6
8
|
export declare function findCorrespondingArrayOid(kyselyDb: Kysely<any>, oid: number): Promise<number | undefined>;
|
|
7
9
|
export declare function parsePostgresDate(dateString: string | null): string | CalendarDate | null;
|
|
8
10
|
export declare function parsePostgresDatetime(datetimeString: string | null): string | DateTime | null;
|
|
11
|
+
export declare function parsePostgresDatetimeTz(datetimeString: string | null): string | DateTime | null;
|
|
12
|
+
export declare function parsePostgresTime(timeString: string | null): string | ClockTime | null;
|
|
13
|
+
export declare function parsePostgresTimeTz(timeString: string | null): string | ClockTimeTz | null;
|
|
9
14
|
export declare function parsePostgresDecimal(numberString: string | null): string | number | null;
|
|
10
15
|
export declare function parsePostgresBigint(numberString: string | null): string | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const DATETIME_OR_DATETIME_ARRAY_COLUMN_CHECK_REGEXP: RegExp;
|
|
2
|
+
export declare const DATE_OR_DATE_ARRAY_COLUMN_CHECK_REGEXP: RegExp;
|
|
3
|
+
export declare const TIME_WITH_TIMEZONE_COLUMN_CHECK_REGEXP: RegExp;
|
|
4
|
+
export declare const TIME_WITHOUT_TIMEZONE_COLUMN_CHECK_REGEXP: RegExp;
|
|
5
|
+
export declare const STRING_OR_STRING_ARRAY_COLUMN_CHECK_REGEXP: RegExp;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ClockTime, ClockTimeTz } from '../package-exports/index.js';
|
|
1
2
|
import CalendarDate from '../utils/datetime/CalendarDate.js';
|
|
2
3
|
import { DateTime } from '../utils/datetime/DateTime.js';
|
|
3
4
|
/**
|
|
@@ -14,4 +15,4 @@ import { DateTime } from '../utils/datetime/DateTime.js';
|
|
|
14
15
|
* // ['hello', 'Hello', 'world', 'World']
|
|
15
16
|
* ```
|
|
16
17
|
*/
|
|
17
|
-
export default function sort<ArrayType extends string[] | number[] | bigint[] | (DateTime | CalendarDate)[]>(array: ArrayType): ArrayType;
|
|
18
|
+
export default function sort<ArrayType extends string[] | number[] | bigint[] | (DateTime | CalendarDate)[] | ClockTime[] | ClockTimeTz[]>(array: ArrayType): ArrayType;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { ClockTime, ClockTimeTz } from '../package-exports/index.js';
|
|
1
2
|
import CalendarDate from '../utils/datetime/CalendarDate.js';
|
|
2
3
|
import { DateTime } from '../utils/datetime/DateTime.js';
|
|
3
4
|
export default function sortBy<T>(array: T[], valueToCompare: (value: T) => number): T[];
|
|
4
5
|
export default function sortBy<T>(array: T[], valueToCompare: (value: T) => bigint): T[];
|
|
5
6
|
export default function sortBy<T>(array: T[], valueToCompare: (value: T) => string): T[];
|
|
6
7
|
export default function sortBy<T>(array: T[], valueToCompare: (value: T) => DateTime | CalendarDate): T[];
|
|
8
|
+
export default function sortBy<T>(array: T[], valueToCompare: (value: T) => ClockTime): T[];
|
|
9
|
+
export default function sortBy<T>(array: T[], valueToCompare: (value: T) => ClockTimeTz): T[];
|
|
7
10
|
export declare class UnsupportedValueFromComparisonFunction extends Error {
|
|
8
11
|
private aPrime;
|
|
9
12
|
private bPrime;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*
|
|
4
|
+
* Returns a shallow copy of the object using a prototype-less container
|
|
5
|
+
* (Object.create(null)). Use when assigning untrusted keys so that keys like
|
|
6
|
+
* __proto__ or constructor cannot pollute Object.prototype.
|
|
7
|
+
*/
|
|
8
|
+
export declare function toSafeObject<T extends object>(obj: T): T;
|
|
@@ -11,4 +11,6 @@ export { default as RecordNotFound } from '../errors/RecordNotFound.js';
|
|
|
11
11
|
export { default as MissingSerializersDefinition } from '../errors/serializers/MissingSerializersDefinition.js';
|
|
12
12
|
export { default as ValidationError } from '../errors/ValidationError.js';
|
|
13
13
|
export { InvalidCalendarDate } from '../utils/datetime/CalendarDate.js';
|
|
14
|
+
export { InvalidClockTime } from '../utils/datetime/ClockTime.js';
|
|
15
|
+
export { InvalidClockTimeTz } from '../utils/datetime/ClockTimeTz.js';
|
|
14
16
|
export { InvalidDateTime } from '../utils/datetime/DateTime.js';
|
|
@@ -12,4 +12,6 @@ export { default as ops } from '../ops/index.js';
|
|
|
12
12
|
export { default as DreamSerializer } from '../serializer/DreamSerializer.js';
|
|
13
13
|
export { default as ObjectSerializer } from '../serializer/ObjectSerializer.js';
|
|
14
14
|
export { default as CalendarDate } from '../utils/datetime/CalendarDate.js';
|
|
15
|
+
export { default as ClockTime } from '../utils/datetime/ClockTime.js';
|
|
16
|
+
export { default as ClockTimeTz } from '../utils/datetime/ClockTimeTz.js';
|
|
15
17
|
export { DateTime } from '../utils/datetime/DateTime.js';
|
|
@@ -8,8 +8,9 @@ export { type HasManyStatement } from '../types/associations/hasMany.js';
|
|
|
8
8
|
export { type HasOneStatement } from '../types/associations/hasOne.js';
|
|
9
9
|
export { type DbConnectionType, type DbTypes, type PrimaryKeyType } from '../types/db.js';
|
|
10
10
|
export { type StrictInterface } from '../types/utils.js';
|
|
11
|
+
export { type CalendarDateDurationUnit, type CalendarDateObject } from '../types/calendardate.js';
|
|
12
|
+
export { type ClockTimeObject } from '../types/clocktime.js';
|
|
11
13
|
export { type DurationObject, type DurationUnit, type WeekdayName } from '../types/datetime.js';
|
|
12
|
-
export { type CalendarDateDurationUnit } from '../types/calendardate.js';
|
|
13
14
|
export { type DreamAssociationMetadata, type DreamAttributes, type DreamClassAssociationAndStatement, type DreamClassColumn, type DreamColumn, type DreamColumnNames, type DreamOrViewModelClassSerializerKey, type DreamOrViewModelSerializerKey, type DreamParamSafeAttributes, type DreamParamSafeColumnNames, type DreamSerializable, type DreamSerializableArray, type DreamSerializerKey, type DreamSerializers, type DreamVirtualColumns, type UpdateableAssociationProperties, type UpdateableProperties, type ViewModel, type ViewModelClass, } from '../types/dream.js';
|
|
14
15
|
export { type DreamModelSerializerType, type InternalAnyTypedSerializerRendersMany, type InternalAnyTypedSerializerRendersOne, type SerializerCasing, type SimpleObjectSerializerType, } from '../types/serializer.js';
|
|
15
16
|
export { type ValidationType } from '../types/validation.js';
|
|
@@ -4,6 +4,7 @@ import { DreamConst } from '../../dream/constants.js';
|
|
|
4
4
|
import { Range } from '../../helpers/range.js';
|
|
5
5
|
import CurriedOpsStatement from '../../ops/curried-ops-statement.js';
|
|
6
6
|
import OpsStatement, { ExtraSimilarityArgs } from '../../ops/ops-statement.js';
|
|
7
|
+
import { ClockTime, ClockTimeTz } from '../../package-exports/index.js';
|
|
7
8
|
import CalendarDate from '../../utils/datetime/CalendarDate.js';
|
|
8
9
|
import { DateTime } from '../../utils/datetime/DateTime.js';
|
|
9
10
|
import { AssociationTableNames } from '../db.js';
|
|
@@ -24,26 +25,27 @@ export type PassthroughOnClause<PassthroughColumns extends string[]> = Partial<R
|
|
|
24
25
|
type DreamSelectable<DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = Partial<{
|
|
25
26
|
[ColumnName in keyof DB[TableName]]: NonKyselySupportedSupplementalWhereClauseValues<DB, Schema, TableName, ColumnName>;
|
|
26
27
|
}>;
|
|
27
|
-
type NonKyselySupportedSupplementalWhereClauseValues<DB, Schema, TableName, Column, ModelPropertyType = ModelColumnType<Schema, TableName, Column>, ColumnType = TableColumnType<Schema, TableName, Column>, EnumTypeArray extends string[] | null = TableColumnEnumTypeArray<Schema, TableName, Column>, PermanentOpsValTypes = null | readonly [], OpsValType = EnumTypeArray extends null ? ColumnType extends 'bigint' ? TypesAllowedForBigintAgainstTheDb | PermanentOpsValTypes : ModelPropertyType extends DateTime | CalendarDate ? DateTime | CalendarDate | null : ModelPropertyType extends number | string ? ModelPropertyType | PermanentOpsValTypes : never : EnumTypeArray extends string[] ? EnumTypeArray[number] | PermanentOpsValTypes : never, PartialTypes = EnumTypeArray extends null ? ModelPropertyType extends DateTime ? Range<DateTime | CalendarDate> | Range<null, DateTime | CalendarDate> | (() => Range<DateTime | CalendarDate>) | (() => Range<null, DateTime | CalendarDate>) | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : ModelPropertyType extends CalendarDate ? Range<DateTime | CalendarDate> | Range<null, DateTime | CalendarDate> | (() => Range<DateTime | CalendarDate>) | (() => Range<null, DateTime | CalendarDate>) | OpsStatement<KyselyComparisonOperatorExpression, OpsValType> : ColumnType extends 'bigint' ? Range<TypesAllowedForBigintAgainstTheDb> | Range<null, TypesAllowedForBigintAgainstTheDb> | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : ModelPropertyType extends number ? Range<ModelPropertyType> | Range<null, ModelPropertyType> | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : ModelPropertyType extends string ? Range<string> | Range<null, string> | OpsStatement<KyselyComparisonOperatorExpression, string, any> | OpsStatement<TrigramOperator, OpsValType, ExtraSimilarityArgs> : never : EnumTypeArray extends string[] ? EnumTypeArray | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : never> = PartialTypes extends never ? OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> | CurriedOpsStatement<any, any, any, OpsValType> | SelectQueryBuilder<DB, keyof DB, any> : PartialTypes | CurriedOpsStatement<any, any, any, OpsValType> | SelectQueryBuilder<DB, keyof DB, any>;
|
|
28
|
-
export type WhereStatementForDreamClass<DreamClass extends typeof Dream> = WhereStatement<InstanceType<DreamClass
|
|
29
|
-
export type WhereStatementForDream<DreamInstance extends Dream> = WhereStatement<DreamInstance
|
|
28
|
+
type NonKyselySupportedSupplementalWhereClauseValues<DB, Schema, TableName, Column, ModelPropertyType = ModelColumnType<Schema, TableName, Column>, ColumnType = TableColumnType<Schema, TableName, Column>, EnumTypeArray extends string[] | null = TableColumnEnumTypeArray<Schema, TableName, Column>, PermanentOpsValTypes = null | readonly [], OpsValType = EnumTypeArray extends null ? ColumnType extends 'bigint' ? TypesAllowedForBigintAgainstTheDb | PermanentOpsValTypes : ModelPropertyType extends DateTime | CalendarDate ? DateTime | CalendarDate | null : ModelPropertyType extends ClockTime ? ClockTime | null : ModelPropertyType extends ClockTimeTz ? ClockTimeTz | null : ModelPropertyType extends number | string ? ModelPropertyType | PermanentOpsValTypes : never : EnumTypeArray extends string[] ? EnumTypeArray[number] | PermanentOpsValTypes : never, PartialTypes = EnumTypeArray extends null ? ModelPropertyType extends DateTime ? Range<DateTime | CalendarDate> | Range<null, DateTime | CalendarDate> | (() => Range<DateTime | CalendarDate>) | (() => Range<null, DateTime | CalendarDate>) | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : ModelPropertyType extends ClockTime ? Range<ClockTime> | Range<null, ClockTime> | (() => Range<ClockTime>) | (() => Range<null, ClockTime>) | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : ModelPropertyType extends ClockTimeTz ? Range<ClockTimeTz> | Range<null, ClockTimeTz> | (() => Range<ClockTimeTz>) | (() => Range<null, ClockTimeTz>) | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : ModelPropertyType extends CalendarDate ? Range<DateTime | CalendarDate> | Range<null, DateTime | CalendarDate> | (() => Range<DateTime | CalendarDate>) | (() => Range<null, DateTime | CalendarDate>) | OpsStatement<KyselyComparisonOperatorExpression, OpsValType> : ColumnType extends 'bigint' ? Range<TypesAllowedForBigintAgainstTheDb> | Range<null, TypesAllowedForBigintAgainstTheDb> | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : ModelPropertyType extends number ? Range<ModelPropertyType> | Range<null, ModelPropertyType> | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : ModelPropertyType extends string ? Range<string> | Range<null, string> | OpsStatement<KyselyComparisonOperatorExpression, string, any> | OpsStatement<TrigramOperator, OpsValType, ExtraSimilarityArgs> : never : EnumTypeArray extends string[] ? EnumTypeArray | OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> : never> = PartialTypes extends never ? OpsStatement<KyselyComparisonOperatorExpression, OpsValType, any> | CurriedOpsStatement<any, any, any, OpsValType> | SelectQueryBuilder<DB, keyof DB, any> : PartialTypes | CurriedOpsStatement<any, any, any, OpsValType> | SelectQueryBuilder<DB, keyof DB, any>;
|
|
29
|
+
export type WhereStatementForDreamClass<DreamClass extends typeof Dream> = WhereStatement<InstanceType<DreamClass>>;
|
|
30
|
+
export type WhereStatementForDream<DreamInstance extends Dream> = WhereStatement<DreamInstance>;
|
|
30
31
|
type AssociationNameToDotReferencedColumns<DB, TableName extends keyof DB, AssociationName> = `${AssociationName & string}.${TableColumnNames<DB, TableName>}`;
|
|
31
32
|
export type ColumnNamesAccountingForJoinedAssociations<JoinedAssociations extends Readonly<JoinedAssociation[]>, DB, RootTableName extends keyof DB, RootTableAlias extends string> = JoinedAssociations['length'] extends 0 ? TableColumnNames<DB, RootTableName> : JoinedAssociationColumnNames<JoinedAssociations, DB, AssociationNameToDotReferencedColumns<DB, RootTableName & keyof DB, RootTableAlias>>;
|
|
32
33
|
type JoinedAssociationColumnNames<JoinedAssociations extends Readonly<JoinedAssociation[]>, DB, AllColumnNames, Depth extends number = 0, CurrentJoinedAssociation = Readonly<JoinedAssociations[0]>, NextTableName = CurrentJoinedAssociation extends Readonly<JoinedAssociation> ? CurrentJoinedAssociation['table'] : never, NextAssociationName = CurrentJoinedAssociation extends Readonly<JoinedAssociation> ? CurrentJoinedAssociation['alias'] : never> = JoinedAssociations['length'] extends 0 ? AllColumnNames : Depth extends MAX_JOINED_TABLES_DEPTH ? AllColumnNames : JoinedAssociationColumnNames<ReadonlyTail<JoinedAssociations>, DB, AllColumnNames | AssociationNameToDotReferencedColumns<DB, NextTableName & keyof DB, NextAssociationName>, Inc<Depth>>;
|
|
33
34
|
type Whereable<R> = {
|
|
34
35
|
[K in keyof Selectable<R>]?: Selectable<R>[K] | Selectable<R>[K][];
|
|
35
36
|
};
|
|
36
|
-
export type WhereStatement<
|
|
37
|
-
export type
|
|
38
|
-
export type
|
|
37
|
+
export type WhereStatement<I extends Dream> = InternalWhereStatement<I, I['DB'], I['schema'], I['table']>;
|
|
38
|
+
export type InternalWhereStatement<I extends Dream, DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = Partial<MergeUnionOfRecordTypes<Whereable<DB[TableName]> | DreamSelectable<DB, Schema, TableName> | AssociatedModelParam<I>>>;
|
|
39
|
+
export type OnStatementForAssociation<I extends Dream, DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB, RequiredOnClauseKeysForThisAssociation, OnStatement extends InternalWhereStatement<I, DB, Schema, TableName> = InternalWhereStatement<I, DB, Schema, TableName>> = RequiredOnClauseKeysForThisAssociation extends null ? InternalWhereStatement<I, DB, Schema, TableName> : RequiredOnClauseKeysForThisAssociation extends string[] ? Required<Pick<OnStatement, RequiredOnClauseKeysForThisAssociation[number] & keyof OnStatement>> & Partial<Omit<OnStatement, RequiredOnClauseKeysForThisAssociation[number] & keyof OnStatement>> : never;
|
|
40
|
+
export type OnStatementForSpecificColumns<I extends Dream, DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB, Columns extends string[], OnStatement extends InternalWhereStatement<I, DB, Schema, TableName> = InternalWhereStatement<I, DB, Schema, TableName>> = Pick<OnStatement, Columns[number] & keyof OnStatement>;
|
|
39
41
|
type OnStatementForAssociationDefinition<DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = Partial<MergeUnionOfRecordTypes<Partial<Selectable<DB[TableName]>> | Partial<{
|
|
40
42
|
[ColumnName in keyof DB[TableName]]: NonKyselySupportedSupplementalWhereClauseValues<DB, Schema, TableName, ColumnName> | typeof DreamConst.passthrough | typeof DreamConst.required;
|
|
41
43
|
}>>>;
|
|
42
44
|
export type SelfOnStatement<BaseInstance extends Dream, DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = Partial<Record<keyof DB[TableName], DreamColumnNames<BaseInstance>>>;
|
|
43
|
-
export type WhereStatementForJoinedAssociation<JoinedAssociations extends Readonly<JoinedAssociation[]>, DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = RecursiveWhereStatementForJoinedAssociation<JoinedAssociations, DB, Schema,
|
|
44
|
-
type RecursiveWhereStatementForJoinedAssociation<JoinedAssociations extends Readonly<JoinedAssociation[]>, DB, Schema, OriginalOnStatement, Depth extends number = 0, CurrentJoinedAssociation = JoinedAssociations[0], TableName = CurrentJoinedAssociation extends JoinedAssociation ? CurrentJoinedAssociation['table'] : never, AssociationName = CurrentJoinedAssociation extends JoinedAssociation ? CurrentJoinedAssociation['alias'] : never, NonNamespacedAssociationOnStatement = TableName extends never ? never : AssociationName extends never ? never :
|
|
45
|
+
export type WhereStatementForJoinedAssociation<I extends Dream, JoinedAssociations extends Readonly<JoinedAssociation[]>, DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = RecursiveWhereStatementForJoinedAssociation<I, JoinedAssociations, DB, Schema, InternalWhereStatement<I, DB, Schema, TableName>>;
|
|
46
|
+
type RecursiveWhereStatementForJoinedAssociation<I extends Dream, JoinedAssociations extends Readonly<JoinedAssociation[]>, DB, Schema, OriginalOnStatement, Depth extends number = 0, CurrentJoinedAssociation = JoinedAssociations[0], TableName = CurrentJoinedAssociation extends JoinedAssociation ? CurrentJoinedAssociation['table'] : never, AssociationName = CurrentJoinedAssociation extends JoinedAssociation ? CurrentJoinedAssociation['alias'] : never, NonNamespacedAssociationOnStatement = TableName extends never ? never : AssociationName extends never ? never : InternalWhereStatement<I, DB, Schema, TableName & AssociationTableNames<DB, Schema> & keyof DB>, NextOnStatement = NonNamespacedAssociationOnStatement extends never ? OriginalOnStatement : OriginalOnStatement & {
|
|
45
47
|
[K in keyof NonNamespacedAssociationOnStatement as `${AssociationName & string}.${K & string}`]: NonNamespacedAssociationOnStatement[K & keyof NonNamespacedAssociationOnStatement] | null;
|
|
46
|
-
}> = JoinedAssociations['length'] extends 0 ? OriginalOnStatement : Depth extends MAX_JOINED_TABLES_DEPTH ? OriginalOnStatement : TableName extends never ? OriginalOnStatement : RecursiveWhereStatementForJoinedAssociation<ReadonlyTail<JoinedAssociations>, DB, Schema, NextOnStatement, Inc<Depth>>;
|
|
48
|
+
}> = JoinedAssociations['length'] extends 0 ? OriginalOnStatement : Depth extends MAX_JOINED_TABLES_DEPTH ? OriginalOnStatement : TableName extends never ? OriginalOnStatement : RecursiveWhereStatementForJoinedAssociation<I, ReadonlyTail<JoinedAssociations>, DB, Schema, NextOnStatement, Inc<Depth>>;
|
|
47
49
|
export type OrderStatement<DB, Schema, TableName extends AssociationTableNames<DB, Schema> & keyof DB> = TableColumnNames<DB, TableName> | Partial<Record<TableColumnNames<DB, TableName>, OrderDir>>;
|
|
48
50
|
export type LimitStatement = number;
|
|
49
51
|
export type OffsetStatement = number;
|
|
@@ -59,8 +61,8 @@ export interface HasStatement<BaseInstance extends Dream, DB, Schema, ForeignTab
|
|
|
59
61
|
foreignKeyTypeField: () => keyof DB[ForeignTableName] & string;
|
|
60
62
|
globalAssociationNameOrNames: string[];
|
|
61
63
|
and?: OnStatementForAssociationDefinition<DB, Schema, ForeignTableName>;
|
|
62
|
-
andNot?:
|
|
63
|
-
andAny?:
|
|
64
|
+
andNot?: InternalWhereStatement<BaseInstance, DB, Schema, ForeignTableName>;
|
|
65
|
+
andAny?: InternalWhereStatement<BaseInstance, DB, Schema, ForeignTableName>[];
|
|
64
66
|
polymorphic: boolean;
|
|
65
67
|
primaryKey: (associationInstance?: Dream) => DreamColumnNames<BaseInstance>;
|
|
66
68
|
primaryKeyOverride?: DreamColumnNames<BaseInstance> | null;
|
|
@@ -76,8 +78,8 @@ interface HasOptionsBase<BaseInstance extends Dream, AssociationGlobalName exten
|
|
|
76
78
|
dependent?: DependentOptions;
|
|
77
79
|
on?: TableColumnNames<BaseInstance['DB'], AssociationTableName & keyof BaseInstance['DB']>;
|
|
78
80
|
and?: OnStatementForAssociationDefinition<BaseInstance['DB'], BaseInstance['schema'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']>;
|
|
79
|
-
andNot?:
|
|
80
|
-
andAny?:
|
|
81
|
+
andNot?: InternalWhereStatement<BaseInstance, BaseInstance['DB'], BaseInstance['schema'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']>;
|
|
82
|
+
andAny?: InternalWhereStatement<BaseInstance, BaseInstance['DB'], BaseInstance['schema'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']>[];
|
|
81
83
|
polymorphic?: boolean;
|
|
82
84
|
primaryKeyOverride?: DreamColumnNames<BaseInstance> | null;
|
|
83
85
|
selfAnd?: SelfOnStatement<BaseInstance, BaseInstance['DB'], BaseInstance['schema'], AssociationTableName & AssociationTableNames<BaseInstance['DB'], BaseInstance['schema']> & keyof BaseInstance['DB']>;
|