@spine-event-engine/proto-tools 2.0.0-snapshot.24 → 2.0.0-snapshot.26
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 +16 -3
- package/REFERENCE.md +55 -3
- package/dist/src/generation/app-query-generator.d.ts +33 -0
- package/dist/src/generation/app-query-generator.d.ts.map +1 -0
- package/dist/src/generation/app-query-generator.js +73 -0
- package/dist/src/generation/app-query-generator.js.map +1 -0
- package/dist/src/generation/build-time-handler-analyzer.d.ts +53 -1
- package/dist/src/generation/build-time-handler-analyzer.d.ts.map +1 -1
- package/dist/src/generation/build-time-handler-analyzer.js +414 -9
- package/dist/src/generation/build-time-handler-analyzer.js.map +1 -1
- package/dist/src/generation/entity-query-generator.d.ts.map +1 -1
- package/dist/src/generation/entity-query-generator.js +3 -0
- package/dist/src/generation/entity-query-generator.js.map +1 -1
- package/dist/src/generation/generated-registry-writer.d.ts +61 -0
- package/dist/src/generation/generated-registry-writer.d.ts.map +1 -1
- package/dist/src/generation/generated-registry-writer.js +470 -13
- package/dist/src/generation/generated-registry-writer.js.map +1 -1
- package/dist/src/generation/generated-source-policy.d.ts.map +1 -1
- package/dist/src/generation/generated-source-policy.js +50 -13
- package/dist/src/generation/generated-source-policy.js.map +1 -1
- package/dist/src/generation/generator.d.ts +4 -0
- package/dist/src/generation/generator.d.ts.map +1 -1
- package/dist/src/generation/generator.js +301 -62
- package/dist/src/generation/generator.js.map +1 -1
- package/dist/src/generation/handler-codegen.d.ts +8 -0
- package/dist/src/generation/handler-codegen.d.ts.map +1 -1
- package/dist/src/generation/handler-codegen.js +202 -13
- package/dist/src/generation/handler-codegen.js.map +1 -1
- package/dist/src/generation/handler-generator.d.ts +3 -0
- package/dist/src/generation/handler-generator.d.ts.map +1 -1
- package/dist/src/generation/handler-generator.js +5 -1
- package/dist/src/generation/handler-generator.js.map +1 -1
- package/dist/src/generation/runtime-metadata-assets.d.ts +48 -0
- package/dist/src/generation/runtime-metadata-assets.d.ts.map +1 -0
- package/dist/src/generation/runtime-metadata-assets.js +263 -0
- package/dist/src/generation/runtime-metadata-assets.js.map +1 -0
- package/dist/src/generation/runtime-metadata-graph.d.ts +82 -0
- package/dist/src/generation/runtime-metadata-graph.d.ts.map +1 -0
- package/dist/src/generation/runtime-metadata-graph.js +390 -0
- package/dist/src/generation/runtime-metadata-graph.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -54,6 +54,12 @@ tsc -b
|
|
|
54
54
|
|
|
55
55
|
Do not edit generated output by hand: change the Proto source or configuration,
|
|
56
56
|
then run generation again.
|
|
57
|
+
The generated `proto-module.js` registers its descriptor graph when imported.
|
|
58
|
+
If the model package lists restrictive `sideEffects` paths, include its
|
|
59
|
+
published runtime module (for example `./dist/generated/proto-module.js`), not
|
|
60
|
+
only the TypeScript source. An application using restrictive `sideEffects`
|
|
61
|
+
metadata must likewise retain the emitted JavaScript path of its composed
|
|
62
|
+
`registryOutput` so startup imports execute.
|
|
57
63
|
|
|
58
64
|
## 🧩 Compose an application after the first model succeeds
|
|
59
65
|
|
|
@@ -76,10 +82,17 @@ tsc -b
|
|
|
76
82
|
```
|
|
77
83
|
|
|
78
84
|
`compose` follows declared model dependencies transitively. `handlers` creates
|
|
79
|
-
|
|
85
|
+
passive `generated/spine-metadata.ts`, the static application bootstrap, and
|
|
86
|
+
portable dependency adapters for decorated application classes. Its emitted
|
|
87
|
+
metadata links each participating package to its direct public `./spine`
|
|
88
|
+
dependencies through lazy accessors, so installed packages can be relocated.
|
|
89
|
+
The build rejects a participating transitive package hidden behind a
|
|
90
|
+
nonparticipating runtime package. Its emitted
|
|
80
91
|
source imports the Server handler-registry contract as a type from
|
|
81
92
|
`@spine-event-engine/server/spi/handler-registry`; the CLI itself has no Server
|
|
82
|
-
runtime dependency.
|
|
93
|
+
runtime dependency. Import the generated bootstrap once before application
|
|
94
|
+
assembly. Run generation after model or handler changes and after the effective
|
|
95
|
+
installed dependency graph or TypeScript output configuration changes.
|
|
83
96
|
The handler analyzer records `@Throws(...)` declarations as rejection outcomes;
|
|
84
97
|
the generated rejection companion supplies the schema used by that metadata.
|
|
85
98
|
Handler results can use native message unions, flat arrays, fixed tuples with
|
|
@@ -96,7 +109,7 @@ code should import generated model modules instead.
|
|
|
96
109
|
|
|
97
110
|
Run this tooling after changing Proto files or decorated handlers. Generated
|
|
98
111
|
files are outputs, not source: never edit them by hand. Application runtime code
|
|
99
|
-
imports
|
|
112
|
+
imports its generated bootstrap and model modules; it does not invoke the CLI.
|
|
100
113
|
|
|
101
114
|
Keep model-package dependencies explicit in both `package.json` and
|
|
102
115
|
`spine-proto.json`. `compose` follows declared model dependencies transitively;
|
package/REFERENCE.md
CHANGED
|
@@ -30,10 +30,11 @@ whose `spine-proto.json` it should read:
|
|
|
30
30
|
- `spine-proto compose` accepts only application configuration and writes the
|
|
31
31
|
configured model registry source;
|
|
32
32
|
- `spine-proto handlers` accepts an application package and writes
|
|
33
|
-
`generated/
|
|
34
|
-
`
|
|
33
|
+
`generated/spine-metadata.ts` and `generated/spine-bootstrap.ts`. The metadata module imports
|
|
34
|
+
`SpineMetadata` as a type from
|
|
35
35
|
`@spine-event-engine/server/spi/handler-registry`; handler analysis and
|
|
36
|
-
rendering remain tooling-owned and never load Server at CLI runtime.
|
|
36
|
+
rendering remain tooling-owned and never load Server at CLI runtime. Import
|
|
37
|
+
the bootstrap once before Bounded Context assembly.
|
|
37
38
|
|
|
38
39
|
The package also exposes `manifestFormatVersion`, `ProtoConfig`, and
|
|
39
40
|
`ProtoManifest` for build tooling that needs to read or validate the same
|
|
@@ -69,6 +70,33 @@ and `spine-proto.json`; import the other model's canonical package path. The
|
|
|
69
70
|
tool keeps package boundaries explicit and does not duplicate the dependency's source or
|
|
70
71
|
generated output.
|
|
71
72
|
|
|
73
|
+
## App Query files
|
|
74
|
+
|
|
75
|
+
Normal model generation recognizes files ending in `_queries.proto`. Each
|
|
76
|
+
top-level message with nested messages named `Query` and `Response` declares
|
|
77
|
+
one App Query. A message with neither nested name remains an ordinary Proto
|
|
78
|
+
message, including its normal generated types, schemas, and registry entries.
|
|
79
|
+
A message with only one of the two names is rejected as an incomplete App Query.
|
|
80
|
+
|
|
81
|
+
One file can contain several App Queries and ordinary helper messages. A module
|
|
82
|
+
can contain several query files. Each file containing an App Query produces one
|
|
83
|
+
`_app_query.ts` companion; a file containing only ordinary messages produces no
|
|
84
|
+
App Query companion.
|
|
85
|
+
|
|
86
|
+
Relative folders are preserved in generated output:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
proto/issues/app_queries.proto → generated/issues/app_queries_app_query.ts
|
|
90
|
+
proto/projects/app_queries.proto → generated/projects/app_queries_app_query.ts
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The example uses `protoRoot: "proto"` and `generatedRoot: "generated"`.
|
|
94
|
+
Identical filenames in different folders do not collide. Query/response
|
|
95
|
+
associations use fully qualified Proto message names, so operation names may
|
|
96
|
+
also repeat in different Proto packages. Duplicate fully qualified Proto
|
|
97
|
+
message names remain invalid. Import aliases distinguish repeated operation
|
|
98
|
+
names in TypeScript source.
|
|
99
|
+
|
|
72
100
|
## Application configuration
|
|
73
101
|
|
|
74
102
|
`ApplicationConfig` requires `formatVersion: 1`, `mode: "application"`, direct
|
|
@@ -78,6 +106,30 @@ sufficient because `TypeRegistry.from()` follows declared dependencies.
|
|
|
78
106
|
|
|
79
107
|
`handlers` must run after a decorated handler or its generated command, event,
|
|
80
108
|
or state types change. Compile the generated registry with the application.
|
|
109
|
+
It also inspects declared runtime dependencies transitively. A participating
|
|
110
|
+
package publishes its passive generated metadata through a `./spine` export
|
|
111
|
+
with JavaScript and declaration targets; build dependency packages before
|
|
112
|
+
generating the consumer. The application bootstrap registers local metadata;
|
|
113
|
+
lazy `dependencies()` accessors on participating packages expose direct
|
|
114
|
+
`./spine` exports by package name. Bootstrap traversal collects the transitive
|
|
115
|
+
graph once, including cycles and shared dependencies. A nonparticipating
|
|
116
|
+
runtime package cannot hide a participating transitive package. Bounded
|
|
117
|
+
Model-only generation applies the same bridge rule to its declared model
|
|
118
|
+
dependencies. Bootstrap validates every returned metadata value and the
|
|
119
|
+
complete graph before publishing any handler or App Query descriptions.
|
|
120
|
+
Malformed or missing `spineMetadata` exports fail registration.
|
|
121
|
+
Bounded
|
|
122
|
+
Context assembly still selects the handler classes explicitly. Regenerate the
|
|
123
|
+
consumer after changing its installed dependency
|
|
124
|
+
layout, a participant's published metadata, or its effective TypeScript
|
|
125
|
+
configuration. Changes to inherited `outDir` or `declarationDir` settings also
|
|
126
|
+
require regeneration so adapter paths are recalculated.
|
|
127
|
+
Generation writes source and emitted `spine-dependencies.js` adapters with
|
|
128
|
+
matching declarations. The normal clean build restores the emitted adapters
|
|
129
|
+
from the generated record before TypeScript compiles. If a separate build step
|
|
130
|
+
deletes those emitted files, regenerate the application against its installed
|
|
131
|
+
dependency tree before compiling. Rebuilding after an output-directory change
|
|
132
|
+
retires the previous adapter locations.
|
|
81
133
|
|
|
82
134
|
Explicit handler return annotations may resolve to one generated message, a
|
|
83
135
|
union, a flat array, or a fixed tuple (including readonly, named, optional, and
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DescMessage } from "@bufbuild/protobuf";
|
|
2
|
+
import type { Schema } from "@bufbuild/protoplugin";
|
|
3
|
+
/**
|
|
4
|
+
* File writer returned by the existing Proto generation stage.
|
|
5
|
+
*/
|
|
6
|
+
type QueryOutput = ReturnType<Schema["generateFile"]>;
|
|
7
|
+
/**
|
|
8
|
+
* One top-level application operation and its nested request/result descriptors.
|
|
9
|
+
*/
|
|
10
|
+
interface QueryPair {
|
|
11
|
+
readonly operation: DescMessage;
|
|
12
|
+
readonly query: DescMessage;
|
|
13
|
+
readonly response: DescMessage;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Emits grouped application query declarations from the normal Proto plugin stage.
|
|
17
|
+
*/
|
|
18
|
+
export declare const AppQueryGenerator: Readonly<{
|
|
19
|
+
/**
|
|
20
|
+
* Generates grouped companions from eligible Proto files.
|
|
21
|
+
*/
|
|
22
|
+
generate(schema: Schema): void;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves a complete nested Query and Response pair, or skips a helper message.
|
|
25
|
+
*/
|
|
26
|
+
pair(operation: DescMessage): QueryPair | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Writes the generated aliases and request-to-result association.
|
|
29
|
+
*/
|
|
30
|
+
emit(output: QueryOutput, pair: QueryPair): void;
|
|
31
|
+
}>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=app-query-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-query-generator.d.ts","sourceRoot":"","sources":["../../../src/generation/app-query-generator.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;GAEG;AACH,KAAK,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;AAEtD;;GAEG;AACH,UAAU,SAAS;IACjB,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;CAChC;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC;IACvC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;IAEpD;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;CAClD,CA8EC,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, CodeMatters. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
|
5
|
+
* in compliance with the License. You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
10
|
+
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
11
|
+
* or implied. See the License for the specific language governing permissions and limitations under
|
|
12
|
+
* the License.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Emits grouped application query declarations from the normal Proto plugin stage.
|
|
16
|
+
*/
|
|
17
|
+
export const AppQueryGenerator = Object.freeze({
|
|
18
|
+
/**
|
|
19
|
+
* Generates paired query companions from eligible source files.
|
|
20
|
+
*
|
|
21
|
+
* @param schema The existing Buf plugin request and output writer.
|
|
22
|
+
*/
|
|
23
|
+
generate(schema) {
|
|
24
|
+
for (const file of schema.files) {
|
|
25
|
+
if (!file.proto.name.endsWith("_queries.proto"))
|
|
26
|
+
continue;
|
|
27
|
+
if (file.messages.length === 0)
|
|
28
|
+
continue;
|
|
29
|
+
const pairs = [];
|
|
30
|
+
for (const operation of file.messages) {
|
|
31
|
+
const pair = AppQueryGenerator.pair(operation);
|
|
32
|
+
if (pair !== undefined)
|
|
33
|
+
pairs.push(pair);
|
|
34
|
+
}
|
|
35
|
+
if (pairs.length === 0)
|
|
36
|
+
continue;
|
|
37
|
+
const output = schema.generateFile(`${file.name}_app_query.ts`);
|
|
38
|
+
output.preamble(file);
|
|
39
|
+
for (const pair of pairs)
|
|
40
|
+
AppQueryGenerator.emit(output, pair);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Finds a complete nested Query/Response pair, skipping messages with neither declaration.
|
|
45
|
+
*
|
|
46
|
+
* @param operation Top-level application query or helper declaration.
|
|
47
|
+
* @returns Its nested request/result descriptors, or undefined for a helper message.
|
|
48
|
+
*/
|
|
49
|
+
pair(operation) {
|
|
50
|
+
const query = operation.nestedMessages.find((message) => message.name === "Query");
|
|
51
|
+
const response = operation.nestedMessages.find((message) => message.name === "Response");
|
|
52
|
+
if (query === undefined && response === undefined)
|
|
53
|
+
return undefined;
|
|
54
|
+
if (query === undefined || response === undefined) {
|
|
55
|
+
throw new Error(`spine-proto: ${operation.typeName} requires nested Query and Response messages`);
|
|
56
|
+
}
|
|
57
|
+
return { operation, query, response };
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* Emits grouped aliases and one literal request-to-result type association.
|
|
61
|
+
*
|
|
62
|
+
* @param output Generated companion file.
|
|
63
|
+
* @param pair Validated Query and Response nested declarations.
|
|
64
|
+
*/
|
|
65
|
+
emit(output, { operation, query, response }) {
|
|
66
|
+
const queryType = output.importShape(query);
|
|
67
|
+
const responseType = output.importShape(response);
|
|
68
|
+
const querySchema = output.importSchema(query);
|
|
69
|
+
const responseSchema = output.importSchema(response);
|
|
70
|
+
output.print(`/**\n * Generated schemas and types for ${operation.name}.\n */\n`, `export namespace ${operation.name} {\n`, "/**\n * The application request message.\n */\nexport type Query = ", queryType, ";\n", "/**\n * The application result message.\n */\nexport type Response = ", responseType, ";\n", "/**\n * The generated request schema.\n */\nexport const querySchema: typeof ", querySchema, " = ", querySchema, ";\n", "/**\n * The generated result schema.\n */\nexport const responseSchema: typeof ", responseSchema, " = ", responseSchema, ";\n}\n", 'declare module "@spine-event-engine/core" {\n', " interface AppQueryResponses {\n ", JSON.stringify(query.typeName), ": ", responseType, ";\n }\n}\n");
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=app-query-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-query-generator.js","sourceRoot":"","sources":["../../../src/generation/app-query-generator.ts"],"names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* Handler role recognized in generated repository metadata.
|
|
4
|
+
*/
|
|
2
5
|
type GeneratedHandlerKind = "command-assignment" | "command-substitution" | "command-reaction" | "event-subscription" | "state-subscription" | "event-reaction";
|
|
6
|
+
/**
|
|
7
|
+
* Supported arity of decorated handler methods.
|
|
8
|
+
*/
|
|
3
9
|
type GeneratedHandlerParameterCount = 1 | 2;
|
|
4
10
|
/**
|
|
5
11
|
* Build-time analysis result for bare decorated receiver handler methods.
|
|
@@ -9,11 +15,50 @@ export interface BuildHandlerAnalysis {
|
|
|
9
15
|
* All generated Entity and standalone receiver declarations.
|
|
10
16
|
*/
|
|
11
17
|
readonly receivers: readonly BuildReceiverHandlers[];
|
|
18
|
+
/**
|
|
19
|
+
* Concrete application query implementations paired to generated schemas.
|
|
20
|
+
*/
|
|
21
|
+
readonly appQueries?: readonly BuildAppQueryHandler[];
|
|
12
22
|
/**
|
|
13
23
|
* Deterministic diagnostics for unsupported handler declarations.
|
|
14
24
|
*/
|
|
15
25
|
readonly diagnostics: readonly BuildHandlerDiagnostic[];
|
|
16
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Passive build-time description of one concrete application query handler.
|
|
29
|
+
*/
|
|
30
|
+
export interface BuildAppQueryHandler {
|
|
31
|
+
/**
|
|
32
|
+
* Exported implementation class.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
readonly className: string;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the implementation uses a default export.
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
readonly defaultExport?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Source file containing the implementation.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
readonly sourceFile: string;
|
|
46
|
+
/**
|
|
47
|
+
* Exact generated request message name.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
readonly queryTypeName: string;
|
|
51
|
+
/**
|
|
52
|
+
* Exact generated request schema.
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
readonly querySchema: SchemaReference;
|
|
56
|
+
/**
|
|
57
|
+
* Exact generated result schema.
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
readonly responseSchema: SchemaReference;
|
|
61
|
+
}
|
|
17
62
|
/**
|
|
18
63
|
* Build-time entity group shaped for later generated registry rendering.
|
|
19
64
|
*/
|
|
@@ -156,7 +201,7 @@ export interface BuildWhereOptions {
|
|
|
156
201
|
/**
|
|
157
202
|
* Stable diagnostic codes emitted by build-time handler analysis.
|
|
158
203
|
*/
|
|
159
|
-
export type BuildHandlerDiagnosticCode = "FRAMEWORK_ENVELOPE_RETURN" | "INVALID_EMITTED_SCHEMA" | "INVALID_HANDLER_NAME" | "INVALID_HANDLER_CONTEXT" | "INVALID_HANDLER_VISIBILITY" | "INVALID_PARAMETER_COUNT" | "INVALID_SIGNAL_TYPE" | "INVALID_EXTERNAL_ORIGIN" | "EXTERNAL_COMMAND_RECEIVER" | "INVALID_SUBSCRIBE_RETURN" | "INVALID_THROWS" | "INVALID_WHERE" | "MISSING_EMITTED_SCHEMAS" | "MISSING_ENTITY_STATE_SCHEMA" | "MISSING_RETURN_TYPE" | "MISSING_SIGNAL_TYPE" | "NON_EXPORTED_RECEIVER_CLASS" | "SCHEMA_BEARING_DECORATOR" | "TYPESCRIPT_SYNTAX_ERROR" | "UNSUPPORTED_ASSIGN_HANDLER" | "UNSUPPORTED_COMMAND_HANDLER" | "UNSUPPORTED_SUBSCRIBE_HANDLER" | "UNSUPPORTED_RETURN_TYPE";
|
|
204
|
+
export type BuildHandlerDiagnosticCode = "FRAMEWORK_ENVELOPE_RETURN" | "INVALID_EMITTED_SCHEMA" | "INVALID_HANDLER_NAME" | "INVALID_HANDLER_CONTEXT" | "INVALID_HANDLER_VISIBILITY" | "INVALID_PARAMETER_COUNT" | "INVALID_SIGNAL_TYPE" | "INVALID_APP_QUERY_PAIR" | "INVALID_EXTERNAL_ORIGIN" | "EXTERNAL_COMMAND_RECEIVER" | "INVALID_SUBSCRIBE_RETURN" | "INVALID_THROWS" | "INVALID_WHERE" | "MISSING_EMITTED_SCHEMAS" | "MISSING_ENTITY_STATE_SCHEMA" | "MISSING_RETURN_TYPE" | "MISSING_SIGNAL_TYPE" | "NON_EXPORTED_RECEIVER_CLASS" | "SCHEMA_BEARING_DECORATOR" | "TYPESCRIPT_SYNTAX_ERROR" | "UNSUPPORTED_ASSIGN_HANDLER" | "UNSUPPORTED_COMMAND_HANDLER" | "UNSUPPORTED_SUBSCRIBE_HANDLER" | "UNSUPPORTED_RETURN_TYPE";
|
|
160
205
|
/**
|
|
161
206
|
* One build-time analyzer diagnostic.
|
|
162
207
|
*/
|
|
@@ -211,7 +256,14 @@ export declare const BuildHandlerAnalyzer: BuildHandlerAnalyzer;
|
|
|
211
256
|
* Finds the package identity that owns an analyzed source file.
|
|
212
257
|
*/
|
|
213
258
|
export declare const PackageIdentity: Readonly<{
|
|
259
|
+
/**
|
|
260
|
+
* Finds the package name declared above an analyzed source file.
|
|
261
|
+
*/
|
|
214
262
|
nameFor(sourceFile: string): string | undefined;
|
|
263
|
+
/**
|
|
264
|
+
* Finds the nearest package directory above an analyzed source file.
|
|
265
|
+
*/
|
|
266
|
+
rootFor(sourceFile: string): string | undefined;
|
|
215
267
|
}>;
|
|
216
268
|
export {};
|
|
217
269
|
//# sourceMappingURL=build-time-handler-analyzer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-time-handler-analyzer.d.ts","sourceRoot":"","sources":["../../../src/generation/build-time-handler-analyzer.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,KAAK,oBAAoB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,kBAAkB,GAClB,oBAAoB,GACpB,oBAAoB,GACpB,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"build-time-handler-analyzer.d.ts","sourceRoot":"","sources":["../../../src/generation/build-time-handler-analyzer.ts"],"names":[],"mappings":"AAqB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