uql-orm 0.89.0 → 0.90.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/dist/migrate/acquireQuerierForMigrations.d.ts +3 -3
- package/dist/migrate/acquireQuerierForMigrations.js +3 -6
- package/dist/migrate/codegen/migrationFile.d.ts +4 -0
- package/dist/migrate/codegen/migrationFile.js +4 -2
- package/dist/migrate/index.d.ts +1 -2
- package/dist/migrate/index.js +0 -2
- package/dist/migrate/introspection/index.d.ts +0 -1
- package/dist/migrate/introspection/index.js +0 -1
- package/dist/migrate/introspection/registry.js +1 -1
- package/dist/migrate/migrationTarget.js +6 -5
- package/dist/mongo/index.d.ts +4 -1
- package/dist/mongo/index.js +4 -1
- package/dist/{migrate/generator → mongo}/mongoCommand.js +1 -1
- package/dist/{migrate/introspection → mongo}/mongoIntrospector.d.ts +3 -3
- package/dist/{migrate/introspection → mongo}/mongoIntrospector.js +4 -4
- package/dist/{migrate/storage/mongoStorage.d.ts → mongo/mongoMigrationStorage.d.ts} +2 -1
- package/dist/{migrate/storage/mongoStorage.js → mongo/mongoMigrationStorage.js} +2 -2
- package/dist/mongo/mongoQuerier.d.ts +18 -0
- package/dist/mongo/mongoQuerier.js +13 -0
- package/dist/{migrate/generator → mongo}/mongoSchemaGenerator.d.ts +4 -4
- package/dist/{migrate/generator → mongo}/mongoSchemaGenerator.js +14 -14
- package/dist/mongo/mongodbQuerier.d.ts +2 -1
- package/dist/type/migratorDialect.d.ts +8 -3
- package/dist/type/querier.d.ts +0 -15
- package/dist/type/querier.js +0 -7
- package/package.json +2 -2
- /package/dist/{migrate/generator → mongo}/mongoCommand.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Querier, type QuerierPool, type SqlQuerier } from '../type/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Querier used for schema migrations and the migration journal.
|
|
4
4
|
*
|
|
@@ -15,5 +15,5 @@ export declare function acquireQuerierForMigrations(pool: QuerierPool): Promise<
|
|
|
15
15
|
export declare function withQuerierForMigrations<T>(pool: QuerierPool, task: (querier: Querier) => Promise<T>): Promise<T>;
|
|
16
16
|
/** Same, for the paths that only work against SQL. `requiredBy` names the caller in the error. */
|
|
17
17
|
export declare function withSqlQuerierForMigrations<T>(pool: QuerierPool, requiredBy: string, task: (querier: SqlQuerier) => Promise<T>): Promise<T>;
|
|
18
|
-
/**
|
|
19
|
-
export declare function
|
|
18
|
+
/** Runs `task` on a migration querier `isKind` accepts, refusing any other with `error`. */
|
|
19
|
+
export declare function withQuerierOfKind<Q extends Querier, T>(pool: QuerierPool, isKind: (querier: Querier) => querier is Q, error: string, task: (querier: Q) => Promise<T>): Promise<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isSqlQuerier } from '../type/index.js';
|
|
2
2
|
import { UqlUsageError } from '../util/uqlError.js';
|
|
3
3
|
/**
|
|
4
4
|
* Querier used for schema migrations and the migration journal.
|
|
@@ -28,11 +28,8 @@ export async function withQuerierForMigrations(pool, task) {
|
|
|
28
28
|
export function withSqlQuerierForMigrations(pool, requiredBy, task) {
|
|
29
29
|
return withQuerierOfKind(pool, isSqlQuerier, `${requiredBy} requires a SQL-based querier`, task);
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
32
|
-
export function
|
|
33
|
-
return withQuerierOfKind(pool, isMongoQuerier, `${requiredBy} requires a MongoDB querier`, task);
|
|
34
|
-
}
|
|
35
|
-
function withQuerierOfKind(pool, isKind, error, task) {
|
|
31
|
+
/** Runs `task` on a migration querier `isKind` accepts, refusing any other with `error`. */
|
|
32
|
+
export function withQuerierOfKind(pool, isKind, error, task) {
|
|
36
33
|
return withQuerierForMigrations(pool, (querier) => {
|
|
37
34
|
if (!isKind(querier)) {
|
|
38
35
|
throw new UqlUsageError(error);
|
|
@@ -31,6 +31,8 @@ export declare const EMPTY_MANUAL_MIGRATION_DOWN_INNER = " // Add your rollba
|
|
|
31
31
|
/** How a migration on one querier is scaffolded empty, and how a generated statement is spelled in it. */
|
|
32
32
|
export type MigrationSource = {
|
|
33
33
|
readonly querier: MigrationQuerierType;
|
|
34
|
+
/** The entry exporting that querier's type: a MongoDB one names the driver's `Db`, so only `uql-orm/mongo` has it. */
|
|
35
|
+
readonly module: string;
|
|
34
36
|
readonly emptyUp: string;
|
|
35
37
|
readonly emptyDown: string;
|
|
36
38
|
emit(statements: string[]): string;
|
|
@@ -38,12 +40,14 @@ export type MigrationSource = {
|
|
|
38
40
|
export declare const migrationSource: {
|
|
39
41
|
SqlQuerier: {
|
|
40
42
|
querier: "SqlQuerier";
|
|
43
|
+
module: string;
|
|
41
44
|
emptyUp: string;
|
|
42
45
|
emptyDown: string;
|
|
43
46
|
emit: typeof emitSqlRunCalls;
|
|
44
47
|
};
|
|
45
48
|
MongoQuerier: {
|
|
46
49
|
querier: "MongoQuerier";
|
|
50
|
+
module: string;
|
|
47
51
|
emptyUp: string;
|
|
48
52
|
emptyDown: string;
|
|
49
53
|
emit: typeof emitMongoCommandCalls;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mongoCommandSource } from '
|
|
1
|
+
import { mongoCommandSource } from '../../mongo/mongoCommand.js';
|
|
2
2
|
/**
|
|
3
3
|
* Emit one `await querier.run(...)` line for entity-generated migrations.
|
|
4
4
|
* Uses `JSON.stringify` so SQL with backticks (SQLite/LibSQL), quotes, `${`, etc. stays valid TS source.
|
|
@@ -27,12 +27,14 @@ export const EMPTY_MANUAL_MIGRATION_DOWN_INNER = ` // Add your rollback logic
|
|
|
27
27
|
export const migrationSource = {
|
|
28
28
|
SqlQuerier: {
|
|
29
29
|
querier: 'SqlQuerier',
|
|
30
|
+
module: 'uql-orm/migrate',
|
|
30
31
|
emptyUp: EMPTY_MANUAL_MIGRATION_UP_INNER,
|
|
31
32
|
emptyDown: EMPTY_MANUAL_MIGRATION_DOWN_INNER,
|
|
32
33
|
emit: emitSqlRunCalls,
|
|
33
34
|
},
|
|
34
35
|
MongoQuerier: {
|
|
35
36
|
querier: 'MongoQuerier',
|
|
37
|
+
module: 'uql-orm/mongo',
|
|
36
38
|
emptyUp: ` // Add your migration logic here, through the database handle.
|
|
37
39
|
// await querier.db.collection('users').updateMany({}, { $set: { active: true } });
|
|
38
40
|
`,
|
|
@@ -49,7 +51,7 @@ export function buildMigrationModule(options) {
|
|
|
49
51
|
const querier = options.querier ?? 'SqlQuerier';
|
|
50
52
|
const iso = options.createdAt.toISOString();
|
|
51
53
|
const extra = options.docExtraLines?.map((line) => `\n * ${line}`).join('') ?? '';
|
|
52
|
-
return /*ts*/ `import type { ${querier} } from '
|
|
54
|
+
return /*ts*/ `import type { ${querier} } from '${migrationSource[querier].module}';
|
|
53
55
|
|
|
54
56
|
/**
|
|
55
57
|
* Migration: ${options.migrationName}
|
package/dist/migrate/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Change, ColumnSchema, DialectName, ForeignKeySchema, IndexSchema, Migration, MigrationDefinition, MigrationResult, MigrationStorage, MigratorOptions,
|
|
1
|
+
export type { Change, ColumnSchema, DialectName, ForeignKeySchema, IndexSchema, Migration, MigrationDefinition, MigrationResult, MigrationStorage, MigratorOptions, PrimaryKeySchema, SchemaDiff, SchemaGenerator, SchemaIntrospector, SqlDialectName, SqlQuerier, SqlQueryDialect, SyncOptions, TableSchema, } from '../type/index.js';
|
|
2
2
|
export { type Config, isSqlQuerier } from '../type/index.js';
|
|
3
3
|
export { acquireQuerierForMigrations } from './acquireQuerierForMigrations.js';
|
|
4
4
|
export { assertCliConfig } from './assertCliConfig.js';
|
|
@@ -14,4 +14,3 @@ export { reverseDiff } from './schemaChange.js';
|
|
|
14
14
|
export { SqlSchemaGenerator } from './schemaGenerator.js';
|
|
15
15
|
export { DatabaseMigrationStorage } from './storage/databaseStorage.js';
|
|
16
16
|
export { JsonMigrationStorage } from './storage/jsonStorage.js';
|
|
17
|
-
export { MongoMigrationStorage } from './storage/mongoStorage.js';
|
package/dist/migrate/index.js
CHANGED
|
@@ -21,5 +21,3 @@ export { SqlSchemaGenerator } from './schemaGenerator.js';
|
|
|
21
21
|
// Storage implementations
|
|
22
22
|
export { DatabaseMigrationStorage } from './storage/databaseStorage.js';
|
|
23
23
|
export { JsonMigrationStorage } from './storage/jsonStorage.js';
|
|
24
|
-
export { MongoMigrationStorage } from './storage/mongoStorage.js';
|
|
25
|
-
// Schema sync
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './abstractSqlSchemaIntrospector.js';
|
|
2
|
-
export * from './mongoIntrospector.js';
|
|
3
2
|
export * from './mssqlIntrospector.js';
|
|
4
3
|
export { MariadbSchemaIntrospector, MysqlSchemaIntrospector } from './mysqlIntrospector.js';
|
|
5
4
|
export * from './postgresIntrospector.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './abstractSqlSchemaIntrospector.js';
|
|
2
|
-
export * from './mongoIntrospector.js';
|
|
3
2
|
export * from './mssqlIntrospector.js';
|
|
4
3
|
export { MariadbSchemaIntrospector, MysqlSchemaIntrospector } from './mysqlIntrospector.js';
|
|
5
4
|
export * from './postgresIntrospector.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MongoSchemaIntrospector } from '
|
|
1
|
+
import { MongoSchemaIntrospector } from '../../mongo/mongoIntrospector.js';
|
|
2
2
|
import { MsSqlSchemaIntrospector } from './mssqlIntrospector.js';
|
|
3
3
|
import { MariadbSchemaIntrospector, MysqlSchemaIntrospector } from './mysqlIntrospector.js';
|
|
4
4
|
import { CockroachSchemaIntrospector, PostgresSchemaIntrospector } from './postgresIntrospector.js';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { runMongoCommand } from '../mongo/mongoCommand.js';
|
|
2
|
+
import { MongoMigrationStorage } from '../mongo/mongoMigrationStorage.js';
|
|
3
|
+
import { isMongoQuerier, withMongoQuerierForMigrations } from '../mongo/mongoQuerier.js';
|
|
4
|
+
import { isSqlQuerier, } from '../type/index.js';
|
|
2
5
|
import { UqlUsageError } from '../util/uqlError.js';
|
|
3
|
-
import {
|
|
6
|
+
import { withSqlQuerierForMigrations } from './acquireQuerierForMigrations.js';
|
|
4
7
|
import { MigrationBuilder } from './builder/migrationBuilder.js';
|
|
5
8
|
import { migrationSource } from './codegen/migrationFile.js';
|
|
6
|
-
import { runMongoCommand } from './generator/mongoCommand.js';
|
|
7
9
|
import { SqlSchemaGenerator } from './schemaGenerator.js';
|
|
8
10
|
import { DatabaseMigrationStorage } from './storage/databaseStorage.js';
|
|
9
|
-
import { MongoMigrationStorage } from './storage/mongoStorage.js';
|
|
10
11
|
const sqlSession = (querier) => ({
|
|
11
12
|
querier,
|
|
12
13
|
run: (statement) => querier.run(statement),
|
|
@@ -45,7 +46,7 @@ const mongoSession = (querier) => ({
|
|
|
45
46
|
});
|
|
46
47
|
/** Imported on use, so the optional `mongodb` peer loads only on MongoDB. */
|
|
47
48
|
async function mongoSchemaGenerator(namingStrategy, defaultForeignKeyAction) {
|
|
48
|
-
const { MongoSchemaGenerator } = await import('
|
|
49
|
+
const { MongoSchemaGenerator } = await import('../mongo/mongoSchemaGenerator.js');
|
|
49
50
|
return new MongoSchemaGenerator(namingStrategy, defaultForeignKeyAction);
|
|
50
51
|
}
|
|
51
52
|
export function migrationTargetFor(pool, defaultForeignKeyAction) {
|
package/dist/mongo/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export { MongoSchemaGenerator } from '../migrate/generator/mongoSchemaGenerator.js';
|
|
2
1
|
export * from './mongoDialect.js';
|
|
3
2
|
export * from './mongodbQuerier.js';
|
|
4
3
|
export * from './mongodbQuerierPool.js';
|
|
4
|
+
export * from './mongoIntrospector.js';
|
|
5
|
+
export * from './mongoMigrationStorage.js';
|
|
6
|
+
export { isMongoQuerier, type MongoQuerier } from './mongoQuerier.js';
|
|
7
|
+
export * from './mongoSchemaGenerator.js';
|
|
5
8
|
export * from './textLanguage.js';
|
package/dist/mongo/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export { MongoSchemaGenerator } from '../migrate/generator/mongoSchemaGenerator.js';
|
|
2
1
|
export * from './mongoDialect.js';
|
|
3
2
|
export * from './mongodbQuerier.js';
|
|
4
3
|
export * from './mongodbQuerierPool.js';
|
|
4
|
+
export * from './mongoIntrospector.js';
|
|
5
|
+
export * from './mongoMigrationStorage.js';
|
|
6
|
+
export { isMongoQuerier } from './mongoQuerier.js';
|
|
7
|
+
export * from './mongoSchemaGenerator.js';
|
|
5
8
|
export * from './textLanguage.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IndexFacet } from '
|
|
2
|
-
import { SchemaAST } from '
|
|
3
|
-
import {
|
|
1
|
+
import type { IndexFacet } from '../schema/indexDifferences.js';
|
|
2
|
+
import { SchemaAST } from '../schema/schemaAST.js';
|
|
3
|
+
import type { InstalledTriggers, QuerierPool, SchemaIntrospector, TableSchema } from '../type/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* MongoDB schema introspector.
|
|
6
6
|
* MongoDB doesn't have a fixed schema, so this primarily focuses on collections and indexes.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { isMongoQuerier
|
|
4
|
-
import {
|
|
1
|
+
import { createTableNode, SchemaAST } from '../schema/schemaAST.js';
|
|
2
|
+
import { UqlUsageError } from '../util/uqlError.js';
|
|
3
|
+
import { isMongoQuerier } from './mongoQuerier.js';
|
|
4
|
+
import { textConfigOf } from './textLanguage.js';
|
|
5
5
|
/** What a server without Atlas Search answers a search index command with. */
|
|
6
6
|
const SEARCH_NOT_ENABLED = 31082;
|
|
7
7
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { MigrationStorage,
|
|
1
|
+
import type { MigrationStorage, QuerierPool } from '../type/index.js';
|
|
2
|
+
import { type MongoQuerier } from './mongoQuerier.js';
|
|
2
3
|
/**
|
|
3
4
|
* Stores migration state in a MongoDB collection, named as the SQL table would be.
|
|
4
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DEFAULT_MIGRATIONS_TABLE } from '../migrate/storage/databaseStorage.js';
|
|
2
|
+
import { withMongoQuerierForMigrations } from './mongoQuerier.js';
|
|
3
3
|
/**
|
|
4
4
|
* Stores migration state in a MongoDB collection, named as the SQL table would be.
|
|
5
5
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Db } from 'mongodb';
|
|
2
|
+
import { type Querier, type QuerierPool } from '../type/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Extended querier interface for MongoDB execution.
|
|
5
|
+
*/
|
|
6
|
+
export interface MongoQuerier extends Querier {
|
|
7
|
+
/**
|
|
8
|
+
* The MongoDB database instance.
|
|
9
|
+
*/
|
|
10
|
+
readonly db: Db;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Type guard for a querier over a MongoDB database. A handle alone does not tell: the SQLite, D1 and
|
|
14
|
+
* Turso queriers carry a `db` of their own.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isMongoQuerier(querier: Querier): querier is MongoQuerier;
|
|
17
|
+
/** Runs `task` on a migration querier over MongoDB. `requiredBy` names the caller in the error. */
|
|
18
|
+
export declare function withMongoQuerierForMigrations<T>(pool: QuerierPool, requiredBy: string, task: (querier: MongoQuerier) => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { withQuerierOfKind } from '../migrate/acquireQuerierForMigrations.js';
|
|
2
|
+
import { isSqlQuerier } from '../type/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Type guard for a querier over a MongoDB database. A handle alone does not tell: the SQLite, D1 and
|
|
5
|
+
* Turso queriers carry a `db` of their own.
|
|
6
|
+
*/
|
|
7
|
+
export function isMongoQuerier(querier) {
|
|
8
|
+
return 'db' in querier && !isSqlQuerier(querier);
|
|
9
|
+
}
|
|
10
|
+
/** Runs `task` on a migration querier over MongoDB. `requiredBy` names the caller in the error. */
|
|
11
|
+
export function withMongoQuerierForMigrations(pool, requiredBy, task) {
|
|
12
|
+
return withQuerierOfKind(pool, isMongoQuerier, `${requiredBy} requires a MongoDB querier`, task);
|
|
13
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ForeignKeyAction, TableNode } from '
|
|
3
|
-
import { type CreateSchemaOptions, type EntityWhereMeta, type IndexSchema, type NamingStrategy, type SchemaDiff, type SchemaGenerator, type Type } from '
|
|
4
|
-
import
|
|
1
|
+
import type { AnyMigrationOperation } from '../migrate/builder/types.js';
|
|
2
|
+
import type { ForeignKeyAction, TableNode } from '../schema/types.js';
|
|
3
|
+
import { type CreateSchemaOptions, type EntityWhereMeta, type IndexSchema, type NamingStrategy, type SchemaDiff, type SchemaGenerator, type Type } from '../type/index.js';
|
|
4
|
+
import { MongoDialect } from './mongoDialect.js';
|
|
5
5
|
export declare class MongoSchemaGenerator extends MongoDialect implements SchemaGenerator {
|
|
6
6
|
protected readonly defaultForeignKeyAction?: ForeignKeyAction | undefined;
|
|
7
7
|
constructor(namingStrategy?: NamingStrategy, defaultForeignKeyAction?: ForeignKeyAction | undefined);
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { getMeta } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { renderIndexDefinition } from './definitionToNode.js';
|
|
14
|
-
import { indexNodeToSchema } from './indexNodeToSchema.js';
|
|
1
|
+
import { getMeta } from '../entity/index.js';
|
|
2
|
+
import { assertIndexFeatures, assertIndexType } from '../migrate/ddl/indexDdl.js';
|
|
3
|
+
import { renderIndexDefinition } from '../migrate/generator/definitionToNode.js';
|
|
4
|
+
import { indexNodeToSchema } from '../migrate/generator/indexNodeToSchema.js';
|
|
5
|
+
import { assertIndexPredicate, refusedIndexPredicate } from '../migrate/indexPredicate.js';
|
|
6
|
+
import { sides } from '../migrate/schemaChange.js';
|
|
7
|
+
import { indexChanges } from '../schema/indexDifferences.js';
|
|
8
|
+
import { QueryRaw, } from '../type/index.js';
|
|
9
|
+
import { indexDistance, unsupportedVectorMetric } from '../type/vector.js';
|
|
10
|
+
import { declaredIndexes, declaredIndexName, renderIndexColumn } from '../util/ddlExpression.util.js';
|
|
11
|
+
import { fulltextConfig, fulltextWeights } from '../util/dialect.util.js';
|
|
12
|
+
import { UqlUsageError } from '../util/uqlError.js';
|
|
15
13
|
import { serializeMongoCommand } from './mongoCommand.js';
|
|
14
|
+
import { MongoDialect } from './mongoDialect.js';
|
|
15
|
+
import { textLanguage } from './textLanguage.js';
|
|
16
16
|
/** The index types a key spec can say, a plain key or `'text'`, and Atlas's vector search index. */
|
|
17
17
|
const MONGO_INDEX_TYPES = new Set(['btree', 'fulltext', 'vectorSearch']);
|
|
18
18
|
/** A key spec's one feature beyond its keys: a partial filter. */
|
|
@@ -2,7 +2,8 @@ import type { Document, MongoClient } from 'mongodb';
|
|
|
2
2
|
import { AbstractQuerier } from '../querier/index.js';
|
|
3
3
|
import type { EntityData, ExtraOptions, PrimaryKey, Query, QueryAggMap, QueryAggregate, QueryAggregateResult, QueryConflictPaths, QueryPage, QueryGroupMap, QueryOptions, QuerySearch, TransactionOptions, Type, UpdatePayload } from '../type/index.js';
|
|
4
4
|
import type { MongoDialect } from './mongoDialect.js';
|
|
5
|
-
|
|
5
|
+
import type { MongoQuerier } from './mongoQuerier.js';
|
|
6
|
+
export declare class MongodbQuerier extends AbstractQuerier implements MongoQuerier {
|
|
6
7
|
readonly dialect: MongoDialect;
|
|
7
8
|
readonly conn: MongoClient;
|
|
8
9
|
readonly extra?: ExtraOptions | undefined;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import type { AbstractDialect } from '../dialect/abstractDialect.js';
|
|
1
2
|
import type { AbstractSqlDialect } from '../dialect/abstractSqlDialect.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The dialects the migrator runs on, which `dialectName` tells apart: every SQL engine, and MongoDB, named
|
|
5
|
+
* by its `dialectName` alone so these types reach no `mongodb` declaration.
|
|
6
|
+
*/
|
|
7
|
+
export type MigratorDialect = AbstractSqlDialect | (AbstractDialect & {
|
|
8
|
+
readonly dialectName: 'mongodb';
|
|
9
|
+
});
|
package/dist/type/querier.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Db } from 'mongodb';
|
|
2
1
|
import type { AbstractSqlDialect } from '../dialect/index.js';
|
|
3
2
|
import type { SqlDialectName } from './dialect.js';
|
|
4
3
|
import type { FieldKey, HookEvent, RelationKey } from './entity.js';
|
|
@@ -116,20 +115,6 @@ export interface SqlQuerier extends Querier {
|
|
|
116
115
|
* Type guard to check if a querier supports raw SQL execution
|
|
117
116
|
*/
|
|
118
117
|
export declare function isSqlQuerier(querier: Querier): querier is SqlQuerier;
|
|
119
|
-
/**
|
|
120
|
-
* Extended querier interface for MongoDB execution.
|
|
121
|
-
*/
|
|
122
|
-
export interface MongoQuerier extends Querier {
|
|
123
|
-
/**
|
|
124
|
-
* The MongoDB database instance.
|
|
125
|
-
*/
|
|
126
|
-
readonly db: Db;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Type guard for a querier over a MongoDB database. A handle alone does not tell: the SQLite, D1 and
|
|
130
|
-
* Turso queriers carry a `db` of their own.
|
|
131
|
-
*/
|
|
132
|
-
export declare function isMongoQuerier(querier: Querier): querier is MongoQuerier;
|
|
133
118
|
/**
|
|
134
119
|
* Context passed to global querier listeners.
|
|
135
120
|
*/
|
package/dist/type/querier.js
CHANGED
|
@@ -8,10 +8,3 @@ export function isSqlQuerier(querier) {
|
|
|
8
8
|
q.dialect !== undefined &&
|
|
9
9
|
typeof q.dialect.escapeIdChar === 'string');
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Type guard for a querier over a MongoDB database. A handle alone does not tell: the SQLite, D1 and
|
|
13
|
-
* Turso queriers carry a `db` of their own.
|
|
14
|
-
*/
|
|
15
|
-
export function isMongoQuerier(querier) {
|
|
16
|
-
return 'db' in querier && !isSqlQuerier(querier);
|
|
17
|
-
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"homepage": "https://uql-orm.dev",
|
|
4
4
|
"description": "JSON-native TypeScript ORM for Bun, Browsers, Edge, Deno, Node, Workers. Supports PostgreSQL, PGlite, MySQL, MariaDB, SQLite, CockroachDB, SQL Server, Turso, Neon, Cloudflare D1 and MongoDB. Queries are plain JSON, typed to the leaf.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.90.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=24"
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"pg-query-stream": "^4.17.0",
|
|
157
157
|
"rxjs": "^7.8.2",
|
|
158
158
|
"sqlite-vec": "^0.1.9",
|
|
159
|
-
"ws": "^8.
|
|
159
|
+
"ws": "^8.22.0"
|
|
160
160
|
},
|
|
161
161
|
"author": "Roger Padilla",
|
|
162
162
|
"repository": {
|
|
File without changes
|