@prisma-next/family-sql 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 +90 -0
- package/dist/exports/control-adapter.d.ts +44 -0
- package/dist/exports/control-adapter.js +1 -0
- package/dist/exports/control-adapter.js.map +1 -0
- package/dist/exports/control.d.ts +148 -0
- package/dist/exports/control.js +1439 -0
- package/dist/exports/control.js.map +1 -0
- package/dist/exports/index-Bi3Sr19r.d.ts +28 -0
- package/dist/exports/runtime.d.ts +296 -0
- package/dist/exports/runtime.js +71 -0
- package/dist/exports/runtime.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// src/core/runtime-instance.ts
|
|
2
|
+
import { createRuntime, createRuntimeContext } from "@prisma-next/sql-runtime";
|
|
3
|
+
function createSqlRuntimeFamilyInstance(options) {
|
|
4
|
+
const {
|
|
5
|
+
adapter: adapterDescriptor,
|
|
6
|
+
driver: driverDescriptor,
|
|
7
|
+
extensions: extensionDescriptors
|
|
8
|
+
} = options;
|
|
9
|
+
return {
|
|
10
|
+
familyId: "sql",
|
|
11
|
+
createRuntime(runtimeOptions) {
|
|
12
|
+
const adapterInstance = adapterDescriptor.create();
|
|
13
|
+
const driverInstance = driverDescriptor.create(runtimeOptions.driverOptions);
|
|
14
|
+
const extensionInstances = extensionDescriptors.map((ext) => ext.create());
|
|
15
|
+
const descriptorExtensions = extensionInstances.map((ext) => {
|
|
16
|
+
const extension = {};
|
|
17
|
+
if ("codecs" in ext && typeof ext.codecs === "function") {
|
|
18
|
+
extension.codecs = ext.codecs;
|
|
19
|
+
}
|
|
20
|
+
if ("operations" in ext && typeof ext.operations === "function") {
|
|
21
|
+
extension.operations = ext.operations;
|
|
22
|
+
}
|
|
23
|
+
return extension;
|
|
24
|
+
});
|
|
25
|
+
const extensions = [...descriptorExtensions, ...runtimeOptions.extensions ?? []];
|
|
26
|
+
const adapter = adapterInstance;
|
|
27
|
+
const context = createRuntimeContext({
|
|
28
|
+
contract: runtimeOptions.contract,
|
|
29
|
+
adapter,
|
|
30
|
+
extensions
|
|
31
|
+
});
|
|
32
|
+
const runtimeOptions_ = {
|
|
33
|
+
adapter,
|
|
34
|
+
driver: driverInstance,
|
|
35
|
+
verify: runtimeOptions.verify,
|
|
36
|
+
context,
|
|
37
|
+
...runtimeOptions.plugins ? { plugins: runtimeOptions.plugins } : {},
|
|
38
|
+
...runtimeOptions.mode ? { mode: runtimeOptions.mode } : {},
|
|
39
|
+
...runtimeOptions.log ? { log: runtimeOptions.log } : {}
|
|
40
|
+
};
|
|
41
|
+
return createRuntime(runtimeOptions_);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// src/core/runtime-descriptor.ts
|
|
47
|
+
var sqlFamilyManifest = {
|
|
48
|
+
id: "sql",
|
|
49
|
+
version: "0.0.1"
|
|
50
|
+
};
|
|
51
|
+
var SqlRuntimeFamilyDescriptor = class {
|
|
52
|
+
kind = "family";
|
|
53
|
+
id = "sql";
|
|
54
|
+
familyId = "sql";
|
|
55
|
+
manifest = sqlFamilyManifest;
|
|
56
|
+
create(options) {
|
|
57
|
+
return createSqlRuntimeFamilyInstance({
|
|
58
|
+
target: options.target,
|
|
59
|
+
adapter: options.adapter,
|
|
60
|
+
driver: options.driver,
|
|
61
|
+
extensions: options.extensions
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/exports/runtime.ts
|
|
67
|
+
var runtime_default = new SqlRuntimeFamilyDescriptor();
|
|
68
|
+
export {
|
|
69
|
+
runtime_default as default
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/runtime-instance.ts","../../src/core/runtime-descriptor.ts","../../src/exports/runtime.ts"],"sourcesContent":["import type {\n RuntimeAdapterDescriptor,\n RuntimeDriverDescriptor,\n RuntimeExtensionDescriptor,\n RuntimeFamilyInstance,\n RuntimeTargetDescriptor,\n} from '@prisma-next/core-execution-plane/types';\nimport type { Log, Plugin, RuntimeVerifyOptions } from '@prisma-next/runtime-executor';\nimport type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';\nimport type {\n Adapter,\n LoweredStatement,\n SelectAst,\n SqlDriver,\n} from '@prisma-next/sql-relational-core/ast';\nimport type { Runtime, RuntimeContext, RuntimeOptions } from '@prisma-next/sql-runtime';\nimport { createRuntime, createRuntimeContext, type Extension } from '@prisma-next/sql-runtime';\n\n/**\n * SQL runtime family instance interface.\n * Extends base RuntimeFamilyInstance with SQL-specific runtime creation method.\n */\nexport interface SqlRuntimeFamilyInstance extends RuntimeFamilyInstance<'sql'> {\n /**\n * Creates a SQL runtime from contract, adapter, driver, and extensions.\n *\n * @param options - Runtime creation options\n * @param options.contract - SQL contract\n * @param options.driverOptions - Driver options (e.g., PostgresDriverOptions)\n * @param options.verify - Runtime verification options\n * @param options.extensions - Optional extensions (Extension objects, not descriptors)\n * @param options.plugins - Optional plugins\n * @param options.mode - Optional runtime mode\n * @param options.log - Optional log instance\n * @returns Runtime instance\n */\n createRuntime<TContract extends SqlContract<SqlStorage>>(options: {\n readonly contract: TContract;\n readonly driverOptions: unknown;\n readonly verify: RuntimeVerifyOptions;\n readonly extensions?: readonly Extension[];\n readonly plugins?: readonly Plugin<\n TContract,\n Adapter<SelectAst, SqlContract<SqlStorage>, LoweredStatement>,\n SqlDriver\n >[];\n readonly mode?: 'strict' | 'permissive';\n readonly log?: Log;\n }): Runtime;\n}\n\n/**\n * Creates a SQL runtime family instance from runtime descriptors.\n */\nexport function createSqlRuntimeFamilyInstance(options: {\n readonly target: RuntimeTargetDescriptor<'sql', string>;\n readonly adapter: RuntimeAdapterDescriptor<'sql', string>;\n readonly driver: RuntimeDriverDescriptor<'sql', string>;\n readonly extensions: readonly RuntimeExtensionDescriptor<'sql', string>[];\n}): SqlRuntimeFamilyInstance {\n const {\n adapter: adapterDescriptor,\n driver: driverDescriptor,\n extensions: extensionDescriptors,\n } = options;\n\n return {\n familyId: 'sql' as const,\n createRuntime<TContract extends SqlContract<SqlStorage>>(runtimeOptions: {\n readonly contract: TContract;\n readonly driverOptions: unknown;\n readonly verify: RuntimeVerifyOptions;\n readonly extensions?: readonly Extension[];\n readonly plugins?: readonly Plugin<\n TContract,\n Adapter<SelectAst, SqlContract<SqlStorage>, LoweredStatement>,\n SqlDriver\n >[];\n readonly mode?: 'strict' | 'permissive';\n readonly log?: Log;\n }): Runtime {\n const adapterInstance = adapterDescriptor.create();\n const driverInstance = driverDescriptor.create(runtimeOptions.driverOptions);\n\n const extensionInstances = extensionDescriptors.map((ext) => ext.create());\n\n const descriptorExtensions: Extension[] = extensionInstances.map((ext) => {\n const extension: Extension = {};\n if ('codecs' in ext && typeof ext.codecs === 'function') {\n extension.codecs =\n ext.codecs as () => import('@prisma-next/sql-relational-core/ast').CodecRegistry;\n }\n if ('operations' in ext && typeof ext.operations === 'function') {\n extension.operations =\n ext.operations as () => readonly import('@prisma-next/sql-operations').SqlOperationSignature[];\n }\n return extension;\n });\n\n const extensions = [...descriptorExtensions, ...(runtimeOptions.extensions ?? [])];\n\n const adapter = adapterInstance as unknown as Adapter<\n SelectAst,\n SqlContract<SqlStorage>,\n LoweredStatement\n >;\n\n const context = createRuntimeContext({\n contract: runtimeOptions.contract,\n adapter,\n extensions,\n }) as RuntimeContext<TContract>;\n\n const runtimeOptions_: RuntimeOptions<TContract> = {\n adapter,\n driver: driverInstance as SqlDriver,\n verify: runtimeOptions.verify,\n context,\n ...(runtimeOptions.plugins ? { plugins: runtimeOptions.plugins } : {}),\n ...(runtimeOptions.mode ? { mode: runtimeOptions.mode } : {}),\n ...(runtimeOptions.log ? { log: runtimeOptions.log } : {}),\n };\n\n return createRuntime(runtimeOptions_);\n },\n };\n}\n","import type { ExtensionPackManifest } from '@prisma-next/contract/pack-manifest-types';\nimport type {\n RuntimeAdapterDescriptor,\n RuntimeDriverDescriptor,\n RuntimeExtensionDescriptor,\n RuntimeFamilyDescriptor,\n RuntimeTargetDescriptor,\n} from '@prisma-next/core-execution-plane/types';\nimport { createSqlRuntimeFamilyInstance, type SqlRuntimeFamilyInstance } from './runtime-instance';\n\n/**\n * SQL family manifest for runtime plane.\n */\nconst sqlFamilyManifest: ExtensionPackManifest = {\n id: 'sql',\n version: '0.0.1',\n};\n\n/**\n * SQL runtime family descriptor implementation.\n * Provides factory method to create SQL runtime family instance.\n */\nexport class SqlRuntimeFamilyDescriptor\n implements RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance>\n{\n readonly kind = 'family' as const;\n readonly id = 'sql';\n readonly familyId = 'sql' as const;\n readonly manifest = sqlFamilyManifest;\n\n create<TTargetId extends string>(options: {\n readonly target: RuntimeTargetDescriptor<'sql', TTargetId>;\n readonly adapter: RuntimeAdapterDescriptor<'sql', TTargetId>;\n readonly driver: RuntimeDriverDescriptor<'sql', TTargetId>;\n readonly extensions: readonly RuntimeExtensionDescriptor<'sql', TTargetId>[];\n }): SqlRuntimeFamilyInstance {\n return createSqlRuntimeFamilyInstance({\n target: options.target,\n adapter: options.adapter,\n driver: options.driver,\n extensions: options.extensions,\n });\n }\n}\n","import { SqlRuntimeFamilyDescriptor } from '../core/runtime-descriptor';\n\n/**\n * SQL runtime family descriptor for execution/runtime plane.\n * Provides factory method to create SQL runtime family instance.\n */\nexport default new SqlRuntimeFamilyDescriptor();\n"],"mappings":";AAgBA,SAAS,eAAe,4BAA4C;AAsC7D,SAAS,+BAA+B,SAKlB;AAC3B,QAAM;AAAA,IACJ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,YAAY;AAAA,EACd,IAAI;AAEJ,SAAO;AAAA,IACL,UAAU;AAAA,IACV,cAAyD,gBAY7C;AACV,YAAM,kBAAkB,kBAAkB,OAAO;AACjD,YAAM,iBAAiB,iBAAiB,OAAO,eAAe,aAAa;AAE3E,YAAM,qBAAqB,qBAAqB,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package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prisma-next/family-sql",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"description": "SQL family descriptor for Prisma Next",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"arktype": "^2.0.0",
|
|
9
|
+
"@prisma-next/core-execution-plane": "0.0.1",
|
|
10
|
+
"@prisma-next/cli": "0.0.1",
|
|
11
|
+
"@prisma-next/core-control-plane": "0.0.1",
|
|
12
|
+
"@prisma-next/contract": "0.0.1",
|
|
13
|
+
"@prisma-next/sql-contract": "0.0.1",
|
|
14
|
+
"@prisma-next/sql-operations": "0.0.1",
|
|
15
|
+
"@prisma-next/sql-contract-emitter": "0.0.1",
|
|
16
|
+
"@prisma-next/sql-runtime": "0.0.1",
|
|
17
|
+
"@prisma-next/sql-contract-ts": "0.0.1",
|
|
18
|
+
"@prisma-next/sql-schema-ir": "0.0.1"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"tsup": "^8.3.0",
|
|
22
|
+
"typescript": "^5.9.3",
|
|
23
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
24
|
+
"vitest": "^2.1.1",
|
|
25
|
+
"@prisma-next/driver-postgres": "0.0.1",
|
|
26
|
+
"@prisma-next/test-utils": "0.0.1",
|
|
27
|
+
"@prisma-next/targets-postgres": "0.0.1"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"exports": {
|
|
33
|
+
"./control": {
|
|
34
|
+
"types": "./dist/exports/control.d.ts",
|
|
35
|
+
"import": "./dist/exports/control.js"
|
|
36
|
+
},
|
|
37
|
+
"./control-adapter": {
|
|
38
|
+
"types": "./dist/exports/control-adapter.d.ts",
|
|
39
|
+
"import": "./dist/exports/control-adapter.js"
|
|
40
|
+
},
|
|
41
|
+
"./runtime": {
|
|
42
|
+
"types": "./dist/exports/runtime.d.ts",
|
|
43
|
+
"import": "./dist/exports/runtime.js"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsup --config tsup.config.ts",
|
|
48
|
+
"test": "vitest run --passWithNoTests",
|
|
49
|
+
"test:coverage": "vitest run --coverage --passWithNoTests",
|
|
50
|
+
"typecheck": "tsc --project tsconfig.json --noEmit",
|
|
51
|
+
"lint": "biome check . --config-path ../../../biome.json --error-on-warnings",
|
|
52
|
+
"clean": "node ../../../scripts/clean.mjs"
|
|
53
|
+
}
|
|
54
|
+
}
|