@rvoh/dream 1.4.1 → 1.5.0
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/CHANGELOG.md +166 -0
- package/dist/cjs/src/Dream.js +12 -16
- package/dist/cjs/src/bin/index.js +23 -7
- package/dist/cjs/src/cli/index.js +18 -3
- package/dist/cjs/src/db/ConnectedToDB.js +0 -8
- package/dist/cjs/src/db/DreamDbConnection.js +25 -36
- package/dist/cjs/src/db/helpers/dbTypesFilenameForConnection.js +6 -0
- package/dist/cjs/src/{bin/helpers/sync.js → db/helpers/syncDbTypesFiles.js} +8 -5
- package/dist/cjs/src/db/index.js +3 -2
- package/dist/cjs/src/decorators/field/sortable/helpers/setPosition.js +17 -2
- package/dist/cjs/src/dream/Query.js +9 -6
- package/dist/cjs/src/dream/QueryDriver/Base.js +111 -7
- package/dist/cjs/src/dream/QueryDriver/Kysely.js +213 -86
- package/dist/cjs/src/dream/QueryDriver/Postgres.js +162 -0
- package/dist/cjs/src/{helpers/db → dream/QueryDriver/helpers/kysely}/runMigration.js +20 -16
- package/dist/cjs/src/{helpers/db → dream/QueryDriver/helpers/pg}/createDb.js +5 -5
- package/dist/cjs/src/{helpers/db → dream/QueryDriver/helpers/pg}/dropDb.js +6 -6
- package/dist/cjs/src/{helpers/db → dream/QueryDriver/helpers/pg}/loadPgClient.js +5 -3
- package/dist/cjs/src/dream/internal/destroyDream.js +3 -10
- package/dist/cjs/src/dream/internal/saveDream.js +1 -1
- package/dist/cjs/src/dream/internal/similarity/SimilarityBuilder.js +9 -3
- package/dist/cjs/src/dream-app/index.js +59 -65
- package/dist/cjs/src/helpers/cli/SchemaBuilder.js +30 -42
- package/dist/cjs/src/helpers/cli/addImportSuffix.js +17 -0
- package/dist/cjs/src/helpers/cli/generateDream.js +2 -0
- package/dist/cjs/src/helpers/cli/generateDreamContent.js +5 -3
- package/dist/cjs/src/helpers/cli/generateFactoryContent.js +29 -0
- package/dist/cjs/src/helpers/cli/generateMigration.js +7 -5
- package/dist/cjs/src/helpers/cli/generateMigrationContent.js +48 -15
- package/dist/cjs/src/helpers/db/primaryKeyType.js +4 -22
- package/dist/cjs/src/helpers/path/relativeDreamPath.js +4 -3
- package/dist/cjs/src/helpers/sqlAttributes.js +4 -1
- package/dist/cjs/src/index.js +8 -2
- package/dist/esm/src/Dream.js +10 -14
- package/dist/esm/src/bin/index.js +23 -7
- package/dist/esm/src/cli/index.js +18 -3
- package/dist/esm/src/db/ConnectedToDB.js +0 -8
- package/dist/esm/src/db/DreamDbConnection.js +22 -34
- package/dist/esm/src/db/helpers/dbTypesFilenameForConnection.js +3 -0
- package/dist/esm/src/{bin/helpers/sync.js → db/helpers/syncDbTypesFiles.js} +7 -4
- package/dist/esm/src/db/index.js +3 -2
- package/dist/esm/src/decorators/field/sortable/helpers/setPosition.js +16 -2
- package/dist/esm/src/dream/Query.js +9 -6
- package/dist/esm/src/dream/QueryDriver/Base.js +111 -7
- package/dist/esm/src/dream/QueryDriver/Kysely.js +215 -88
- package/dist/esm/src/dream/QueryDriver/Postgres.js +162 -0
- package/dist/esm/src/{helpers/db → dream/QueryDriver/helpers/kysely}/runMigration.js +14 -10
- package/dist/esm/src/{helpers/db → dream/QueryDriver/helpers/pg}/createDb.js +5 -5
- package/dist/esm/src/{helpers/db → dream/QueryDriver/helpers/pg}/dropDb.js +6 -6
- package/dist/esm/src/{helpers/db → dream/QueryDriver/helpers/pg}/loadPgClient.js +5 -3
- package/dist/esm/src/dream/internal/destroyDream.js +3 -10
- package/dist/esm/src/dream/internal/saveDream.js +1 -1
- package/dist/esm/src/dream/internal/similarity/SimilarityBuilder.js +9 -3
- package/dist/esm/src/dream-app/index.js +55 -61
- package/dist/esm/src/helpers/cli/SchemaBuilder.js +24 -36
- package/dist/esm/src/helpers/cli/addImportSuffix.js +14 -0
- package/dist/esm/src/helpers/cli/generateDream.js +2 -0
- package/dist/esm/src/helpers/cli/generateDreamContent.js +5 -3
- package/dist/esm/src/helpers/cli/generateFactoryContent.js +29 -0
- package/dist/esm/src/helpers/cli/generateMigration.js +7 -5
- package/dist/esm/src/helpers/cli/generateMigrationContent.js +48 -15
- package/dist/esm/src/helpers/db/primaryKeyType.js +4 -22
- package/dist/esm/src/helpers/path/relativeDreamPath.js +4 -3
- package/dist/esm/src/helpers/sqlAttributes.js +4 -1
- package/dist/esm/src/index.js +3 -0
- package/dist/types/src/Dream.d.ts +5 -3
- package/dist/types/src/bin/index.d.ts +3 -1
- package/dist/types/src/db/ConnectedToDB.d.ts +0 -2
- package/dist/types/src/db/DreamDbConnection.d.ts +7 -3
- package/dist/types/src/db/helpers/dbTypesFilenameForConnection.d.ts +1 -0
- package/dist/types/src/db/helpers/syncDbTypesFiles.d.ts +1 -0
- package/dist/types/src/db/index.d.ts +2 -1
- package/dist/types/src/decorators/field/sortable/helpers/setPosition.d.ts +2 -0
- package/dist/types/src/dream/Query.d.ts +5 -20
- package/dist/types/src/dream/QueryDriver/Base.d.ts +74 -13
- package/dist/types/src/dream/QueryDriver/Kysely.d.ts +75 -9
- package/dist/types/src/dream/QueryDriver/Postgres.d.ts +32 -0
- package/dist/types/src/dream/QueryDriver/helpers/kysely/foreignKeyTypeFromPrimaryKey.d.ts +2 -0
- package/dist/types/src/dream/QueryDriver/helpers/kysely/runMigration.d.ts +9 -0
- package/dist/types/src/dream/QueryDriver/helpers/pg/createDb.d.ts +2 -0
- package/dist/types/src/dream/QueryDriver/helpers/pg/dropDb.d.ts +2 -0
- package/dist/types/src/dream/QueryDriver/helpers/pg/loadPgClient.d.ts +5 -0
- package/dist/types/src/dream/internal/destroyOptions.d.ts +3 -3
- package/dist/types/src/dream-app/index.d.ts +16 -7
- package/dist/types/src/helpers/cli/SchemaBuilder.d.ts +26 -0
- package/dist/types/src/helpers/cli/addImportSuffix.d.ts +1 -0
- package/dist/types/src/helpers/cli/generateDream.d.ts +1 -0
- package/dist/types/src/helpers/cli/generateDreamContent.d.ts +2 -1
- package/dist/types/src/helpers/cli/generateMigration.d.ts +2 -1
- package/dist/types/src/helpers/cli/generateMigrationContent.d.ts +2 -1
- package/dist/types/src/helpers/db/primaryKeyType.d.ts +1 -1
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/types/dream.d.ts +4 -4
- package/dist/types/src/types/dream.ts +8 -9
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Benchmark.html +2 -2
- package/docs/classes/CalendarDate.html +2 -2
- package/docs/classes/CheckConstraintViolation.html +3 -3
- package/docs/classes/CliFileWriter.html +2 -2
- package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +3 -3
- package/docs/classes/DataTypeColumnTypeMismatch.html +3 -3
- package/docs/classes/Decorators.html +19 -19
- package/docs/classes/Dream.html +117 -115
- package/docs/classes/DreamApp.html +9 -5
- package/docs/classes/DreamBin.html +2 -2
- package/docs/classes/DreamCLI.html +4 -4
- package/docs/classes/DreamImporter.html +2 -2
- package/docs/classes/DreamLogos.html +2 -2
- package/docs/classes/DreamMigrationHelpers.html +7 -7
- package/docs/classes/DreamSerializerBuilder.html +8 -8
- package/docs/classes/DreamTransaction.html +2 -2
- package/docs/classes/Encrypt.html +2 -2
- package/docs/classes/Env.html +2 -2
- package/docs/classes/GlobalNameNotSet.html +3 -3
- package/docs/classes/KyselyQueryDriver.html +163 -0
- package/docs/classes/NonLoadedAssociation.html +3 -3
- package/docs/classes/NotNullViolation.html +3 -3
- package/docs/classes/ObjectSerializerBuilder.html +8 -8
- package/docs/classes/PostgresQueryDriver.html +165 -0
- package/docs/classes/Query.html +59 -87
- package/docs/classes/QueryDriverBase.html +156 -0
- package/docs/classes/Range.html +2 -2
- package/docs/classes/RecordNotFound.html +3 -3
- package/docs/classes/ValidationError.html +3 -3
- package/docs/functions/DreamSerializer.html +1 -1
- package/docs/functions/ObjectSerializer.html +1 -1
- package/docs/functions/ReplicaSafe.html +1 -1
- package/docs/functions/STI.html +1 -1
- package/docs/functions/SoftDelete.html +1 -1
- package/docs/functions/camelize.html +1 -1
- package/docs/functions/capitalize.html +1 -1
- package/docs/functions/cloneDeepSafe.html +1 -1
- package/docs/functions/closeAllDbConnections.html +1 -1
- package/docs/functions/compact.html +1 -1
- package/docs/functions/dreamDbConnections.html +1 -1
- package/docs/functions/dreamPath.html +1 -1
- package/docs/functions/expandStiClasses.html +1 -1
- package/docs/functions/generateDream.html +1 -1
- package/docs/functions/globalClassNameFromFullyQualifiedModelName.html +1 -1
- package/docs/functions/groupBy.html +1 -1
- package/docs/functions/hyphenize.html +1 -1
- package/docs/functions/inferSerializerFromDreamOrViewModel.html +1 -1
- package/docs/functions/inferSerializersFromDreamClassOrViewModelClass.html +1 -1
- package/docs/functions/intersection.html +1 -1
- package/docs/functions/isDreamSerializer.html +1 -1
- package/docs/functions/isEmpty.html +1 -1
- package/docs/functions/loadRepl.html +1 -1
- package/docs/functions/lookupClassByGlobalName.html +1 -1
- package/docs/functions/normalizeUnicode.html +1 -1
- package/docs/functions/pascalize.html +1 -1
- package/docs/functions/pgErrorType.html +1 -1
- package/docs/functions/range-1.html +1 -1
- package/docs/functions/relativeDreamPath.html +1 -1
- package/docs/functions/round.html +1 -1
- package/docs/functions/serializerNameFromFullyQualifiedModelName.html +1 -1
- package/docs/functions/sharedPathPrefix.html +1 -1
- package/docs/functions/snakeify.html +1 -1
- package/docs/functions/sort.html +1 -1
- package/docs/functions/sortBy.html +1 -1
- package/docs/functions/sortObjectByKey.html +1 -1
- package/docs/functions/sortObjectByValue.html +1 -1
- package/docs/functions/standardizeFullyQualifiedModelName.html +1 -1
- package/docs/functions/uncapitalize.html +1 -1
- package/docs/functions/uniq.html +1 -1
- package/docs/functions/untypedDb.html +1 -1
- package/docs/functions/validateColumn.html +1 -1
- package/docs/functions/validateTable.html +1 -1
- package/docs/hierarchy.html +1 -0
- package/docs/interfaces/BelongsToStatement.html +2 -2
- package/docs/interfaces/DecoratorContext.html +2 -2
- package/docs/interfaces/DreamAppInitOptions.html +2 -2
- package/docs/interfaces/DreamAppOpts.html +2 -2
- package/docs/interfaces/EncryptOptions.html +2 -2
- package/docs/interfaces/InternalAnyTypedSerializerRendersMany.html +2 -2
- package/docs/interfaces/InternalAnyTypedSerializerRendersOne.html +2 -2
- package/docs/interfaces/OpenapiDescription.html +2 -2
- package/docs/interfaces/OpenapiSchemaProperties.html +1 -1
- package/docs/interfaces/OpenapiSchemaPropertiesShorthand.html +1 -1
- package/docs/interfaces/OpenapiTypeFieldObject.html +1 -1
- package/docs/interfaces/SerializerRendererOpts.html +2 -2
- package/docs/modules.html +3 -0
- package/docs/types/Camelized.html +1 -1
- package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
- package/docs/types/DateTime.html +1 -1
- package/docs/types/DbConnectionType.html +1 -1
- package/docs/types/DbTypes.html +1 -1
- package/docs/types/DreamAppAllowedPackageManagersEnum.html +1 -1
- package/docs/types/DreamAssociationMetadata.html +1 -1
- package/docs/types/DreamAttributes.html +1 -1
- package/docs/types/DreamClassAssociationAndStatement.html +1 -1
- package/docs/types/DreamClassColumn.html +1 -1
- package/docs/types/DreamColumn.html +1 -1
- package/docs/types/DreamColumnNames.html +1 -1
- package/docs/types/DreamLogLevel.html +1 -1
- package/docs/types/DreamLogger.html +1 -1
- package/docs/types/DreamModelSerializerType.html +1 -1
- package/docs/types/DreamOrViewModelClassSerializerKey.html +1 -1
- package/docs/types/DreamOrViewModelSerializerKey.html +1 -1
- package/docs/types/DreamParamSafeAttributes.html +1 -1
- package/docs/types/DreamParamSafeColumnNames.html +1 -1
- package/docs/types/DreamSerializable.html +1 -1
- package/docs/types/DreamSerializableArray.html +1 -1
- package/docs/types/DreamSerializerKey.html +1 -1
- package/docs/types/DreamSerializers.html +1 -1
- package/docs/types/DreamVirtualColumns.html +1 -1
- package/docs/types/EncryptAlgorithm.html +1 -1
- package/docs/types/HasManyStatement.html +1 -1
- package/docs/types/HasOneStatement.html +1 -1
- package/docs/types/Hyphenized.html +1 -1
- package/docs/types/OpenapiAllTypes.html +1 -1
- package/docs/types/OpenapiFormats.html +1 -1
- package/docs/types/OpenapiNumberFormats.html +1 -1
- package/docs/types/OpenapiPrimitiveBaseTypes.html +1 -1
- package/docs/types/OpenapiPrimitiveTypes.html +1 -1
- package/docs/types/OpenapiSchemaArray.html +1 -1
- package/docs/types/OpenapiSchemaArrayShorthand.html +1 -1
- package/docs/types/OpenapiSchemaBase.html +1 -1
- package/docs/types/OpenapiSchemaBody.html +1 -1
- package/docs/types/OpenapiSchemaBodyShorthand.html +1 -1
- package/docs/types/OpenapiSchemaCommonFields.html +1 -1
- package/docs/types/OpenapiSchemaExpressionAllOf.html +1 -1
- package/docs/types/OpenapiSchemaExpressionAnyOf.html +1 -1
- package/docs/types/OpenapiSchemaExpressionOneOf.html +1 -1
- package/docs/types/OpenapiSchemaExpressionRef.html +1 -1
- package/docs/types/OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
- package/docs/types/OpenapiSchemaInteger.html +1 -1
- package/docs/types/OpenapiSchemaNull.html +1 -1
- package/docs/types/OpenapiSchemaNumber.html +1 -1
- package/docs/types/OpenapiSchemaObject.html +1 -1
- package/docs/types/OpenapiSchemaObjectAllOf.html +1 -1
- package/docs/types/OpenapiSchemaObjectAllOfShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectAnyOf.html +1 -1
- package/docs/types/OpenapiSchemaObjectAnyOfShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectBase.html +1 -1
- package/docs/types/OpenapiSchemaObjectBaseShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectOneOf.html +1 -1
- package/docs/types/OpenapiSchemaObjectOneOfShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectShorthand.html +1 -1
- package/docs/types/OpenapiSchemaPrimitiveGeneric.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionAllOf.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionOneOf.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
- package/docs/types/OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
- package/docs/types/OpenapiSchemaString.html +1 -1
- package/docs/types/OpenapiShorthandAllTypes.html +1 -1
- package/docs/types/OpenapiShorthandPrimitiveBaseTypes.html +1 -1
- package/docs/types/OpenapiShorthandPrimitiveTypes.html +1 -1
- package/docs/types/OpenapiTypeField.html +1 -1
- package/docs/types/Pascalized.html +1 -1
- package/docs/types/RoundingPrecision.html +1 -1
- package/docs/types/SerializerCasing.html +1 -1
- package/docs/types/SimpleObjectSerializerType.html +1 -1
- package/docs/types/Snakeified.html +1 -1
- package/docs/types/UpdateableAssociationProperties.html +1 -1
- package/docs/types/UpdateableProperties.html +1 -1
- package/docs/types/ValidationType.html +1 -1
- package/docs/types/ViewModel.html +1 -1
- package/docs/types/ViewModelClass.html +1 -1
- package/docs/types/WhereStatementForDream.html +1 -1
- package/docs/types/WhereStatementForDreamClass.html +1 -1
- package/docs/variables/DateTime-1.html +1 -1
- package/docs/variables/DreamAppAllowedPackageManagersEnumValues.html +1 -1
- package/docs/variables/DreamConst.html +1 -1
- package/docs/variables/TRIGRAM_OPERATORS.html +1 -1
- package/docs/variables/openapiPrimitiveTypes-1.html +1 -1
- package/docs/variables/openapiShorthandPrimitiveTypes-1.html +1 -1
- package/docs/variables/ops.html +1 -1
- package/docs/variables/primaryKeyTypes.html +1 -1
- package/package.json +4 -3
- package/dist/cjs/src/helpers/db/truncateDb.js +0 -27
- package/dist/esm/src/helpers/db/truncateDb.js +0 -24
- package/dist/types/src/bin/helpers/sync.d.ts +0 -1
- package/dist/types/src/helpers/db/createDb.d.ts +0 -2
- package/dist/types/src/helpers/db/dropDb.d.ts +0 -2
- package/dist/types/src/helpers/db/foreignKeyTypeFromPrimaryKey.d.ts +0 -2
- package/dist/types/src/helpers/db/loadPgClient.d.ts +0 -4
- package/dist/types/src/helpers/db/runMigration.d.ts +0 -6
- package/dist/types/src/helpers/db/truncateDb.d.ts +0 -1
- /package/dist/cjs/src/{helpers/db → dream/QueryDriver/helpers/kysely}/foreignKeyTypeFromPrimaryKey.js +0 -0
- /package/dist/esm/src/{helpers/db → dream/QueryDriver/helpers/kysely}/foreignKeyTypeFromPrimaryKey.js +0 -0
|
@@ -1,36 +1,81 @@
|
|
|
1
1
|
import { DeleteQueryBuilder, Kysely, Transaction as KyselyTransaction, SelectQueryBuilder, UpdateQueryBuilder } from 'kysely';
|
|
2
|
+
import { DialectProviderCb } from '../../db/DreamDbConnection.js';
|
|
2
3
|
import Dream from '../../Dream.js';
|
|
4
|
+
import { SchemaBuilderInformationSchemaRow } from '../../helpers/cli/SchemaBuilder.js';
|
|
3
5
|
import { AssociationStatement } from '../../types/associations/shared.js';
|
|
4
6
|
import { DbConnectionType } from '../../types/db.js';
|
|
5
|
-
import { DreamColumnNames, DreamTableSchema, SqlCommandType } from '../../types/dream.js';
|
|
7
|
+
import { DreamColumnNames, DreamTableSchema, OrderDir, PrimaryKeyType, SqlCommandType } from '../../types/dream.js';
|
|
6
8
|
import { PreloadedDreamsAndWhatTheyPointTo, QueryToKyselyDBType, QueryToKyselyTableNamesType } from '../../types/query.js';
|
|
7
9
|
import DreamTransaction from '../DreamTransaction.js';
|
|
8
10
|
import Query from '../Query.js';
|
|
9
11
|
import QueryDriverBase from './Base.js';
|
|
10
12
|
export default class KyselyQueryDriver<DreamInstance extends Dream> extends QueryDriverBase<DreamInstance> {
|
|
11
13
|
dbFor(sqlCommandType: SqlCommandType): Kysely<DreamInstance['DB']> | KyselyTransaction<DreamInstance['DB']>;
|
|
14
|
+
static dbFor<I extends Dream>(connectionName: string, dbConnectionType: DbConnectionType, dreamTransaction?: DreamTransaction<I> | null): Kysely<I['DB']> | KyselyTransaction<I['DB']>;
|
|
15
|
+
static dialectProvider(connectionName: string, dbConnectionType: DbConnectionType): DialectProviderCb;
|
|
12
16
|
/**
|
|
13
17
|
* migrate the database. Must respond to the NODE_ENV value.
|
|
14
18
|
*/
|
|
15
|
-
static migrate(): Promise<void>;
|
|
19
|
+
static migrate(connectionName: string): Promise<void>;
|
|
16
20
|
/**
|
|
17
21
|
* rollback the database. Must respond to the NODE_ENV value.
|
|
18
22
|
*/
|
|
19
23
|
static rollback(opts: {
|
|
24
|
+
connectionName: string;
|
|
20
25
|
steps: number;
|
|
21
26
|
}): Promise<void>;
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
/**
|
|
28
|
+
* This should build a new migration file in the migrations folder
|
|
29
|
+
* of your application. This will then need to be read and run
|
|
30
|
+
* whenever the `migrate` method is called. The filename should
|
|
31
|
+
* contain a timestamp at the front of the filename, so that it
|
|
32
|
+
* is sorted by date in the file tree, and, more importantly, so
|
|
33
|
+
* they can be run in order by your migration runner.
|
|
34
|
+
*/
|
|
35
|
+
static generateMigration(connectionName: string, migrationName: string, columnsWithTypes: string[]): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* defines the syncing behavior for dream and psychic,
|
|
38
|
+
* which is run whenever the `sync` command is called.
|
|
39
|
+
* This is an important step, and will be incredibly
|
|
40
|
+
* comlpex to override. You will need to do the following
|
|
41
|
+
* when overriding this method:
|
|
42
|
+
*
|
|
43
|
+
* 1. introspect the db and use it to generate a db.ts file in the
|
|
44
|
+
* same shape as the existing one. Currently, the process for generating
|
|
45
|
+
* this file is extremely complex and messy, and will be difficult
|
|
46
|
+
* to achieve.
|
|
47
|
+
* 2. generate a types/dream.ts file in the same shape as the existing
|
|
48
|
+
* one. This is normally done using `await new SchemaBuilder().build()`,
|
|
49
|
+
* but this will likely need to be overridden to tailor to your custom
|
|
50
|
+
* database engine.
|
|
51
|
+
*/
|
|
52
|
+
static sync(connectionName: string, onSync: () => Promise<void> | void, options?: {
|
|
24
53
|
schemaOnly?: boolean;
|
|
25
54
|
}): Promise<void>;
|
|
55
|
+
static get syncDialect(): string;
|
|
26
56
|
/**
|
|
27
|
-
*
|
|
57
|
+
* @internal
|
|
58
|
+
*
|
|
59
|
+
* returns the foreign key type based on the primary key received.
|
|
60
|
+
* gives the driver the opportunity to switch i.e. bigserial to bigint.
|
|
28
61
|
*/
|
|
29
|
-
static
|
|
62
|
+
static foreignKeyTypeFromPrimaryKey(primaryKey: PrimaryKeyType): "bigint" | "uuid" | "integer";
|
|
30
63
|
/**
|
|
31
|
-
*
|
|
64
|
+
* @internal
|
|
65
|
+
*
|
|
66
|
+
* used to return the computed primary key type based
|
|
67
|
+
* on the primaryKeyType set in the DreamApp class.
|
|
32
68
|
*/
|
|
33
|
-
static
|
|
69
|
+
static primaryKeyType(): "bigint" | "bigserial" | "uuid" | "integer";
|
|
70
|
+
/**
|
|
71
|
+
* destroys a dream, possibly implementing soft delete if reallyDestroy is false
|
|
72
|
+
* and the record being deleted implements soft delete.
|
|
73
|
+
*
|
|
74
|
+
* @param dream - the dream instance you wish to destroy
|
|
75
|
+
* @param txn - a transaction to encapsulate, consistently provided by underlying dream mechanisms
|
|
76
|
+
* @param reallyDestroy - whether or not to reallyDestroy. If false, soft delete will be attempted when relevant
|
|
77
|
+
*/
|
|
78
|
+
static destroyDream(dream: Dream, txn: DreamTransaction<Dream>, reallyDestroy: boolean): Promise<void>;
|
|
34
79
|
/**
|
|
35
80
|
* Converts the given dream class into a Kysely query, enabling
|
|
36
81
|
* you to build custom queries using the Kysely API
|
|
@@ -43,6 +88,27 @@ export default class KyselyQueryDriver<DreamInstance extends Dream> extends Quer
|
|
|
43
88
|
* @returns A Kysely query. Depending on the type passed, it will return either a SelectQueryBuilder, DeleteQueryBuilder, or an UpdateQueryBuilder
|
|
44
89
|
*/
|
|
45
90
|
toKysely<QueryType extends 'select' | 'delete' | 'update', DbType = QueryToKyselyDBType<Query<DreamInstance>>, TableNames = QueryToKyselyTableNamesType<Query<DreamInstance>>, ToKyselyReturnType = QueryType extends 'select' ? SelectQueryBuilder<DbType, TableNames & keyof DbType, unknown> : QueryType extends 'delete' ? DeleteQueryBuilder<DbType, TableNames & keyof DbType, unknown> : QueryType extends 'update' ? UpdateQueryBuilder<DbType, TableNames & keyof DbType, TableNames & keyof DbType, unknown> : never>(type: QueryType): ToKyselyReturnType;
|
|
91
|
+
/**
|
|
92
|
+
* Builds a new DreamTransaction instance, provides
|
|
93
|
+
* the instance to the provided callback.
|
|
94
|
+
*
|
|
95
|
+
* ```ts
|
|
96
|
+
* await ApplicationModel.transaction(async txn => {
|
|
97
|
+
* const user = await User.txn(txn).create({ email: 'how@yadoin' })
|
|
98
|
+
* await Pet.txn(txn).create({ user })
|
|
99
|
+
* })
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @param callback - A callback function to call. The transaction provided to the callback can be passed to subsequent database calls within the transaction callback
|
|
103
|
+
* @returns void
|
|
104
|
+
*/
|
|
105
|
+
static transaction<DreamInstance extends Dream, CB extends (txn: DreamTransaction<DreamInstance>) => unknown, RetType extends ReturnType<CB>>(dreamInstance: DreamInstance, callback: CB): Promise<RetType>;
|
|
106
|
+
/**
|
|
107
|
+
* @internal
|
|
108
|
+
*
|
|
109
|
+
* this is used by getColumnData to serialize enums
|
|
110
|
+
*/
|
|
111
|
+
static enumType(row: SchemaBuilderInformationSchemaRow): Capitalize<string>;
|
|
46
112
|
/**
|
|
47
113
|
* @internal
|
|
48
114
|
*
|
|
@@ -200,6 +266,7 @@ export default class KyselyQueryDriver<DreamInstance extends Dream> extends Quer
|
|
|
200
266
|
}>;
|
|
201
267
|
private buildDelete;
|
|
202
268
|
private buildSelect;
|
|
269
|
+
orderByDirection(direction: OrderDir | null): import("kysely").RawBuilder<unknown>;
|
|
203
270
|
private buildUpdate;
|
|
204
271
|
/**
|
|
205
272
|
* @internal
|
|
@@ -213,7 +280,6 @@ export default class KyselyQueryDriver<DreamInstance extends Dream> extends Quer
|
|
|
213
280
|
* Used by loadBuider
|
|
214
281
|
*/
|
|
215
282
|
hydratePreload(this: KyselyQueryDriver<DreamInstance>, dream: Dream): Promise<void>;
|
|
216
|
-
static duplicateDatabase(): Promise<void>;
|
|
217
283
|
private aliasWhereStatements;
|
|
218
284
|
private aliasWhereStatement;
|
|
219
285
|
private rawifiedSelfOnClause;
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
import Dream from '../../Dream.js';
|
|
2
|
+
import { SchemaBuilderAssociationData, SchemaBuilderColumnData } from '../../helpers/cli/SchemaBuilder.js';
|
|
2
3
|
import KyselyQueryDriver from './Kysely.js';
|
|
3
4
|
export default class PostgresQueryDriver<DreamInstance extends Dream> extends KyselyQueryDriver<DreamInstance> {
|
|
5
|
+
/**
|
|
6
|
+
* create the database. Must respond to the NODE_ENV value.
|
|
7
|
+
*/
|
|
8
|
+
static dbCreate(connectionName: string): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* delete the database. Must respond to the NODE_ENV value.
|
|
11
|
+
*/
|
|
12
|
+
static dbDrop(connectionName: string): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*
|
|
16
|
+
* this method is called when dream is initializing, and is used
|
|
17
|
+
* to configure the database to utilize custom type parsers for
|
|
18
|
+
* a variety of data types.
|
|
19
|
+
*
|
|
20
|
+
* @param connectionName - the name of the connection you are doing this for
|
|
21
|
+
* @returns void
|
|
22
|
+
*/
|
|
23
|
+
static setDatabaseTypeParsers(connectionName: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*
|
|
27
|
+
* this is used by the SchemaBuilder to store column data permanently
|
|
28
|
+
* within the types/dream.ts file.
|
|
29
|
+
*/
|
|
30
|
+
static getColumnData(connectionName: string, tableName: string, associationData: {
|
|
31
|
+
[key: string]: SchemaBuilderAssociationData;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
[key: string]: SchemaBuilderColumnData;
|
|
34
|
+
}>;
|
|
35
|
+
static duplicateDatabase(connectionName: string): Promise<void>;
|
|
4
36
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DialectProviderCb } from '../../../../db/DreamDbConnection.js';
|
|
2
|
+
type MigrationModes = 'migrate' | 'rollback';
|
|
3
|
+
interface MigrationOpts {
|
|
4
|
+
connectionName: string;
|
|
5
|
+
dialectProvider: DialectProviderCb;
|
|
6
|
+
mode?: MigrationModes;
|
|
7
|
+
}
|
|
8
|
+
export default function runMigration({ connectionName, mode, dialectProvider, }: MigrationOpts): Promise<void>;
|
|
9
|
+
export {};
|
|
@@ -27,19 +27,19 @@ export interface DestroyOptions<DreamInstance extends Dream> {
|
|
|
27
27
|
export declare function destroyOptions<DreamInstance extends Dream>(options: DestroyOptions<DreamInstance>): {
|
|
28
28
|
reallyDestroy: boolean;
|
|
29
29
|
bypassAllDefaultScopes: boolean;
|
|
30
|
-
defaultScopesToBypass: Exclude<DreamInstance["
|
|
30
|
+
defaultScopesToBypass: Exclude<DreamInstance["connectionTypeConfig" & keyof DreamInstance]["allDefaultScopeNames" & keyof DreamInstance["connectionTypeConfig" & keyof DreamInstance]][number & keyof DreamInstance["connectionTypeConfig" & keyof DreamInstance]["allDefaultScopeNames" & keyof DreamInstance["connectionTypeConfig" & keyof DreamInstance]]], "dream:STI">[];
|
|
31
31
|
cascade: boolean;
|
|
32
32
|
skipHooks: boolean;
|
|
33
33
|
};
|
|
34
34
|
export declare function undestroyOptions<DreamInstance extends Dream>(options: DestroyOptions<DreamInstance>): {
|
|
35
|
-
defaultScopesToBypass: Exclude<DreamInstance["
|
|
35
|
+
defaultScopesToBypass: Exclude<DreamInstance["connectionTypeConfig" & keyof DreamInstance]["allDefaultScopeNames" & keyof DreamInstance["connectionTypeConfig" & keyof DreamInstance]][number & keyof DreamInstance["connectionTypeConfig" & keyof DreamInstance]["allDefaultScopeNames" & keyof DreamInstance["connectionTypeConfig" & keyof DreamInstance]]], "dream:STI">[];
|
|
36
36
|
bypassAllDefaultScopes: boolean;
|
|
37
37
|
cascade: boolean;
|
|
38
38
|
skipHooks: boolean;
|
|
39
39
|
};
|
|
40
40
|
export declare function reallyDestroyOptions<DreamInstance extends Dream>(options: DestroyOptions<DreamInstance>): {
|
|
41
41
|
reallyDestroy: boolean;
|
|
42
|
-
defaultScopesToBypass: Exclude<DreamInstance["
|
|
42
|
+
defaultScopesToBypass: Exclude<DreamInstance["connectionTypeConfig" & keyof DreamInstance]["allDefaultScopeNames" & keyof DreamInstance["connectionTypeConfig" & keyof DreamInstance]][number & keyof DreamInstance["connectionTypeConfig" & keyof DreamInstance]["allDefaultScopeNames" & keyof DreamInstance["connectionTypeConfig" & keyof DreamInstance]]], "dream:STI">[];
|
|
43
43
|
bypassAllDefaultScopes: boolean;
|
|
44
44
|
cascade: boolean;
|
|
45
45
|
skipHooks: boolean;
|
|
@@ -5,6 +5,7 @@ import { primaryKeyTypes } from '../dream/constants.js';
|
|
|
5
5
|
import { EncryptOptions } from '../encrypt/index.js';
|
|
6
6
|
import { DbConnectionType } from '../types/db.js';
|
|
7
7
|
import { DreamModelSerializerType, SimpleObjectSerializerType } from '../types/serializer.js';
|
|
8
|
+
import QueryDriverBase from '../dream/QueryDriver/Base.js';
|
|
8
9
|
export default class DreamApp {
|
|
9
10
|
/**
|
|
10
11
|
* initializes a new dream application and caches it for use
|
|
@@ -57,7 +58,8 @@ export default class DreamApp {
|
|
|
57
58
|
private _specialHooks;
|
|
58
59
|
get specialHooks(): DreamAppSpecialHooks;
|
|
59
60
|
private _dbCredentials;
|
|
60
|
-
get dbCredentials(): DreamDbCredentialOptions
|
|
61
|
+
get dbCredentials(): Record<string, DreamDbCredentialOptions>;
|
|
62
|
+
dbCredentialsFor(connectionName: string): DreamDbCredentialOptions | null;
|
|
61
63
|
private _encryption;
|
|
62
64
|
get encryption(): DreamAppEncryptionOptions;
|
|
63
65
|
private _parallelTests;
|
|
@@ -67,7 +69,7 @@ export default class DreamApp {
|
|
|
67
69
|
private _paginationPageSize;
|
|
68
70
|
get paginationPageSize(): number;
|
|
69
71
|
private _primaryKeyType;
|
|
70
|
-
get primaryKeyType(): "bigint" | "
|
|
72
|
+
get primaryKeyType(): "bigint" | "bigserial" | "uuid" | "integer";
|
|
71
73
|
private _projectRoot;
|
|
72
74
|
get projectRoot(): string;
|
|
73
75
|
private _paths;
|
|
@@ -82,17 +84,21 @@ export default class DreamApp {
|
|
|
82
84
|
get plugins(): ((app: DreamApp) => void | Promise<void>)[];
|
|
83
85
|
private _packageManager;
|
|
84
86
|
get packageManager(): "yarn" | "npm" | "pnpm";
|
|
87
|
+
private _importExtension;
|
|
88
|
+
get importExtension(): ".js" | ".ts" | "none";
|
|
85
89
|
protected loadedModels: boolean;
|
|
86
90
|
constructor(opts?: Partial<DreamAppOpts>);
|
|
87
91
|
get models(): Record<string, typeof Dream>;
|
|
88
92
|
get serializers(): Record<string, DreamModelSerializerType | SimpleObjectSerializerType>;
|
|
89
|
-
dbName(connection: DbConnectionType): string;
|
|
90
|
-
dbConnectionConfig(connection: DbConnectionType): SingleDbCredential;
|
|
91
|
-
|
|
93
|
+
dbName(connectionName: string, connection: DbConnectionType): string;
|
|
94
|
+
dbConnectionConfig(connectionName: string, connection: DbConnectionType): SingleDbCredential;
|
|
95
|
+
dbConnectionQueryDriverClass<T extends Dream = Dream>(connectionName: string): typeof QueryDriverBase<T>;
|
|
96
|
+
dbConnectionKeys(): string[];
|
|
97
|
+
hasReplicaConfig(connectionName: string): boolean;
|
|
92
98
|
get parallelDatabasesEnabled(): boolean;
|
|
93
99
|
load<RT extends 'models' | 'serializers'>(resourceType: RT, resourcePath: string, importCb: (path: string) => Promise<any>): Promise<void>;
|
|
94
100
|
plugin(cb: (app: DreamApp) => void | Promise<void>): void;
|
|
95
|
-
set<ApplyOpt extends DreamAppSetOption>(applyOption: ApplyOpt, options: ApplyOpt extends 'db' ? DreamDbCredentialOptions : ApplyOpt extends 'encryption' ? DreamAppEncryptionOptions : ApplyOpt extends 'primaryKeyType' ? (typeof primaryKeyTypes)[number] : ApplyOpt extends 'logger' ? DreamLogger : ApplyOpt extends 'projectRoot' ? string : ApplyOpt extends 'inflections' ? () => void | Promise<void> : ApplyOpt extends 'packageManager' ? DreamAppAllowedPackageManagersEnum : ApplyOpt extends 'paths' ? DreamDirectoryPaths : ApplyOpt extends 'parallelTests' ? number : ApplyOpt extends 'unicodeNormalization' ? UnicodeNormalizationForm : ApplyOpt extends 'paginationPageSize' ? number : never): void;
|
|
101
|
+
set<ApplyOpt extends DreamAppSetOption>(applyOption: ApplyOpt, options: ApplyOpt extends 'db' ? DreamDbCredentialOptions | string : ApplyOpt extends 'encryption' ? DreamAppEncryptionOptions : ApplyOpt extends 'primaryKeyType' ? (typeof primaryKeyTypes)[number] : ApplyOpt extends 'importExtension' ? GeneratorImportStyle : ApplyOpt extends 'logger' ? DreamLogger : ApplyOpt extends 'projectRoot' ? string : ApplyOpt extends 'inflections' ? () => void | Promise<void> : ApplyOpt extends 'packageManager' ? DreamAppAllowedPackageManagersEnum : ApplyOpt extends 'paths' ? DreamDirectoryPaths : ApplyOpt extends 'parallelTests' ? number : ApplyOpt extends 'unicodeNormalization' ? UnicodeNormalizationForm : ApplyOpt extends 'paginationPageSize' ? number : never, secondaryOptions?: ApplyOpt extends 'db' ? DreamDbCredentialOptions : never): void;
|
|
96
102
|
on<T extends DreamHookEventType>(hookEventType: T, cb: T extends 'db:log' ? (event: KyselyLogEvent) => void : T extends 'repl:start' ? (context: Context) => void | Promise<void> : never): void;
|
|
97
103
|
}
|
|
98
104
|
export type DreamHookEventType = 'db:log' | 'repl:start';
|
|
@@ -105,7 +111,7 @@ export interface DreamAppOpts {
|
|
|
105
111
|
serializerCasing?: DreamSerializerCasing;
|
|
106
112
|
parallelTests: number | undefined;
|
|
107
113
|
}
|
|
108
|
-
export type DreamAppSetOption = 'db' | 'encryption' | 'inflections' | 'logger' | 'paths' | 'primaryKeyType' | 'projectRoot' | 'serializerCasing' | 'parallelTests' | 'unicodeNormalization' | 'paginationPageSize' | 'packageManager';
|
|
114
|
+
export type DreamAppSetOption = 'db' | 'encryption' | 'inflections' | 'importExtension' | 'logger' | 'paths' | 'primaryKeyType' | 'projectRoot' | 'serializerCasing' | 'parallelTests' | 'unicodeNormalization' | 'paginationPageSize' | 'packageManager';
|
|
109
115
|
export interface DreamDirectoryPaths {
|
|
110
116
|
models?: string;
|
|
111
117
|
serializers?: string;
|
|
@@ -118,6 +124,7 @@ export interface DreamDirectoryPaths {
|
|
|
118
124
|
export interface DreamDbCredentialOptions {
|
|
119
125
|
primary: SingleDbCredential;
|
|
120
126
|
replica?: SingleDbCredential | undefined;
|
|
127
|
+
queryDriverClass?: typeof QueryDriverBase;
|
|
121
128
|
}
|
|
122
129
|
type UnicodeNormalizationForm = 'NFC' | 'NFD' | 'none';
|
|
123
130
|
export interface SingleDbCredential {
|
|
@@ -158,4 +165,6 @@ export interface KyselyLogEvent {
|
|
|
158
165
|
}
|
|
159
166
|
export declare const DreamAppAllowedPackageManagersEnumValues: readonly ["yarn", "npm", "pnpm"];
|
|
160
167
|
export type DreamAppAllowedPackageManagersEnum = (typeof DreamAppAllowedPackageManagersEnumValues)[number];
|
|
168
|
+
export declare const GeneratorImportStyles: readonly [".js", ".ts", "none"];
|
|
169
|
+
export type GeneratorImportStyle = (typeof GeneratorImportStyles)[number];
|
|
161
170
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { DreamConst } from '../../dream/constants.js';
|
|
1
2
|
export default class SchemaBuilder {
|
|
3
|
+
private connectionName;
|
|
2
4
|
hasForeignKeyError: boolean;
|
|
5
|
+
constructor(connectionName: string);
|
|
3
6
|
build(): Promise<void>;
|
|
7
|
+
static buildGlobalTypes(): Promise<void>;
|
|
4
8
|
private globalModelNames;
|
|
5
9
|
private buildSchemaContent;
|
|
6
10
|
private getSchemaImports;
|
|
@@ -15,3 +19,25 @@ export default class SchemaBuilder {
|
|
|
15
19
|
private coercedType;
|
|
16
20
|
private loadDbSyncFile;
|
|
17
21
|
}
|
|
22
|
+
export interface SchemaBuilderAssociationData {
|
|
23
|
+
tables: string[];
|
|
24
|
+
type: 'BelongsTo' | 'HasOne' | 'HasMany';
|
|
25
|
+
polymorphic: boolean;
|
|
26
|
+
optional: boolean | null;
|
|
27
|
+
foreignKey: string | null;
|
|
28
|
+
where: Record<string, string | typeof DreamConst.passthrough | typeof DreamConst.required> | null;
|
|
29
|
+
}
|
|
30
|
+
export interface SchemaBuilderColumnData {
|
|
31
|
+
dbType: string;
|
|
32
|
+
allowNull: boolean;
|
|
33
|
+
enumType: string | null;
|
|
34
|
+
enumValues: string | null;
|
|
35
|
+
isArray: boolean;
|
|
36
|
+
foreignKey: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface SchemaBuilderInformationSchemaRow {
|
|
39
|
+
columnName: string;
|
|
40
|
+
udtName: string;
|
|
41
|
+
dataType: string;
|
|
42
|
+
isNullable: 'YES' | 'NO';
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function addImportSuffix(filepath: string): string;
|
|
@@ -2,6 +2,7 @@ export default function generateDream({ fullyQualifiedModelName, columnsWithType
|
|
|
2
2
|
fullyQualifiedModelName: string;
|
|
3
3
|
columnsWithTypes: string[];
|
|
4
4
|
options: {
|
|
5
|
+
connectionName: string;
|
|
5
6
|
serializer: boolean;
|
|
6
7
|
stiBaseSerializer: boolean;
|
|
7
8
|
includeAdminSerializers: boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export default function generateDreamContent({ fullyQualifiedModelName, columnsWithTypes, fullyQualifiedParentName, serializer, includeAdminSerializers, }: {
|
|
1
|
+
export default function generateDreamContent({ fullyQualifiedModelName, columnsWithTypes, fullyQualifiedParentName, serializer, includeAdminSerializers, connectionName, }: {
|
|
2
2
|
fullyQualifiedModelName: string;
|
|
3
3
|
columnsWithTypes: string[];
|
|
4
4
|
fullyQualifiedParentName?: string | undefined;
|
|
5
|
+
connectionName?: string;
|
|
5
6
|
serializer: boolean;
|
|
6
7
|
includeAdminSerializers: boolean;
|
|
7
8
|
}): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export default function generateMigration({ migrationName, columnsWithTypes, fullyQualifiedModelName, fullyQualifiedParentName, }: {
|
|
1
|
+
export default function generateMigration({ migrationName, columnsWithTypes, connectionName, fullyQualifiedModelName, fullyQualifiedParentName, }: {
|
|
2
2
|
migrationName: string;
|
|
3
3
|
columnsWithTypes: string[];
|
|
4
|
+
connectionName: string;
|
|
4
5
|
fullyQualifiedModelName?: string | undefined;
|
|
5
6
|
fullyQualifiedParentName?: string | undefined;
|
|
6
7
|
}): Promise<void>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PrimaryKeyType } from '../../types/dream.js';
|
|
2
|
-
export default function generateMigrationContent({ table, columnsWithTypes, primaryKeyType, createOrAlter, stiChildClassName, }?: {
|
|
2
|
+
export default function generateMigrationContent({ connectionName, table, columnsWithTypes, primaryKeyType, createOrAlter, stiChildClassName, }?: {
|
|
3
|
+
connectionName?: string;
|
|
3
4
|
table?: string | undefined;
|
|
4
5
|
columnsWithTypes?: string[] | undefined;
|
|
5
6
|
primaryKeyType?: PrimaryKeyType | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function primaryKeyType():
|
|
1
|
+
export default function primaryKeyType(connectionName: string): void;
|
|
@@ -19,6 +19,9 @@ export { default as Dream } from './Dream.js';
|
|
|
19
19
|
export { DreamConst, openapiPrimitiveTypes, openapiShorthandPrimitiveTypes, type primaryKeyTypes, type TRIGRAM_OPERATORS, } from './dream/constants.js';
|
|
20
20
|
export { default as DreamTransaction } from './dream/DreamTransaction.js';
|
|
21
21
|
export { default as Query } from './dream/Query.js';
|
|
22
|
+
export { default as QueryDriverBase } from './dream/QueryDriver/Base.js';
|
|
23
|
+
export { default as KyselyQueryDriver } from './dream/QueryDriver/Kysely.js';
|
|
24
|
+
export { default as PostgresQueryDriver } from './dream/QueryDriver/Postgres.js';
|
|
22
25
|
export { default as Encrypt, type EncryptAlgorithm, type EncryptOptions } from './encrypt/index.js';
|
|
23
26
|
export { default as NonLoadedAssociation } from './errors/associations/NonLoadedAssociation.js';
|
|
24
27
|
export { default as CreateOrFindByFailedToCreateAndFind } from './errors/CreateOrFindByFailedToCreateAndFind.js';
|
|
@@ -81,9 +81,9 @@ export interface UpdateOrCreateByExtraOpts<T extends typeof Dream> {
|
|
|
81
81
|
}
|
|
82
82
|
export type TableNameForGlobalModelName<I extends Dream, GMN extends keyof GlobalModelNameTableMap<I>> = GlobalModelNameTableMap<I>[GMN];
|
|
83
83
|
export type GlobalModelNames<I extends Dream> = keyof GlobalModelNameTableMap<I>;
|
|
84
|
-
export type GlobalModelNameTableMap<I extends Dream,
|
|
84
|
+
export type GlobalModelNameTableMap<I extends Dream, ConnectionTypeConfig = I['connectionTypeConfig'], GlobalNames = ConnectionTypeConfig['globalNames' & keyof ConnectionTypeConfig]> = GlobalNames['models' & keyof GlobalNames];
|
|
85
85
|
export type GlobalSerializerName<I extends Dream> = GlobalSerializerNames<I>[number];
|
|
86
|
-
type GlobalSerializerNames<I extends Dream,
|
|
86
|
+
type GlobalSerializerNames<I extends Dream, GlobalTypeConfig = I['globalTypeConfig']> = GlobalTypeConfig['serializers' & keyof GlobalTypeConfig];
|
|
87
87
|
export type DreamSerializers<I extends Dream> = Record<'default', GlobalSerializerName<I>> & Record<string, GlobalSerializerName<I>>;
|
|
88
88
|
export type DreamConstructorType<T extends Dream> = (new (...arguments_: any[]) => T) & typeof Dream;
|
|
89
89
|
export type ViewModel = {
|
|
@@ -127,10 +127,10 @@ export interface SimilarityStatement {
|
|
|
127
127
|
columnName: string;
|
|
128
128
|
opsStatement: OpsStatement<any, any>;
|
|
129
129
|
}
|
|
130
|
-
export type PassthroughColumnNames<DreamConf,
|
|
130
|
+
export type PassthroughColumnNames<DreamConf, ConnectionTypeConfig = DreamConf['connectionTypeConfig' & keyof DreamConf], PassthroughColumns = ConnectionTypeConfig['passthroughColumns' & keyof ConnectionTypeConfig]> = PassthroughColumns;
|
|
131
131
|
export type DefaultScopeName<DreamInstance extends Dream, Schema = DreamInstance['schema'], TableName extends keyof Schema = DreamInstance['table'] & keyof Schema> = DefaultScopeNameForTable<Schema, TableName>;
|
|
132
132
|
export type DefaultScopeNameForTable<Schema, TableName extends keyof Schema, SchemaTable = Schema[TableName], SchemaDefaultScopes extends string[] = SchemaTable['scopes' & keyof SchemaTable]['default' & keyof SchemaTable['scopes' & keyof SchemaTable]] & string[]> = Exclude<SchemaDefaultScopes[number], typeof STI_SCOPE_NAME>;
|
|
133
|
-
export type AllDefaultScopeNames<DreamConf,
|
|
133
|
+
export type AllDefaultScopeNames<DreamConf, ConnectionTypeConfig = DreamConf['connectionTypeConfig' & keyof DreamConf], AllNames = ConnectionTypeConfig['allDefaultScopeNames' & keyof ConnectionTypeConfig]> = Exclude<AllNames[number & keyof AllNames], typeof STI_SCOPE_NAME>;
|
|
134
134
|
export type NamedScopeName<DreamInstance extends Dream, Schema = DreamInstance['schema'], SchemaTable = Schema[DreamInstance['table'] & keyof Schema], SchemaNamedScopes extends string[] = SchemaTable['scopes' & keyof SchemaTable]['named' & keyof SchemaTable['scopes' & keyof SchemaTable]] & string[]> = SchemaNamedScopes[number];
|
|
135
135
|
export type DefaultOrNamedScopeName<DreamInstance extends Dream> = DefaultScopeName<DreamInstance> | NamedScopeName<DreamInstance>;
|
|
136
136
|
export type PluckEachArgs<ColumnNames extends unknown[], CbArgTypes extends unknown[]> = [...fields: ColumnNames] | [...fields: ColumnNames, callback: (...values: CbArgTypes) => void | Promise<void>] | [...fields: ColumnNames, callback: (...values: CbArgTypes) => void | Promise<void>, opts: FindEachOpts];
|
|
@@ -391,8 +391,8 @@ export type GlobalModelNames<I extends Dream> = keyof GlobalModelNameTableMap<I>
|
|
|
391
391
|
|
|
392
392
|
export type GlobalModelNameTableMap<
|
|
393
393
|
I extends Dream,
|
|
394
|
-
|
|
395
|
-
GlobalNames =
|
|
394
|
+
ConnectionTypeConfig = I['connectionTypeConfig'],
|
|
395
|
+
GlobalNames = ConnectionTypeConfig['globalNames' & keyof ConnectionTypeConfig],
|
|
396
396
|
> = GlobalNames['models' & keyof GlobalNames]
|
|
397
397
|
// end:Model global names and tables
|
|
398
398
|
|
|
@@ -401,9 +401,8 @@ export type GlobalSerializerName<I extends Dream> = GlobalSerializerNames<I>[num
|
|
|
401
401
|
|
|
402
402
|
type GlobalSerializerNames<
|
|
403
403
|
I extends Dream,
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
> = GlobalNames['serializers' & keyof GlobalNames]
|
|
404
|
+
GlobalTypeConfig = I['globalTypeConfig'],
|
|
405
|
+
> = GlobalTypeConfig['serializers' & keyof GlobalTypeConfig]
|
|
407
406
|
// end:Serializer global names
|
|
408
407
|
|
|
409
408
|
export type DreamSerializers<I extends Dream> = Record<'default', GlobalSerializerName<I>> &
|
|
@@ -551,8 +550,8 @@ export interface SimilarityStatement {
|
|
|
551
550
|
|
|
552
551
|
export type PassthroughColumnNames<
|
|
553
552
|
DreamConf,
|
|
554
|
-
|
|
555
|
-
PassthroughColumns =
|
|
553
|
+
ConnectionTypeConfig = DreamConf['connectionTypeConfig' & keyof DreamConf],
|
|
554
|
+
PassthroughColumns = ConnectionTypeConfig['passthroughColumns' & keyof ConnectionTypeConfig],
|
|
556
555
|
> = PassthroughColumns
|
|
557
556
|
|
|
558
557
|
export type DefaultScopeName<
|
|
@@ -574,8 +573,8 @@ export type DefaultScopeNameForTable<
|
|
|
574
573
|
|
|
575
574
|
export type AllDefaultScopeNames<
|
|
576
575
|
DreamConf,
|
|
577
|
-
|
|
578
|
-
AllNames =
|
|
576
|
+
ConnectionTypeConfig = DreamConf['connectionTypeConfig' & keyof DreamConf],
|
|
577
|
+
AllNames = ConnectionTypeConfig['allDefaultScopeNames' & keyof ConnectionTypeConfig],
|
|
579
578
|
> =
|
|
580
579
|
// it is not valid to remove the STI scope
|
|
581
580
|
Exclude<AllNames[number & keyof AllNames], typeof STI_SCOPE_NAME>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.navigationData = "data:application/octet-stream;base64,
|
|
1
|
+
window.navigationData = "data:application/octet-stream;base64,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"
|