@danielfgray/pg-sourcerer 0.3.0 → 0.4.0
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/bin/pgsourcerer +2 -0
- package/dist/__tests__/fixtures/index.d.ts +15 -0
- package/dist/__tests__/fixtures/index.d.ts.map +1 -0
- package/dist/__tests__/fixtures/index.js +19 -0
- package/dist/__tests__/fixtures/index.js.map +1 -0
- package/dist/__tests__/fixtures/introspection.json +40522 -0
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +7 -46
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +38 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -2
- package/dist/config.js.map +1 -1
- package/dist/{lib/conjure.d.ts → conjure/index.d.ts} +62 -3
- package/dist/conjure/index.d.ts.map +1 -0
- package/dist/{lib/conjure.js → conjure/index.js} +124 -3
- package/dist/conjure/index.js.map +1 -0
- package/dist/conjure/signature.d.ts +85 -0
- package/dist/conjure/signature.d.ts.map +1 -0
- package/dist/conjure/signature.js +130 -0
- package/dist/conjure/signature.js.map +1 -0
- package/dist/conjure/types.d.ts +97 -0
- package/dist/conjure/types.d.ts.map +1 -0
- package/dist/conjure/types.js +206 -0
- package/dist/conjure/types.js.map +1 -0
- package/dist/errors.d.ts +114 -139
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +82 -36
- package/dist/errors.js.map +1 -1
- package/dist/generate.d.ts +45 -46
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +86 -59
- package/dist/generate.js.map +1 -1
- package/dist/hex/builder.d.ts +12 -0
- package/dist/hex/builder.d.ts.map +1 -0
- package/dist/hex/builder.js +64 -0
- package/dist/hex/builder.js.map +1 -0
- package/dist/hex/ddl.d.ts +53 -0
- package/dist/hex/ddl.d.ts.map +1 -0
- package/dist/hex/ddl.js +306 -0
- package/dist/hex/ddl.js.map +1 -0
- package/dist/hex/index.d.ts +105 -0
- package/dist/hex/index.d.ts.map +1 -0
- package/dist/hex/index.js +81 -0
- package/dist/hex/index.js.map +1 -0
- package/dist/hex/primitives.d.ts +23 -0
- package/dist/hex/primitives.d.ts.map +1 -0
- package/dist/hex/primitives.js +38 -0
- package/dist/hex/primitives.js.map +1 -0
- package/dist/hex/query.d.ts +116 -0
- package/dist/hex/query.d.ts.map +1 -0
- package/dist/hex/query.js +219 -0
- package/dist/hex/query.js.map +1 -0
- package/dist/hex/types.d.ts +287 -0
- package/dist/hex/types.d.ts.map +1 -0
- package/dist/hex/types.js +431 -0
- package/dist/hex/types.js.map +1 -0
- package/dist/index.d.ts +17 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -44
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +76 -140
- package/dist/init.js.map +1 -1
- package/dist/ir/extensions/queries.d.ts +6 -6
- package/dist/ir/extensions/queries.d.ts.map +1 -1
- package/dist/ir/extensions/queries.js +6 -4
- package/dist/ir/extensions/queries.js.map +1 -1
- package/dist/ir/extensions/schema-builder.d.ts.map +1 -1
- package/dist/ir/extensions/schema-builder.js.map +1 -1
- package/dist/ir/index.d.ts.map +1 -1
- package/dist/ir/index.js.map +1 -1
- package/dist/ir/relation-graph.d.ts.map +1 -1
- package/dist/ir/relation-graph.js +8 -8
- package/dist/ir/relation-graph.js.map +1 -1
- package/dist/ir/semantic-ir.d.ts +38 -0
- package/dist/ir/semantic-ir.d.ts.map +1 -1
- package/dist/ir/semantic-ir.js +50 -2
- package/dist/ir/semantic-ir.js.map +1 -1
- package/dist/ir/smart-tags.d.ts.map +1 -1
- package/dist/ir/smart-tags.js.map +1 -1
- package/dist/lib/field-utils.d.ts.map +1 -1
- package/dist/lib/field-utils.js +7 -7
- package/dist/lib/field-utils.js.map +1 -1
- package/dist/lib/join-graph.d.ts +95 -0
- package/dist/lib/join-graph.d.ts.map +1 -0
- package/dist/lib/join-graph.js +305 -0
- package/dist/lib/join-graph.js.map +1 -0
- package/dist/lib/picker.d.ts +60 -0
- package/dist/lib/picker.d.ts.map +1 -0
- package/dist/lib/picker.js +325 -0
- package/dist/lib/picker.js.map +1 -0
- package/dist/plugins/arktype.d.ts +20 -24
- package/dist/plugins/arktype.d.ts.map +1 -1
- package/dist/plugins/arktype.js +462 -386
- package/dist/plugins/arktype.js.map +1 -1
- package/dist/plugins/effect/http.d.ts +7 -0
- package/dist/plugins/effect/http.d.ts.map +1 -0
- package/dist/plugins/effect/http.js +460 -0
- package/dist/plugins/effect/http.js.map +1 -0
- package/dist/plugins/effect/index.d.ts +22 -0
- package/dist/plugins/effect/index.d.ts.map +1 -0
- package/dist/plugins/effect/index.js +65 -0
- package/dist/plugins/effect/index.js.map +1 -0
- package/dist/plugins/effect/models.d.ts +6 -0
- package/dist/plugins/effect/models.d.ts.map +1 -0
- package/dist/plugins/effect/models.js +116 -0
- package/dist/plugins/effect/models.js.map +1 -0
- package/dist/plugins/effect/repos.d.ts +21 -0
- package/dist/plugins/effect/repos.d.ts.map +1 -0
- package/dist/plugins/effect/repos.js +131 -0
- package/dist/plugins/effect/repos.js.map +1 -0
- package/dist/plugins/effect/schemas.d.ts +7 -0
- package/dist/plugins/effect/schemas.d.ts.map +1 -0
- package/dist/plugins/effect/schemas.js +75 -0
- package/dist/plugins/effect/schemas.js.map +1 -0
- package/dist/plugins/effect/shared.d.ts +116 -0
- package/dist/plugins/effect/shared.d.ts.map +1 -0
- package/dist/plugins/effect/shared.js +164 -0
- package/dist/plugins/effect/shared.js.map +1 -0
- package/dist/plugins/http-elysia.d.ts +20 -27
- package/dist/plugins/http-elysia.d.ts.map +1 -1
- package/dist/plugins/http-elysia.js +350 -475
- package/dist/plugins/http-elysia.js.map +1 -1
- package/dist/plugins/http-express.d.ts +20 -31
- package/dist/plugins/http-express.d.ts.map +1 -1
- package/dist/plugins/http-express.js +281 -268
- package/dist/plugins/http-express.js.map +1 -1
- package/dist/plugins/http-hono.d.ts +17 -33
- package/dist/plugins/http-hono.d.ts.map +1 -1
- package/dist/plugins/http-hono.js +317 -341
- package/dist/plugins/http-hono.js.map +1 -1
- package/dist/plugins/http-orpc.d.ts +34 -33
- package/dist/plugins/http-orpc.d.ts.map +1 -1
- package/dist/plugins/http-orpc.js +345 -257
- package/dist/plugins/http-orpc.js.map +1 -1
- package/dist/plugins/http-trpc.d.ts +33 -35
- package/dist/plugins/http-trpc.d.ts.map +1 -1
- package/dist/plugins/http-trpc.js +337 -241
- package/dist/plugins/http-trpc.js.map +1 -1
- package/dist/plugins/kysely.d.ts +54 -59
- package/dist/plugins/kysely.d.ts.map +1 -1
- package/dist/plugins/kysely.js +826 -687
- package/dist/plugins/kysely.js.map +1 -1
- package/dist/plugins/sql-queries.d.ts +38 -44
- package/dist/plugins/sql-queries.d.ts.map +1 -1
- package/dist/plugins/sql-queries.js +497 -897
- package/dist/plugins/sql-queries.js.map +1 -1
- package/dist/plugins/types.d.ts +12 -20
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js +84 -227
- package/dist/plugins/types.js.map +1 -1
- package/dist/plugins/valibot.d.ts +7 -44
- package/dist/plugins/valibot.d.ts.map +1 -1
- package/dist/plugins/valibot.js +376 -382
- package/dist/plugins/valibot.js.map +1 -1
- package/dist/plugins/zod.d.ts +20 -24
- package/dist/plugins/zod.d.ts.map +1 -1
- package/dist/plugins/zod.js +370 -367
- package/dist/plugins/zod.js.map +1 -1
- package/dist/runtime/emit.d.ts +64 -0
- package/dist/runtime/emit.d.ts.map +1 -0
- package/dist/runtime/emit.js +445 -0
- package/dist/runtime/emit.js.map +1 -0
- package/dist/runtime/errors.d.ts +36 -0
- package/dist/runtime/errors.d.ts.map +1 -0
- package/dist/runtime/errors.js +29 -0
- package/dist/runtime/errors.js.map +1 -0
- package/dist/runtime/file-assignment.d.ts +161 -0
- package/dist/runtime/file-assignment.d.ts.map +1 -0
- package/dist/runtime/file-assignment.js +195 -0
- package/dist/runtime/file-assignment.js.map +1 -0
- package/dist/runtime/orchestrator.d.ts +62 -0
- package/dist/runtime/orchestrator.d.ts.map +1 -0
- package/dist/runtime/orchestrator.js +99 -0
- package/dist/runtime/orchestrator.js.map +1 -0
- package/dist/runtime/registry.d.ts +268 -0
- package/dist/runtime/registry.d.ts.map +1 -0
- package/dist/runtime/registry.js +436 -0
- package/dist/runtime/registry.js.map +1 -0
- package/dist/runtime/types.d.ts +182 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +2 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/validation.d.ts +41 -0
- package/dist/runtime/validation.d.ts.map +1 -0
- package/dist/runtime/validation.js +70 -0
- package/dist/runtime/validation.js.map +1 -0
- package/dist/services/config-loader.d.ts.map +1 -1
- package/dist/services/config-loader.js +15 -6
- package/dist/services/config-loader.js.map +1 -1
- package/dist/services/config.d.ts +55 -25
- package/dist/services/config.d.ts.map +1 -1
- package/dist/services/config.js +60 -34
- package/dist/services/config.js.map +1 -1
- package/dist/services/file-writer.d.ts +3 -3
- package/dist/services/file-writer.d.ts.map +1 -1
- package/dist/services/file-writer.js +6 -8
- package/dist/services/file-writer.js.map +1 -1
- package/dist/services/inflection.d.ts +126 -27
- package/dist/services/inflection.d.ts.map +1 -1
- package/dist/services/inflection.js +300 -72
- package/dist/services/inflection.js.map +1 -1
- package/dist/services/introspection.d.ts.map +1 -1
- package/dist/services/introspection.js +6 -6
- package/dist/services/introspection.js.map +1 -1
- package/dist/services/ir-builder.d.ts.map +1 -1
- package/dist/services/ir-builder.js +73 -77
- package/dist/services/ir-builder.js.map +1 -1
- package/dist/services/ir.d.ts.map +1 -1
- package/dist/services/ir.js.map +1 -1
- package/dist/services/pg-types.d.ts.map +1 -1
- package/dist/services/pg-types.js +3 -3
- package/dist/services/pg-types.js.map +1 -1
- package/dist/services/smart-tags-parser.d.ts.map +1 -1
- package/dist/services/smart-tags-parser.js +4 -4
- package/dist/services/smart-tags-parser.js.map +1 -1
- package/dist/services/type-hints.d.ts.map +1 -1
- package/dist/services/type-hints.js +1 -1
- package/dist/services/type-hints.js.map +1 -1
- package/dist/services/user-module-parser.d.ts +46 -0
- package/dist/services/user-module-parser.d.ts.map +1 -0
- package/dist/services/user-module-parser.js +181 -0
- package/dist/services/user-module-parser.js.map +1 -0
- package/dist/shared/converters.d.ts +60 -0
- package/dist/shared/converters.d.ts.map +1 -0
- package/dist/shared/converters.js +168 -0
- package/dist/shared/converters.js.map +1 -0
- package/dist/shared/query-types.d.ts +95 -0
- package/dist/shared/query-types.d.ts.map +1 -0
- package/dist/shared/query-types.js +9 -0
- package/dist/shared/query-types.js.map +1 -0
- package/dist/testing.d.ts +125 -37
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +134 -42
- package/dist/testing.js.map +1 -1
- package/dist/user-module.d.ts +86 -0
- package/dist/user-module.d.ts.map +1 -0
- package/dist/user-module.js +55 -0
- package/dist/user-module.js.map +1 -0
- package/package.json +10 -6
- package/dist/lib/conjure.d.ts.map +0 -1
- package/dist/lib/conjure.js.map +0 -1
- package/dist/lib/hex.d.ts +0 -119
- package/dist/lib/hex.d.ts.map +0 -1
- package/dist/lib/hex.js +0 -188
- package/dist/lib/hex.js.map +0 -1
- package/dist/plugins/effect.d.ts +0 -53
- package/dist/plugins/effect.d.ts.map +0 -1
- package/dist/plugins/effect.js +0 -1074
- package/dist/plugins/effect.js.map +0 -1
- package/dist/plugins/kysely/queries.d.ts +0 -92
- package/dist/plugins/kysely/queries.d.ts.map +0 -1
- package/dist/plugins/kysely/queries.js +0 -1169
- package/dist/plugins/kysely/queries.js.map +0 -1
- package/dist/plugins/kysely/shared.d.ts +0 -59
- package/dist/plugins/kysely/shared.d.ts.map +0 -1
- package/dist/plugins/kysely/shared.js +0 -247
- package/dist/plugins/kysely/shared.js.map +0 -1
- package/dist/plugins/kysely/types.d.ts +0 -22
- package/dist/plugins/kysely/types.d.ts.map +0 -1
- package/dist/plugins/kysely/types.js +0 -428
- package/dist/plugins/kysely/types.js.map +0 -1
- package/dist/services/artifact-store.d.ts +0 -65
- package/dist/services/artifact-store.d.ts.map +0 -1
- package/dist/services/artifact-store.js +0 -57
- package/dist/services/artifact-store.js.map +0 -1
- package/dist/services/core-providers.d.ts +0 -15
- package/dist/services/core-providers.d.ts.map +0 -1
- package/dist/services/core-providers.js +0 -23
- package/dist/services/core-providers.js.map +0 -1
- package/dist/services/emissions.d.ts +0 -103
- package/dist/services/emissions.d.ts.map +0 -1
- package/dist/services/emissions.js +0 -241
- package/dist/services/emissions.js.map +0 -1
- package/dist/services/execution.d.ts +0 -35
- package/dist/services/execution.d.ts.map +0 -1
- package/dist/services/execution.js +0 -86
- package/dist/services/execution.js.map +0 -1
- package/dist/services/file-builder.d.ts +0 -85
- package/dist/services/file-builder.d.ts.map +0 -1
- package/dist/services/file-builder.js +0 -112
- package/dist/services/file-builder.js.map +0 -1
- package/dist/services/plugin-meta.d.ts +0 -33
- package/dist/services/plugin-meta.d.ts.map +0 -1
- package/dist/services/plugin-meta.js +0 -24
- package/dist/services/plugin-meta.js.map +0 -1
- package/dist/services/plugin-runner.d.ts +0 -42
- package/dist/services/plugin-runner.d.ts.map +0 -1
- package/dist/services/plugin-runner.js +0 -84
- package/dist/services/plugin-runner.js.map +0 -1
- package/dist/services/plugin.d.ts +0 -421
- package/dist/services/plugin.d.ts.map +0 -1
- package/dist/services/plugin.js +0 -197
- package/dist/services/plugin.js.map +0 -1
- package/dist/services/resolution.d.ts +0 -38
- package/dist/services/resolution.d.ts.map +0 -1
- package/dist/services/resolution.js +0 -242
- package/dist/services/resolution.js.map +0 -1
- package/dist/services/service-registry.d.ts +0 -74
- package/dist/services/service-registry.d.ts.map +0 -1
- package/dist/services/service-registry.js +0 -61
- package/dist/services/service-registry.js.map +0 -1
- package/dist/services/symbols.d.ts +0 -144
- package/dist/services/symbols.d.ts.map +0 -1
- package/dist/services/symbols.js +0 -144
- package/dist/services/symbols.js.map +0 -1
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { Context, Effect, Schema } from "effect";
|
|
2
|
+
import type { Capability, SymbolDeclaration, SymbolRef, SymbolHandle } from "./types.js";
|
|
3
|
+
declare const SymbolCollision_base: Schema.TaggedErrorClass<SymbolCollision, "SymbolCollision", {
|
|
4
|
+
readonly _tag: Schema.tag<"SymbolCollision">;
|
|
5
|
+
} & {
|
|
6
|
+
message: typeof Schema.String;
|
|
7
|
+
capability: typeof Schema.String;
|
|
8
|
+
existingSymbol: typeof Schema.String;
|
|
9
|
+
newSymbol: typeof Schema.String;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Error thrown when two plugins try to register the same capability.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SymbolCollision extends SymbolCollision_base {
|
|
15
|
+
}
|
|
16
|
+
declare const CapabilityNotFound_base: Schema.TaggedErrorClass<CapabilityNotFound, "CapabilityNotFound", {
|
|
17
|
+
readonly _tag: Schema.tag<"CapabilityNotFound">;
|
|
18
|
+
} & {
|
|
19
|
+
message: typeof Schema.String;
|
|
20
|
+
capability: typeof Schema.String;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Error when trying to get a handle for an unregistered capability.
|
|
24
|
+
*/
|
|
25
|
+
export declare class CapabilityNotFound extends CapabilityNotFound_base {
|
|
26
|
+
}
|
|
27
|
+
declare const CategoryConflict_base: Schema.TaggedErrorClass<CategoryConflict, "CategoryConflict", {
|
|
28
|
+
readonly _tag: Schema.tag<"CategoryConflict">;
|
|
29
|
+
} & {
|
|
30
|
+
message: typeof Schema.String;
|
|
31
|
+
category: typeof Schema.String;
|
|
32
|
+
existingProvider: typeof Schema.String;
|
|
33
|
+
newProvider: typeof Schema.String;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Error when multiple plugins try to provide the same capability category.
|
|
37
|
+
*/
|
|
38
|
+
export declare class CategoryConflict extends CategoryConflict_base {
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates a SymbolHandle that tracks cross-references.
|
|
42
|
+
*
|
|
43
|
+
* @param decl - The symbol being referenced
|
|
44
|
+
* @param metadata - Optional metadata from render phase (may include consume callback)
|
|
45
|
+
* @param onReference - Callback when ref() or call() is invoked (for import tracking)
|
|
46
|
+
*/
|
|
47
|
+
export declare function createSymbolHandle(decl: SymbolDeclaration, metadata: unknown | undefined, onReference?: (capability: Capability) => void): SymbolHandle;
|
|
48
|
+
/**
|
|
49
|
+
* Service interface for SymbolRegistry - what plugins see.
|
|
50
|
+
*/
|
|
51
|
+
export interface SymbolRegistryService {
|
|
52
|
+
/** Resolve a capability to its symbol reference */
|
|
53
|
+
readonly resolve: (capability: Capability) => SymbolRef | undefined;
|
|
54
|
+
/** Get a handle for importing another symbol (tracks cross-references) */
|
|
55
|
+
readonly import: (capability: Capability) => SymbolHandle;
|
|
56
|
+
/** Query for capabilities matching a prefix pattern */
|
|
57
|
+
readonly query: (pattern: string) => readonly SymbolDeclaration[];
|
|
58
|
+
/** Check if a capability is registered */
|
|
59
|
+
readonly has: (capability: Capability) => boolean;
|
|
60
|
+
/** Get rendered metadata for a capability */
|
|
61
|
+
readonly getMetadata: (capability: Capability) => unknown;
|
|
62
|
+
/**
|
|
63
|
+
* Get declarations owned by the current plugin.
|
|
64
|
+
* Returns only the symbols declared by this plugin in Phase 1.
|
|
65
|
+
*/
|
|
66
|
+
readonly own: () => readonly SymbolDeclaration[];
|
|
67
|
+
/**
|
|
68
|
+
* Scope cross-reference tracking to a single symbol.
|
|
69
|
+
* All `import().ref()` calls within the callback are attributed
|
|
70
|
+
* only to the specified capability, not all plugin capabilities.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* for (const decl of registry.own()) {
|
|
75
|
+
* registry.forSymbol(decl.capability, () => {
|
|
76
|
+
* const queryFn = registry.import(`queries:kysely:${entityName}`);
|
|
77
|
+
* queryFn.ref(); // Only attributed to decl.capability
|
|
78
|
+
* });
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
readonly forSymbol: <T>(capability: Capability, fn: () => T) => T;
|
|
83
|
+
}
|
|
84
|
+
declare const SymbolRegistry_base: Context.TagClass<SymbolRegistry, "SymbolRegistry", SymbolRegistryService>;
|
|
85
|
+
/**
|
|
86
|
+
* Effect Context tag for SymbolRegistry service.
|
|
87
|
+
* Plugins access this in render phase via `yield* SymbolRegistry`.
|
|
88
|
+
*/
|
|
89
|
+
export declare class SymbolRegistry extends SymbolRegistry_base {
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Internal registry implementation that tracks all declared symbols.
|
|
93
|
+
*
|
|
94
|
+
* Used during the two-phase plugin execution:
|
|
95
|
+
* 1. Declare phase: Plugins register symbols via register()
|
|
96
|
+
* 2. Render phase: Plugins lookup symbols via resolve()/import()
|
|
97
|
+
*
|
|
98
|
+
* During render phase, tracks cross-references between capabilities
|
|
99
|
+
* for import generation in the emit phase.
|
|
100
|
+
*/
|
|
101
|
+
export declare class SymbolRegistryImpl {
|
|
102
|
+
private symbols;
|
|
103
|
+
private rendered;
|
|
104
|
+
private referenceCallbacks;
|
|
105
|
+
/**
|
|
106
|
+
* Category providers: Maps category name -> provider plugin name.
|
|
107
|
+
* e.g., "queries" -> "kysely", "schema" -> "zod"
|
|
108
|
+
* Used to resolve generic capability prefixes to implementation-specific ones.
|
|
109
|
+
*/
|
|
110
|
+
private categoryProviders;
|
|
111
|
+
/**
|
|
112
|
+
* Cross-reference tracking: Maps source capability -> set of referenced capabilities.
|
|
113
|
+
* Populated during render phase when registry.import(cap).ref() is called.
|
|
114
|
+
*/
|
|
115
|
+
private references;
|
|
116
|
+
/**
|
|
117
|
+
* Current capabilities being rendered. Set by orchestrator before calling render().
|
|
118
|
+
* When a handle's ref()/call() is invoked, edges are added from these to the target.
|
|
119
|
+
*
|
|
120
|
+
* When forSymbol() is active, this contains only the single scoped capability.
|
|
121
|
+
*/
|
|
122
|
+
private currentCapabilities;
|
|
123
|
+
/**
|
|
124
|
+
* Declarations owned by the current plugin.
|
|
125
|
+
* Set by orchestrator before render phase.
|
|
126
|
+
*/
|
|
127
|
+
private ownedDeclarations;
|
|
128
|
+
/**
|
|
129
|
+
* Stack for nested forSymbol() calls (though nesting is unusual).
|
|
130
|
+
* Stores the previous currentCapabilities to restore after forSymbol() completes.
|
|
131
|
+
*/
|
|
132
|
+
private capabilityStack;
|
|
133
|
+
/**
|
|
134
|
+
* Register a symbol declaration. Called during declare phase.
|
|
135
|
+
* Returns Effect that fails with SymbolCollision if capability already registered.
|
|
136
|
+
*/
|
|
137
|
+
register(decl: SymbolDeclaration): Effect.Effect<void, SymbolCollision>;
|
|
138
|
+
/**
|
|
139
|
+
* Store rendered output for a symbol. Called during render phase.
|
|
140
|
+
*/
|
|
141
|
+
setRendered(capability: Capability, node: unknown, metadata?: unknown): void;
|
|
142
|
+
/**
|
|
143
|
+
* Get rendered metadata for a capability.
|
|
144
|
+
*/
|
|
145
|
+
getRenderedMetadata(capability: Capability): unknown;
|
|
146
|
+
/**
|
|
147
|
+
* Register multiple declarations at once.
|
|
148
|
+
*/
|
|
149
|
+
registerAll(decls: readonly SymbolDeclaration[]): Effect.Effect<void, SymbolCollision>;
|
|
150
|
+
/**
|
|
151
|
+
* Register a plugin as the provider for a capability category.
|
|
152
|
+
* Only one plugin can provide each category.
|
|
153
|
+
*
|
|
154
|
+
* @param category - Category name (e.g., "queries", "schema")
|
|
155
|
+
* @param pluginName - Name of the plugin providing this category
|
|
156
|
+
*/
|
|
157
|
+
registerCategoryProvider(category: string, pluginName: string): Effect.Effect<void, CategoryConflict>;
|
|
158
|
+
/**
|
|
159
|
+
* Get the provider name for a category.
|
|
160
|
+
*/
|
|
161
|
+
getCategoryProvider(category: string): string | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Resolve a generic capability to implementation-specific.
|
|
164
|
+
*
|
|
165
|
+
* Examples:
|
|
166
|
+
* - "queries:User:findById" → "queries:kysely:User:findById" (if kysely provides queries)
|
|
167
|
+
* - "schema:UserInsert" → "schema:zod:UserInsert" (if zod provides schema)
|
|
168
|
+
* - "queries:kysely:User:findById" → unchanged (already specific)
|
|
169
|
+
* - "type:User" → unchanged (no category provider needed)
|
|
170
|
+
*/
|
|
171
|
+
resolveCapability(capability: Capability): Capability;
|
|
172
|
+
/**
|
|
173
|
+
* Resolve a capability to its symbol reference.
|
|
174
|
+
* Automatically resolves generic capabilities to implementation-specific.
|
|
175
|
+
* Returns undefined if not found.
|
|
176
|
+
*/
|
|
177
|
+
resolve(capability: Capability): SymbolRef | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* Check if a capability is registered.
|
|
180
|
+
* Automatically resolves generic capabilities to implementation-specific.
|
|
181
|
+
*/
|
|
182
|
+
has(capability: Capability): boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Register a callback to be invoked when a symbol is referenced.
|
|
185
|
+
* Used for import tracking across files.
|
|
186
|
+
*/
|
|
187
|
+
onReference(capability: Capability, callback: (capability: Capability) => void): void;
|
|
188
|
+
/**
|
|
189
|
+
* Get a SymbolHandle for referencing another symbol.
|
|
190
|
+
* The handle tracks when ref()/call() are used for import generation.
|
|
191
|
+
* Automatically resolves generic capabilities to implementation-specific.
|
|
192
|
+
* Returns Effect that fails with CapabilityNotFound if not registered.
|
|
193
|
+
*/
|
|
194
|
+
getHandle(capability: Capability): Effect.Effect<SymbolHandle, CapabilityNotFound>;
|
|
195
|
+
/**
|
|
196
|
+
* Get a SymbolHandle synchronously (for service interface).
|
|
197
|
+
* Automatically resolves generic capabilities to implementation-specific.
|
|
198
|
+
* Throws if not found.
|
|
199
|
+
*/
|
|
200
|
+
import(capability: Capability): SymbolHandle;
|
|
201
|
+
/**
|
|
202
|
+
* Get all registered symbols.
|
|
203
|
+
*/
|
|
204
|
+
all(): readonly SymbolDeclaration[];
|
|
205
|
+
/**
|
|
206
|
+
* Get symbols that match a capability pattern.
|
|
207
|
+
* Pattern uses simple prefix matching: "type:" matches all types.
|
|
208
|
+
* Note: For category-based queries, use the implementation-specific prefix
|
|
209
|
+
* (e.g., "queries:kysely:") or query by category pattern (e.g., "queries:").
|
|
210
|
+
*/
|
|
211
|
+
query(pattern: string): readonly SymbolDeclaration[];
|
|
212
|
+
/**
|
|
213
|
+
* Get the declaration for a specific capability.
|
|
214
|
+
* Automatically resolves generic capabilities to implementation-specific.
|
|
215
|
+
*/
|
|
216
|
+
get(capability: Capability): SymbolDeclaration | undefined;
|
|
217
|
+
/**
|
|
218
|
+
* Set the current capabilities being rendered.
|
|
219
|
+
* Called by orchestrator before each plugin's render() phase.
|
|
220
|
+
*/
|
|
221
|
+
setCurrentCapabilities(caps: readonly Capability[]): void;
|
|
222
|
+
/**
|
|
223
|
+
* Clear current capabilities context.
|
|
224
|
+
* Called by orchestrator after each plugin's render() completes.
|
|
225
|
+
*/
|
|
226
|
+
clearCurrentCapabilities(): void;
|
|
227
|
+
/**
|
|
228
|
+
* Set the declarations owned by the current plugin.
|
|
229
|
+
* Called by orchestrator before render phase.
|
|
230
|
+
*/
|
|
231
|
+
setOwnedDeclarations(decls: readonly SymbolDeclaration[]): void;
|
|
232
|
+
/**
|
|
233
|
+
* Get declarations owned by the current plugin.
|
|
234
|
+
* Returns only the symbols declared by this plugin in Phase 1.
|
|
235
|
+
*/
|
|
236
|
+
own(): readonly SymbolDeclaration[];
|
|
237
|
+
/**
|
|
238
|
+
* Scope cross-reference tracking to a single symbol.
|
|
239
|
+
* All `import().ref()` calls within the callback are attributed
|
|
240
|
+
* only to the specified capability.
|
|
241
|
+
*
|
|
242
|
+
* @param capability - The capability to scope refs to
|
|
243
|
+
* @param fn - Function to execute with scoped context
|
|
244
|
+
* @returns The result of fn()
|
|
245
|
+
*/
|
|
246
|
+
forSymbol<T>(capability: Capability, fn: () => T): T;
|
|
247
|
+
/**
|
|
248
|
+
* Record a reference from current capabilities to target.
|
|
249
|
+
* Called internally when SymbolHandle.ref() or .call() is invoked.
|
|
250
|
+
*/
|
|
251
|
+
private recordReference;
|
|
252
|
+
/**
|
|
253
|
+
* Get all capabilities referenced by a given capability.
|
|
254
|
+
*/
|
|
255
|
+
getReferences(capability: Capability): readonly Capability[];
|
|
256
|
+
/**
|
|
257
|
+
* Get the full reference map for emit phase.
|
|
258
|
+
* Maps: source capability -> capabilities it references
|
|
259
|
+
*/
|
|
260
|
+
getAllReferences(): ReadonlyMap<Capability, readonly Capability[]>;
|
|
261
|
+
/**
|
|
262
|
+
* Create a service instance that conforms to SymbolRegistryService.
|
|
263
|
+
* Used by orchestrator to provide the service to plugins.
|
|
264
|
+
*/
|
|
265
|
+
toService(): SymbolRegistryService;
|
|
266
|
+
}
|
|
267
|
+
export {};
|
|
268
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/runtime/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;;;;;;;;;AAYzF;;GAEG;AACH,qBAAa,eAAgB,SAAQ,oBAKnC;CAAG;;;;;;;AAEL;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,uBAMvC;CAAG;;;;;;;;;AAEJ;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,qBAKpC;CAAG;AAeL;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,GAC7C,YAAY,CA0Bd;AAMD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,SAAS,GAAG,SAAS,CAAC;IAEpE,0EAA0E;IAC1E,QAAQ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