@prisma-next/sql-operations 0.0.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 ADDED
@@ -0,0 +1,99 @@
1
+ # @prisma-next/sql-operations
2
+
3
+ SQL-specific operation types and registry helpers for Prisma Next.
4
+
5
+ ## Package Classification
6
+
7
+ - **Domain**: sql
8
+ - **Layer**: core
9
+ - **Plane**: shared
10
+
11
+ ## Overview
12
+
13
+ This package provides SQL-specific operation types and typed registry helpers. It lives in the shared plane to allow both migration-plane (emitter/CLI) and runtime-plane (lanes/runtime) packages to import operation types without violating plane boundaries. The package contains only types and pure helpers (no pack I/O, no manifest assembly); manifest assembly is handled by the CLI/tooling layer.
14
+
15
+ ## Responsibilities
16
+
17
+ - **SQL Operation Types**: SQL-specific operation signature types
18
+ - `SqlOperationSignature`: SQL-specific operation signature (extends core `OperationSignature` with lowering specs)
19
+ - `SqlLoweringSpec`: SQL-specific lowering specification (target family, strategy, template)
20
+ - `SqlOperationRegistry`: Typed registry alias for SQL operations
21
+
22
+ - **Registry Helpers**: Typed helpers for creating and using SQL operation registries
23
+ - `createSqlOperationRegistry()`: Creates a typed SQL operation registry
24
+ - `register()`: Typed wrapper for registering operations in a registry
25
+
26
+ ## Dependencies
27
+
28
+ - **Depends on**:
29
+ - `@prisma-next/operations` (core operation registry types)
30
+ - **Depended on by**:
31
+ - `@prisma-next/sql-relational-core` (uses for operation execution)
32
+ - `@prisma-next/sql-runtime` (uses for operation signature types)
33
+ - `@prisma-next/cli` (uses types when assembling registries from packs)
34
+
35
+ ## Architecture
36
+
37
+ ```mermaid
38
+ flowchart TD
39
+ subgraph "Core Ring (Shared Plane)"
40
+ OPS[@prisma-next/operations]
41
+ SQL_OPS[@prisma-next/sql-operations]
42
+ end
43
+
44
+ subgraph "Tooling Ring (Migration Plane)"
45
+ CLI[@prisma-next/cli]
46
+ end
47
+
48
+ subgraph "Lanes Ring (Runtime Plane)"
49
+ REL_CORE[@prisma-next/sql-relational-core]
50
+ end
51
+
52
+ subgraph "Runtime Ring (Runtime Plane)"
53
+ SQL_RUNTIME[@prisma-next/sql-runtime]
54
+ end
55
+
56
+ OPS --> SQL_OPS
57
+ CLI --> SQL_OPS
58
+ SQL_OPS --> REL_CORE
59
+ SQL_OPS --> SQL_RUNTIME
60
+ ```
61
+
62
+ ## Usage
63
+
64
+ ### Creating and Using SQL Operation Registries
65
+
66
+ ```typescript
67
+ import {
68
+ createSqlOperationRegistry,
69
+ register,
70
+ type SqlOperationSignature,
71
+ } from '@prisma-next/sql-operations';
72
+
73
+ const registry = createSqlOperationRegistry();
74
+
75
+ const signature: SqlOperationSignature = {
76
+ forTypeId: 'pgvector/vector@1',
77
+ method: 'cosineDistance',
78
+ args: [{ kind: 'typeId', type: 'pgvector/vector@1' }],
79
+ returns: { kind: 'builtin', type: 'number' },
80
+ lowering: {
81
+ targetFamily: 'sql',
82
+ strategy: 'infix',
83
+ template: '${self} <=> ${arg0}',
84
+ },
85
+ };
86
+
87
+ register(registry, signature);
88
+
89
+ const operations = registry.byType('pgvector/vector@1');
90
+ ```
91
+
92
+ ### Assembling Operations from Extension Packs (CLI/Tooling)
93
+
94
+ For tooling code that works with extension packs, manifest assembly happens in the CLI layer. See `@prisma-next/cli` for pack assembly utilities.
95
+
96
+ ## Related Documentation
97
+
98
+ - [Package Layering](../../../../docs/architecture docs/Package-Layering.md)
99
+ - [ADR 140 - Package Layering & Target-Family Namespacing](../../../../docs/architecture docs/adrs/ADR 140 - Package Layering & Target-Family Namespacing.md)
@@ -0,0 +1,15 @@
1
+ import { OperationSignature, OperationRegistry } from '@prisma-next/operations';
2
+
3
+ interface SqlLoweringSpec {
4
+ readonly targetFamily: 'sql';
5
+ readonly strategy: 'infix' | 'function';
6
+ readonly template: string;
7
+ }
8
+ interface SqlOperationSignature extends OperationSignature {
9
+ readonly lowering: SqlLoweringSpec;
10
+ }
11
+ type SqlOperationRegistry = OperationRegistry;
12
+ declare function createSqlOperationRegistry(): SqlOperationRegistry;
13
+ declare function register(registry: SqlOperationRegistry, signature: SqlOperationSignature): void;
14
+
15
+ export { type SqlLoweringSpec, type SqlOperationRegistry, type SqlOperationSignature, createSqlOperationRegistry, register };
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ // src/index.ts
2
+ import { createOperationRegistry } from "@prisma-next/operations";
3
+ function createSqlOperationRegistry() {
4
+ return createOperationRegistry();
5
+ }
6
+ function register(registry, signature) {
7
+ registry.register(signature);
8
+ }
9
+ export {
10
+ createSqlOperationRegistry,
11
+ register
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {\n OperationSignature as CoreOperationSignature,\n OperationRegistry,\n} from '@prisma-next/operations';\nimport { createOperationRegistry } from '@prisma-next/operations';\n\nexport interface SqlLoweringSpec {\n readonly targetFamily: 'sql';\n readonly strategy: 'infix' | 'function';\n readonly template: string;\n}\n\nexport interface SqlOperationSignature extends CoreOperationSignature {\n readonly lowering: SqlLoweringSpec;\n}\n\nexport type SqlOperationRegistry = OperationRegistry;\n\nexport function createSqlOperationRegistry(): SqlOperationRegistry {\n return createOperationRegistry() as SqlOperationRegistry;\n}\n\nexport function register(registry: SqlOperationRegistry, signature: SqlOperationSignature): void {\n registry.register(signature);\n}\n"],"mappings":";AAIA,SAAS,+BAA+B;AAcjC,SAAS,6BAAmD;AACjE,SAAO,wBAAwB;AACjC;AAEO,SAAS,SAAS,UAAgC,WAAwC;AAC/F,WAAS,SAAS,SAAS;AAC7B;","names":[]}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@prisma-next/sql-operations",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "description": "SQL-specific operations for Prisma Next",
7
+ "dependencies": {
8
+ "arktype": "^2.1.26",
9
+ "@prisma-next/operations": "0.0.1"
10
+ },
11
+ "devDependencies": {
12
+ "tsup": "^8.3.0",
13
+ "typescript": "^5.9.3",
14
+ "vitest": "^2.1.1",
15
+ "@prisma-next/test-utils": "0.0.1",
16
+ "@prisma-next/emitter": "0.0.1"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js"
25
+ }
26
+ },
27
+ "scripts": {
28
+ "build": "tsup --config tsup.config.ts",
29
+ "test": "vitest run --passWithNoTests",
30
+ "test:coverage": "vitest run --coverage --passWithNoTests",
31
+ "typecheck": "tsc --project tsconfig.json --noEmit",
32
+ "lint": "biome check . --config-path ../../../biome.json --error-on-warnings",
33
+ "clean": "node ../../../scripts/clean.mjs"
34
+ }
35
+ }