@aigne/sqlite 0.4.9-beta.2 → 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.
Files changed (80) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +38 -0
  2. package/dist/_virtual/rolldown_runtime.mjs +36 -0
  3. package/dist/index.browser.cjs +50 -0
  4. package/dist/index.browser.d.cts +18 -0
  5. package/dist/index.browser.d.cts.map +1 -0
  6. package/dist/index.browser.d.mts +19 -0
  7. package/dist/index.browser.d.mts.map +1 -0
  8. package/dist/index.browser.mjs +32 -0
  9. package/dist/index.browser.mjs.map +1 -0
  10. package/dist/index.cjs +42 -0
  11. package/dist/index.d.cts +19 -0
  12. package/dist/index.d.cts.map +1 -0
  13. package/dist/index.d.mts +20 -0
  14. package/dist/index.d.mts.map +1 -0
  15. package/dist/index.mjs +24 -0
  16. package/dist/index.mjs.map +1 -0
  17. package/dist/index.node.cjs +74 -0
  18. package/dist/index.node.d.cts +24 -0
  19. package/dist/index.node.d.cts.map +1 -0
  20. package/dist/index.node.d.mts +25 -0
  21. package/dist/index.node.d.mts.map +1 -0
  22. package/dist/index.node.mjs +56 -0
  23. package/dist/index.node.mjs.map +1 -0
  24. package/dist/promise.cjs +17 -0
  25. package/dist/promise.d.cts +10 -0
  26. package/dist/promise.d.cts.map +1 -0
  27. package/dist/promise.d.mts +10 -0
  28. package/dist/promise.d.mts.map +1 -0
  29. package/dist/promise.mjs +17 -0
  30. package/dist/promise.mjs.map +1 -0
  31. package/dist/reexport.cjs +28 -0
  32. package/dist/reexport.d.cts +6 -0
  33. package/dist/reexport.d.mts +6 -0
  34. package/dist/reexport.mjs +10 -0
  35. package/dist/retry.cjs +33 -0
  36. package/dist/retry.d.cts +18 -0
  37. package/dist/retry.d.cts.map +1 -0
  38. package/dist/retry.d.mts +18 -0
  39. package/dist/retry.d.mts.map +1 -0
  40. package/dist/retry.mjs +33 -0
  41. package/dist/retry.mjs.map +1 -0
  42. package/dist/type.cjs +17 -0
  43. package/dist/type.d.cts +40 -0
  44. package/dist/type.d.cts.map +1 -0
  45. package/dist/type.d.mts +40 -0
  46. package/dist/type.d.mts.map +1 -0
  47. package/dist/type.mjs +17 -0
  48. package/dist/type.mjs.map +1 -0
  49. package/package.json +50 -37
  50. package/CHANGELOG.md +0 -159
  51. package/lib/cjs/index.browser.d.ts +0 -4
  52. package/lib/cjs/index.browser.js +0 -32
  53. package/lib/cjs/index.d.ts +0 -6
  54. package/lib/cjs/index.js +0 -46
  55. package/lib/cjs/index.node.d.ts +0 -8
  56. package/lib/cjs/index.node.js +0 -62
  57. package/lib/cjs/package.json +0 -3
  58. package/lib/cjs/promise.d.ts +0 -6
  59. package/lib/cjs/promise.js +0 -12
  60. package/lib/cjs/reexport.d.ts +0 -4
  61. package/lib/cjs/reexport.js +0 -21
  62. package/lib/cjs/retry.d.ts +0 -8
  63. package/lib/cjs/retry.js +0 -45
  64. package/lib/cjs/type.d.ts +0 -34
  65. package/lib/cjs/type.js +0 -15
  66. package/lib/esm/index.browser.d.ts +0 -4
  67. package/lib/esm/index.browser.js +0 -15
  68. package/lib/esm/index.d.ts +0 -6
  69. package/lib/esm/index.js +0 -7
  70. package/lib/esm/index.node.d.ts +0 -8
  71. package/lib/esm/index.node.js +0 -45
  72. package/lib/esm/package.json +0 -3
  73. package/lib/esm/promise.d.ts +0 -6
  74. package/lib/esm/promise.js +0 -9
  75. package/lib/esm/reexport.d.ts +0 -4
  76. package/lib/esm/reexport.js +0 -5
  77. package/lib/esm/retry.d.ts +0 -8
  78. package/lib/esm/retry.js +0 -42
  79. package/lib/esm/type.d.ts +0 -34
  80. package/lib/esm/type.js +0 -11
@@ -0,0 +1,10 @@
1
+ import { __exportAll, __reExport } from "./_virtual/rolldown_runtime.mjs";
2
+ import { datetime, json } from "./type.mjs";
3
+
4
+ export * from "drizzle-orm"
5
+
6
+ export * from "drizzle-orm/sql"
7
+
8
+ export * from "drizzle-orm/sqlite-core"
9
+
10
+ export { datetime, json };
package/dist/retry.cjs ADDED
@@ -0,0 +1,33 @@
1
+
2
+ //#region src/retry.ts
3
+ function isDBLockedError(error) {
4
+ let err = error;
5
+ while (err) {
6
+ if (!(err instanceof Error)) return false;
7
+ if (typeof err.message !== "string") return false;
8
+ if (err.message.includes("SQLITE_BUSY")) return true;
9
+ err = err.cause;
10
+ }
11
+ return false;
12
+ }
13
+ function withRetry(db, methods, { max = 30, backoffBase = 300, backoffExponent = 1.2, backoffJitter = 300, shouldRetry = isDBLockedError } = {}) {
14
+ return new Proxy(db, { get(target, prop) {
15
+ const val = target?.[prop];
16
+ if (methods.includes(prop) && typeof val === "function") return async (...args) => {
17
+ let attempt = 1;
18
+ while (true) try {
19
+ return await val.apply(target, args);
20
+ } catch (err) {
21
+ if (!shouldRetry(err) || ++attempt > max) throw err;
22
+ const expDelay = backoffBase * backoffExponent ** (attempt - 1);
23
+ const jitter = Math.random() * backoffJitter;
24
+ const waitTime = Math.floor(expDelay + jitter);
25
+ await new Promise((resolve) => setTimeout(resolve, waitTime));
26
+ }
27
+ };
28
+ return val;
29
+ } });
30
+ }
31
+
32
+ //#endregion
33
+ exports.withRetry = withRetry;
@@ -0,0 +1,18 @@
1
+ //#region src/retry.d.ts
2
+ interface WithRetryOptions {
3
+ max?: number;
4
+ backoffBase?: number;
5
+ backoffExponent?: number;
6
+ backoffJitter?: number;
7
+ shouldRetry?: (err: any) => boolean;
8
+ }
9
+ declare function withRetry<T extends object>(db: T, methods: (keyof T)[], {
10
+ max,
11
+ backoffBase,
12
+ backoffExponent,
13
+ backoffJitter,
14
+ shouldRetry
15
+ }?: WithRetryOptions): T;
16
+ //#endregion
17
+ export { WithRetryOptions, withRetry };
18
+ //# sourceMappingURL=retry.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.cts","names":[],"sources":["../src/retry.ts"],"mappings":";UAAiB,gBAAA;EAAA,GAAA;EAAA,WAAA;EAAA,eAAA;EAAA,aAAA;EAAA,WAAA,IAAA,GAAA;AAAA;AAAA,iBAyBD,SAAA,kBAAA,CAAA,EAAA,EACV,CAAA,EAAA,OAAA,SACY,CAAA;EAAA,GAAA;EAAA,WAAA;EAAA,eAAA;EAAA,aAAA;EAAA;AAAA,IAOb,gBAAA,GACF,CAAA"}
@@ -0,0 +1,18 @@
1
+ //#region src/retry.d.ts
2
+ interface WithRetryOptions {
3
+ max?: number;
4
+ backoffBase?: number;
5
+ backoffExponent?: number;
6
+ backoffJitter?: number;
7
+ shouldRetry?: (err: any) => boolean;
8
+ }
9
+ declare function withRetry<T extends object>(db: T, methods: (keyof T)[], {
10
+ max,
11
+ backoffBase,
12
+ backoffExponent,
13
+ backoffJitter,
14
+ shouldRetry
15
+ }?: WithRetryOptions): T;
16
+ //#endregion
17
+ export { WithRetryOptions, withRetry };
18
+ //# sourceMappingURL=retry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.mts","names":[],"sources":["../src/retry.ts"],"mappings":";UAAiB,gBAAA;EAAA,GAAA;EAAA,WAAA;EAAA,eAAA;EAAA,aAAA;EAAA,WAAA,IAAA,GAAA;AAAA;AAAA,iBAyBD,SAAA,kBAAA,CAAA,EAAA,EACV,CAAA,EAAA,OAAA,SACY,CAAA;EAAA,GAAA;EAAA,WAAA;EAAA,eAAA;EAAA,aAAA;EAAA;AAAA,IAOb,gBAAA,GACF,CAAA"}
package/dist/retry.mjs ADDED
@@ -0,0 +1,33 @@
1
+ //#region src/retry.ts
2
+ function isDBLockedError(error) {
3
+ let err = error;
4
+ while (err) {
5
+ if (!(err instanceof Error)) return false;
6
+ if (typeof err.message !== "string") return false;
7
+ if (err.message.includes("SQLITE_BUSY")) return true;
8
+ err = err.cause;
9
+ }
10
+ return false;
11
+ }
12
+ function withRetry(db, methods, { max = 30, backoffBase = 300, backoffExponent = 1.2, backoffJitter = 300, shouldRetry = isDBLockedError } = {}) {
13
+ return new Proxy(db, { get(target, prop) {
14
+ const val = target?.[prop];
15
+ if (methods.includes(prop) && typeof val === "function") return async (...args) => {
16
+ let attempt = 1;
17
+ while (true) try {
18
+ return await val.apply(target, args);
19
+ } catch (err) {
20
+ if (!shouldRetry(err) || ++attempt > max) throw err;
21
+ const expDelay = backoffBase * backoffExponent ** (attempt - 1);
22
+ const jitter = Math.random() * backoffJitter;
23
+ const waitTime = Math.floor(expDelay + jitter);
24
+ await new Promise((resolve) => setTimeout(resolve, waitTime));
25
+ }
26
+ };
27
+ return val;
28
+ } });
29
+ }
30
+
31
+ //#endregion
32
+ export { withRetry };
33
+ //# sourceMappingURL=retry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.mjs","names":[],"sources":["../src/retry.ts"],"sourcesContent":["export interface WithRetryOptions {\n max?: number;\n backoffBase?: number;\n backoffExponent?: number;\n backoffJitter?: number;\n shouldRetry?: (err: any) => boolean;\n}\n\nfunction isDBLockedError(error: any): boolean {\n let err = error;\n\n while (err) {\n if (!(err instanceof Error)) return false;\n\n if (typeof err.message !== \"string\") return false;\n\n const isLock = err.message.includes(\"SQLITE_BUSY\");\n if (isLock) return true;\n\n err = err.cause;\n }\n\n return false;\n}\n\nexport function withRetry<T extends object>(\n db: T,\n methods: (keyof T)[],\n {\n max = 30,\n backoffBase = 300,\n backoffExponent = 1.2,\n backoffJitter = 300,\n shouldRetry = isDBLockedError,\n }: WithRetryOptions = {},\n): T {\n return new Proxy(db, {\n get(target, prop) {\n const val = (target as any)?.[prop];\n\n if (methods.includes(prop as keyof T) && typeof val === \"function\") {\n return async (...args: any[]) => {\n let attempt = 1;\n\n while (true) {\n try {\n return await val.apply(target, args);\n } catch (err) {\n if (!shouldRetry(err) || ++attempt > max) {\n throw err;\n }\n\n const exp = backoffExponent ** (attempt - 1);\n const expDelay = backoffBase * exp;\n const jitter = Math.random() * backoffJitter;\n const waitTime = Math.floor(expDelay + jitter);\n\n await new Promise((resolve) => setTimeout(resolve, waitTime));\n }\n }\n };\n }\n return val;\n },\n });\n}\n"],"mappings":";AAQA,SAAS,gBAAgB,OAAqB;CAC5C,IAAI,MAAM;AAEV,QAAO,KAAK;AACV,MAAI,EAAE,eAAe,OAAQ,QAAO;AAEpC,MAAI,OAAO,IAAI,YAAY,SAAU,QAAO;AAG5C,MADe,IAAI,QAAQ,SAAS,cAAc,CACtC,QAAO;AAEnB,QAAM,IAAI;;AAGZ,QAAO;;AAGT,SAAgB,UACd,IACA,SACA,EACE,MAAM,IACN,cAAc,KACd,kBAAkB,KAClB,gBAAgB,KAChB,cAAc,oBACM,EAAE,EACrB;AACH,QAAO,IAAI,MAAM,IAAI,EACnB,IAAI,QAAQ,MAAM;EAChB,MAAM,MAAO,SAAiB;AAE9B,MAAI,QAAQ,SAAS,KAAgB,IAAI,OAAO,QAAQ,WACtD,QAAO,OAAO,GAAG,SAAgB;GAC/B,IAAI,UAAU;AAEd,UAAO,KACL,KAAI;AACF,WAAO,MAAM,IAAI,MAAM,QAAQ,KAAK;YAC7B,KAAK;AACZ,QAAI,CAAC,YAAY,IAAI,IAAI,EAAE,UAAU,IACnC,OAAM;IAIR,MAAM,WAAW,cADL,oBAAoB,UAAU;IAE1C,MAAM,SAAS,KAAK,QAAQ,GAAG;IAC/B,MAAM,WAAW,KAAK,MAAM,WAAW,OAAO;AAE9C,UAAM,IAAI,SAAS,YAAY,WAAW,SAAS,SAAS,CAAC;;;AAKrE,SAAO;IAEV,CAAC"}
package/dist/type.cjs ADDED
@@ -0,0 +1,17 @@
1
+ let drizzle_orm_sqlite_core = require("drizzle-orm/sqlite-core");
2
+
3
+ //#region src/type.ts
4
+ const json = (dbName) => (0, drizzle_orm_sqlite_core.customType)({
5
+ dataType: () => "json",
6
+ fromDriver: (value) => JSON.parse(value),
7
+ toDriver: (value) => JSON.stringify(value)
8
+ })(dbName);
9
+ const datetime = (0, drizzle_orm_sqlite_core.customType)({
10
+ dataType: () => "datetime",
11
+ fromDriver: (value) => new Date(value),
12
+ toDriver: (value) => value.toISOString()
13
+ });
14
+
15
+ //#endregion
16
+ exports.datetime = datetime;
17
+ exports.json = json;
@@ -0,0 +1,40 @@
1
+ import * as drizzle_orm_sqlite_core0 from "drizzle-orm/sqlite-core";
2
+
3
+ //#region src/type.d.ts
4
+ declare const json: <T>(dbName: string) => drizzle_orm_sqlite_core0.SQLiteCustomColumnBuilder<{
5
+ name: string;
6
+ dataType: "custom";
7
+ columnType: "SQLiteCustomColumn";
8
+ data: T;
9
+ driverParam: string;
10
+ enumValues: undefined;
11
+ }>;
12
+ declare const datetime: {
13
+ (): drizzle_orm_sqlite_core0.SQLiteCustomColumnBuilder<{
14
+ name: "";
15
+ dataType: "custom";
16
+ columnType: "SQLiteCustomColumn";
17
+ data: Date;
18
+ driverParam: string;
19
+ enumValues: undefined;
20
+ }>;
21
+ <TConfig extends Record<string, any>>(fieldConfig?: TConfig | undefined): drizzle_orm_sqlite_core0.SQLiteCustomColumnBuilder<{
22
+ name: "";
23
+ dataType: "custom";
24
+ columnType: "SQLiteCustomColumn";
25
+ data: Date;
26
+ driverParam: string;
27
+ enumValues: undefined;
28
+ }>;
29
+ <TName extends string>(dbName: TName, fieldConfig?: unknown): drizzle_orm_sqlite_core0.SQLiteCustomColumnBuilder<{
30
+ name: TName;
31
+ dataType: "custom";
32
+ columnType: "SQLiteCustomColumn";
33
+ data: Date;
34
+ driverParam: string;
35
+ enumValues: undefined;
36
+ }>;
37
+ };
38
+ //#endregion
39
+ export { datetime, json };
40
+ //# sourceMappingURL=type.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.cts","names":[],"sources":["../src/type.ts"],"mappings":";;;cAEa,IAAA,MAAA,MAAA,aAQD,wBAAA,CAR0B,yBAAA;EAAA,IAAA;EAAA,QAAA;EAAA,UAAA;EAAA,IAAA,EAQ1B,CAAA;EAAA,WAAA;EAAA,UAAA;AAAA;AAAA,cAEC,QAAA;EAAA"}
@@ -0,0 +1,40 @@
1
+ import * as drizzle_orm_sqlite_core0 from "drizzle-orm/sqlite-core";
2
+
3
+ //#region src/type.d.ts
4
+ declare const json: <T>(dbName: string) => drizzle_orm_sqlite_core0.SQLiteCustomColumnBuilder<{
5
+ name: string;
6
+ dataType: "custom";
7
+ columnType: "SQLiteCustomColumn";
8
+ data: T;
9
+ driverParam: string;
10
+ enumValues: undefined;
11
+ }>;
12
+ declare const datetime: {
13
+ (): drizzle_orm_sqlite_core0.SQLiteCustomColumnBuilder<{
14
+ name: "";
15
+ dataType: "custom";
16
+ columnType: "SQLiteCustomColumn";
17
+ data: Date;
18
+ driverParam: string;
19
+ enumValues: undefined;
20
+ }>;
21
+ <TConfig extends Record<string, any>>(fieldConfig?: TConfig | undefined): drizzle_orm_sqlite_core0.SQLiteCustomColumnBuilder<{
22
+ name: "";
23
+ dataType: "custom";
24
+ columnType: "SQLiteCustomColumn";
25
+ data: Date;
26
+ driverParam: string;
27
+ enumValues: undefined;
28
+ }>;
29
+ <TName extends string>(dbName: TName, fieldConfig?: unknown): drizzle_orm_sqlite_core0.SQLiteCustomColumnBuilder<{
30
+ name: TName;
31
+ dataType: "custom";
32
+ columnType: "SQLiteCustomColumn";
33
+ data: Date;
34
+ driverParam: string;
35
+ enumValues: undefined;
36
+ }>;
37
+ };
38
+ //#endregion
39
+ export { datetime, json };
40
+ //# sourceMappingURL=type.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.mts","names":[],"sources":["../src/type.ts"],"mappings":";;;cAEa,IAAA,MAAA,MAAA,aAQD,wBAAA,CAR0B,yBAAA;EAAA,IAAA;EAAA,QAAA;EAAA,UAAA;EAAA,IAAA,EAQ1B,CAAA;EAAA,WAAA;EAAA,UAAA;AAAA;AAAA,cAEC,QAAA;EAAA"}
package/dist/type.mjs ADDED
@@ -0,0 +1,17 @@
1
+ import { customType } from "drizzle-orm/sqlite-core";
2
+
3
+ //#region src/type.ts
4
+ const json = (dbName) => customType({
5
+ dataType: () => "json",
6
+ fromDriver: (value) => JSON.parse(value),
7
+ toDriver: (value) => JSON.stringify(value)
8
+ })(dbName);
9
+ const datetime = customType({
10
+ dataType: () => "datetime",
11
+ fromDriver: (value) => new Date(value),
12
+ toDriver: (value) => value.toISOString()
13
+ });
14
+
15
+ //#endregion
16
+ export { datetime, json };
17
+ //# sourceMappingURL=type.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.mjs","names":[],"sources":["../src/type.ts"],"sourcesContent":["import { customType } from \"drizzle-orm/sqlite-core\";\n\nexport const json = <T>(dbName: string) =>\n customType<{\n data: T;\n driverData: string;\n }>({\n dataType: () => \"json\",\n fromDriver: (value) => JSON.parse(value),\n toDriver: (value) => JSON.stringify(value),\n })(dbName);\n\nexport const datetime = customType<{\n data: Date;\n driverData: string;\n}>({\n dataType: () => \"datetime\",\n fromDriver: (value) => new Date(value),\n toDriver: (value) => value.toISOString(),\n});\n"],"mappings":";;;AAEA,MAAa,QAAW,WACtB,WAGG;CACD,gBAAgB;CAChB,aAAa,UAAU,KAAK,MAAM,MAAM;CACxC,WAAW,UAAU,KAAK,UAAU,MAAM;CAC3C,CAAC,CAAC,OAAO;AAEZ,MAAa,WAAW,WAGrB;CACD,gBAAgB;CAChB,aAAa,UAAU,IAAI,KAAK,MAAM;CACtC,WAAW,UAAU,MAAM,aAAa;CACzC,CAAC"}
package/package.json CHANGED
@@ -1,70 +1,83 @@
1
1
  {
2
2
  "name": "@aigne/sqlite",
3
- "version": "0.4.9-beta.2",
3
+ "version": "1.74.0-beta",
4
4
  "description": "AIGNE SQLite database library for building AI-powered applications",
5
+ "license": "Elastic-2.0",
5
6
  "publishConfig": {
6
7
  "access": "public"
7
8
  },
8
9
  "author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
9
10
  "homepage": "https://www.aigne.io/framework",
10
- "license": "Elastic-2.0",
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git+https://github.com/AIGNE-io/aigne-framework"
13
+ "url": "git+https://github.com/ArcBlock/aigne-framework"
14
14
  },
15
15
  "bugs": {
16
- "url": "https://github.com/AIGNE-io/aigne-framework/issues"
16
+ "url": "https://github.com/ArcBlock/aigne-framework/issues"
17
17
  },
18
- "files": [
19
- "lib/cjs",
20
- "lib/esm",
21
- "LICENSE",
22
- "README.md",
23
- "CHANGELOG.md"
24
- ],
25
18
  "type": "module",
26
- "types": "./lib/esm/index.d.ts",
19
+ "main": "./dist/index.cjs",
20
+ "module": "./dist/index.mjs",
21
+ "types": "./dist/index.d.cts",
27
22
  "exports": {
28
23
  ".": {
29
- "browser": "./lib/esm/index.browser.js",
24
+ "browser": {
25
+ "import": "./dist/index.browser.mjs",
26
+ "require": "./dist/index.browser.cjs"
27
+ },
30
28
  "node": {
31
- "require": "./lib/cjs/index.node.js",
32
- "import": "./lib/esm/index.node.js"
29
+ "import": "./dist/index.node.mjs",
30
+ "require": "./dist/index.node.cjs"
33
31
  },
34
- "default": "./lib/esm/index.js",
35
- "types": "./lib/esm/index.d.ts"
32
+ "default": {
33
+ "import": "./dist/index.mjs",
34
+ "require": "./dist/index.cjs"
35
+ }
36
36
  },
37
- "./type.js": {
38
- "require": "./lib/cjs/type.js",
39
- "default": "./lib/esm/type.js",
40
- "types": "./lib/esm/type.d.ts"
41
- }
42
- },
43
- "typesVersions": {
44
- "*": {
45
- "type.js": [
46
- "./lib/esm/type.d.ts"
47
- ]
48
- }
37
+ "./promise": {
38
+ "require": "./dist/promise.cjs",
39
+ "import": "./dist/promise.mjs"
40
+ },
41
+ "./reexport": {
42
+ "require": "./dist/reexport.cjs",
43
+ "import": "./dist/reexport.mjs"
44
+ },
45
+ "./retry": {
46
+ "require": "./dist/retry.cjs",
47
+ "import": "./dist/retry.mjs"
48
+ },
49
+ "./type": {
50
+ "require": "./dist/type.cjs",
51
+ "import": "./dist/type.mjs"
52
+ },
53
+ "./*": "./*"
49
54
  },
55
+ "files": [
56
+ "dist",
57
+ "LICENSE",
58
+ "README.md",
59
+ "CHANGELOG.md"
60
+ ],
50
61
  "dependencies": {
51
62
  "@libsql/client": "^0.15.15",
52
63
  "drizzle-orm": "^0.44.5",
53
64
  "sqlocal": "^0.14.2"
54
65
  },
55
66
  "devDependencies": {
56
- "@types/bun": "^1.2.22",
67
+ "@types/bun": "^1.3.6",
57
68
  "@types/node": "^24.5.1",
58
69
  "npm-run-all": "^4.1.5",
59
- "rimraf": "^6.0.1",
60
- "typescript": "^5.9.2"
70
+ "rimraf": "^6.1.2",
71
+ "tsdown": "0.20.0-beta.3",
72
+ "typescript": "5.9.2",
73
+ "@aigne/scripts": "0.0.0",
74
+ "@aigne/typescript-config": "0.0.0"
61
75
  },
62
76
  "scripts": {
63
- "lint": "tsc --noEmit",
64
- "build": "tsc --build scripts/tsconfig.build.json",
65
- "clean": "rimraf lib test/coverage",
77
+ "build": "tsdown",
78
+ "check-types": "tsc --noEmit",
79
+ "clean": "rimraf dist coverage",
66
80
  "test": "bun test",
67
- "test:coverage": "bun test --coverage --coverage-reporter=lcov --coverage-reporter=text",
68
- "postbuild": "node ../../scripts/post-build-lib.mjs"
81
+ "test:coverage": "bun test --coverage --coverage-reporter=lcov --coverage-reporter=text"
69
82
  }
70
83
  }
package/CHANGELOG.md DELETED
@@ -1,159 +0,0 @@
1
- # Changelog
2
-
3
- ## [0.4.9-beta.2](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.9-beta.1...sqlite-v0.4.9-beta.2) (2026-01-14)
4
-
5
-
6
- ### Bug Fixes
7
-
8
- * improve test coverage tracking and reporting ([#903](https://github.com/AIGNE-io/aigne-framework/issues/903)) ([031144e](https://github.com/AIGNE-io/aigne-framework/commit/031144e74f29e882cffe52ffda8f7a18c76ace7f))
9
-
10
- ## [0.4.9-beta.1](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.9-beta...sqlite-v0.4.9-beta.1) (2026-01-08)
11
-
12
-
13
- ### Bug Fixes
14
-
15
- * bump version ([696560f](https://github.com/AIGNE-io/aigne-framework/commit/696560fa2673eddcb4d00ac0523fbbbde7273cb3))
16
-
17
- ## [0.4.9-beta](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.8...sqlite-v0.4.9-beta) (2025-12-17)
18
-
19
-
20
- ### Bug Fixes
21
-
22
- * bump version ([70d217c](https://github.com/AIGNE-io/aigne-framework/commit/70d217c8360dd0dda7f5f17011c4e92ec836e801))
23
-
24
- ## [0.4.8](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.8-beta...sqlite-v0.4.8) (2025-12-12)
25
-
26
- ## [0.4.8-beta](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.7...sqlite-v0.4.8-beta) (2025-12-10)
27
-
28
-
29
- ### Bug Fixes
30
-
31
- * bump version ([af04b69](https://github.com/AIGNE-io/aigne-framework/commit/af04b6931951afa35d52065430acc7fef4b10087))
32
-
33
- ## [0.4.7](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.7-beta...sqlite-v0.4.7) (2025-11-28)
34
-
35
- ## [0.4.7-beta](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.6...sqlite-v0.4.7-beta) (2025-11-28)
36
-
37
-
38
- ### Bug Fixes
39
-
40
- * bump version ([ba7ad18](https://github.com/AIGNE-io/aigne-framework/commit/ba7ad184fcf32b49bf0507a3cb638d20fb00690d))
41
-
42
- ## [0.4.6](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.6-beta.2...sqlite-v0.4.6) (2025-11-21)
43
-
44
- ## [0.4.6-beta.2](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.6-beta.1...sqlite-v0.4.6-beta.2) (2025-11-18)
45
-
46
-
47
- ### Features
48
-
49
- * **afs:** add basic AFS(AIGNE File System) support ([#505](https://github.com/AIGNE-io/aigne-framework/issues/505)) ([ac2a18a](https://github.com/AIGNE-io/aigne-framework/commit/ac2a18a82470a2f31c466f329386525eb1cdab6d))
50
- * **memory:** support did space memory adapter ([#229](https://github.com/AIGNE-io/aigne-framework/issues/229)) ([6f69b64](https://github.com/AIGNE-io/aigne-framework/commit/6f69b64e98b963db9d6ab5357306b445385eaa68))
51
-
52
-
53
- ### Bug Fixes
54
-
55
- * bump version ([93a1c10](https://github.com/AIGNE-io/aigne-framework/commit/93a1c10cf35f88eaafe91092481f5d087bd5b3a9))
56
- * **cli:** reduce memory usage of AIGNE CLI ([#411](https://github.com/AIGNE-io/aigne-framework/issues/411)) ([9c36969](https://github.com/AIGNE-io/aigne-framework/commit/9c369699d966d37abf2d6a1624eac3d2fda4123b))
57
- * improve SQLite busy error handling and observability logging ([#545](https://github.com/AIGNE-io/aigne-framework/issues/545)) ([6dc8e06](https://github.com/AIGNE-io/aigne-framework/commit/6dc8e064231f3d6342036626591e89bff1ae5c08))
58
- * **observability:** introduce TraceContext and improve delete UX ([#755](https://github.com/AIGNE-io/aigne-framework/issues/755)) ([dee54f1](https://github.com/AIGNE-io/aigne-framework/commit/dee54f1c548ed1046781e919f8c51a642b6b0dac))
59
- * **sqlite:** auto-create parent directories for file-based databases ([#727](https://github.com/AIGNE-io/aigne-framework/issues/727)) ([581789f](https://github.com/AIGNE-io/aigne-framework/commit/581789f38d838f53396e9e41ce9367a486319c53))
60
- * **sqlite:** improve WAL checkpoint and database cleanup ([#751](https://github.com/AIGNE-io/aigne-framework/issues/751)) ([85c7884](https://github.com/AIGNE-io/aigne-framework/commit/85c78849a8d2637349786c696d6eaa01f8c70fcf))
61
-
62
- ## [0.4.6-beta.1](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.6-beta...sqlite-v0.4.6-beta.1) (2025-11-18)
63
-
64
-
65
- ### Bug Fixes
66
-
67
- * **observability:** introduce TraceContext and improve delete UX ([#755](https://github.com/AIGNE-io/aigne-framework/issues/755)) ([dee54f1](https://github.com/AIGNE-io/aigne-framework/commit/dee54f1c548ed1046781e919f8c51a642b6b0dac))
68
-
69
- ## [0.4.6-beta](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.5...sqlite-v0.4.6-beta) (2025-11-17)
70
-
71
-
72
- ### Bug Fixes
73
-
74
- * **sqlite:** improve WAL checkpoint and database cleanup ([#751](https://github.com/AIGNE-io/aigne-framework/issues/751)) ([85c7884](https://github.com/AIGNE-io/aigne-framework/commit/85c78849a8d2637349786c696d6eaa01f8c70fcf))
75
-
76
- ## [0.4.5](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.5-beta...sqlite-v0.4.5) (2025-11-15)
77
-
78
- ## [0.4.5-beta](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.4...sqlite-v0.4.5-beta) (2025-11-15)
79
-
80
-
81
- ### Bug Fixes
82
-
83
- * bump version ([93a1c10](https://github.com/AIGNE-io/aigne-framework/commit/93a1c10cf35f88eaafe91092481f5d087bd5b3a9))
84
-
85
- ## [0.4.4](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.4-beta...sqlite-v0.4.4) (2025-11-12)
86
-
87
- ## [0.4.4-beta](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.3...sqlite-v0.4.4-beta) (2025-11-12)
88
-
89
-
90
- ### Bug Fixes
91
-
92
- * **sqlite:** auto-create parent directories for file-based databases ([#727](https://github.com/AIGNE-io/aigne-framework/issues/727)) ([581789f](https://github.com/AIGNE-io/aigne-framework/commit/581789f38d838f53396e9e41ce9367a486319c53))
93
-
94
- ## [0.4.3](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.3-beta...sqlite-v0.4.3) (2025-10-19)
95
-
96
- ## [0.4.3-beta](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.2...sqlite-v0.4.3-beta) (2025-10-07)
97
-
98
-
99
- ### Features
100
-
101
- * **afs:** add basic AFS(AIGNE File System) support ([#505](https://github.com/AIGNE-io/aigne-framework/issues/505)) ([ac2a18a](https://github.com/AIGNE-io/aigne-framework/commit/ac2a18a82470a2f31c466f329386525eb1cdab6d))
102
-
103
- ## [0.4.2](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.2-beta...sqlite-v0.4.2) (2025-09-27)
104
-
105
- ## [0.4.2-beta](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.1...sqlite-v0.4.2-beta) (2025-09-25)
106
-
107
-
108
- ### Bug Fixes
109
-
110
- * improve SQLite busy error handling and observability logging ([#545](https://github.com/AIGNE-io/aigne-framework/issues/545)) ([6dc8e06](https://github.com/AIGNE-io/aigne-framework/commit/6dc8e064231f3d6342036626591e89bff1ae5c08))
111
-
112
- ## [0.4.1](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.4.0...sqlite-v0.4.1) (2025-08-26)
113
-
114
-
115
- ### Bug Fixes
116
-
117
- * **cli:** reduce memory usage of AIGNE CLI ([#411](https://github.com/AIGNE-io/aigne-framework/issues/411)) ([9c36969](https://github.com/AIGNE-io/aigne-framework/commit/9c369699d966d37abf2d6a1624eac3d2fda4123b))
118
-
119
- ## [0.4.0](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.3.1...sqlite-v0.4.0) (2025-07-15)
120
-
121
-
122
- ### Features
123
-
124
- * **memory:** support did space memory adapter ([#229](https://github.com/AIGNE-io/aigne-framework/issues/229)) ([6f69b64](https://github.com/AIGNE-io/aigne-framework/commit/6f69b64e98b963db9d6ab5357306b445385eaa68))
125
-
126
- ## [0.3.1](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.3.0...sqlite-v0.3.1) (2025-07-14)
127
-
128
-
129
- ### Bug Fixes
130
-
131
- * **deps:** update deps to latest version ([#247](https://github.com/AIGNE-io/aigne-framework/issues/247)) ([3972f88](https://github.com/AIGNE-io/aigne-framework/commit/3972f887a9abff20c26da6b51c1071cbd54c0bf1))
132
-
133
- ## [0.3.0](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.2.0...sqlite-v0.3.0) (2025-07-04)
134
-
135
-
136
- ### Features
137
-
138
- * **core:** add standard userId/sessionId in userContext ([#219](https://github.com/AIGNE-io/aigne-framework/issues/219)) ([58e5804](https://github.com/AIGNE-io/aigne-framework/commit/58e5804cf08b1d2fa6e232646fadd70b5db2e007))
139
-
140
- ## [0.2.0](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.1.1...sqlite-v0.2.0) (2025-07-03)
141
-
142
-
143
- ### Features
144
-
145
- * upgrade dependencies and adapt code to breaking changes ([#216](https://github.com/AIGNE-io/aigne-framework/issues/216)) ([f215ced](https://github.com/AIGNE-io/aigne-framework/commit/f215cedc1a57e321164064c33316e496eae8d25f))
146
-
147
- ## [0.1.1](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.1.0...sqlite-v0.1.1) (2025-06-05)
148
-
149
-
150
- ### Bug Fixes
151
-
152
- * compatible nodejs version &gt;=20 ([#149](https://github.com/AIGNE-io/aigne-framework/issues/149)) ([d5ae9f2](https://github.com/AIGNE-io/aigne-framework/commit/d5ae9f245972e87e70fd87cdd960ade9940f288c))
153
-
154
- ## [0.1.0](https://github.com/AIGNE-io/aigne-framework/compare/sqlite-v0.0.1...sqlite-v0.1.0) (2025-05-29)
155
-
156
-
157
- ### Features
158
-
159
- * add memory agents support for client agent ([#139](https://github.com/AIGNE-io/aigne-framework/issues/139)) ([57044fa](https://github.com/AIGNE-io/aigne-framework/commit/57044fa87b8abcba395cd05f941d6d312ab65764))
@@ -1,4 +0,0 @@
1
- import { type SqliteRemoteDatabase } from "drizzle-orm/sqlite-proxy";
2
- import type { InitDatabaseOptions } from "./index.js";
3
- export * from "./reexport.js";
4
- export declare function initDatabase({ url, }?: InitDatabaseOptions): Promise<SqliteRemoteDatabase>;
@@ -1,32 +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 sqlite_proxy_1 = require("drizzle-orm/sqlite-proxy");
19
- // @ts-ignore sqlocal does not support commonjs, but we can use it in the browser with ESM module
20
- const drizzle_1 = require("sqlocal/drizzle");
21
- const promise_js_1 = require("./promise.js");
22
- __exportStar(require("./reexport.js"), exports);
23
- async function initDatabase({ url = ":memory:", } = {}) {
24
- const init = (0, promise_js_1.promiseWithResolvers)();
25
- const { driver } = new drizzle_1.SQLocalDrizzle({
26
- databasePath: url,
27
- onConnect: () => init.resolve(),
28
- });
29
- await init.promise;
30
- const db = (0, sqlite_proxy_1.drizzle)(driver);
31
- return db;
32
- }
@@ -1,6 +0,0 @@
1
- export * from "./reexport.js";
2
- export interface InitDatabaseOptions {
3
- url?: string;
4
- wal?: boolean;
5
- }
6
- export declare function initDatabase(options?: InitDatabaseOptions): Promise<import("drizzle-orm/sqlite-proxy/driver.js").SqliteRemoteDatabase<Record<string, never>>>;
package/lib/cjs/index.js DELETED
@@ -1,46 +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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
- };
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.initDatabase = initDatabase;
40
- __exportStar(require("./reexport.js"), exports);
41
- async function initDatabase(options) {
42
- if (typeof window === "undefined") {
43
- return Promise.resolve().then(() => __importStar(require("./index.node.js"))).then((m) => m.initDatabase(options));
44
- }
45
- return Promise.resolve().then(() => __importStar(require("./index.browser.js"))).then((m) => m.initDatabase(options));
46
- }
@@ -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
- }>;