uql-orm 0.101.2 → 0.101.4
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/codegen/migrationFile.d.ts +1 -1
- package/dist/migrate/codegen/migrationFile.js +4 -4
- package/dist/migrate/index.d.ts +0 -5
- package/dist/migrate/index.js +0 -5
- package/dist/nestjs/index.d.ts +0 -1
- package/dist/nestjs/index.js +0 -1
- package/package.json +1 -1
- package/skills/uql-orm/SKILL.md +1 -1
|
@@ -12,7 +12,7 @@ export type MigrationModuleOptions = {
|
|
|
12
12
|
/** Indented body inside `async down` (including newlines). */
|
|
13
13
|
downInner: string;
|
|
14
14
|
};
|
|
15
|
-
/** One `await querier.run`...`` line, its SQL as written. */
|
|
15
|
+
/** One `await querier.run`...`` line, its SQL as written, marked with an `sql` block comment, which editors highlight by. */
|
|
16
16
|
export declare function emitSqlRunCall(sql: string): string;
|
|
17
17
|
/** Indented `up`/`down` body: one `await querier.run`...`` per SQL string. */
|
|
18
18
|
export declare function emitSqlRunCalls(statements: string[]): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { mongoCommandSource } from '../../mongodb/mongoCommand.js';
|
|
2
2
|
import { templateOf } from './sourceLiteral.js';
|
|
3
|
-
/** One `await querier.run`...`` line, its SQL as written. */
|
|
3
|
+
/** One `await querier.run`...`` line, its SQL as written, marked with an `sql` block comment, which editors highlight by. */
|
|
4
4
|
export function emitSqlRunCall(sql) {
|
|
5
|
-
return /*ts*/ ` await querier.run${templateOf(sql)};`;
|
|
5
|
+
return /*ts*/ ` await querier.run /*sql*/ ${templateOf(sql)};`;
|
|
6
6
|
}
|
|
7
7
|
/** Indented `up`/`down` body: one `await querier.run`...`` per SQL string. */
|
|
8
8
|
export function emitSqlRunCalls(statements) {
|
|
@@ -18,10 +18,10 @@ export const migrationSource = {
|
|
|
18
18
|
entry: 'uql-orm',
|
|
19
19
|
emptyUp: ` // Add your migration logic here: one await querier.run\`...\` per SQL statement.
|
|
20
20
|
// Example (Postgres):
|
|
21
|
-
// await querier.run\`CREATE TABLE "users" ("id" SERIAL PRIMARY KEY)\`;
|
|
21
|
+
// await querier.run /*sql*/ \`CREATE TABLE "users" ("id" SERIAL PRIMARY KEY)\`;
|
|
22
22
|
`,
|
|
23
23
|
emptyDown: ` // Add your rollback logic here.
|
|
24
|
-
// await querier.run\`DROP TABLE IF EXISTS "users"\`;
|
|
24
|
+
// await querier.run /*sql*/ \`DROP TABLE IF EXISTS "users"\`;
|
|
25
25
|
`,
|
|
26
26
|
emit: emitSqlRunCalls,
|
|
27
27
|
},
|
package/dist/migrate/index.d.ts
CHANGED
|
@@ -2,10 +2,5 @@ export type { Change, ColumnSchema, Config, DialectName, ForeignKeySchema, Index
|
|
|
2
2
|
export * from './builder/index.js';
|
|
3
3
|
export { EntityCodeGenerator, type EntityCodeGeneratorOptions, type GeneratedEntity, } from './codegen/entityCodeGenerator.js';
|
|
4
4
|
export { buildMigrationModule, type MigrationModuleOptions, type MigrationQuerierType, } from './codegen/migrationFile.js';
|
|
5
|
-
export { AbstractSqlSchemaIntrospector } from './introspection/abstractSqlSchemaIntrospector.js';
|
|
6
|
-
export { MsSqlSchemaIntrospector } from './introspection/mssqlIntrospector.js';
|
|
7
|
-
export { MariadbSchemaIntrospector, MysqlSchemaIntrospector } from './introspection/mysqlIntrospector.js';
|
|
8
|
-
export { CockroachSchemaIntrospector, PostgresSchemaIntrospector } from './introspection/postgresIntrospector.js';
|
|
9
|
-
export { SqliteSchemaIntrospector } from './introspection/sqliteIntrospector.js';
|
|
10
5
|
export { type BuilderMigrationDefinition, defineBuilderMigration, defineMigration, Migrator } from './migrator.js';
|
|
11
6
|
export { SqlSchemaGenerator } from './schemaGenerator.js';
|
package/dist/migrate/index.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
export * from './builder/index.js';
|
|
2
2
|
export { EntityCodeGenerator, } from './codegen/entityCodeGenerator.js';
|
|
3
3
|
export { buildMigrationModule, } from './codegen/migrationFile.js';
|
|
4
|
-
export { AbstractSqlSchemaIntrospector } from './introspection/abstractSqlSchemaIntrospector.js';
|
|
5
|
-
export { MsSqlSchemaIntrospector } from './introspection/mssqlIntrospector.js';
|
|
6
|
-
export { MariadbSchemaIntrospector, MysqlSchemaIntrospector } from './introspection/mysqlIntrospector.js';
|
|
7
|
-
export { CockroachSchemaIntrospector, PostgresSchemaIntrospector } from './introspection/postgresIntrospector.js';
|
|
8
|
-
export { SqliteSchemaIntrospector } from './introspection/sqliteIntrospector.js';
|
|
9
4
|
export { defineBuilderMigration, defineMigration, Migrator } from './migrator.js';
|
|
10
5
|
export { SqlSchemaGenerator } from './schemaGenerator.js';
|
package/dist/nestjs/index.d.ts
CHANGED
package/dist/nestjs/index.js
CHANGED
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, 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.101.
|
|
6
|
+
"version": "0.101.4",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=22.18"
|
package/skills/uql-orm/SKILL.md
CHANGED
|
@@ -120,7 +120,7 @@ const users = await pool.findMany(User, {
|
|
|
120
120
|
- An update takes `{ stock: { $inc: -1 } }` to add, or `$mul` to multiply, in the statement, a NULL counting as 0, so a guard in `$where` (`stock: { $gte: 1 }`) makes a decrement race-safe. On SQL the step may be a ref or `sql` of the field's type (`{ total: { $inc: newRow.amount } }` in a trigger). JSON fields take `$set`, `$unset`, `$push`, `$pull`.
|
|
121
121
|
- `$lock: true` locks the rows a read returns (`{ $wait: 'skip' | 'nowait' }` says what to do about a row someone else holds) and needs an open transaction; SQLite, libSQL, Turso, D1 and MongoDB have no row lock and refuse it.
|
|
122
122
|
- `queryErrorKind(err)` names any failure the same on every engine - `uniqueViolation`, `foreignKeyViolation`, `notNullViolation`, `checkViolation`, `optimisticLock`, `retryable`, `usage`, `security` - so catch by kind rather than by a driver's code or an `instanceof`. Every error UQL raises itself is a `UqlError`.
|
|
123
|
-
- ``pool.all`SELECT ... WHERE id = ${id}` `` runs a `SELECT` and ``pool.run`...` `` a write, one statement per call: both are tags, each interpolated value bound: a scalar, `null` or a list of them, never `undefined` or a plain object (bind `JSON.stringify(doc)`). `sql` builds a fragment to embed anywhere a value or field goes, or to compose a statement, and `sql.join(fragments, ' AND ')` joins them. `sql.text(sql)` runs trusted SQL held in a string, binding nothing: never build it from user input. Migrations write ``querier.run`CREATE TABLE ...`
|
|
123
|
+
- ``pool.all`SELECT ... WHERE id = ${id}` `` runs a `SELECT` and ``pool.run`...` `` a write, one statement per call: both are tags, each interpolated value bound: a scalar, `null` or a list of them, never `undefined` or a plain object (bind `JSON.stringify(doc)`). `sql` builds a fragment to embed anywhere a value or field goes, or to compose a statement, and `sql.join(fragments, ' AND ')` joins them. `sql.text(sql)` runs trusted SQL held in a string, binding nothing: never build it from user input. Migrations write ``querier.run /*sql*/ `CREATE TABLE ...` ``, the comment being what es6-string-html highlights as SQL. `sql` is a tag, so ``sql(`...`)`` does not compile. `raw` is its deprecated former name. A field read off `refs(Entity)` carries its type: on its own as a value it fits only a field of that type.
|
|
124
124
|
|
|
125
125
|
## Connections and transactions
|
|
126
126
|
|