@prisma-next/sql-operations 0.5.0-dev.9 → 0.6.0-dev.1
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/README.md +5 -10
- package/dist/index.d.mts +12 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -8
- package/src/index.ts +12 -4
package/README.md
CHANGED
|
@@ -16,7 +16,8 @@ This package provides SQL-specific operation types that extend the generic `Oper
|
|
|
16
16
|
|
|
17
17
|
- **SQL Operation Types**: SQL-specific operation entry and descriptor types
|
|
18
18
|
- `SqlOperationEntry`: Extends `OperationEntry` with a `lowering` field (`SqlLoweringSpec`)
|
|
19
|
-
- `SqlOperationDescriptor`:
|
|
19
|
+
- `SqlOperationDescriptor`: Alias for `SqlOperationEntry` used at registration sites
|
|
20
|
+
- `SqlOperationDescriptors`: `Readonly<Record<string, SqlOperationDescriptor>>` — the keyed-record shape adapter/extension `queryOperations()` factories return
|
|
20
21
|
- `SqlLoweringSpec`: SQL-specific lowering specification (`targetFamily`, `strategy`, `template`)
|
|
21
22
|
- `SqlOperationRegistry`: Typed registry alias (`OperationRegistry<SqlOperationEntry>`)
|
|
22
23
|
|
|
@@ -72,17 +73,11 @@ import {
|
|
|
72
73
|
const registry = createSqlOperationRegistry();
|
|
73
74
|
|
|
74
75
|
const descriptor: SqlOperationDescriptor = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
returns: { codecId: 'pg/float8@1', nullable: false },
|
|
78
|
-
lowering: {
|
|
79
|
-
targetFamily: 'sql',
|
|
80
|
-
strategy: 'infix',
|
|
81
|
-
template: '{{self}} <=> {{arg0}}',
|
|
82
|
-
},
|
|
76
|
+
self: { codecId: 'pg/vector@1' },
|
|
77
|
+
impl: () => ({ returnType: { codecId: 'pg/float8@1', nullable: false } }),
|
|
83
78
|
};
|
|
84
79
|
|
|
85
|
-
registry.register(descriptor);
|
|
80
|
+
registry.register('cosineDistance', descriptor);
|
|
86
81
|
|
|
87
82
|
const entries = registry.entries(); // Record<string, SqlOperationEntry>
|
|
88
83
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OperationDescriptor,
|
|
1
|
+
import { OperationDescriptor, OperationDescriptors, OperationRegistry } from "@prisma-next/operations";
|
|
2
|
+
import { QueryOperationTypeEntry } from "@prisma-next/sql-contract/types";
|
|
2
3
|
|
|
3
4
|
//#region src/index.d.ts
|
|
4
5
|
interface SqlLoweringSpec {
|
|
@@ -6,12 +7,18 @@ interface SqlLoweringSpec {
|
|
|
6
7
|
readonly strategy: 'infix' | 'function';
|
|
7
8
|
readonly template: string;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Runtime shape of a SQL operation entry — tightened beyond the framework's
|
|
12
|
+
* target-agnostic `OperationEntry` so `impl` returns a codec-exact
|
|
13
|
+
* `QueryOperationReturn` instead of `unknown`. Consumers (ORM column helper,
|
|
14
|
+
* sql-builder `fns` dispatch) can read `result.returnType.codecId` without a
|
|
15
|
+
* cast.
|
|
16
|
+
*/
|
|
17
|
+
type SqlOperationEntry = QueryOperationTypeEntry;
|
|
12
18
|
type SqlOperationDescriptor = OperationDescriptor<SqlOperationEntry>;
|
|
19
|
+
type SqlOperationDescriptors = OperationDescriptors<SqlOperationEntry>;
|
|
13
20
|
type SqlOperationRegistry = OperationRegistry<SqlOperationEntry>;
|
|
14
21
|
declare function createSqlOperationRegistry(): SqlOperationRegistry;
|
|
15
22
|
//#endregion
|
|
16
|
-
export { SqlLoweringSpec, SqlOperationDescriptor, SqlOperationEntry, SqlOperationRegistry, createSqlOperationRegistry };
|
|
23
|
+
export { SqlLoweringSpec, SqlOperationDescriptor, SqlOperationDescriptors, SqlOperationEntry, SqlOperationRegistry, createSqlOperationRegistry };
|
|
17
24
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;UAQiB,eAAA;EAAA,SACN,YAAA;EAAA,SACA,QAAA;EAAA,SACA,QAAA;AAAA;;;;;;;AAUX;KAAY,iBAAA,GAAoB,uBAAA;AAAA,KAEpB,sBAAA,GAAyB,mBAAA,CAAoB,iBAAA;AAAA,KAE7C,uBAAA,GAA0B,oBAAA,CAAqB,iBAAA;AAAA,KAE/C,oBAAA,GAAuB,iBAAA,CAAkB,iBAAA;AAAA,iBAErC,0BAAA,CAAA,GAA8B,oBAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { createOperationRegistry } from "@prisma-next/operations";
|
|
2
|
-
|
|
3
2
|
//#region src/index.ts
|
|
4
3
|
function createSqlOperationRegistry() {
|
|
5
4
|
return createOperationRegistry();
|
|
6
5
|
}
|
|
7
|
-
|
|
8
6
|
//#endregion
|
|
9
7
|
export { createSqlOperationRegistry };
|
|
8
|
+
|
|
10
9
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type {\n OperationDescriptor,\n
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type {\n OperationDescriptor,\n OperationDescriptors,\n OperationRegistry,\n} from '@prisma-next/operations';\nimport { createOperationRegistry } from '@prisma-next/operations';\nimport type { QueryOperationTypeEntry } from '@prisma-next/sql-contract/types';\n\nexport interface SqlLoweringSpec {\n readonly targetFamily: 'sql';\n readonly strategy: 'infix' | 'function';\n readonly template: string;\n}\n\n/**\n * Runtime shape of a SQL operation entry — tightened beyond the framework's\n * target-agnostic `OperationEntry` so `impl` returns a codec-exact\n * `QueryOperationReturn` instead of `unknown`. Consumers (ORM column helper,\n * sql-builder `fns` dispatch) can read `result.returnType.codecId` without a\n * cast.\n */\nexport type SqlOperationEntry = QueryOperationTypeEntry;\n\nexport type SqlOperationDescriptor = OperationDescriptor<SqlOperationEntry>;\n\nexport type SqlOperationDescriptors = OperationDescriptors<SqlOperationEntry>;\n\nexport type SqlOperationRegistry = OperationRegistry<SqlOperationEntry>;\n\nexport function createSqlOperationRegistry(): SqlOperationRegistry {\n return createOperationRegistry<SqlOperationEntry>();\n}\n"],"mappings":";;AA6BA,SAAgB,6BAAmD;CACjE,OAAO,yBAA4C"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/sql-operations",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-dev.1",
|
|
4
|
+
"license": "Apache-2.0",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"sideEffects": false,
|
|
6
7
|
"description": "SQL-specific operations for Prisma Next",
|
|
7
8
|
"dependencies": {
|
|
8
|
-
"arktype": "^2.1.
|
|
9
|
-
"@prisma-next/operations": "0.
|
|
9
|
+
"arktype": "^2.1.29",
|
|
10
|
+
"@prisma-next/operations": "0.6.0-dev.1",
|
|
11
|
+
"@prisma-next/sql-contract": "0.6.0-dev.1"
|
|
10
12
|
},
|
|
11
13
|
"devDependencies": {
|
|
12
|
-
"tsdown": "0.
|
|
14
|
+
"tsdown": "0.22.0",
|
|
13
15
|
"typescript": "5.9.3",
|
|
14
|
-
"vitest": "4.
|
|
16
|
+
"vitest": "4.1.5",
|
|
17
|
+
"@prisma-next/emitter": "0.6.0-dev.1",
|
|
15
18
|
"@prisma-next/test-utils": "0.0.1",
|
|
16
|
-
"@prisma-next/
|
|
17
|
-
"@prisma-next/
|
|
18
|
-
"@prisma-next/tsconfig": "0.0.0"
|
|
19
|
+
"@prisma-next/tsconfig": "0.0.0",
|
|
20
|
+
"@prisma-next/tsdown": "0.0.0"
|
|
19
21
|
},
|
|
20
22
|
"files": [
|
|
21
23
|
"dist",
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
OperationDescriptor,
|
|
3
|
-
|
|
3
|
+
OperationDescriptors,
|
|
4
4
|
OperationRegistry,
|
|
5
5
|
} from '@prisma-next/operations';
|
|
6
6
|
import { createOperationRegistry } from '@prisma-next/operations';
|
|
7
|
+
import type { QueryOperationTypeEntry } from '@prisma-next/sql-contract/types';
|
|
7
8
|
|
|
8
9
|
export interface SqlLoweringSpec {
|
|
9
10
|
readonly targetFamily: 'sql';
|
|
@@ -11,12 +12,19 @@ export interface SqlLoweringSpec {
|
|
|
11
12
|
readonly template: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Runtime shape of a SQL operation entry — tightened beyond the framework's
|
|
17
|
+
* target-agnostic `OperationEntry` so `impl` returns a codec-exact
|
|
18
|
+
* `QueryOperationReturn` instead of `unknown`. Consumers (ORM column helper,
|
|
19
|
+
* sql-builder `fns` dispatch) can read `result.returnType.codecId` without a
|
|
20
|
+
* cast.
|
|
21
|
+
*/
|
|
22
|
+
export type SqlOperationEntry = QueryOperationTypeEntry;
|
|
17
23
|
|
|
18
24
|
export type SqlOperationDescriptor = OperationDescriptor<SqlOperationEntry>;
|
|
19
25
|
|
|
26
|
+
export type SqlOperationDescriptors = OperationDescriptors<SqlOperationEntry>;
|
|
27
|
+
|
|
20
28
|
export type SqlOperationRegistry = OperationRegistry<SqlOperationEntry>;
|
|
21
29
|
|
|
22
30
|
export function createSqlOperationRegistry(): SqlOperationRegistry {
|