@inflector/optima 1.0.9 → 1.0.11
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.ts +3 -1
- package/dist/index.js +26 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -175,6 +175,7 @@ T | ConditionBuilder<T>;
|
|
|
175
175
|
type Where<Schema> = {
|
|
176
176
|
[K in keyof Schema]?: FieldQuery<Schema[K]>;
|
|
177
177
|
};
|
|
178
|
+
type TableSchema<T> = T extends OptimaTable<infer Schema> ? Prettify$1<Infer<Schema>> : never;
|
|
178
179
|
type GetRefSchema<Col> = Col extends ColumnBuilder<any, any, infer Ref> ? Ref : Col extends {
|
|
179
180
|
config: {
|
|
180
181
|
reference?: {
|
|
@@ -312,6 +313,7 @@ declare class OptimaDB<T extends Record<string, OptimaTable>> {
|
|
|
312
313
|
execute(sql: string): Promise<DBRow[]>;
|
|
313
314
|
getTables(): Promise<string[]>;
|
|
314
315
|
getDiskSize(): Promise<unknown>;
|
|
316
|
+
close(): void;
|
|
315
317
|
/**
|
|
316
318
|
* Runs a function within a transaction.
|
|
317
319
|
* Re-throws error after rollback so caller handles logic failure.
|
|
@@ -319,4 +321,4 @@ declare class OptimaDB<T extends Record<string, OptimaTable>> {
|
|
|
319
321
|
transaction<R>(fn: () => Promise<R>): Promise<R>;
|
|
320
322
|
}
|
|
321
323
|
|
|
322
|
-
export { Array$1 as Array, BigInt, Boolean, Bytes, Color, type ColumnBuilder, type ColumnConfig, type ConditionBuilder, DateType, Email, Enum, Float, GeoArea, GeoPoint, type Infer, type InferAdd, type InferColumnType, Int, Json, type Many, type One, OptimaDB, Password, type Prettify$1 as Prettify, type Restrict, SQLBuilder, Slug, Table, Text, Timestamp, Uuid, between, cond, contains, endsWith, eq, gt, gte, inOp, is, isNot, like, lt, lte, ne, notBetween, notIn, notLike, notRegexp, refHelpers, regexp, startsWith };
|
|
324
|
+
export { Array$1 as Array, BigInt, Boolean, Bytes, Color, type ColumnBuilder, type ColumnConfig, type ConditionBuilder, DateType, Email, Enum, type Extension, type FieldQuery, Float, GeoArea, GeoPoint, type Infer, type InferAdd, type InferColumnType, Int, Json, type Many, OPS, type One, type OpKey, OptimaDB, OptimaTable, Password, type Prettify$1 as Prettify, type Restrict, SQLBuilder, Slug, Table, type TableSchema, Text, Timestamp, Uuid, type Where, between, cond, contains, endsWith, eq, gt, gte, inOp, is, isNot, like, lt, lte, ne, notBetween, notIn, notLike, notRegexp, refHelpers, regexp, startsWith };
|
package/dist/index.js
CHANGED
|
@@ -272,6 +272,27 @@ function createQueryBuilderOne(table, initialConfig = {}) {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
// src/table.ts
|
|
275
|
+
var OPS = [
|
|
276
|
+
"eq",
|
|
277
|
+
"ne",
|
|
278
|
+
"gt",
|
|
279
|
+
"gte",
|
|
280
|
+
"lt",
|
|
281
|
+
"lte",
|
|
282
|
+
"like",
|
|
283
|
+
"notLike",
|
|
284
|
+
"in",
|
|
285
|
+
"notIn",
|
|
286
|
+
"is",
|
|
287
|
+
"isNot",
|
|
288
|
+
"between",
|
|
289
|
+
"notBetween",
|
|
290
|
+
"startsWith",
|
|
291
|
+
"endsWith",
|
|
292
|
+
"contains",
|
|
293
|
+
"regexp",
|
|
294
|
+
"notRegexp"
|
|
295
|
+
];
|
|
275
296
|
var ConditionBuilderImpl = class _ConditionBuilderImpl {
|
|
276
297
|
constructor(node) {
|
|
277
298
|
this.node = node;
|
|
@@ -879,6 +900,9 @@ var OptimaDB = class _OptimaDB {
|
|
|
879
900
|
const result = await this.execute("PRAGMA database_size;");
|
|
880
901
|
return result[0];
|
|
881
902
|
}
|
|
903
|
+
close() {
|
|
904
|
+
this.connection.closeSync();
|
|
905
|
+
}
|
|
882
906
|
/**
|
|
883
907
|
* Runs a function within a transaction.
|
|
884
908
|
* Re-throws error after rollback so caller handles logic failure.
|
|
@@ -1041,7 +1065,9 @@ export {
|
|
|
1041
1065
|
GeoPoint,
|
|
1042
1066
|
Int,
|
|
1043
1067
|
Json,
|
|
1068
|
+
OPS,
|
|
1044
1069
|
OptimaDB,
|
|
1070
|
+
OptimaTable,
|
|
1045
1071
|
Password,
|
|
1046
1072
|
SQLBuilder,
|
|
1047
1073
|
Slug,
|