@pikku/kysely-sqlite 0.12.9 → 0.12.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/CHANGELOG.md +49 -0
- package/dist/src/index.d.ts +1 -2
- package/dist/src/index.js +1 -0
- package/dist/src/sqlite-functions.d.ts +32 -0
- package/dist/src/sqlite-functions.js +33 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/index.ts +4 -2
- package/src/sqlite-functions.ts +47 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @pikku/kysely-sqlite
|
|
2
2
|
|
|
3
|
+
## 0.12.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fd9d834: Stop publishing internals that only their own package or file used. The declarations stay; only the entrypoint re-export is removed, so nothing that imported a name from where it is declared is affected.
|
|
8
|
+
- Updated dependencies [063f43a]
|
|
9
|
+
- Updated dependencies [ce66bf8]
|
|
10
|
+
- Updated dependencies [d0307a8]
|
|
11
|
+
- Updated dependencies [ce66bf8]
|
|
12
|
+
- Updated dependencies [3ad2131]
|
|
13
|
+
- Updated dependencies [b930dca]
|
|
14
|
+
- Updated dependencies [b95e77d]
|
|
15
|
+
- Updated dependencies [fd9d834]
|
|
16
|
+
- Updated dependencies [8978fbd]
|
|
17
|
+
- @pikku/core@0.12.82
|
|
18
|
+
- @pikku/kysely@0.13.15
|
|
19
|
+
|
|
20
|
+
## 0.12.10
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 9d62571: Make user-defined SQL functions an explicit, checked capability of the SQLite drivers.
|
|
25
|
+
|
|
26
|
+
`node:sqlite` can register scalar UDFs (`db.function()`); `bun:sqlite` cannot. Until now
|
|
27
|
+
neither driver mentioned that, so an app that registered a UDF by reaching for the raw
|
|
28
|
+
connection worked on Node and, on bun, failed as `no such function: …` from whichever
|
|
29
|
+
query used it — typically one endpoint breaking in production while everything else
|
|
30
|
+
looked healthy.
|
|
31
|
+
|
|
32
|
+
Both drivers now export `registerSqliteFunctions(db, functions)` and accept a
|
|
33
|
+
`functions` option on `createNodeSqliteKysely` / `createBunSqliteKysely`. The Node
|
|
34
|
+
implementation registers them as deterministic; the bun implementation throws
|
|
35
|
+
`SqliteFunctionsUnsupportedError` — exported from `@pikku/kysely-sqlite`, and naming
|
|
36
|
+
every function requested — so the incompatibility surfaces at wiring time with a message
|
|
37
|
+
saying what to do about it.
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [32277d5]
|
|
40
|
+
- Updated dependencies [ea8aabf]
|
|
41
|
+
- Updated dependencies [33e96ab]
|
|
42
|
+
- Updated dependencies [fd72e58]
|
|
43
|
+
- Updated dependencies [cabd9dc]
|
|
44
|
+
- Updated dependencies [fd72e58]
|
|
45
|
+
- Updated dependencies [fd72e58]
|
|
46
|
+
- Updated dependencies [894b2f8]
|
|
47
|
+
- Updated dependencies [dd19aa7]
|
|
48
|
+
- Updated dependencies [50ec500]
|
|
49
|
+
- @pikku/core@0.12.75
|
|
50
|
+
- @pikku/kysely@0.13.8
|
|
51
|
+
|
|
3
52
|
## 0.12.9
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
package/dist/src/index.d.ts
CHANGED
|
@@ -7,9 +7,8 @@ export { SQLiteKyselyWorkflowRunService } from './sqlite-kysely-workflow-run-ser
|
|
|
7
7
|
export { SQLiteKyselyChannelStore } from './sqlite-kysely-channel-store.js';
|
|
8
8
|
export { SQLiteKyselyEventHubStore } from './sqlite-kysely-eventhub-store.js';
|
|
9
9
|
export { SQLiteKyselySecretService } from './sqlite-kysely-secret-service.js';
|
|
10
|
+
export { SqliteFunctionsUnsupportedError, type SqliteFunctionMap, } from './sqlite-functions.js';
|
|
10
11
|
export { LibsqlWebDialect } from './libsql-web-dialect.js';
|
|
11
|
-
export type { LibsqlWebDialectConfig } from './libsql-web-dialect.js';
|
|
12
12
|
export type { KyselyPikkuDB } from '@pikku/kysely';
|
|
13
|
-
export type { KyselySecretServiceConfig } from '@pikku/kysely';
|
|
14
13
|
export type { WorkflowRunService } from '@pikku/core/workflow';
|
|
15
14
|
export type { AgentRunService, AgentRunRow } from '@pikku/core/ai-agent';
|
package/dist/src/index.js
CHANGED
|
@@ -7,4 +7,5 @@ export { SQLiteKyselyWorkflowRunService } from './sqlite-kysely-workflow-run-ser
|
|
|
7
7
|
export { SQLiteKyselyChannelStore } from './sqlite-kysely-channel-store.js';
|
|
8
8
|
export { SQLiteKyselyEventHubStore } from './sqlite-kysely-eventhub-store.js';
|
|
9
9
|
export { SQLiteKyselySecretService } from './sqlite-kysely-secret-service.js';
|
|
10
|
+
export { SqliteFunctionsUnsupportedError, } from './sqlite-functions.js';
|
|
10
11
|
export { LibsqlWebDialect } from './libsql-web-dialect.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-defined SQL functions, shared between the runtime-specific SQLite
|
|
3
|
+
* drivers so that `functions: { … }` means the same thing whichever one an app
|
|
4
|
+
* is wired to.
|
|
5
|
+
*
|
|
6
|
+
* Only `@pikku/kysely-node-sqlite` can actually register them. bun:sqlite has
|
|
7
|
+
* no equivalent of `db.function()`, so `@pikku/kysely-bun-sqlite` rejects this
|
|
8
|
+
* option outright rather than accepting it and letting the queries fail. That
|
|
9
|
+
* asymmetry is the whole reason this type is declared once, in a package both
|
|
10
|
+
* depend on: an app that names its UDFs against this type finds out at wiring
|
|
11
|
+
* time — or at the type level — that it cannot move to bun, instead of finding
|
|
12
|
+
* out as `no such function: …` from whichever endpoint happens to use it.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* A scalar SQL function. Arguments arrive as the values SQLite stores — string,
|
|
16
|
+
* number, bigint, Uint8Array or null — and the return value must be one SQLite
|
|
17
|
+
* can store, so no Date, boolean or object.
|
|
18
|
+
*/
|
|
19
|
+
export type SqliteFunction = (...args: Array<string | number | bigint | Uint8Array | null>) => string | number | bigint | Uint8Array | null;
|
|
20
|
+
/** Scalar SQL functions to register, keyed by the name SQL will call them by. */
|
|
21
|
+
export type SqliteFunctionMap = Record<string, SqliteFunction>;
|
|
22
|
+
/**
|
|
23
|
+
* Thrown when UDFs are requested on a runtime that cannot provide them.
|
|
24
|
+
*
|
|
25
|
+
* Its own class rather than a plain Error because the one sensible reaction —
|
|
26
|
+
* fall back to doing the work outside SQL — is worth being able to catch for.
|
|
27
|
+
*/
|
|
28
|
+
export declare class SqliteFunctionsUnsupportedError extends Error {
|
|
29
|
+
readonly runtime: string;
|
|
30
|
+
readonly functionNames: string[];
|
|
31
|
+
constructor(runtime: string, functionNames: string[]);
|
|
32
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-defined SQL functions, shared between the runtime-specific SQLite
|
|
3
|
+
* drivers so that `functions: { … }` means the same thing whichever one an app
|
|
4
|
+
* is wired to.
|
|
5
|
+
*
|
|
6
|
+
* Only `@pikku/kysely-node-sqlite` can actually register them. bun:sqlite has
|
|
7
|
+
* no equivalent of `db.function()`, so `@pikku/kysely-bun-sqlite` rejects this
|
|
8
|
+
* option outright rather than accepting it and letting the queries fail. That
|
|
9
|
+
* asymmetry is the whole reason this type is declared once, in a package both
|
|
10
|
+
* depend on: an app that names its UDFs against this type finds out at wiring
|
|
11
|
+
* time — or at the type level — that it cannot move to bun, instead of finding
|
|
12
|
+
* out as `no such function: …` from whichever endpoint happens to use it.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Thrown when UDFs are requested on a runtime that cannot provide them.
|
|
16
|
+
*
|
|
17
|
+
* Its own class rather than a plain Error because the one sensible reaction —
|
|
18
|
+
* fall back to doing the work outside SQL — is worth being able to catch for.
|
|
19
|
+
*/
|
|
20
|
+
export class SqliteFunctionsUnsupportedError extends Error {
|
|
21
|
+
runtime;
|
|
22
|
+
functionNames;
|
|
23
|
+
constructor(runtime, functionNames) {
|
|
24
|
+
super(`${runtime} cannot register user-defined SQL functions, but ${functionNames.length} were requested: ${functionNames.join(', ')}.\n\n` +
|
|
25
|
+
`Every query calling them would fail with "no such function". Options:\n` +
|
|
26
|
+
` - run on Node with @pikku/kysely-node-sqlite, which supports them; or\n` +
|
|
27
|
+
` - do the work outside SQL, narrowing rows with an index first so the\n` +
|
|
28
|
+
` computation runs over a candidate set rather than the whole table.`);
|
|
29
|
+
this.runtime = runtime;
|
|
30
|
+
this.functionNames = functionNames;
|
|
31
|
+
this.name = 'SqliteFunctionsUnsupportedError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/create-sqlite-kysely.ts","../src/index.ts","../src/libsql-web-dialect.ts","../src/sqlite-kysely-agent-run-service.ts","../src/sqlite-kysely-ai-storage-service.ts","../src/sqlite-kysely-channel-store.ts","../src/sqlite-kysely-deployment-service.ts","../src/sqlite-kysely-eventhub-store.ts","../src/sqlite-kysely-secret-service.ts","../src/sqlite-kysely-workflow-run-service.ts","../src/sqlite-kysely-workflow-service.ts"],"version":"6.0.3"}
|
|
1
|
+
{"root":["../src/create-sqlite-kysely.ts","../src/index.ts","../src/libsql-web-dialect.ts","../src/sqlite-functions.ts","../src/sqlite-kysely-agent-run-service.ts","../src/sqlite-kysely-ai-storage-service.ts","../src/sqlite-kysely-channel-store.ts","../src/sqlite-kysely-deployment-service.ts","../src/sqlite-kysely-eventhub-store.ts","../src/sqlite-kysely-secret-service.ts","../src/sqlite-kysely-workflow-run-service.ts","../src/sqlite-kysely-workflow-service.ts"],"version":"6.0.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/kysely-sqlite",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.11",
|
|
4
4
|
"description": "SQLite dialect services and libSQL web dialect for Pikku, backed by Kysely",
|
|
5
5
|
"author": "yasser.fadl@gmail.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"prepublishOnly": "yarn build"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@pikku/kysely": "^0.13.
|
|
20
|
+
"@pikku/kysely": "^0.13.15",
|
|
21
21
|
"kysely": "^0.29.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@pikku/core": "^0.12.
|
|
24
|
+
"@pikku/core": "^0.12.82"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@pikku/core": "^0.12.
|
|
27
|
+
"@pikku/core": "^0.12.82",
|
|
28
28
|
"typescript": "^6.0.3"
|
|
29
29
|
},
|
|
30
30
|
"exports": {
|
package/src/index.ts
CHANGED
|
@@ -7,10 +7,12 @@ export { SQLiteKyselyWorkflowRunService } from './sqlite-kysely-workflow-run-ser
|
|
|
7
7
|
export { SQLiteKyselyChannelStore } from './sqlite-kysely-channel-store.js'
|
|
8
8
|
export { SQLiteKyselyEventHubStore } from './sqlite-kysely-eventhub-store.js'
|
|
9
9
|
export { SQLiteKyselySecretService } from './sqlite-kysely-secret-service.js'
|
|
10
|
+
export {
|
|
11
|
+
SqliteFunctionsUnsupportedError,
|
|
12
|
+
type SqliteFunctionMap,
|
|
13
|
+
} from './sqlite-functions.js'
|
|
10
14
|
export { LibsqlWebDialect } from './libsql-web-dialect.js'
|
|
11
|
-
export type { LibsqlWebDialectConfig } from './libsql-web-dialect.js'
|
|
12
15
|
|
|
13
16
|
export type { KyselyPikkuDB } from '@pikku/kysely'
|
|
14
|
-
export type { KyselySecretServiceConfig } from '@pikku/kysely'
|
|
15
17
|
export type { WorkflowRunService } from '@pikku/core/workflow'
|
|
16
18
|
export type { AgentRunService, AgentRunRow } from '@pikku/core/ai-agent'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-defined SQL functions, shared between the runtime-specific SQLite
|
|
3
|
+
* drivers so that `functions: { … }` means the same thing whichever one an app
|
|
4
|
+
* is wired to.
|
|
5
|
+
*
|
|
6
|
+
* Only `@pikku/kysely-node-sqlite` can actually register them. bun:sqlite has
|
|
7
|
+
* no equivalent of `db.function()`, so `@pikku/kysely-bun-sqlite` rejects this
|
|
8
|
+
* option outright rather than accepting it and letting the queries fail. That
|
|
9
|
+
* asymmetry is the whole reason this type is declared once, in a package both
|
|
10
|
+
* depend on: an app that names its UDFs against this type finds out at wiring
|
|
11
|
+
* time — or at the type level — that it cannot move to bun, instead of finding
|
|
12
|
+
* out as `no such function: …` from whichever endpoint happens to use it.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A scalar SQL function. Arguments arrive as the values SQLite stores — string,
|
|
17
|
+
* number, bigint, Uint8Array or null — and the return value must be one SQLite
|
|
18
|
+
* can store, so no Date, boolean or object.
|
|
19
|
+
*/
|
|
20
|
+
export type SqliteFunction = (
|
|
21
|
+
...args: Array<string | number | bigint | Uint8Array | null>
|
|
22
|
+
) => string | number | bigint | Uint8Array | null
|
|
23
|
+
|
|
24
|
+
/** Scalar SQL functions to register, keyed by the name SQL will call them by. */
|
|
25
|
+
export type SqliteFunctionMap = Record<string, SqliteFunction>
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Thrown when UDFs are requested on a runtime that cannot provide them.
|
|
29
|
+
*
|
|
30
|
+
* Its own class rather than a plain Error because the one sensible reaction —
|
|
31
|
+
* fall back to doing the work outside SQL — is worth being able to catch for.
|
|
32
|
+
*/
|
|
33
|
+
export class SqliteFunctionsUnsupportedError extends Error {
|
|
34
|
+
constructor(
|
|
35
|
+
readonly runtime: string,
|
|
36
|
+
readonly functionNames: string[]
|
|
37
|
+
) {
|
|
38
|
+
super(
|
|
39
|
+
`${runtime} cannot register user-defined SQL functions, but ${functionNames.length} were requested: ${functionNames.join(', ')}.\n\n` +
|
|
40
|
+
`Every query calling them would fail with "no such function". Options:\n` +
|
|
41
|
+
` - run on Node with @pikku/kysely-node-sqlite, which supports them; or\n` +
|
|
42
|
+
` - do the work outside SQL, narrowing rows with an index first so the\n` +
|
|
43
|
+
` computation runs over a candidate set rather than the whole table.`
|
|
44
|
+
)
|
|
45
|
+
this.name = 'SqliteFunctionsUnsupportedError'
|
|
46
|
+
}
|
|
47
|
+
}
|