@aigne/sqlite 0.4.9 → 1.74.0-beta
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/_virtual/rolldown_runtime.cjs +38 -0
- package/dist/_virtual/rolldown_runtime.mjs +36 -0
- package/dist/index.browser.cjs +50 -0
- package/dist/index.browser.d.cts +18 -0
- package/dist/index.browser.d.cts.map +1 -0
- package/dist/index.browser.d.mts +19 -0
- package/dist/index.browser.d.mts.map +1 -0
- package/dist/index.browser.mjs +32 -0
- package/dist/index.browser.mjs.map +1 -0
- package/dist/index.cjs +42 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +24 -0
- package/dist/index.mjs.map +1 -0
- package/dist/index.node.cjs +74 -0
- package/dist/index.node.d.cts +24 -0
- package/dist/index.node.d.cts.map +1 -0
- package/dist/index.node.d.mts +25 -0
- package/dist/index.node.d.mts.map +1 -0
- package/dist/index.node.mjs +56 -0
- package/dist/index.node.mjs.map +1 -0
- package/dist/promise.cjs +17 -0
- package/dist/promise.d.cts +10 -0
- package/dist/promise.d.cts.map +1 -0
- package/dist/promise.d.mts +10 -0
- package/dist/promise.d.mts.map +1 -0
- package/dist/promise.mjs +17 -0
- package/dist/promise.mjs.map +1 -0
- package/dist/reexport.cjs +28 -0
- package/dist/reexport.d.cts +6 -0
- package/dist/reexport.d.mts +6 -0
- package/dist/reexport.mjs +10 -0
- package/dist/retry.cjs +33 -0
- package/dist/retry.d.cts +18 -0
- package/dist/retry.d.cts.map +1 -0
- package/dist/retry.d.mts +18 -0
- package/dist/retry.d.mts.map +1 -0
- package/dist/retry.mjs +33 -0
- package/dist/retry.mjs.map +1 -0
- package/dist/type.cjs +17 -0
- package/dist/type.d.cts +40 -0
- package/dist/type.d.cts.map +1 -0
- package/dist/type.d.mts +40 -0
- package/dist/type.d.mts.map +1 -0
- package/dist/type.mjs +17 -0
- package/dist/type.mjs.map +1 -0
- package/package.json +50 -37
- package/CHANGELOG.md +0 -161
- package/lib/cjs/index.browser.d.ts +0 -4
- package/lib/cjs/index.browser.js +0 -32
- package/lib/cjs/index.d.ts +0 -6
- package/lib/cjs/index.js +0 -46
- package/lib/cjs/index.node.d.ts +0 -8
- package/lib/cjs/index.node.js +0 -62
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/promise.d.ts +0 -6
- package/lib/cjs/promise.js +0 -12
- package/lib/cjs/reexport.d.ts +0 -4
- package/lib/cjs/reexport.js +0 -21
- package/lib/cjs/retry.d.ts +0 -8
- package/lib/cjs/retry.js +0 -45
- package/lib/cjs/type.d.ts +0 -34
- package/lib/cjs/type.js +0 -15
- package/lib/esm/index.browser.d.ts +0 -4
- package/lib/esm/index.browser.js +0 -15
- package/lib/esm/index.d.ts +0 -6
- package/lib/esm/index.js +0 -7
- package/lib/esm/index.node.d.ts +0 -8
- package/lib/esm/index.node.js +0 -45
- package/lib/esm/package.json +0 -3
- package/lib/esm/promise.d.ts +0 -6
- package/lib/esm/promise.js +0 -9
- package/lib/esm/reexport.d.ts +0 -4
- package/lib/esm/reexport.js +0 -5
- package/lib/esm/retry.d.ts +0 -8
- package/lib/esm/retry.js +0 -42
- package/lib/esm/type.d.ts +0 -34
- package/lib/esm/type.js +0 -11
package/lib/cjs/index.node.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.initDatabase = initDatabase;
|
|
18
|
-
const promises_1 = require("node:fs/promises");
|
|
19
|
-
const node_path_1 = require("node:path");
|
|
20
|
-
const client_1 = require("@libsql/client");
|
|
21
|
-
const libsql_1 = require("drizzle-orm/libsql");
|
|
22
|
-
const retry_js_1 = require("./retry.js");
|
|
23
|
-
__exportStar(require("./reexport.js"), exports);
|
|
24
|
-
async function initDatabase({ url = ":memory:", wal = false, walAutocheckpoint = 5000, } = {}) {
|
|
25
|
-
let db;
|
|
26
|
-
let client;
|
|
27
|
-
if (/^file:.*/.test(url)) {
|
|
28
|
-
const path = url.replace(/^file:(\/\/)?/, "");
|
|
29
|
-
await (0, promises_1.mkdir)((0, node_path_1.dirname)(path), { recursive: true });
|
|
30
|
-
}
|
|
31
|
-
if (wal) {
|
|
32
|
-
client = (0, client_1.createClient)({ url });
|
|
33
|
-
await client.execute(`\
|
|
34
|
-
PRAGMA journal_mode = WAL;
|
|
35
|
-
PRAGMA synchronous = normal;
|
|
36
|
-
PRAGMA wal_autocheckpoint = ${walAutocheckpoint};
|
|
37
|
-
PRAGMA busy_timeout = 5000;
|
|
38
|
-
`);
|
|
39
|
-
db = (0, libsql_1.drizzle)(client);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
db = (0, libsql_1.drizzle)(url);
|
|
43
|
-
}
|
|
44
|
-
if ("session" in db && db.session && typeof db.session === "object") {
|
|
45
|
-
db.session = (0, retry_js_1.withRetry)(db.session, [
|
|
46
|
-
"all",
|
|
47
|
-
"get",
|
|
48
|
-
"run",
|
|
49
|
-
"values",
|
|
50
|
-
"count",
|
|
51
|
-
]);
|
|
52
|
-
}
|
|
53
|
-
db.clean = async () => {
|
|
54
|
-
if (wal && client && typeof client.execute === "function") {
|
|
55
|
-
await client.execute(`PRAGMA auto_vacuum = FULL;`);
|
|
56
|
-
await client.execute(`VACUUM;`);
|
|
57
|
-
await client.execute("PRAGMA wal_checkpoint(TRUNCATE);");
|
|
58
|
-
await client.execute(`VACUUM;`);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
return db;
|
|
62
|
-
}
|
package/lib/cjs/package.json
DELETED
package/lib/cjs/promise.d.ts
DELETED
package/lib/cjs/promise.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promiseWithResolvers = promiseWithResolvers;
|
|
4
|
-
function promiseWithResolvers() {
|
|
5
|
-
let resolve;
|
|
6
|
-
let reject;
|
|
7
|
-
const promise = new Promise((res, rej) => {
|
|
8
|
-
resolve = res;
|
|
9
|
-
reject = rej;
|
|
10
|
-
});
|
|
11
|
-
return { promise, resolve, reject };
|
|
12
|
-
}
|
package/lib/cjs/reexport.d.ts
DELETED
package/lib/cjs/reexport.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("drizzle-orm"), exports);
|
|
18
|
-
__exportStar(require("drizzle-orm/sql"), exports);
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
__exportStar(require("drizzle-orm/sqlite-core"), exports);
|
|
21
|
-
__exportStar(require("./type.js"), exports);
|
package/lib/cjs/retry.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface WithRetryOptions {
|
|
2
|
-
max?: number;
|
|
3
|
-
backoffBase?: number;
|
|
4
|
-
backoffExponent?: number;
|
|
5
|
-
backoffJitter?: number;
|
|
6
|
-
shouldRetry?: (err: any) => boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function withRetry<T extends object>(db: T, methods: (keyof T)[], { max, backoffBase, backoffExponent, backoffJitter, shouldRetry, }?: WithRetryOptions): T;
|
package/lib/cjs/retry.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withRetry = withRetry;
|
|
4
|
-
function isDBLockedError(error) {
|
|
5
|
-
let err = error;
|
|
6
|
-
while (err) {
|
|
7
|
-
if (!(err instanceof Error))
|
|
8
|
-
return false;
|
|
9
|
-
if (typeof err.message !== "string")
|
|
10
|
-
return false;
|
|
11
|
-
const isLock = err.message.includes("SQLITE_BUSY");
|
|
12
|
-
if (isLock)
|
|
13
|
-
return true;
|
|
14
|
-
err = err.cause;
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
function withRetry(db, methods, { max = 30, backoffBase = 300, backoffExponent = 1.2, backoffJitter = 300, shouldRetry = isDBLockedError, } = {}) {
|
|
19
|
-
return new Proxy(db, {
|
|
20
|
-
get(target, prop) {
|
|
21
|
-
const val = target?.[prop];
|
|
22
|
-
if (methods.includes(prop) && typeof val === "function") {
|
|
23
|
-
return async (...args) => {
|
|
24
|
-
let attempt = 1;
|
|
25
|
-
while (true) {
|
|
26
|
-
try {
|
|
27
|
-
return await val.apply(target, args);
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
if (!shouldRetry(err) || ++attempt > max) {
|
|
31
|
-
throw err;
|
|
32
|
-
}
|
|
33
|
-
const exp = backoffExponent ** (attempt - 1);
|
|
34
|
-
const expDelay = backoffBase * exp;
|
|
35
|
-
const jitter = Math.random() * backoffJitter;
|
|
36
|
-
const waitTime = Math.floor(expDelay + jitter);
|
|
37
|
-
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
return val;
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
}
|
package/lib/cjs/type.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare const json: <T>(dbName: string) => import("drizzle-orm/sqlite-core").SQLiteCustomColumnBuilder<{
|
|
2
|
-
name: string;
|
|
3
|
-
dataType: "custom";
|
|
4
|
-
columnType: "SQLiteCustomColumn";
|
|
5
|
-
data: T;
|
|
6
|
-
driverParam: string;
|
|
7
|
-
enumValues: undefined;
|
|
8
|
-
}>;
|
|
9
|
-
export declare const datetime: {
|
|
10
|
-
(): import("drizzle-orm/sqlite-core").SQLiteCustomColumnBuilder<{
|
|
11
|
-
name: "";
|
|
12
|
-
dataType: "custom";
|
|
13
|
-
columnType: "SQLiteCustomColumn";
|
|
14
|
-
data: Date;
|
|
15
|
-
driverParam: string;
|
|
16
|
-
enumValues: undefined;
|
|
17
|
-
}>;
|
|
18
|
-
<TConfig extends Record<string, any>>(fieldConfig?: TConfig | undefined): import("drizzle-orm/sqlite-core").SQLiteCustomColumnBuilder<{
|
|
19
|
-
name: "";
|
|
20
|
-
dataType: "custom";
|
|
21
|
-
columnType: "SQLiteCustomColumn";
|
|
22
|
-
data: Date;
|
|
23
|
-
driverParam: string;
|
|
24
|
-
enumValues: undefined;
|
|
25
|
-
}>;
|
|
26
|
-
<TName extends string>(dbName: TName, fieldConfig?: unknown): import("drizzle-orm/sqlite-core").SQLiteCustomColumnBuilder<{
|
|
27
|
-
name: TName;
|
|
28
|
-
dataType: "custom";
|
|
29
|
-
columnType: "SQLiteCustomColumn";
|
|
30
|
-
data: Date;
|
|
31
|
-
driverParam: string;
|
|
32
|
-
enumValues: undefined;
|
|
33
|
-
}>;
|
|
34
|
-
};
|
package/lib/cjs/type.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.datetime = exports.json = void 0;
|
|
4
|
-
const sqlite_core_1 = require("drizzle-orm/sqlite-core");
|
|
5
|
-
const json = (dbName) => (0, sqlite_core_1.customType)({
|
|
6
|
-
dataType: () => "json",
|
|
7
|
-
fromDriver: (value) => JSON.parse(value),
|
|
8
|
-
toDriver: (value) => JSON.stringify(value),
|
|
9
|
-
})(dbName);
|
|
10
|
-
exports.json = json;
|
|
11
|
-
exports.datetime = (0, sqlite_core_1.customType)({
|
|
12
|
-
dataType: () => "datetime",
|
|
13
|
-
fromDriver: (value) => new Date(value),
|
|
14
|
-
toDriver: (value) => value.toISOString(),
|
|
15
|
-
});
|
package/lib/esm/index.browser.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { drizzle } from "drizzle-orm/sqlite-proxy";
|
|
2
|
-
// @ts-ignore sqlocal does not support commonjs, but we can use it in the browser with ESM module
|
|
3
|
-
import { SQLocalDrizzle } from "sqlocal/drizzle";
|
|
4
|
-
import { promiseWithResolvers } from "./promise.js";
|
|
5
|
-
export * from "./reexport.js";
|
|
6
|
-
export async function initDatabase({ url = ":memory:", } = {}) {
|
|
7
|
-
const init = promiseWithResolvers();
|
|
8
|
-
const { driver } = new SQLocalDrizzle({
|
|
9
|
-
databasePath: url,
|
|
10
|
-
onConnect: () => init.resolve(),
|
|
11
|
-
});
|
|
12
|
-
await init.promise;
|
|
13
|
-
const db = drizzle(driver);
|
|
14
|
-
return db;
|
|
15
|
-
}
|
package/lib/esm/index.d.ts
DELETED
package/lib/esm/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "./reexport.js";
|
|
2
|
-
export async function initDatabase(options) {
|
|
3
|
-
if (typeof window === "undefined") {
|
|
4
|
-
return import("./index.node.js").then((m) => m.initDatabase(options));
|
|
5
|
-
}
|
|
6
|
-
return import("./index.browser.js").then((m) => m.initDatabase(options));
|
|
7
|
-
}
|
package/lib/esm/index.node.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type LibSQLDatabase } from "drizzle-orm/libsql";
|
|
2
|
-
import type { InitDatabaseOptions } from "./index.js";
|
|
3
|
-
export * from "./reexport.js";
|
|
4
|
-
export declare function initDatabase({ url, wal, walAutocheckpoint, }?: InitDatabaseOptions & {
|
|
5
|
-
walAutocheckpoint?: number;
|
|
6
|
-
}): Promise<LibSQLDatabase & {
|
|
7
|
-
vacuum?: () => Promise<void>;
|
|
8
|
-
}>;
|
package/lib/esm/index.node.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { mkdir } from "node:fs/promises";
|
|
2
|
-
import { dirname } from "node:path";
|
|
3
|
-
import { createClient } from "@libsql/client";
|
|
4
|
-
import { drizzle } from "drizzle-orm/libsql";
|
|
5
|
-
import { withRetry } from "./retry.js";
|
|
6
|
-
export * from "./reexport.js";
|
|
7
|
-
export async function initDatabase({ url = ":memory:", wal = false, walAutocheckpoint = 5000, } = {}) {
|
|
8
|
-
let db;
|
|
9
|
-
let client;
|
|
10
|
-
if (/^file:.*/.test(url)) {
|
|
11
|
-
const path = url.replace(/^file:(\/\/)?/, "");
|
|
12
|
-
await mkdir(dirname(path), { recursive: true });
|
|
13
|
-
}
|
|
14
|
-
if (wal) {
|
|
15
|
-
client = createClient({ url });
|
|
16
|
-
await client.execute(`\
|
|
17
|
-
PRAGMA journal_mode = WAL;
|
|
18
|
-
PRAGMA synchronous = normal;
|
|
19
|
-
PRAGMA wal_autocheckpoint = ${walAutocheckpoint};
|
|
20
|
-
PRAGMA busy_timeout = 5000;
|
|
21
|
-
`);
|
|
22
|
-
db = drizzle(client);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
db = drizzle(url);
|
|
26
|
-
}
|
|
27
|
-
if ("session" in db && db.session && typeof db.session === "object") {
|
|
28
|
-
db.session = withRetry(db.session, [
|
|
29
|
-
"all",
|
|
30
|
-
"get",
|
|
31
|
-
"run",
|
|
32
|
-
"values",
|
|
33
|
-
"count",
|
|
34
|
-
]);
|
|
35
|
-
}
|
|
36
|
-
db.clean = async () => {
|
|
37
|
-
if (wal && client && typeof client.execute === "function") {
|
|
38
|
-
await client.execute(`PRAGMA auto_vacuum = FULL;`);
|
|
39
|
-
await client.execute(`VACUUM;`);
|
|
40
|
-
await client.execute("PRAGMA wal_checkpoint(TRUNCATE);");
|
|
41
|
-
await client.execute(`VACUUM;`);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
return db;
|
|
45
|
-
}
|
package/lib/esm/package.json
DELETED
package/lib/esm/promise.d.ts
DELETED
package/lib/esm/promise.js
DELETED
package/lib/esm/reexport.d.ts
DELETED
package/lib/esm/reexport.js
DELETED
package/lib/esm/retry.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export interface WithRetryOptions {
|
|
2
|
-
max?: number;
|
|
3
|
-
backoffBase?: number;
|
|
4
|
-
backoffExponent?: number;
|
|
5
|
-
backoffJitter?: number;
|
|
6
|
-
shouldRetry?: (err: any) => boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function withRetry<T extends object>(db: T, methods: (keyof T)[], { max, backoffBase, backoffExponent, backoffJitter, shouldRetry, }?: WithRetryOptions): T;
|
package/lib/esm/retry.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
function isDBLockedError(error) {
|
|
2
|
-
let err = error;
|
|
3
|
-
while (err) {
|
|
4
|
-
if (!(err instanceof Error))
|
|
5
|
-
return false;
|
|
6
|
-
if (typeof err.message !== "string")
|
|
7
|
-
return false;
|
|
8
|
-
const isLock = err.message.includes("SQLITE_BUSY");
|
|
9
|
-
if (isLock)
|
|
10
|
-
return true;
|
|
11
|
-
err = err.cause;
|
|
12
|
-
}
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
export function withRetry(db, methods, { max = 30, backoffBase = 300, backoffExponent = 1.2, backoffJitter = 300, shouldRetry = isDBLockedError, } = {}) {
|
|
16
|
-
return new Proxy(db, {
|
|
17
|
-
get(target, prop) {
|
|
18
|
-
const val = target?.[prop];
|
|
19
|
-
if (methods.includes(prop) && typeof val === "function") {
|
|
20
|
-
return async (...args) => {
|
|
21
|
-
let attempt = 1;
|
|
22
|
-
while (true) {
|
|
23
|
-
try {
|
|
24
|
-
return await val.apply(target, args);
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
if (!shouldRetry(err) || ++attempt > max) {
|
|
28
|
-
throw err;
|
|
29
|
-
}
|
|
30
|
-
const exp = backoffExponent ** (attempt - 1);
|
|
31
|
-
const expDelay = backoffBase * exp;
|
|
32
|
-
const jitter = Math.random() * backoffJitter;
|
|
33
|
-
const waitTime = Math.floor(expDelay + jitter);
|
|
34
|
-
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
return val;
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
}
|
package/lib/esm/type.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare const json: <T>(dbName: string) => import("drizzle-orm/sqlite-core").SQLiteCustomColumnBuilder<{
|
|
2
|
-
name: string;
|
|
3
|
-
dataType: "custom";
|
|
4
|
-
columnType: "SQLiteCustomColumn";
|
|
5
|
-
data: T;
|
|
6
|
-
driverParam: string;
|
|
7
|
-
enumValues: undefined;
|
|
8
|
-
}>;
|
|
9
|
-
export declare const datetime: {
|
|
10
|
-
(): import("drizzle-orm/sqlite-core").SQLiteCustomColumnBuilder<{
|
|
11
|
-
name: "";
|
|
12
|
-
dataType: "custom";
|
|
13
|
-
columnType: "SQLiteCustomColumn";
|
|
14
|
-
data: Date;
|
|
15
|
-
driverParam: string;
|
|
16
|
-
enumValues: undefined;
|
|
17
|
-
}>;
|
|
18
|
-
<TConfig extends Record<string, any>>(fieldConfig?: TConfig | undefined): import("drizzle-orm/sqlite-core").SQLiteCustomColumnBuilder<{
|
|
19
|
-
name: "";
|
|
20
|
-
dataType: "custom";
|
|
21
|
-
columnType: "SQLiteCustomColumn";
|
|
22
|
-
data: Date;
|
|
23
|
-
driverParam: string;
|
|
24
|
-
enumValues: undefined;
|
|
25
|
-
}>;
|
|
26
|
-
<TName extends string>(dbName: TName, fieldConfig?: unknown): import("drizzle-orm/sqlite-core").SQLiteCustomColumnBuilder<{
|
|
27
|
-
name: TName;
|
|
28
|
-
dataType: "custom";
|
|
29
|
-
columnType: "SQLiteCustomColumn";
|
|
30
|
-
data: Date;
|
|
31
|
-
driverParam: string;
|
|
32
|
-
enumValues: undefined;
|
|
33
|
-
}>;
|
|
34
|
-
};
|
package/lib/esm/type.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { customType } from "drizzle-orm/sqlite-core";
|
|
2
|
-
export const json = (dbName) => customType({
|
|
3
|
-
dataType: () => "json",
|
|
4
|
-
fromDriver: (value) => JSON.parse(value),
|
|
5
|
-
toDriver: (value) => JSON.stringify(value),
|
|
6
|
-
})(dbName);
|
|
7
|
-
export const datetime = customType({
|
|
8
|
-
dataType: () => "datetime",
|
|
9
|
-
fromDriver: (value) => new Date(value),
|
|
10
|
-
toDriver: (value) => value.toISOString(),
|
|
11
|
-
});
|