uql-orm 0.4.1 → 0.4.5
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 +16 -2
- package/README.md +1 -1
- package/dist/browser/uql-browser.min.js +268 -205
- package/dist/browser/uql-browser.min.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [0.4.
|
|
6
|
+
## [0.4.5](https://github.com/rogerpadilla/uql/compare/uql-orm@0.4.0...uql-orm@0.4.5) (2026-03-14)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Features
|
|
10
10
|
|
|
11
|
+
* add vector search integration tests for `findMany` with `$sort: { $vector }` and update test infrastructure. ([c920cde](https://github.com/rogerpadilla/uql/commit/c920cde46dbb4985d07a1926dfc3ac845862244c))
|
|
11
12
|
* implement cursor-based stream with across all queriers and deprecate in favor of ([2d6c2ea](https://github.com/rogerpadilla/uql/commit/2d6c2ea0851d9c20ca9d092717087eaa65e5f937))
|
|
13
|
+
* upgrade to Vite 8 and TypeScript 6, removing redundant compiler options and `vite-tsconfig-paths` plugin. ([f81563c](https://github.com/rogerpadilla/uql/commit/f81563cfe5246bfa59966f08493fd9786a817e02))
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
|
|
@@ -20,6 +22,18 @@ All notable changes to this project will be documented in this file. Please add
|
|
|
20
22
|
|
|
21
23
|
date format is [yyyy-mm-dd]
|
|
22
24
|
|
|
25
|
+
## [0.4.5] - 2026-03-14
|
|
26
|
+
### Testing
|
|
27
|
+
- **Vector search integration tests**: Added 7 end-to-end tests for `findMany` with `$sort: { $vector }` against a real Postgres+pgvector database — covers cosine/L2 similarity ordering, `$project` distance projection, filter+sort combo, `$limit`, and empty-table edge case.
|
|
28
|
+
- Docker Postgres image switched to `pgvector/pgvector:pg18` for pgvector extension support.
|
|
29
|
+
- Test DDL generator now handles `vector`, `halfvec`, and `sparsevec` column types.
|
|
30
|
+
|
|
31
|
+
## [0.4.4] - 2026-03-14
|
|
32
|
+
### Dependencies
|
|
33
|
+
- **Vite 7 → 8**: Upgraded to Vite 8 (powered by Rolldown), replacing the `vite-tsconfig-paths` plugin with Vite's built-in `resolve.tsconfigPaths` option.
|
|
34
|
+
- **TypeScript 5.9 → 6.0**: Upgraded to TypeScript 6.0.1-rc. Removed 6 redundant compiler options now default in TS6: `strict`, `strictNullChecks`, `noImplicitAny`, `esModuleInterop`, `allowSyntheticDefaultImports`, `useDefineForClassFields`.
|
|
35
|
+
- Removed `vite-tsconfig-paths` (replaced by built-in Vite 8 feature).
|
|
36
|
+
|
|
23
37
|
## [0.4.1] - 2026-03-13
|
|
24
38
|
### Documentation
|
|
25
39
|
- Removed Discord badge from README temporarily.
|
|
@@ -541,7 +555,7 @@ date format is [yyyy-mm-dd]
|
|
|
541
555
|
Reflect major changes in the package structure and dependencies.
|
|
542
556
|
|
|
543
557
|
## [2.0.0] - 2025-12-29
|
|
544
|
-
- **Major Rebranding**: Rebranded the project from **Nukak** to **UQL** (Universal Query Language -
|
|
558
|
+
- **Major Rebranding**: Rebranded the project from **Nukak** to **UQL** (Universal Query Language - back to its original name!).
|
|
545
559
|
- New Slogan: **"One Language. Frontend to Backend."**
|
|
546
560
|
- Project homepage: [uql-orm.dev](https://uql-orm.dev).
|
|
547
561
|
- **Package Unification**: Unified all database adapters (`mysql`, `postgres`, `maria`, `sqlite`, `mongo`) and `express` middleware into a single core package: `uql-orm`.
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://github.com/rogerpadilla/uql) [](https://coveralls.io/github/rogerpadilla/uql?branch=main) [](https://github.com/rogerpadilla/uql/blob/main/LICENSE) [](https://www.npmjs.com/package/uql-orm)
|
|
6
6
|
|
|
7
|
-
**[UQL](https://uql-orm.dev)** is the [
|
|
7
|
+
**[UQL](https://uql-orm.dev)** is the [best TypeScript ORM](https://www.uql-orm.dev/blog/in-search-of-the-fastest-typescript-orm/). It is engineered to be **fast**, **safe**, and **universally compatible**.
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
```ts
|
|
@@ -1,181 +1,207 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import '../
|
|
5
|
-
import {
|
|
6
|
-
import 'reflect-metadata';
|
|
1
|
+
import sqlstring from 'sqlstring-sqlite';
|
|
2
|
+
import { AbstractSqlDialect } from '../dialect/index.js';
|
|
3
|
+
import { getMeta } from '../entity/index.js';
|
|
4
|
+
import { hasKeys } from '../util/index.js';
|
|
5
|
+
import { AbstractSqlQuerier, AbstractQuerierPool } from '../querier/index.js';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
references: ()=>_Company
|
|
36
|
-
}), _dec2 = ManyToOne({
|
|
37
|
-
entity: ()=>_Company
|
|
38
|
-
}), _dec3 = Field({
|
|
39
|
-
references: ()=>_User
|
|
40
|
-
}), _dec4 = ManyToOne({
|
|
41
|
-
entity: ()=>_User
|
|
42
|
-
}), _dec5 = Field({
|
|
43
|
-
onInsert: Date.now
|
|
44
|
-
}), _dec6 = Field({
|
|
45
|
-
onUpdate: Date.now
|
|
46
|
-
});
|
|
47
|
-
/**
|
|
48
|
-
* an `abstract` class can (optionally) be used as the base "template" for the entities
|
|
49
|
-
* (so common fields' declaration is easily reused).
|
|
50
|
-
*/ class BaseEntity {
|
|
51
|
-
static{
|
|
52
|
-
({ e: [_init_id, _init_companyId, _init_company, _init_creatorId, _init_creator, _init_createdAt, _init_updatedAt, _initProto] } = _apply_decs_2203_r(this, [
|
|
53
|
-
[
|
|
54
|
-
_dec,
|
|
55
|
-
0,
|
|
56
|
-
"id"
|
|
57
|
-
],
|
|
58
|
-
[
|
|
59
|
-
_dec1,
|
|
60
|
-
0,
|
|
61
|
-
"companyId"
|
|
62
|
-
],
|
|
63
|
-
[
|
|
64
|
-
_dec2,
|
|
65
|
-
0,
|
|
66
|
-
"company"
|
|
67
|
-
],
|
|
68
|
-
[
|
|
69
|
-
_dec3,
|
|
70
|
-
0,
|
|
71
|
-
"creatorId"
|
|
72
|
-
],
|
|
73
|
-
[
|
|
74
|
-
_dec4,
|
|
75
|
-
0,
|
|
76
|
-
"creator"
|
|
77
|
-
],
|
|
78
|
-
[
|
|
79
|
-
_dec5,
|
|
80
|
-
0,
|
|
81
|
-
"createdAt"
|
|
82
|
-
],
|
|
83
|
-
[
|
|
84
|
-
_dec6,
|
|
85
|
-
0,
|
|
86
|
-
"updatedAt"
|
|
87
|
-
]
|
|
88
|
-
], []));
|
|
7
|
+
class SqliteDialect extends AbstractSqlDialect {
|
|
8
|
+
constructor(namingStrategy){
|
|
9
|
+
super('sqlite', namingStrategy);
|
|
10
|
+
}
|
|
11
|
+
addValue(values, value) {
|
|
12
|
+
if (value instanceof Date) {
|
|
13
|
+
value = value.getTime();
|
|
14
|
+
} else if (typeof value === 'boolean') {
|
|
15
|
+
value = value ? 1 : 0;
|
|
16
|
+
}
|
|
17
|
+
return super.addValue(values, value);
|
|
18
|
+
}
|
|
19
|
+
compare(ctx, entity, key, val, opts) {
|
|
20
|
+
if (key === '$text') {
|
|
21
|
+
const meta = getMeta(entity);
|
|
22
|
+
const search = val;
|
|
23
|
+
const fields = search.$fields.map((fKey)=>{
|
|
24
|
+
const field = meta.fields[fKey];
|
|
25
|
+
const columnName = this.resolveColumnName(fKey, field);
|
|
26
|
+
return this.escapeId(columnName);
|
|
27
|
+
});
|
|
28
|
+
const tableName = this.resolveTableName(entity, meta);
|
|
29
|
+
ctx.append(`${this.escapeId(tableName)} MATCH {${fields.join(' ')}} : `);
|
|
30
|
+
ctx.addValue(search.$value);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
super.compare(ctx, entity, key, val, opts);
|
|
89
34
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
35
|
+
compareFieldOperator(ctx, entity, key, op, val, opts = {}) {
|
|
36
|
+
switch(op){
|
|
37
|
+
case '$elemMatch':
|
|
38
|
+
this.buildElemMatchCondition(ctx, entity, key, val, opts);
|
|
39
|
+
break;
|
|
40
|
+
case '$all':
|
|
41
|
+
{
|
|
42
|
+
// SQLite: Check JSON array contains all values using multiple json_each subqueries
|
|
43
|
+
const values = val;
|
|
44
|
+
const conditions = values.map((v)=>{
|
|
45
|
+
ctx.pushValue(JSON.stringify(v));
|
|
46
|
+
return `EXISTS (SELECT 1 FROM json_each(${this.escapeId(key)}) WHERE value = json(?))`;
|
|
47
|
+
}).join(' AND ');
|
|
48
|
+
ctx.append(`(${conditions})`);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
case '$size':
|
|
52
|
+
// SQLite: Check JSON array length
|
|
53
|
+
// e.g., json_array_length(roles) = 3, or json_array_length(roles) >= 2
|
|
54
|
+
this.buildSizeComparison(ctx, ()=>{
|
|
55
|
+
ctx.append('json_array_length(');
|
|
56
|
+
this.getComparisonKey(ctx, entity, key, opts);
|
|
57
|
+
ctx.append(')');
|
|
58
|
+
}, val);
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
super.compareFieldOperator(ctx, entity, key, op, val, opts);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Build $elemMatch condition for SQLite JSON arrays.
|
|
66
|
+
* Uses EXISTS with json_each and supports nested operators.
|
|
67
|
+
*/ buildElemMatchCondition(ctx, _entity, key, match, opts) {
|
|
68
|
+
ctx.append('EXISTS (SELECT 1 FROM json_each(');
|
|
69
|
+
this.getComparisonKey(ctx, _entity, key, opts);
|
|
70
|
+
ctx.append(') WHERE ');
|
|
71
|
+
const conditions = [];
|
|
72
|
+
for (const [field, value] of Object.entries(match)){
|
|
73
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
74
|
+
// Value is an operator object
|
|
75
|
+
const ops = value;
|
|
76
|
+
for (const [op, opVal] of Object.entries(ops)){
|
|
77
|
+
conditions.push(this.buildJsonFieldOperator(ctx, field, op, opVal));
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
// Simple equality
|
|
81
|
+
ctx.pushValue(value);
|
|
82
|
+
conditions.push(`json_extract(value, '$.${field}') = ?`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
ctx.append(conditions.join(' AND '));
|
|
86
|
+
ctx.append(')');
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Build a comparison condition for a JSON field with an operator.
|
|
90
|
+
*/ buildJsonFieldOperator(ctx, field, op, value) {
|
|
91
|
+
return this.buildJsonFieldCondition(ctx, {
|
|
92
|
+
...this.getBaseJsonConfig(),
|
|
93
|
+
fieldAccessor: (f)=>`json_extract(value, '$.${f}')`
|
|
94
|
+
}, field, op, value);
|
|
95
|
+
}
|
|
96
|
+
getJsonFieldConfig(escapedColumn, jsonPath) {
|
|
97
|
+
return {
|
|
98
|
+
...this.getBaseJsonConfig(),
|
|
99
|
+
fieldAccessor: ()=>`json_extract(${escapedColumn}, '$.${jsonPath}')`
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
getBaseJsonConfig() {
|
|
103
|
+
return {
|
|
104
|
+
...super.getBaseJsonConfig(),
|
|
105
|
+
numericCast: (expr)=>`CAST(${expr} AS REAL)`,
|
|
106
|
+
neExpr: (f, ph)=>`${f} IS NOT ${ph}`
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
upsert(ctx, entity, conflictPaths, payload) {
|
|
110
|
+
this.onConflictUpsert(ctx, entity, conflictPaths, payload, this.insert.bind(this));
|
|
111
|
+
}
|
|
112
|
+
formatJsonMerge(ctx, escapedCol, value) {
|
|
113
|
+
let expr = escapedCol;
|
|
114
|
+
if (hasKeys(value.$merge)) {
|
|
115
|
+
ctx.pushValue(JSON.stringify(value.$merge));
|
|
116
|
+
expr = `json_patch(COALESCE(${escapedCol}, '{}'), ?)`;
|
|
117
|
+
}
|
|
118
|
+
if (value.$unset?.length) {
|
|
119
|
+
const paths = value.$unset.map((k)=>`'$.${this.escapeJsonKey(k)}'`).join(', ');
|
|
120
|
+
expr = `json_remove(${expr}, ${paths})`;
|
|
121
|
+
}
|
|
122
|
+
ctx.append(`${escapedCol} = ${expr}`);
|
|
125
123
|
}
|
|
126
124
|
static{
|
|
127
|
-
|
|
125
|
+
/** sqlite-vec distance functions. */ this.VECTOR_FNS = {
|
|
126
|
+
cosine: 'vec_distance_cosine',
|
|
127
|
+
l2: 'vec_distance_L2',
|
|
128
|
+
hamming: 'vec_distance_hamming'
|
|
129
|
+
};
|
|
128
130
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
/** Emit a sqlite-vec distance function: `vec_distance_<metric>(col, ?)`. */ appendVectorSort(ctx, meta, key, search) {
|
|
132
|
+
this.appendFunctionVectorSort(ctx, meta, key, search, SqliteDialect.VECTOR_FNS, 'SQLite');
|
|
133
|
+
}
|
|
134
|
+
escape(value) {
|
|
135
|
+
return sqlstring.escape(value);
|
|
131
136
|
}
|
|
132
137
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
_dec12,
|
|
144
|
-
0,
|
|
145
|
-
"pk"
|
|
146
|
-
],
|
|
147
|
-
[
|
|
148
|
-
_dec13,
|
|
149
|
-
0,
|
|
150
|
-
"picture"
|
|
151
|
-
]
|
|
152
|
-
], [
|
|
153
|
-
_dec11
|
|
154
|
-
], _BaseEntity1));
|
|
138
|
+
|
|
139
|
+
class AbstractSqliteQuerier extends AbstractSqlQuerier {
|
|
140
|
+
buildUpdateResult(changes, lastInsertRowid) {
|
|
141
|
+
const firstId = lastInsertRowid ? Number(lastInsertRowid) - (changes - 1) : undefined;
|
|
142
|
+
const ids = firstId ? Array(changes).fill(firstId).map((i, index)=>i + index) : [];
|
|
143
|
+
return {
|
|
144
|
+
changes,
|
|
145
|
+
ids,
|
|
146
|
+
firstId
|
|
147
|
+
};
|
|
155
148
|
}
|
|
156
|
-
|
|
157
|
-
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
class SqliteQuerier extends AbstractSqliteQuerier {
|
|
152
|
+
constructor(db, extra){
|
|
153
|
+
super(new SqliteDialect(extra?.namingStrategy), extra), this.db = db, this.extra = extra;
|
|
158
154
|
}
|
|
159
|
-
|
|
160
|
-
|
|
155
|
+
async internalAll(query, values) {
|
|
156
|
+
return this.db.prepare(query).all(values || []);
|
|
157
|
+
}
|
|
158
|
+
async *internalStream(query, values) {
|
|
159
|
+
for (const row of this.db.prepare(query).iterate(values || [])){
|
|
160
|
+
yield row;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async internalRun(query, values) {
|
|
164
|
+
const { changes, lastInsertRowid } = this.db.prepare(query).run(values || []);
|
|
165
|
+
return this.buildUpdateResult(changes, lastInsertRowid);
|
|
166
|
+
}
|
|
167
|
+
async internalRelease() {
|
|
168
|
+
if (this.hasOpenTransaction) {
|
|
169
|
+
throw TypeError('pending transaction');
|
|
170
|
+
}
|
|
171
|
+
// no-op
|
|
161
172
|
}
|
|
162
173
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
|
|
175
|
+
class Sqlite3QuerierPool extends AbstractQuerierPool {
|
|
176
|
+
constructor(filename, opts, extra){
|
|
177
|
+
super('sqlite', extra), this.filename = filename, this.opts = opts;
|
|
178
|
+
}
|
|
179
|
+
async getQuerier() {
|
|
180
|
+
if (!this.querier) {
|
|
181
|
+
let db;
|
|
182
|
+
if (typeof Bun !== 'undefined') {
|
|
183
|
+
const { Database: BunDatabase } = await import('bun:sqlite');
|
|
184
|
+
const bunDb = new BunDatabase(this.filename, this.opts);
|
|
185
|
+
bunDb.run('PRAGMA journal_mode = WAL');
|
|
186
|
+
db = bunDb;
|
|
187
|
+
} else {
|
|
188
|
+
const { default: BetterSqlite3 } = await import('better-sqlite3');
|
|
189
|
+
db = new BetterSqlite3(this.filename, this.opts);
|
|
190
|
+
db.pragma('journal_mode = WAL');
|
|
191
|
+
}
|
|
192
|
+
this.querier = new SqliteQuerier(db, this.extra);
|
|
193
|
+
}
|
|
194
|
+
return this.querier;
|
|
195
|
+
}
|
|
196
|
+
async end() {
|
|
197
|
+
await this.querier?.db.close();
|
|
198
|
+
this.querier = undefined;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export { Sqlite3QuerierPool, SqliteDialect, SqliteQuerier };
|
|
203
|
+
//# sourceMappingURL=uql-browser.min.js.map
|
|
204
|
+
1, _init_email, _init_password, _init_profile, _init_users, _initProto3], c: [_User, _initClass2] } = _apply_decs_2203_r(this, [
|
|
179
205
|
[
|
|
180
206
|
_dec15,
|
|
181
207
|
0,
|
|
@@ -772,6 +798,42 @@ class ItemAdjustment extends (_BaseEntity12 = BaseEntity) {
|
|
|
772
798
|
super(...args), this.itemId = (_initProto15(this), _init_itemId1(this)), this.item = _init_item(this), this.number = _init_number(this), this.buyPrice = _init_buyPrice(this), this.storehouseId = _init_storehouseId(this), this.storehouse = _init_storehouse(this), this.inventoryAdjustmentId = _init_inventoryAdjustmentId(this), this.inventoryAdjustment = _init_inventoryAdjustment(this);
|
|
773
799
|
}
|
|
774
800
|
}
|
|
801
|
+
let _VectorItem;
|
|
802
|
+
_dec88 = Entity(), _dec89 = Id(), _dec90 = Field(), _dec91 = Field({
|
|
803
|
+
type: 'vector',
|
|
804
|
+
dimensions: 3
|
|
805
|
+
});
|
|
806
|
+
class VectorItem {
|
|
807
|
+
static{
|
|
808
|
+
({ e: [_init_id3, _init_name11, _init_vec, _initProto16], c: [_VectorItem, _initClass15] } = _apply_decs_2203_r(this, [
|
|
809
|
+
[
|
|
810
|
+
_dec89,
|
|
811
|
+
0,
|
|
812
|
+
"id"
|
|
813
|
+
],
|
|
814
|
+
[
|
|
815
|
+
_dec90,
|
|
816
|
+
0,
|
|
817
|
+
"name"
|
|
818
|
+
],
|
|
819
|
+
[
|
|
820
|
+
_dec91,
|
|
821
|
+
0,
|
|
822
|
+
"vec"
|
|
823
|
+
]
|
|
824
|
+
], [
|
|
825
|
+
_dec88
|
|
826
|
+
]));
|
|
827
|
+
}
|
|
828
|
+
static{
|
|
829
|
+
_initClass15();
|
|
830
|
+
}
|
|
831
|
+
constructor(){
|
|
832
|
+
this.id = (_initProto16(this), _init_id3(this));
|
|
833
|
+
this.name = _init_name11(this);
|
|
834
|
+
this.vec = _init_vec(this);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
775
837
|
|
|
776
838
|
const holder = globalThis;
|
|
777
839
|
const metaKey = Symbol.for('uql-orm/entity/decorator');
|
|
@@ -960,14 +1022,14 @@ function getDdlForTable(entity, querier, primaryKeyType) {
|
|
|
960
1022
|
let propSql = querier.dialect.escapeId(field.name) + ' ';
|
|
961
1023
|
if (field.isId) {
|
|
962
1024
|
propSql += field.onInsert ? `${insertableIdType} PRIMARY KEY` : primaryKeyType;
|
|
1025
|
+
} else if (field.type === 'vector' || field.type === 'halfvec' || field.type === 'sparsevec') {
|
|
1026
|
+
propSql += field.dimensions ? `${field.type}(${field.dimensions})` : field.type;
|
|
1027
|
+
} else if (field.type === Number) {
|
|
1028
|
+
propSql += 'BIGINT';
|
|
1029
|
+
} else if (field.type === Date) {
|
|
1030
|
+
propSql += 'TIMESTAMP';
|
|
963
1031
|
} else {
|
|
964
|
-
|
|
965
|
-
propSql += 'BIGINT';
|
|
966
|
-
} else if (field.type === Date) {
|
|
967
|
-
propSql += 'TIMESTAMP';
|
|
968
|
-
} else {
|
|
969
|
-
propSql += defaultType;
|
|
970
|
-
}
|
|
1032
|
+
propSql += defaultType;
|
|
971
1033
|
}
|
|
972
1034
|
return propSql;
|
|
973
1035
|
});
|
|
@@ -978,7 +1040,7 @@ function getDdlForTable(entity, querier, primaryKeyType) {
|
|
|
978
1040
|
}
|
|
979
1041
|
|
|
980
1042
|
// src/index.ts
|
|
981
|
-
var
|
|
1043
|
+
var b = {
|
|
982
1044
|
reset: [
|
|
983
1045
|
0,
|
|
984
1046
|
0
|
|
@@ -1146,37 +1208,38 @@ var d = {
|
|
|
1146
1208
|
49
|
|
1147
1209
|
]
|
|
1148
1210
|
};
|
|
1149
|
-
function
|
|
1211
|
+
function i(e) {
|
|
1150
1212
|
return String(e);
|
|
1151
1213
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
function
|
|
1155
|
-
let e = typeof process != "undefined" ? process : void 0,
|
|
1156
|
-
return !("NO_COLOR" in
|
|
1157
|
-
}
|
|
1158
|
-
function
|
|
1159
|
-
let
|
|
1160
|
-
let
|
|
1161
|
-
do
|
|
1162
|
-
while (~
|
|
1163
|
-
return
|
|
1164
|
-
},
|
|
1165
|
-
let
|
|
1166
|
-
let s = String(
|
|
1167
|
-
return ~
|
|
1214
|
+
i.open = "";
|
|
1215
|
+
i.close = "";
|
|
1216
|
+
function B() {
|
|
1217
|
+
let e = typeof process != "undefined" ? process : void 0, r = (e == null ? void 0 : e.env) || {}, a = r.FORCE_TTY !== "false", l = (e == null ? void 0 : e.argv) || [];
|
|
1218
|
+
return !("NO_COLOR" in r || l.includes("--no-color")) && ("FORCE_COLOR" in r || l.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && r.TERM !== "dumb" || "CI" in r) || typeof window != "undefined" && !!window.chrome;
|
|
1219
|
+
}
|
|
1220
|
+
function C({ force: e } = {}) {
|
|
1221
|
+
let r = e || B(), a = (t, o, u, n)=>{
|
|
1222
|
+
let g = "", s = 0;
|
|
1223
|
+
do g += t.substring(s, n) + u, s = n + o.length, n = t.indexOf(o, s);
|
|
1224
|
+
while (~n)
|
|
1225
|
+
return g + t.substring(s);
|
|
1226
|
+
}, l = (t, o, u = t)=>{
|
|
1227
|
+
let n = (g)=>{
|
|
1228
|
+
let s = String(g), h = s.indexOf(o, t.length);
|
|
1229
|
+
return ~h ? t + a(s, o, u, h) + o : t + s + o;
|
|
1168
1230
|
};
|
|
1169
|
-
return
|
|
1170
|
-
},
|
|
1171
|
-
isColorSupported:
|
|
1172
|
-
},
|
|
1173
|
-
for(let
|
|
1174
|
-
let
|
|
1175
|
-
|
|
1176
|
-
}
|
|
1177
|
-
return
|
|
1178
|
-
}
|
|
1179
|
-
var
|
|
1231
|
+
return n.open = t, n.close = o, n;
|
|
1232
|
+
}, c = {
|
|
1233
|
+
isColorSupported: r
|
|
1234
|
+
}, f = (t)=>`\x1B[${t}m`;
|
|
1235
|
+
for(let t in b){
|
|
1236
|
+
let o = b[t];
|
|
1237
|
+
c[t] = r ? l(f(o[0]), f(o[1]), o[2]) : i;
|
|
1238
|
+
}
|
|
1239
|
+
return c;
|
|
1240
|
+
}
|
|
1241
|
+
var d = C();
|
|
1242
|
+
var y = d;
|
|
1180
1243
|
|
|
1181
1244
|
function _mergeNamespaces$1(n, m) {
|
|
1182
1245
|
m.forEach(function(e) {
|
|
@@ -2170,7 +2233,7 @@ function validateOptions(options) {
|
|
|
2170
2233
|
function getColorsHighlight() {
|
|
2171
2234
|
return DEFAULT_THEME_KEYS.reduce((colors, key)=>{
|
|
2172
2235
|
const value = DEFAULT_THEME[key];
|
|
2173
|
-
const color = value &&
|
|
2236
|
+
const color = value && y[value];
|
|
2174
2237
|
if (color && typeof color.close === "string" && typeof color.open === "string") {
|
|
2175
2238
|
colors[key] = color;
|
|
2176
2239
|
} else {
|
|
@@ -5379,5 +5442,5 @@ const hooks = {
|
|
|
5379
5442
|
afterAll
|
|
5380
5443
|
};
|
|
5381
5444
|
|
|
5382
|
-
export { BaseEntity, _Company as Company, _InventoryAdjustment as InventoryAdjustment, _Item as Item, _ItemAdjustment as ItemAdjustment, _ItemTag as ItemTag, _LedgerAccount as LedgerAccount, _MeasureUnit as MeasureUnit, _MeasureUnitCategory as MeasureUnitCategory, _Profile as Profile, _Storehouse as Storehouse, _Tag as Tag, _Tax as Tax, _TaxCategory as TaxCategory, _User as User, _UserWithNonUpdatableId as UserWithNonUpdatableId, clearTables, createSpec, createTables, dropTables };
|
|
5445
|
+
export { BaseEntity, _Company as Company, _InventoryAdjustment as InventoryAdjustment, _Item as Item, _ItemAdjustment as ItemAdjustment, _ItemTag as ItemTag, _LedgerAccount as LedgerAccount, _MeasureUnit as MeasureUnit, _MeasureUnitCategory as MeasureUnitCategory, _Profile as Profile, _Storehouse as Storehouse, _Tag as Tag, _Tax as Tax, _TaxCategory as TaxCategory, _User as User, _UserWithNonUpdatableId as UserWithNonUpdatableId, _VectorItem as VectorItem, clearTables, createSpec, createTables, dropTables };
|
|
5383
5446
|
//# sourceMappingURL=uql-browser.min.js.map
|