@type32/tauri-sqlite-orm 0.2.5 → 0.2.7
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/index.d.mts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +16 -17
- package/dist/index.mjs +16 -17
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -212,7 +212,7 @@ declare class SQLiteColumn<TName extends string = string, TType extends ColumnDa
|
|
|
212
212
|
enum: TEnum;
|
|
213
213
|
customType: TCustomType;
|
|
214
214
|
};
|
|
215
|
-
constructor(name: TName, type: TType, options?: ColumnOptions<ColumnValueTypes<TType, TMode>, TEnum
|
|
215
|
+
constructor(name: TName, type: TType, options?: ColumnOptions<ColumnValueTypes<TType, TMode>, TEnum>);
|
|
216
216
|
notNull(): SQLiteColumn<TName, TType, TMode, true, THasDefault, TAutoincrement, TEnum, TCustomType>;
|
|
217
217
|
default(value: ColumnValueTypes<TType, TMode>): SQLiteColumn<TName, TType, TMode, TNotNull, true, TAutoincrement, TEnum, TCustomType>;
|
|
218
218
|
$defaultFn(fn: () => ColumnValueTypes<TType, TMode>): SQLiteColumn<TName, TType, TMode, TNotNull, true, TAutoincrement, TEnum, TCustomType>;
|
|
@@ -396,22 +396,22 @@ declare const as: <T>(aggregate: SQLAggregate<T>, alias: string) => SQLAggregate
|
|
|
396
396
|
declare const subquery: <T extends AnyTable>(query: SelectQueryBuilder<T, any>) => SQLSubquery;
|
|
397
397
|
declare const scalarSubquery: <T extends AnyTable>(query: SelectQueryBuilder<T, any>) => SQLSubquery;
|
|
398
398
|
|
|
399
|
-
declare const text: <TName extends string, TEnum extends readonly string[]>(name: TName, config?: {
|
|
400
|
-
mode?:
|
|
399
|
+
declare const text: <TName extends string, TMode extends "default" | "json" = "default", TEnum extends readonly string[] = never>(name: TName, config?: {
|
|
400
|
+
mode?: TMode;
|
|
401
401
|
enum?: TEnum;
|
|
402
|
-
}) => SQLiteColumn<TName, "TEXT",
|
|
402
|
+
}) => SQLiteColumn<TName, "TEXT", TMode, false, false, false, TEnum, never>;
|
|
403
403
|
declare const integer: <TName extends string, TMode extends Mode = "default">(name: TName, config?: {
|
|
404
404
|
mode?: TMode;
|
|
405
|
-
}) => SQLiteColumn<TName, "INTEGER",
|
|
405
|
+
}) => SQLiteColumn<TName, "INTEGER", TMode, false, false, false, never, never>;
|
|
406
406
|
declare const real: <TName extends string>(name: TName) => SQLiteColumn<TName, "REAL", "default", false, false, false, never, never>;
|
|
407
|
-
declare const blob: <TName extends string>(name: TName, config?: {
|
|
408
|
-
mode
|
|
409
|
-
}) => SQLiteColumn<TName, "BLOB",
|
|
407
|
+
declare const blob: <TName extends string, TMode extends "json" | "bigint" | "default" = "default">(name: TName, config?: {
|
|
408
|
+
mode?: TMode;
|
|
409
|
+
}) => SQLiteColumn<TName, "BLOB", TMode, false, false, false, never, never>;
|
|
410
410
|
declare const boolean: <TName extends string>(name: TName) => SQLiteColumn<TName, "BOOLEAN", "default", false, false, false, never, never>;
|
|
411
|
-
declare const numeric: <TName extends string>(name: TName, config?: {
|
|
412
|
-
mode?:
|
|
413
|
-
}) => SQLiteColumn<TName, "NUMERIC",
|
|
414
|
-
declare const enumType: <TName extends string, TValues extends readonly [string, ...string[]]>(name: TName, values: TValues) => SQLiteColumn<TName, "TEXT", "
|
|
411
|
+
declare const numeric: <TName extends string, TMode extends "bigint" | "default" = "default">(name: TName, config?: {
|
|
412
|
+
mode?: TMode;
|
|
413
|
+
}) => SQLiteColumn<TName, "NUMERIC", TMode, false, false, false, never, never>;
|
|
414
|
+
declare const enumType: <TName extends string, TValues extends readonly [string, ...string[]]>(name: TName, values: TValues) => SQLiteColumn<TName, "TEXT", "default", false, false, false, TValues, never>;
|
|
415
415
|
|
|
416
416
|
declare class TauriORMError extends Error {
|
|
417
417
|
constructor(message: string);
|
package/dist/index.d.ts
CHANGED
|
@@ -212,7 +212,7 @@ declare class SQLiteColumn<TName extends string = string, TType extends ColumnDa
|
|
|
212
212
|
enum: TEnum;
|
|
213
213
|
customType: TCustomType;
|
|
214
214
|
};
|
|
215
|
-
constructor(name: TName, type: TType, options?: ColumnOptions<ColumnValueTypes<TType, TMode>, TEnum
|
|
215
|
+
constructor(name: TName, type: TType, options?: ColumnOptions<ColumnValueTypes<TType, TMode>, TEnum>);
|
|
216
216
|
notNull(): SQLiteColumn<TName, TType, TMode, true, THasDefault, TAutoincrement, TEnum, TCustomType>;
|
|
217
217
|
default(value: ColumnValueTypes<TType, TMode>): SQLiteColumn<TName, TType, TMode, TNotNull, true, TAutoincrement, TEnum, TCustomType>;
|
|
218
218
|
$defaultFn(fn: () => ColumnValueTypes<TType, TMode>): SQLiteColumn<TName, TType, TMode, TNotNull, true, TAutoincrement, TEnum, TCustomType>;
|
|
@@ -396,22 +396,22 @@ declare const as: <T>(aggregate: SQLAggregate<T>, alias: string) => SQLAggregate
|
|
|
396
396
|
declare const subquery: <T extends AnyTable>(query: SelectQueryBuilder<T, any>) => SQLSubquery;
|
|
397
397
|
declare const scalarSubquery: <T extends AnyTable>(query: SelectQueryBuilder<T, any>) => SQLSubquery;
|
|
398
398
|
|
|
399
|
-
declare const text: <TName extends string, TEnum extends readonly string[]>(name: TName, config?: {
|
|
400
|
-
mode?:
|
|
399
|
+
declare const text: <TName extends string, TMode extends "default" | "json" = "default", TEnum extends readonly string[] = never>(name: TName, config?: {
|
|
400
|
+
mode?: TMode;
|
|
401
401
|
enum?: TEnum;
|
|
402
|
-
}) => SQLiteColumn<TName, "TEXT",
|
|
402
|
+
}) => SQLiteColumn<TName, "TEXT", TMode, false, false, false, TEnum, never>;
|
|
403
403
|
declare const integer: <TName extends string, TMode extends Mode = "default">(name: TName, config?: {
|
|
404
404
|
mode?: TMode;
|
|
405
|
-
}) => SQLiteColumn<TName, "INTEGER",
|
|
405
|
+
}) => SQLiteColumn<TName, "INTEGER", TMode, false, false, false, never, never>;
|
|
406
406
|
declare const real: <TName extends string>(name: TName) => SQLiteColumn<TName, "REAL", "default", false, false, false, never, never>;
|
|
407
|
-
declare const blob: <TName extends string>(name: TName, config?: {
|
|
408
|
-
mode
|
|
409
|
-
}) => SQLiteColumn<TName, "BLOB",
|
|
407
|
+
declare const blob: <TName extends string, TMode extends "json" | "bigint" | "default" = "default">(name: TName, config?: {
|
|
408
|
+
mode?: TMode;
|
|
409
|
+
}) => SQLiteColumn<TName, "BLOB", TMode, false, false, false, never, never>;
|
|
410
410
|
declare const boolean: <TName extends string>(name: TName) => SQLiteColumn<TName, "BOOLEAN", "default", false, false, false, never, never>;
|
|
411
|
-
declare const numeric: <TName extends string>(name: TName, config?: {
|
|
412
|
-
mode?:
|
|
413
|
-
}) => SQLiteColumn<TName, "NUMERIC",
|
|
414
|
-
declare const enumType: <TName extends string, TValues extends readonly [string, ...string[]]>(name: TName, values: TValues) => SQLiteColumn<TName, "TEXT", "
|
|
411
|
+
declare const numeric: <TName extends string, TMode extends "bigint" | "default" = "default">(name: TName, config?: {
|
|
412
|
+
mode?: TMode;
|
|
413
|
+
}) => SQLiteColumn<TName, "NUMERIC", TMode, false, false, false, never, never>;
|
|
414
|
+
declare const enumType: <TName extends string, TValues extends readonly [string, ...string[]]>(name: TName, values: TValues) => SQLiteColumn<TName, "TEXT", "default", false, false, false, TValues, never>;
|
|
415
415
|
|
|
416
416
|
declare class TauriORMError extends Error {
|
|
417
417
|
constructor(message: string);
|
package/dist/index.js
CHANGED
|
@@ -1123,13 +1123,13 @@ var WithQueryBuilder = class {
|
|
|
1123
1123
|
|
|
1124
1124
|
// src/orm.ts
|
|
1125
1125
|
var SQLiteColumn = class _SQLiteColumn {
|
|
1126
|
-
constructor(name, type, options = {}
|
|
1126
|
+
constructor(name, type, options = {}) {
|
|
1127
1127
|
this.type = type;
|
|
1128
1128
|
this.options = options;
|
|
1129
1129
|
this._ = {
|
|
1130
1130
|
name,
|
|
1131
1131
|
dataType: type,
|
|
1132
|
-
mode: mode || "default",
|
|
1132
|
+
mode: options.mode || "default",
|
|
1133
1133
|
notNull: options.notNull ?? false,
|
|
1134
1134
|
hasDefault: options.default !== void 0 || options.$defaultFn !== void 0,
|
|
1135
1135
|
autoincrement: options.autoincrement ?? false,
|
|
@@ -1139,27 +1139,26 @@ var SQLiteColumn = class _SQLiteColumn {
|
|
|
1139
1139
|
}
|
|
1140
1140
|
_;
|
|
1141
1141
|
notNull() {
|
|
1142
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, notNull: true
|
|
1142
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, notNull: true, mode: this._.mode });
|
|
1143
1143
|
}
|
|
1144
1144
|
default(value) {
|
|
1145
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, default: value
|
|
1145
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, default: value, mode: this._.mode });
|
|
1146
1146
|
}
|
|
1147
1147
|
$defaultFn(fn) {
|
|
1148
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, $defaultFn: fn
|
|
1148
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, $defaultFn: fn, mode: this._.mode });
|
|
1149
1149
|
}
|
|
1150
1150
|
primaryKey() {
|
|
1151
1151
|
return new _SQLiteColumn(
|
|
1152
1152
|
this._.name,
|
|
1153
1153
|
this.type,
|
|
1154
|
-
{ ...this.options, primaryKey: true, notNull: true }
|
|
1155
|
-
this._.mode
|
|
1154
|
+
{ ...this.options, primaryKey: true, notNull: true, mode: this._.mode }
|
|
1156
1155
|
);
|
|
1157
1156
|
}
|
|
1158
1157
|
autoincrement() {
|
|
1159
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, autoincrement: true
|
|
1158
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, autoincrement: true, mode: this._.mode });
|
|
1160
1159
|
}
|
|
1161
1160
|
unique() {
|
|
1162
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, unique: true
|
|
1161
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, unique: true, mode: this._.mode });
|
|
1163
1162
|
}
|
|
1164
1163
|
references(ref, column) {
|
|
1165
1164
|
const columnKey = typeof column === "string" ? column : column._.name;
|
|
@@ -1172,13 +1171,13 @@ var SQLiteColumn = class _SQLiteColumn {
|
|
|
1172
1171
|
references: {
|
|
1173
1172
|
table: ref,
|
|
1174
1173
|
column: columnObj
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1174
|
+
},
|
|
1175
|
+
mode: this._.mode
|
|
1176
|
+
}
|
|
1178
1177
|
);
|
|
1179
1178
|
}
|
|
1180
1179
|
$onUpdateFn(fn) {
|
|
1181
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, $onUpdateFn: fn
|
|
1180
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, $onUpdateFn: fn, mode: this._.mode });
|
|
1182
1181
|
}
|
|
1183
1182
|
$type() {
|
|
1184
1183
|
return this;
|
|
@@ -1565,12 +1564,12 @@ var scalarSubquery = (query) => {
|
|
|
1565
1564
|
};
|
|
1566
1565
|
|
|
1567
1566
|
// src/column-helpers.ts
|
|
1568
|
-
var text = (name, config) => new SQLiteColumn(name, "TEXT", config
|
|
1569
|
-
var integer = (name, config) => new SQLiteColumn(name, "INTEGER",
|
|
1567
|
+
var text = (name, config) => new SQLiteColumn(name, "TEXT", config);
|
|
1568
|
+
var integer = (name, config) => new SQLiteColumn(name, "INTEGER", config);
|
|
1570
1569
|
var real = (name) => new SQLiteColumn(name, "REAL");
|
|
1571
|
-
var blob = (name, config) => new SQLiteColumn(name, "BLOB",
|
|
1570
|
+
var blob = (name, config) => new SQLiteColumn(name, "BLOB", config);
|
|
1572
1571
|
var boolean = (name) => new SQLiteColumn(name, "BOOLEAN");
|
|
1573
|
-
var numeric = (name, config) => new SQLiteColumn(name, "NUMERIC",
|
|
1572
|
+
var numeric = (name, config) => new SQLiteColumn(name, "NUMERIC", config);
|
|
1574
1573
|
var enumType = (name, values) => text(name, { enum: values });
|
|
1575
1574
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1576
1575
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -1024,13 +1024,13 @@ var WithQueryBuilder = class {
|
|
|
1024
1024
|
|
|
1025
1025
|
// src/orm.ts
|
|
1026
1026
|
var SQLiteColumn = class _SQLiteColumn {
|
|
1027
|
-
constructor(name, type, options = {}
|
|
1027
|
+
constructor(name, type, options = {}) {
|
|
1028
1028
|
this.type = type;
|
|
1029
1029
|
this.options = options;
|
|
1030
1030
|
this._ = {
|
|
1031
1031
|
name,
|
|
1032
1032
|
dataType: type,
|
|
1033
|
-
mode: mode || "default",
|
|
1033
|
+
mode: options.mode || "default",
|
|
1034
1034
|
notNull: options.notNull ?? false,
|
|
1035
1035
|
hasDefault: options.default !== void 0 || options.$defaultFn !== void 0,
|
|
1036
1036
|
autoincrement: options.autoincrement ?? false,
|
|
@@ -1040,27 +1040,26 @@ var SQLiteColumn = class _SQLiteColumn {
|
|
|
1040
1040
|
}
|
|
1041
1041
|
_;
|
|
1042
1042
|
notNull() {
|
|
1043
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, notNull: true
|
|
1043
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, notNull: true, mode: this._.mode });
|
|
1044
1044
|
}
|
|
1045
1045
|
default(value) {
|
|
1046
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, default: value
|
|
1046
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, default: value, mode: this._.mode });
|
|
1047
1047
|
}
|
|
1048
1048
|
$defaultFn(fn) {
|
|
1049
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, $defaultFn: fn
|
|
1049
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, $defaultFn: fn, mode: this._.mode });
|
|
1050
1050
|
}
|
|
1051
1051
|
primaryKey() {
|
|
1052
1052
|
return new _SQLiteColumn(
|
|
1053
1053
|
this._.name,
|
|
1054
1054
|
this.type,
|
|
1055
|
-
{ ...this.options, primaryKey: true, notNull: true }
|
|
1056
|
-
this._.mode
|
|
1055
|
+
{ ...this.options, primaryKey: true, notNull: true, mode: this._.mode }
|
|
1057
1056
|
);
|
|
1058
1057
|
}
|
|
1059
1058
|
autoincrement() {
|
|
1060
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, autoincrement: true
|
|
1059
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, autoincrement: true, mode: this._.mode });
|
|
1061
1060
|
}
|
|
1062
1061
|
unique() {
|
|
1063
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, unique: true
|
|
1062
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, unique: true, mode: this._.mode });
|
|
1064
1063
|
}
|
|
1065
1064
|
references(ref, column) {
|
|
1066
1065
|
const columnKey = typeof column === "string" ? column : column._.name;
|
|
@@ -1073,13 +1072,13 @@ var SQLiteColumn = class _SQLiteColumn {
|
|
|
1073
1072
|
references: {
|
|
1074
1073
|
table: ref,
|
|
1075
1074
|
column: columnObj
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1075
|
+
},
|
|
1076
|
+
mode: this._.mode
|
|
1077
|
+
}
|
|
1079
1078
|
);
|
|
1080
1079
|
}
|
|
1081
1080
|
$onUpdateFn(fn) {
|
|
1082
|
-
return new _SQLiteColumn(this._.name, this.type, { ...this.options, $onUpdateFn: fn
|
|
1081
|
+
return new _SQLiteColumn(this._.name, this.type, { ...this.options, $onUpdateFn: fn, mode: this._.mode });
|
|
1083
1082
|
}
|
|
1084
1083
|
$type() {
|
|
1085
1084
|
return this;
|
|
@@ -1466,12 +1465,12 @@ var scalarSubquery = (query) => {
|
|
|
1466
1465
|
};
|
|
1467
1466
|
|
|
1468
1467
|
// src/column-helpers.ts
|
|
1469
|
-
var text = (name, config) => new SQLiteColumn(name, "TEXT", config
|
|
1470
|
-
var integer = (name, config) => new SQLiteColumn(name, "INTEGER",
|
|
1468
|
+
var text = (name, config) => new SQLiteColumn(name, "TEXT", config);
|
|
1469
|
+
var integer = (name, config) => new SQLiteColumn(name, "INTEGER", config);
|
|
1471
1470
|
var real = (name) => new SQLiteColumn(name, "REAL");
|
|
1472
|
-
var blob = (name, config) => new SQLiteColumn(name, "BLOB",
|
|
1471
|
+
var blob = (name, config) => new SQLiteColumn(name, "BLOB", config);
|
|
1473
1472
|
var boolean = (name) => new SQLiteColumn(name, "BOOLEAN");
|
|
1474
|
-
var numeric = (name, config) => new SQLiteColumn(name, "NUMERIC",
|
|
1473
|
+
var numeric = (name, config) => new SQLiteColumn(name, "NUMERIC", config);
|
|
1475
1474
|
var enumType = (name, values) => text(name, { enum: values });
|
|
1476
1475
|
export {
|
|
1477
1476
|
BaseQueryBuilder,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@type32/tauri-sqlite-orm",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "A Drizzle-like ORM for Tauri v2's SQL JS API plugin.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"author": "Type-32",
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/node": "^24.10.
|
|
33
|
+
"@types/node": "^24.10.1",
|
|
34
34
|
"tsup": "^8.5.0",
|
|
35
35
|
"typescript": "^5.9.3"
|
|
36
36
|
},
|