document-model 6.2.3-dev.100 → 6.2.3-dev.102
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/dist/index.d.ts +205 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +881 -81
- package/dist/index.js.map +1 -1
- package/dist/tooling.d.mts +302 -23
- package/dist/tooling.d.mts.map +1 -1
- package/dist/tooling.mjs +1937 -663
- package/dist/tooling.mjs.map +1 -1
- package/package.json +2 -2
package/dist/tooling.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefinitionCheckProfile, DefinitionCheckReport, DefinitionCheckSkipReason, DefinitionDiagnostic, DefinitionPath, DefinitionSource, DocumentModelDefinition, DocumentModelModule, DocumentModelPHState, Sha256Digest, UpgradeManifest } from "@powerhousedao/shared/document-model";
|
|
1
|
+
import { DefinitionCheckProfile, DefinitionCheckReport, DefinitionCheckSkipReason, DefinitionDiagnostic, DefinitionPath, DefinitionSource, DocumentModelDefinition, DocumentModelModule, DocumentModelPHState, Sha256Digest, SubgraphDefinition, UpgradeManifest } from "@powerhousedao/shared/document-model";
|
|
2
2
|
//#region src/definition/kernel/diagnostics.d.ts
|
|
3
3
|
/** @experimental A source as `specifier#/export/path`, each segment escaped as a JSON Pointer token. */
|
|
4
4
|
export declare function formatDefinitionSource(source: DefinitionSource): string;
|
|
@@ -34,13 +34,76 @@ type NormalizedDocumentModelResult = {
|
|
|
34
34
|
*/
|
|
35
35
|
export declare function adaptCodeFirstDocumentModelSource(value: unknown, source: DefinitionSource): NormalizedDocumentModelResult;
|
|
36
36
|
//#endregion
|
|
37
|
+
//#region src/definition/tooling/model-directories.d.ts
|
|
38
|
+
/** @experimental The models directory a config without `documentModelsDir` uses. */
|
|
39
|
+
export declare const DEFAULT_DOCUMENT_MODELS_DIR = "./document-models";
|
|
40
|
+
/**
|
|
41
|
+
* @experimental What one immediate directory of the models directory holds.
|
|
42
|
+
*
|
|
43
|
+
* - `stored`: a schema-first model, because `<name>/<name>.json` exists. An
|
|
44
|
+
* unreadable or invalid file is still this model's, never a code-first one.
|
|
45
|
+
* - `generated`: schema-first generated code (`gen/` or `v<N>/gen/`) without
|
|
46
|
+
* its stored specification. Its generated modules stay; nothing is pruned.
|
|
47
|
+
* - `module`: a code-first model, whose entry is the directory's one
|
|
48
|
+
* `index.<ext>` module. Generated code wins over an index, which codegen
|
|
49
|
+
* writes into schema-first directories too.
|
|
50
|
+
* - `invalid`: a directory discovery cannot classify; a diagnostic says why.
|
|
51
|
+
* - `none`: no model entry. The declaration scan reports code-first models
|
|
52
|
+
* declared here without an entry.
|
|
53
|
+
*/
|
|
54
|
+
type DocumentModelDirectory = {
|
|
55
|
+
readonly name: string;
|
|
56
|
+
/** Absolute, as spelled under the models directory. */
|
|
57
|
+
readonly path: string;
|
|
58
|
+
} & ({
|
|
59
|
+
readonly kind: "stored";
|
|
60
|
+
readonly specification: `./${string}`;
|
|
61
|
+
} | {
|
|
62
|
+
readonly kind: "generated";
|
|
63
|
+
} | {
|
|
64
|
+
readonly kind: "module";
|
|
65
|
+
readonly entry: `./${string}`;
|
|
66
|
+
} | {
|
|
67
|
+
readonly kind: "invalid";
|
|
68
|
+
} | {
|
|
69
|
+
readonly kind: "none";
|
|
70
|
+
});
|
|
71
|
+
/** @experimental The classified model directories, sorted by name. */
|
|
72
|
+
type DocumentModelDirectories = {
|
|
73
|
+
/** Absolute. */
|
|
74
|
+
readonly documentModelsDir: string;
|
|
75
|
+
readonly directories: readonly DocumentModelDirectory[];
|
|
76
|
+
readonly diagnostics: readonly DefinitionDiagnostic[];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* The configured models directory, resolved inside the package, or why it
|
|
80
|
+
* cannot be read. The package root itself is refused: its directories are
|
|
81
|
+
* the package's other sources, not models.
|
|
82
|
+
*/
|
|
83
|
+
export declare function resolveDocumentModelsDir(packageRoot: string, config: Readonly<Record<string, unknown>>): {
|
|
84
|
+
readonly ok: true;
|
|
85
|
+
readonly path: string;
|
|
86
|
+
} | {
|
|
87
|
+
readonly ok: false;
|
|
88
|
+
readonly diagnostic: DefinitionDiagnostic;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* @experimental Classifies each immediate directory of the models directory
|
|
92
|
+
* by the files it holds, without importing anything. Discovery never reads
|
|
93
|
+
* the generated barrels beside the directories. A missing models directory
|
|
94
|
+
* holds no models; a directory that cannot be read is `invalid` with a
|
|
95
|
+
* diagnostic, so no caller mistakes it for an absent model.
|
|
96
|
+
*/
|
|
97
|
+
export declare function discoverDocumentModelDirectories(packageRoot: string, documentModelsDir: string): DocumentModelDirectories;
|
|
98
|
+
//#endregion
|
|
37
99
|
//#region src/definition/tooling/definition-source-types.d.ts
|
|
38
100
|
/**
|
|
39
|
-
* @experimental The
|
|
40
|
-
* them. Defined from the stored report type so the two cannot
|
|
101
|
+
* @experimental The discovered sources, exactly as a definition report
|
|
102
|
+
* carries them. Defined from the stored report type so the two cannot
|
|
103
|
+
* disagree.
|
|
41
104
|
*/
|
|
42
105
|
type DefinitionSourceSet = DefinitionCheckReport["sourceSet"];
|
|
43
|
-
/** @experimental
|
|
106
|
+
/** @experimental Whether discovery or a caller chose the sources. */
|
|
44
107
|
type DefinitionSourceOrigin = DefinitionSourceSet["origin"];
|
|
45
108
|
/**
|
|
46
109
|
* @experimental The loader's one substitutable dependency: something that
|
|
@@ -56,7 +119,11 @@ interface TypeScriptSourceImportInterface {
|
|
|
56
119
|
}): Promise<Readonly<Record<string, unknown>>>;
|
|
57
120
|
disposeRevision?(packageRevision?: Sha256Digest): Promise<void> | void;
|
|
58
121
|
}
|
|
59
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* @experimental The package whose models are discovered: the directory of
|
|
124
|
+
* `configFile`, read with the config's `documentModelsDir`. A missing config
|
|
125
|
+
* fails unless `allowMissingConfig`, which then reads the default directory.
|
|
126
|
+
*/
|
|
60
127
|
type DefinitionSourceSelectionRequest = {
|
|
61
128
|
readonly configFile?: string;
|
|
62
129
|
readonly allowMissingConfig?: boolean;
|
|
@@ -70,7 +137,7 @@ type DefinitionSourceLoadRequest = DefinitionSourceSelectionRequest & {
|
|
|
70
137
|
readonly packageRevision: Sha256Digest;
|
|
71
138
|
readonly signal?: AbortSignal;
|
|
72
139
|
};
|
|
73
|
-
/** @experimental
|
|
140
|
+
/** @experimental The discovered sources, resolved without importing anything. */
|
|
74
141
|
type DefinitionSourceResolution = {
|
|
75
142
|
readonly packageRoot: string;
|
|
76
143
|
readonly sourceSet: DefinitionSourceSet;
|
|
@@ -90,16 +157,26 @@ type LoadedDefinition<TValue> = {
|
|
|
90
157
|
};
|
|
91
158
|
/** @experimental */
|
|
92
159
|
type LoadedDefinitionSet = DefinitionSourceResolution & {
|
|
160
|
+
/** Absolute; absent when the configured models directory cannot be read. */
|
|
161
|
+
readonly documentModelsDir?: string;
|
|
162
|
+
/** What discovery found in each model directory; absent for requested sources. */
|
|
163
|
+
readonly directories?: readonly DocumentModelDirectory[];
|
|
93
164
|
readonly documentModels: readonly LoadedDefinition<DocumentModelModule>[];
|
|
94
165
|
readonly upgradeManifests: readonly LoadedDefinition<UpgradeManifest<readonly number[]>>[];
|
|
166
|
+
/**
|
|
167
|
+
* The sources that export a definition. A value several sources export is
|
|
168
|
+
* listed above under the first one only, so a source that re-exports
|
|
169
|
+
* another's definitions is named here and nowhere else.
|
|
170
|
+
*/
|
|
171
|
+
readonly sourcesWithDefinitions: readonly DefinitionSource[];
|
|
95
172
|
};
|
|
96
173
|
//#endregion
|
|
97
174
|
//#region src/definition/tooling/definition-source-loader.d.ts
|
|
98
175
|
/**
|
|
99
|
-
* @experimental Imports the
|
|
176
|
+
* @experimental Imports the discovered definition sources and finds the
|
|
100
177
|
* materialized document models, families and upgrade manifests they export.
|
|
101
178
|
* It folds aliases, reports two values that claim one `documentType@version`,
|
|
102
|
-
* and returns everything sorted by source, so neither
|
|
179
|
+
* and returns everything sorted by source, so neither directory order nor
|
|
103
180
|
* import completion order changes a result. Validity belongs to the
|
|
104
181
|
* adapters; registration belongs to the host.
|
|
105
182
|
*/
|
|
@@ -107,7 +184,18 @@ export declare class DefinitionSourceLoader {
|
|
|
107
184
|
#private;
|
|
108
185
|
constructor(importer: TypeScriptSourceImportInterface);
|
|
109
186
|
resolve(request: DefinitionSourceSelectionRequest): DefinitionSourceResolution;
|
|
187
|
+
/**
|
|
188
|
+
* Imports the entry module of every model directory discovery finds and
|
|
189
|
+
* collects the models, families and upgrade manifests it exports.
|
|
190
|
+
*/
|
|
110
191
|
normalizeDefinitionSources(request: DefinitionSourceLoadRequest): Promise<LoadedDefinitionSet>;
|
|
192
|
+
/**
|
|
193
|
+
* @experimental Loads sources the caller names, through the same imports
|
|
194
|
+
* and checks as discovered ones.
|
|
195
|
+
*/
|
|
196
|
+
normalizeRequestedSources(request: DefinitionSourceLoadRequest & {
|
|
197
|
+
readonly sources: readonly unknown[];
|
|
198
|
+
}): Promise<LoadedDefinitionSet>;
|
|
111
199
|
/**
|
|
112
200
|
* @experimental Imports one package module through the same importer and
|
|
113
201
|
* package revision as the selected sources, so a module both reach is
|
|
@@ -129,8 +217,8 @@ export declare class DefinitionSourceLoader {
|
|
|
129
217
|
//#endregion
|
|
130
218
|
//#region src/definition/tooling/definition-source-resolution.d.ts
|
|
131
219
|
/**
|
|
132
|
-
* @experimental The
|
|
133
|
-
*
|
|
220
|
+
* @experimental The sources discovery finds, resolved without importing
|
|
221
|
+
* anything and without any machine-specific path but the root.
|
|
134
222
|
*/
|
|
135
223
|
export declare function resolveDefinitionSelection(request: DefinitionSourceSelectionRequest): DefinitionSourceResolution;
|
|
136
224
|
//#endregion
|
|
@@ -162,15 +250,19 @@ type DefinitionProducerInput = {
|
|
|
162
250
|
type DefinitionProducer = (input: DefinitionProducerInput) => ProducedDefinitions | Promise<ProducedDefinitions>;
|
|
163
251
|
//#endregion
|
|
164
252
|
//#region src/definition/tooling/report/types.d.ts
|
|
165
|
-
/** A code-first declaration under the document models directory that no
|
|
253
|
+
/** A code-first declaration under the document models directory that no model entry exports. */
|
|
166
254
|
type UnregisteredDefinition = {
|
|
167
255
|
readonly kind: "document-model";
|
|
168
256
|
/** `./<documentModelsDir>/<name>/`. */
|
|
169
257
|
readonly unit: `./${string}`;
|
|
170
|
-
/** The module
|
|
258
|
+
/** The declaring module: the directory's `index.ts` when it declares, else the first declaring file. */
|
|
171
259
|
readonly specifier: `./${string}`;
|
|
172
|
-
/**
|
|
173
|
-
|
|
260
|
+
/**
|
|
261
|
+
* `not-exported`: an entry module evaluated the declaring files without
|
|
262
|
+
* exporting the model. `stored-directory`: the directory holds a stored
|
|
263
|
+
* specification, so discovery reads it as schema-first.
|
|
264
|
+
*/
|
|
265
|
+
readonly reason: "unreached" | "not-exported" | "stored-directory";
|
|
174
266
|
};
|
|
175
267
|
/**
|
|
176
268
|
* @experimental What every registered check reads. A wider input, such as
|
|
@@ -331,7 +423,7 @@ type DocumentModelFamilyInspection = {
|
|
|
331
423
|
*/
|
|
332
424
|
type DefinitionInspectionReport = {
|
|
333
425
|
readonly kind: "powerhouse.definition-inspection";
|
|
334
|
-
readonly formatVersion:
|
|
426
|
+
readonly formatVersion: 2;
|
|
335
427
|
readonly status: DefinitionStatus;
|
|
336
428
|
readonly sourceSet: DefinitionSourceSet;
|
|
337
429
|
readonly families: readonly DocumentModelFamilyInspection[];
|
|
@@ -356,6 +448,38 @@ export declare function inspectProjectDefinitions(project: LoadedDefinitionProje
|
|
|
356
448
|
readonly selection?: DefinitionInspectionSelection;
|
|
357
449
|
}): DefinitionInspectionReport;
|
|
358
450
|
//#endregion
|
|
451
|
+
//#region src/definition/tooling/project/unregistered-definitions.d.ts
|
|
452
|
+
/**
|
|
453
|
+
* Each `<documentModelsDir>/<name>/` whose sources declare a code-first model
|
|
454
|
+
* that no entry module's import reached, or that an entry reached without
|
|
455
|
+
* exporting the model's literal id. An entry that did not import reaches
|
|
456
|
+
* files no one can name, so the scan then reports nothing.
|
|
457
|
+
*/
|
|
458
|
+
export declare function findUnregisteredDefinitions(request: {
|
|
459
|
+
readonly packageRoot: string;
|
|
460
|
+
/** Absolute, and already checked to stay inside the package root. */
|
|
461
|
+
readonly documentModelsDir: string;
|
|
462
|
+
readonly sources: readonly DefinitionSource[];
|
|
463
|
+
/** Absolute paths of every module the import of `specifier` evaluated, its own included. */
|
|
464
|
+
readonly importedFiles: (specifier: string) => readonly string[];
|
|
465
|
+
readonly loadedDocumentTypes: ReadonlySet<string>;
|
|
466
|
+
/** Units (`./<documentModelsDir>/<name>/`) a stored specification owns. */
|
|
467
|
+
readonly storedUnits?: ReadonlySet<string>;
|
|
468
|
+
}): {
|
|
469
|
+
readonly unregistered: readonly UnregisteredDefinition[];
|
|
470
|
+
readonly diagnostics: readonly DefinitionDiagnostic[];
|
|
471
|
+
};
|
|
472
|
+
/**
|
|
473
|
+
* @experimental The package-relative files under `directory` that declare a
|
|
474
|
+
* code-first document model, read from source text without running them.
|
|
475
|
+
* Codegen refuses to write a stored model over them.
|
|
476
|
+
*/
|
|
477
|
+
export declare function codeFirstDeclarationFiles(packageRoot: string, directory: string): readonly `./${string}`[];
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/definition/tooling/check/checks/unregistered-definitions.d.ts
|
|
480
|
+
/** @experimental Reports declarations that an entry does not publish. */
|
|
481
|
+
export declare function unregisteredDefinitionDiagnostics(unregistered: readonly UnregisteredDefinition[]): import("@powerhousedao/shared/document-model").DefinitionDiagnostic[];
|
|
482
|
+
//#endregion
|
|
359
483
|
//#region src/definition/tooling/project/project-definitions.d.ts
|
|
360
484
|
/**
|
|
361
485
|
* @experimental A package's document models, loaded once and read by both
|
|
@@ -367,23 +491,178 @@ type ProjectDefinitions = LoadedDefinitionProject & {
|
|
|
367
491
|
readonly packageRoot: string;
|
|
368
492
|
};
|
|
369
493
|
/**
|
|
370
|
-
* @experimental Loads the
|
|
371
|
-
* schema-first models, and scans for code-first
|
|
372
|
-
* reaches. Artifacts and diagnostics are
|
|
373
|
-
* `producers` replaces the default readers.
|
|
374
|
-
* absolute paths of every module the loader's
|
|
375
|
-
* specifier evaluated, so reach follows whatever the
|
|
376
|
-
* Experimental while code-first projects are introduced.
|
|
494
|
+
* @experimental Loads the code-first model directories discovery finds and
|
|
495
|
+
* the package's stored schema-first models, and scans for code-first
|
|
496
|
+
* declarations no entry module reaches. Artifacts and diagnostics are
|
|
497
|
+
* sorted and package relative. `producers` replaces the default readers.
|
|
498
|
+
* `importedFiles` names the absolute paths of every module the loader's
|
|
499
|
+
* import of a discovered specifier evaluated, so reach follows whatever the
|
|
500
|
+
* importer resolved. Experimental while code-first projects are introduced.
|
|
377
501
|
*/
|
|
378
502
|
export declare function loadProjectDefinitions(request: {
|
|
379
503
|
readonly loader: DefinitionSourceLoader;
|
|
380
504
|
readonly configFile: string;
|
|
505
|
+
readonly allowMissingConfig?: boolean;
|
|
381
506
|
readonly packageRevision: Sha256Digest;
|
|
382
507
|
readonly signal?: AbortSignal;
|
|
383
508
|
readonly producers?: readonly DefinitionProducer[];
|
|
384
509
|
readonly importedFiles: (specifier: string) => readonly string[];
|
|
385
510
|
}): Promise<ProjectDefinitions>;
|
|
386
511
|
//#endregion
|
|
387
|
-
|
|
512
|
+
//#region src/definition/tooling/subgraph/read.d.ts
|
|
513
|
+
/** @experimental The definition a code-first class's `describe()` compiled. */
|
|
514
|
+
type TypedSubgraphDefinition = Extract<SubgraphDefinition, {
|
|
515
|
+
readonly schemaKind: "typed";
|
|
516
|
+
}>;
|
|
517
|
+
/** @experimental A code-first subgraph whose description compiled. */
|
|
518
|
+
type CodeFirstSubgraph = {
|
|
519
|
+
readonly name: string;
|
|
520
|
+
readonly source: DefinitionSource;
|
|
521
|
+
readonly definition: TypedSubgraphDefinition;
|
|
522
|
+
};
|
|
523
|
+
/** @experimental What {@link readSubgraphDefinitions} found in a module. */
|
|
524
|
+
type SubgraphDefinitions = {
|
|
525
|
+
/** In export order: the module's own order, or name order for an ES module namespace. */
|
|
526
|
+
readonly subgraphs: readonly CodeFirstSubgraph[];
|
|
527
|
+
/** Protocol, describe and name problems, and each description's own diagnostics. */
|
|
528
|
+
readonly diagnostics: readonly DefinitionDiagnostic[];
|
|
529
|
+
};
|
|
530
|
+
/**
|
|
531
|
+
* @experimental Reads the code-first subgraph classes a module exports, as
|
|
532
|
+
* the host's extraction reaches them: each export, and each value of an
|
|
533
|
+
* exported object. It calls each class's protocol `describe()` and never
|
|
534
|
+
* constructs a class, so a constructor that needs a database or environment
|
|
535
|
+
* does not run. Schema-first classes and other values are left out. A
|
|
536
|
+
* code-first class without a name is a base: it is skipped when another
|
|
537
|
+
* export extends it, and reported when none does.
|
|
538
|
+
*/
|
|
539
|
+
export declare function readSubgraphDefinitions(exports: object, options?: {
|
|
540
|
+
readonly specifier?: `./${string}`;
|
|
541
|
+
}): SubgraphDefinitions;
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/definition/tooling/subgraph/schema-first/sdl-conflicts.d.ts
|
|
544
|
+
/**
|
|
545
|
+
* @experimental The source text of one schema-first subgraph, as ph-cli
|
|
546
|
+
* finds it next to the subgraph's class. Tooling never imports or
|
|
547
|
+
* constructs a schema-first class, so its SDL is read from text.
|
|
548
|
+
*/
|
|
549
|
+
type SchemaFirstSubgraphSource = {
|
|
550
|
+
/** The subgraph's directory, `./subgraphs/<dir>/`. */
|
|
551
|
+
readonly unit: `./${string}`;
|
|
552
|
+
/** The name the class assigns, when its text shows a literal one. */
|
|
553
|
+
readonly name: string | null;
|
|
554
|
+
/** The file the SDL is read from. */
|
|
555
|
+
readonly source: DefinitionSource;
|
|
556
|
+
/** `graphql` for an SDL file, `typescript` for a module holding gql templates. */
|
|
557
|
+
readonly language: "graphql" | "typescript";
|
|
558
|
+
/** `null` when the subgraph has no file to read. */
|
|
559
|
+
readonly text: string | null;
|
|
560
|
+
};
|
|
561
|
+
//#endregion
|
|
562
|
+
//#region src/definition/tooling/subgraph/input.d.ts
|
|
563
|
+
/**
|
|
564
|
+
* @experimental Everything the subgraph checks read: the code-first
|
|
565
|
+
* subgraphs as their classes describe them, the text of the schema-first
|
|
566
|
+
* ones, and the scalars the package exports.
|
|
567
|
+
*/
|
|
568
|
+
type SubgraphCheckInput = {
|
|
569
|
+
readonly codeFirst: readonly CodeFirstSubgraph[];
|
|
570
|
+
readonly schemaFirst: readonly SchemaFirstSubgraphSource[];
|
|
571
|
+
/**
|
|
572
|
+
* The scalar names `scalars/index.ts` exports under their own name, sorted.
|
|
573
|
+
* `undefined` when it was not read, which skips the scalar check.
|
|
574
|
+
*/
|
|
575
|
+
readonly packageScalars: readonly string[] | undefined;
|
|
576
|
+
/** Import, protocol and describe problems, and each description's own diagnostics. */
|
|
577
|
+
readonly diagnostics: readonly DefinitionDiagnostic[];
|
|
578
|
+
/** What a host's admission does with each code-first subgraph, as the caller replayed it; empty when it did not. */
|
|
579
|
+
readonly hostConflicts: readonly SubgraphHostConflict[];
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* @experimental A code-first subgraph a host would refuse or leave out, from
|
|
583
|
+
* a replay of the host's admission: `nameHeldBy` when a built-in subgraph or
|
|
584
|
+
* a document model's subgraph holds its name, and `claims` for the types and
|
|
585
|
+
* root fields other subgraphs own, with their owners.
|
|
586
|
+
*/
|
|
587
|
+
type SubgraphHostConflict = {
|
|
588
|
+
readonly subgraph: string;
|
|
589
|
+
readonly nameHeldBy?: "core" | "document model";
|
|
590
|
+
readonly claims: readonly {
|
|
591
|
+
readonly claim: string;
|
|
592
|
+
readonly owner: string;
|
|
593
|
+
}[];
|
|
594
|
+
};
|
|
595
|
+
/** @experimental A code-first subgraph's entry in the check report. */
|
|
596
|
+
type SubgraphInventoryEntry = DefinitionCheckReport["definitions"][number];
|
|
597
|
+
/** @experimental A package module the caller could not import, and why, in package-relative words. */
|
|
598
|
+
type SubgraphImportFailure = {
|
|
599
|
+
readonly specifier: `./${string}`;
|
|
600
|
+
readonly reason: string;
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
603
|
+
* @experimental Builds the subgraph check input and the inventory entries
|
|
604
|
+
* once, for the check, inspection and release callers to share. `scalars`
|
|
605
|
+
* is the namespace of `scalars/index.ts`: `null` when the package has none,
|
|
606
|
+
* absent when the caller did not read it. `importFailures` names the
|
|
607
|
+
* modules the caller could not import. `hostConflicts` is the caller's replay
|
|
608
|
+
* of a host's admission of the code-first subgraphs.
|
|
609
|
+
*/
|
|
610
|
+
export declare function subgraphCheckInput(request: {
|
|
611
|
+
readonly definitions: SubgraphDefinitions;
|
|
612
|
+
readonly schemaFirst?: readonly SchemaFirstSubgraphSource[];
|
|
613
|
+
readonly scalars?: object | null;
|
|
614
|
+
readonly importFailures?: readonly SubgraphImportFailure[];
|
|
615
|
+
readonly hostConflicts?: readonly SubgraphHostConflict[];
|
|
616
|
+
}): {
|
|
617
|
+
readonly input: SubgraphCheckInput;
|
|
618
|
+
readonly inventory: readonly SubgraphInventoryEntry[];
|
|
619
|
+
};
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region src/definition/tooling/subgraph/checks.d.ts
|
|
622
|
+
/** @experimental The input of {@link subgraphChecks}. */
|
|
623
|
+
type SubgraphChecksInput = DefinitionCheckInput & {
|
|
624
|
+
readonly subgraphs: SubgraphCheckInput;
|
|
625
|
+
};
|
|
626
|
+
type SubgraphCheck = DefinitionCheck<SubgraphChecksInput>;
|
|
627
|
+
/**
|
|
628
|
+
* @experimental The checks `ph model check` adds when a project has a
|
|
629
|
+
* code-first subgraph. A caller registers them with
|
|
630
|
+
* `[...documentModelChecks, ...subgraphChecks]` and a
|
|
631
|
+
* {@link SubgraphChecksInput}.
|
|
632
|
+
*/
|
|
633
|
+
export declare const subgraphChecks: readonly SubgraphCheck[];
|
|
634
|
+
//#endregion
|
|
635
|
+
//#region src/definition/tooling/subgraph/inspection.d.ts
|
|
636
|
+
/** @experimental One subgraph, as `ph model inspect` prints it. */
|
|
637
|
+
type SubgraphInspection = {
|
|
638
|
+
readonly style: "code-first";
|
|
639
|
+
readonly name: string;
|
|
640
|
+
readonly source: DefinitionSource;
|
|
641
|
+
readonly digest: Sha256Digest;
|
|
642
|
+
readonly hasSubscriptions: boolean;
|
|
643
|
+
/** Schema coordinates of the entries, in entry order: `Query.x`, `Type.field`, or the abstract type a resolveType serves. */
|
|
644
|
+
readonly entries: readonly string[];
|
|
645
|
+
readonly types: readonly string[];
|
|
646
|
+
readonly scalars: readonly {
|
|
647
|
+
readonly name: string;
|
|
648
|
+
readonly implementation: string;
|
|
649
|
+
}[];
|
|
650
|
+
} | {
|
|
651
|
+
readonly style: "schema-first";
|
|
652
|
+
readonly name: string | null;
|
|
653
|
+
readonly source: DefinitionSource;
|
|
654
|
+
};
|
|
655
|
+
/** @experimental An inspection report with the project's subgraphs. */
|
|
656
|
+
type SubgraphInspectionReport = DefinitionInspectionReport & {
|
|
657
|
+
readonly subgraphs: readonly SubgraphInspection[];
|
|
658
|
+
};
|
|
659
|
+
/**
|
|
660
|
+
* @experimental Adds the project's subgraphs to an inspection report: a
|
|
661
|
+
* `subgraphs` section, the subgraph diagnostics, and a status that counts
|
|
662
|
+
* them. A project whose only definitions are subgraphs is not skipped.
|
|
663
|
+
*/
|
|
664
|
+
export declare function withSubgraphInspection(project: LoadedDefinitionProject, report: DefinitionInspectionReport, subgraphs: SubgraphCheckInput): SubgraphInspectionReport;
|
|
665
|
+
//#endregion
|
|
666
|
+
export type { CodeFirstSubgraph, DefinitionCheck, DefinitionCheckInput, DefinitionInspectionReport, DefinitionSourceLoadRequest, DefinitionSourceOrigin, DefinitionSourceResolution, DefinitionSourceSelectionRequest, DefinitionSourceSet, DocumentModelDirectories, DocumentModelDirectory, DocumentModelFamilyInspection, DocumentModelInspection, HostValidationEvidence, LoadedDefinition, LoadedDefinitionSet, NormalizedDocumentModelArtifact, NormalizedDocumentModelResult, ProjectDefinitions, ReleaseCheckInput, ReleaseEvidence, SchemaFirstSubgraphSource, SubgraphCheckInput, SubgraphChecksInput, SubgraphDefinitions, SubgraphHostConflict, SubgraphImportFailure, SubgraphInspection, SubgraphInspectionReport, SubgraphInventoryEntry, TypeScriptSourceImportInterface, TypedSubgraphDefinition };
|
|
388
667
|
export {};
|
|
389
668
|
//# sourceMappingURL=tooling.d.mts.map
|
package/dist/tooling.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooling.d.mts","names":[],"sources":["../src/definition/kernel/diagnostics.ts","../src/definition/tooling/adapters/types.ts","../src/definition/tooling/adapters/code-first-document-model-source-adapter.ts","../src/definition/tooling/definition-source-types.ts","../src/definition/tooling/definition-source-loader.ts","../src/definition/tooling/definition-source-resolution.ts","../src/definition/tooling/adapters/producer.ts","../src/definition/tooling/report/types.ts","../src/definition/tooling/check/types.ts","../src/definition/tooling/check/check-project-definitions.ts","../src/definition/tooling/release/types.ts","../src/definition/tooling/release/release-checks.ts","../src/definition/tooling/report/status.ts","../src/definition/tooling/inspect/types.ts","../src/definition/tooling/inspect/inspect-project-definitions.ts","../src/definition/tooling/project/project-definitions.ts"],"mappings":";;;wBAwPgB,uBAAuB,QAAQ;;wBAmB/B,2BACd,YAAY;;;;;;;KC/PF;WACD;WACA,QAAQ;WACR;WAEA;WAEA,YAAY;WAEZ,QAAQ;WAER,eAAe;;;KAId;WACD,oBAAoB;WAEpB,iBAAiB;WACjB,sBAAsB;;;;;;;;;wBC+MjB,kCACd,gBACA,QAAQ,mBACP;;;;;;;
|
|
1
|
+
{"version":3,"file":"tooling.d.mts","names":[],"sources":["../src/definition/kernel/diagnostics.ts","../src/definition/tooling/adapters/types.ts","../src/definition/tooling/adapters/code-first-document-model-source-adapter.ts","../src/definition/tooling/model-directories.ts","../src/definition/tooling/definition-source-types.ts","../src/definition/tooling/definition-source-loader.ts","../src/definition/tooling/definition-source-resolution.ts","../src/definition/tooling/adapters/producer.ts","../src/definition/tooling/report/types.ts","../src/definition/tooling/check/types.ts","../src/definition/tooling/check/check-project-definitions.ts","../src/definition/tooling/release/types.ts","../src/definition/tooling/release/release-checks.ts","../src/definition/tooling/report/status.ts","../src/definition/tooling/inspect/types.ts","../src/definition/tooling/inspect/inspect-project-definitions.ts","../src/definition/tooling/project/unregistered-definitions.ts","../src/definition/tooling/check/checks/unregistered-definitions.ts","../src/definition/tooling/project/project-definitions.ts","../src/definition/tooling/subgraph/read.ts","../src/definition/tooling/subgraph/schema-first/sdl-conflicts.ts","../src/definition/tooling/subgraph/input.ts","../src/definition/tooling/subgraph/checks.ts","../src/definition/tooling/subgraph/inspection.ts"],"mappings":";;;wBAwPgB,uBAAuB,QAAQ;;wBAmB/B,2BACd,YAAY;;;;;;;KC/PF;WACD;WACA,QAAQ;WACR;WAEA;WAEA,YAAY;WAEZ,QAAQ;WAER,eAAe;;;KAId;WACD,oBAAoB;WAEpB,iBAAiB;WACjB,sBAAsB;;;;;;;;;wBC+MjB,kCACd,gBACA,QAAQ,mBACP;;;;qBC/NU;;;;;;;;;;;;;;;KAgBD;WACD;;WAEA;;WAEI;WAAyB;;WACzB;;WACA;WAAyB;;WACzB;;WACA;;;KAIH;;WAED;WACA,sBAAsB;WACtB,sBAAsB;;;;;;;wBAwCjB,yBACd,qBACA,QAAQ,SAAS;WAEJ;WAAmB;;WACnB;WAAoB,YAAY;;;;;;;;;wBAuJ/B,iCACd,qBACA,4BACC;;;;;;;;KC1OS,sBAAsB;;KAGtB,yBAAyB;;;;;;UAOpB;EACf,aAAa;aACF;aACA;aACA,iBAAiB;aACjB,SAAS;MAChB,QAAQ,SAAS;EAErB,iBAAiB,kBAAkB,eAAe;;;;;;;KAQxC;WACD;WAEA;;;KAIC,8BAA8B;;;;;WAK/B,iBAAiB;WACjB,SAAS;;;KAIR;WACD;WACA,WAAW;WACX,sBAAsB;;WAElB;WAAqC;;WAErC;WACA,YAAY;;;KAKf,iBAAiB;WAClB,QAAQ;WAER,MAAM;WACN,OAAO;;;KAIN,sBAAsB;;WAEvB;;WAEA,uBAAuB;WACvB,yBAAyB,iBAAiB;WAC1C,2BAA2B,iBAClC;;;;;;WAOO,iCAAiC;;;;;;;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