@skmtc/core 0.47.4 → 0.49.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/esm/context/CoreContext.d.ts +1 -1
- package/esm/context/CoreContext.js +6 -2
- package/esm/context/GenerateContext.d.ts +15 -4
- package/esm/context/GenerateContext.js +40 -34
- package/esm/context/ParseContext.d.ts +4 -4
- package/esm/context/ParseContext.js +6 -6
- package/esm/context/RenderContext.d.ts +3 -2
- package/esm/context/RenderContext.js +6 -5
- package/esm/context/generateTypes.d.ts +10 -6
- package/esm/context/tryParseAt.d.ts +1 -1
- package/esm/context/tryParseAt.js +1 -1
- package/esm/dsl/ContentSettings.d.ts +17 -12
- package/esm/dsl/ContentSettings.js +13 -9
- package/esm/dsl/Inserted.d.ts +4 -3
- package/esm/dsl/Inserted.js +2 -2
- package/esm/dsl/PendingDefinition.d.ts +3 -2
- package/esm/dsl/driverFiles.d.ts +46 -0
- package/esm/dsl/driverFiles.js +31 -0
- package/esm/dsl/model/ModelDriver.d.ts +5 -7
- package/esm/dsl/model/ModelDriver.js +12 -29
- package/esm/dsl/operation/gql/GqlOperationDriver.d.ts +1 -1
- package/esm/dsl/operation/gql/GqlOperationDriver.js +15 -12
- package/esm/dsl/operation/oas/OasOperationDriver.d.ts +1 -1
- package/esm/dsl/operation/oas/OasOperationDriver.js +11 -14
- package/esm/dsl/webhook/WebhookDriver.d.ts +1 -1
- package/esm/dsl/webhook/WebhookDriver.js +15 -12
- package/esm/enrichments/EnrichmentAudit.d.ts +1 -1
- package/esm/enrichments/EnrichmentWarning.d.ts +1 -1
- package/esm/enrichments/findUnknownKeys.d.ts +1 -1
- package/esm/enrichments/findUnknownKeys.js +1 -1
- package/esm/enrichments/parseEnrichmentUmbrella.d.ts +1 -1
- package/esm/enrichments/parseEnrichmentUmbrella.js +1 -1
- package/esm/enrichments/parseEnrichmentValue.d.ts +2 -2
- package/esm/enrichments/parseEnrichmentValue.js +2 -2
- package/esm/enrichments/readEnrichments.d.ts +4 -4
- package/esm/enrichments/readEnrichments.js +4 -4
- package/esm/enrichments/validateConfig.d.ts +1 -1
- package/esm/helpers/applyGeneratedSuffix.d.ts +1 -1
- package/esm/helpers/applyGeneratedSuffix.js +1 -1
- package/esm/helpers/getByWorkspacePath.d.ts +9 -0
- package/esm/helpers/getByWorkspacePath.js +10 -0
- package/esm/helpers/normalizeWorkspacePath.d.ts +26 -3
- package/esm/helpers/normalizeWorkspacePath.js +17 -2
- package/esm/oas/array/Array.d.ts +2 -2
- package/esm/oas/array/Array.js +2 -2
- package/esm/oas/boolean/Boolean.d.ts +2 -2
- package/esm/oas/boolean/Boolean.js +2 -2
- package/esm/oas/integer/Integer.d.ts +2 -2
- package/esm/oas/integer/Integer.js +2 -2
- package/esm/oas/intersection/Intersection.d.ts +3 -3
- package/esm/oas/intersection/Intersection.js +3 -3
- package/esm/oas/number/Number.d.ts +2 -2
- package/esm/oas/number/Number.js +2 -2
- package/esm/oas/object/Object.d.ts +2 -2
- package/esm/oas/object/Object.js +2 -2
- package/esm/oas/operation/Operation.d.ts +1 -1
- package/esm/oas/operation/Operation.js +1 -1
- package/esm/oas/operation/toEffectiveParameters.d.ts +2 -2
- package/esm/oas/operation/toEffectiveParameters.js +2 -2
- package/esm/oas/ref/DanglingRefError.d.ts +1 -1
- package/esm/oas/ref/DanglingRefError.js +1 -1
- package/esm/oas/ref/Ref.d.ts +2 -2
- package/esm/oas/ref/Ref.js +2 -2
- package/esm/oas/string/String.d.ts +2 -2
- package/esm/oas/string/String.js +2 -2
- package/esm/oas/union/Union.d.ts +3 -3
- package/esm/oas/union/Union.js +3 -3
- package/esm/oas/unknown/Unknown.d.ts +2 -2
- package/esm/oas/unknown/Unknown.js +2 -2
- package/esm/parse/allOfSystem.d.ts +4 -4
- package/esm/parse/allOfSystem.js +2 -2
- package/esm/parse/anyOfSystem.d.ts +5 -5
- package/esm/parse/anyOfSystem.js +4 -4
- package/esm/parse/keptRefs.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +1 -1
- package/esm/parse/v3-0/_merge-all-of/merge-union.js +3 -3
- package/esm/parse/v3-0/_merge-all-of/merge.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/types.d.ts +4 -4
- package/esm/parse/v3-0/ref/toRefV31.js +1 -1
- package/esm/parse/v3-0/schema/toSchemasV3.js +3 -3
- package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +1 -1
- package/esm/parse/v3-1/_merge-all-of/merge-union.js +3 -3
- package/esm/parse/v3-1/_merge-all-of/merge.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/types.d.ts +4 -4
- package/esm/parse/v3-1/ref/toRefV31.js +1 -1
- package/esm/parse/v3-1/schema/toSchemasV3.js +3 -3
- package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +1 -1
- package/esm/parse/v3-2/_merge-all-of/merge-union.js +3 -3
- package/esm/parse/v3-2/_merge-all-of/merge.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/types.d.ts +4 -4
- package/esm/parse/v3-2/ref/toRefV31.js +1 -1
- package/esm/parse/v3-2/schema/toSchemasV3.js +3 -3
- package/esm/run/toEnrichmentDefaults.d.ts +1 -1
- package/esm/run/toEnrichmentDefaults.js +1 -1
- package/esm/types/EnrichmentDefaults.d.ts +1 -1
- package/esm/types/EnrichmentDefaults.js +1 -1
- package/esm/types/Enrichments.d.ts +1 -1
- package/esm/types/Manifest.d.ts +1 -1
- package/esm/types/ModuleSelect.d.ts +1 -1
- package/esm/types/Settings.d.ts +29 -11
- package/esm/types/Settings.js +13 -6
- package/esm/types/Variant.d.ts +3 -3
- package/esm/types/Variant.js +3 -3
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +1 -1
- package/script/context/CoreContext.js +6 -2
- package/script/context/GenerateContext.d.ts +15 -4
- package/script/context/GenerateContext.js +38 -32
- package/script/context/ParseContext.d.ts +4 -4
- package/script/context/ParseContext.js +6 -6
- package/script/context/RenderContext.d.ts +3 -2
- package/script/context/RenderContext.js +6 -5
- package/script/context/generateTypes.d.ts +10 -6
- package/script/context/tryParseAt.d.ts +1 -1
- package/script/context/tryParseAt.js +1 -1
- package/script/dsl/ContentSettings.d.ts +17 -12
- package/script/dsl/ContentSettings.js +13 -9
- package/script/dsl/Inserted.d.ts +4 -3
- package/script/dsl/Inserted.js +2 -2
- package/script/dsl/PendingDefinition.d.ts +3 -2
- package/script/dsl/driverFiles.d.ts +46 -0
- package/script/dsl/driverFiles.js +38 -0
- package/script/dsl/model/ModelDriver.d.ts +5 -7
- package/script/dsl/model/ModelDriver.js +12 -29
- package/script/dsl/operation/gql/GqlOperationDriver.d.ts +1 -1
- package/script/dsl/operation/gql/GqlOperationDriver.js +15 -12
- package/script/dsl/operation/oas/OasOperationDriver.d.ts +1 -1
- package/script/dsl/operation/oas/OasOperationDriver.js +11 -14
- package/script/dsl/webhook/WebhookDriver.d.ts +1 -1
- package/script/dsl/webhook/WebhookDriver.js +15 -12
- package/script/enrichments/EnrichmentAudit.d.ts +1 -1
- package/script/enrichments/EnrichmentWarning.d.ts +1 -1
- package/script/enrichments/findUnknownKeys.d.ts +1 -1
- package/script/enrichments/findUnknownKeys.js +1 -1
- package/script/enrichments/parseEnrichmentUmbrella.d.ts +1 -1
- package/script/enrichments/parseEnrichmentUmbrella.js +1 -1
- package/script/enrichments/parseEnrichmentValue.d.ts +2 -2
- package/script/enrichments/parseEnrichmentValue.js +2 -2
- package/script/enrichments/readEnrichments.d.ts +4 -4
- package/script/enrichments/readEnrichments.js +4 -4
- package/script/enrichments/validateConfig.d.ts +1 -1
- package/script/helpers/applyGeneratedSuffix.d.ts +1 -1
- package/script/helpers/applyGeneratedSuffix.js +1 -1
- package/script/helpers/getByWorkspacePath.d.ts +9 -0
- package/script/helpers/getByWorkspacePath.js +14 -0
- package/script/helpers/normalizeWorkspacePath.d.ts +26 -3
- package/script/helpers/normalizeWorkspacePath.js +19 -3
- package/script/oas/array/Array.d.ts +2 -2
- package/script/oas/array/Array.js +2 -2
- package/script/oas/boolean/Boolean.d.ts +2 -2
- package/script/oas/boolean/Boolean.js +2 -2
- package/script/oas/integer/Integer.d.ts +2 -2
- package/script/oas/integer/Integer.js +2 -2
- package/script/oas/intersection/Intersection.d.ts +3 -3
- package/script/oas/intersection/Intersection.js +3 -3
- package/script/oas/number/Number.d.ts +2 -2
- package/script/oas/number/Number.js +2 -2
- package/script/oas/object/Object.d.ts +2 -2
- package/script/oas/object/Object.js +2 -2
- package/script/oas/operation/Operation.d.ts +1 -1
- package/script/oas/operation/Operation.js +1 -1
- package/script/oas/operation/toEffectiveParameters.d.ts +2 -2
- package/script/oas/operation/toEffectiveParameters.js +2 -2
- package/script/oas/ref/DanglingRefError.d.ts +1 -1
- package/script/oas/ref/DanglingRefError.js +1 -1
- package/script/oas/ref/Ref.d.ts +2 -2
- package/script/oas/ref/Ref.js +2 -2
- package/script/oas/string/String.d.ts +2 -2
- package/script/oas/string/String.js +2 -2
- package/script/oas/union/Union.d.ts +3 -3
- package/script/oas/union/Union.js +3 -3
- package/script/oas/unknown/Unknown.d.ts +2 -2
- package/script/oas/unknown/Unknown.js +2 -2
- package/script/parse/allOfSystem.d.ts +4 -4
- package/script/parse/allOfSystem.js +2 -2
- package/script/parse/anyOfSystem.d.ts +5 -5
- package/script/parse/anyOfSystem.js +4 -4
- package/script/parse/keptRefs.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +1 -1
- package/script/parse/v3-0/_merge-all-of/merge-union.js +3 -3
- package/script/parse/v3-0/_merge-all-of/merge.js +2 -2
- package/script/parse/v3-0/_merge-all-of/types.d.ts +4 -4
- package/script/parse/v3-0/ref/toRefV31.js +1 -1
- package/script/parse/v3-0/schema/toSchemasV3.js +3 -3
- package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +1 -1
- package/script/parse/v3-1/_merge-all-of/merge-union.js +3 -3
- package/script/parse/v3-1/_merge-all-of/merge.js +2 -2
- package/script/parse/v3-1/_merge-all-of/types.d.ts +4 -4
- package/script/parse/v3-1/ref/toRefV31.js +1 -1
- package/script/parse/v3-1/schema/toSchemasV3.js +3 -3
- package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +1 -1
- package/script/parse/v3-2/_merge-all-of/merge-union.js +3 -3
- package/script/parse/v3-2/_merge-all-of/merge.js +2 -2
- package/script/parse/v3-2/_merge-all-of/types.d.ts +4 -4
- package/script/parse/v3-2/ref/toRefV31.js +1 -1
- package/script/parse/v3-2/schema/toSchemasV3.js +3 -3
- package/script/run/toEnrichmentDefaults.d.ts +1 -1
- package/script/run/toEnrichmentDefaults.js +1 -1
- package/script/types/EnrichmentDefaults.d.ts +1 -1
- package/script/types/EnrichmentDefaults.js +1 -1
- package/script/types/Enrichments.d.ts +1 -1
- package/script/types/Manifest.d.ts +1 -1
- package/script/types/ModuleSelect.d.ts +1 -1
- package/script/types/Settings.d.ts +29 -11
- package/script/types/Settings.js +14 -7
- package/script/types/Variant.d.ts +3 -3
- package/script/types/Variant.js +3 -3
|
@@ -22,15 +22,15 @@ import { DEFAULT_VARIANT } from '../types/Variant.js';
|
|
|
22
22
|
*
|
|
23
23
|
* @example Basic settings without enrichments
|
|
24
24
|
* ```typescript
|
|
25
|
-
* import { ContentSettings } from '@skmtc/core';
|
|
25
|
+
* import { ContentSettings, normalizeWorkspacePath } from '@skmtc/core';
|
|
26
26
|
* import { createType } from '@skmtc/lang-typescript';
|
|
27
27
|
*
|
|
28
28
|
* const settings = ContentSettings.empty({
|
|
29
|
-
* exportPath: './src/generated/models.ts',
|
|
29
|
+
* exportPath: normalizeWorkspacePath('./src/generated/models.ts'),
|
|
30
30
|
* identifier: createType('UserModels')
|
|
31
31
|
* });
|
|
32
32
|
*
|
|
33
|
-
* console.log(settings.exportPath); // '
|
|
33
|
+
* console.log(settings.exportPath); // '@/src/generated/models.ts'
|
|
34
34
|
* console.log(settings.enrichments); // undefined
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
@@ -44,7 +44,7 @@ import { DEFAULT_VARIANT } from '../types/Variant.js';
|
|
|
44
44
|
*
|
|
45
45
|
* const enrichedSettings = new ContentSettings({
|
|
46
46
|
* identifier: createType('ValidatedModels'),
|
|
47
|
-
* exportPath: './src/models/validated.ts',
|
|
47
|
+
* exportPath: normalizeWorkspacePath('./src/models/validated.ts'),
|
|
48
48
|
* enrichments: {
|
|
49
49
|
* validateRequired: true,
|
|
50
50
|
* generateComments: true,
|
|
@@ -66,7 +66,7 @@ import { DEFAULT_VARIANT } from '../types/Variant.js';
|
|
|
66
66
|
* ...args,
|
|
67
67
|
* settings: new ContentSettings({
|
|
68
68
|
* identifier: createType(args.refName),
|
|
69
|
-
* exportPath: './src/validated-models.ts',
|
|
69
|
+
* exportPath: normalizeWorkspacePath('./src/validated-models.ts'),
|
|
70
70
|
* enrichments: {
|
|
71
71
|
* validateRequired: true,
|
|
72
72
|
* generateComments: false,
|
|
@@ -107,7 +107,7 @@ export class ContentSettings {
|
|
|
107
107
|
* ```typescript
|
|
108
108
|
* const settings = new ContentSettings({
|
|
109
109
|
* identifier: createType('ApiModels'),
|
|
110
|
-
* exportPath: './src/api/models.ts',
|
|
110
|
+
* exportPath: normalizeWorkspacePath('./src/api/models.ts'),
|
|
111
111
|
* enrichments: {
|
|
112
112
|
* includeValidation: true,
|
|
113
113
|
* format: 'detailed'
|
|
@@ -124,7 +124,11 @@ export class ContentSettings {
|
|
|
124
124
|
writable: true,
|
|
125
125
|
value: void 0
|
|
126
126
|
});
|
|
127
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* The path where generated content will be exported, normalized
|
|
129
|
+
* ({@link normalizeWorkspacePath}): it finds its file without being
|
|
130
|
+
* normalized again.
|
|
131
|
+
*/
|
|
128
132
|
Object.defineProperty(this, "exportPath", {
|
|
129
133
|
enumerable: true,
|
|
130
134
|
configurable: true,
|
|
@@ -171,7 +175,7 @@ export class ContentSettings {
|
|
|
171
175
|
* ```typescript
|
|
172
176
|
* const basicSettings = ContentSettings.empty({
|
|
173
177
|
* identifier: createType('SimpleModels'),
|
|
174
|
-
* exportPath: './src/models.ts'
|
|
178
|
+
* exportPath: normalizeWorkspacePath('./src/models.ts')
|
|
175
179
|
* });
|
|
176
180
|
*
|
|
177
181
|
* console.log(basicSettings.enrichments); // undefined
|
|
@@ -183,7 +187,7 @@ export class ContentSettings {
|
|
|
183
187
|
* ...args,
|
|
184
188
|
* settings: ContentSettings.empty({
|
|
185
189
|
* identifier: createType(args.refName),
|
|
186
|
-
* exportPath: './src/simple-models.ts'
|
|
190
|
+
* exportPath: normalizeWorkspacePath('./src/simple-models.ts')
|
|
187
191
|
* })
|
|
188
192
|
* });
|
|
189
193
|
* }
|
package/esm/dsl/Inserted.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { GeneratedDefinition, GeneratedValue } from './GeneratedValue.js';
|
|
2
2
|
import type { ContentSettings } from './ContentSettings.js';
|
|
3
3
|
import type { IdentifierBase } from './IdentifierBase.js';
|
|
4
|
+
import type { WorkspacePath } from '../helpers/normalizeWorkspacePath.js';
|
|
4
5
|
/**
|
|
5
6
|
* Constructor arguments for {@link Inserted}.
|
|
6
7
|
*
|
|
@@ -49,7 +50,7 @@ type ConstructorArgs<V extends GeneratedValue, EnrichmentType> = {
|
|
|
49
50
|
*
|
|
50
51
|
* // Access the generated value (guaranteed to be present)
|
|
51
52
|
* const userTypeName = userModel.toValue(); // UserModelValue (not undefined)
|
|
52
|
-
* const exportPath = userModel.toExportPath(); // '
|
|
53
|
+
* const exportPath = userModel.toExportPath(); // '@/src/models.ts'
|
|
53
54
|
* const identifier = userModel.toName(); // 'User'
|
|
54
55
|
*
|
|
55
56
|
* return new Definition({
|
|
@@ -126,13 +127,13 @@ export declare class Inserted<V extends GeneratedValue, EnrichmentType> {
|
|
|
126
127
|
* @example
|
|
127
128
|
* ```typescript
|
|
128
129
|
* const userModel = this.insertModel(generator, 'User');
|
|
129
|
-
* const exportPath = userModel.toExportPath(); // '
|
|
130
|
+
* const exportPath = userModel.toExportPath(); // '@/src/models/User.ts'
|
|
130
131
|
*
|
|
131
132
|
* // Create import statement
|
|
132
133
|
* const importStmt = `import { User } from '${exportPath}';`;
|
|
133
134
|
* ```
|
|
134
135
|
*/
|
|
135
|
-
toExportPath():
|
|
136
|
+
toExportPath(): WorkspacePath;
|
|
136
137
|
/**
|
|
137
138
|
* Gets the generated value from the inserted artifact.
|
|
138
139
|
*
|
package/esm/dsl/Inserted.js
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
*
|
|
35
35
|
* // Access the generated value (guaranteed to be present)
|
|
36
36
|
* const userTypeName = userModel.toValue(); // UserModelValue (not undefined)
|
|
37
|
-
* const exportPath = userModel.toExportPath(); // '
|
|
37
|
+
* const exportPath = userModel.toExportPath(); // '@/src/models.ts'
|
|
38
38
|
* const identifier = userModel.toName(); // 'User'
|
|
39
39
|
*
|
|
40
40
|
* return new Definition({
|
|
@@ -128,7 +128,7 @@ export class Inserted {
|
|
|
128
128
|
* @example
|
|
129
129
|
* ```typescript
|
|
130
130
|
* const userModel = this.insertModel(generator, 'User');
|
|
131
|
-
* const exportPath = userModel.toExportPath(); // '
|
|
131
|
+
* const exportPath = userModel.toExportPath(); // '@/src/models/User.ts'
|
|
132
132
|
*
|
|
133
133
|
* // Create import statement
|
|
134
134
|
* const importStmt = `import { User } from '${exportPath}';`;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { IdentifierBase } from './IdentifierBase.js';
|
|
2
2
|
import type { GeneratorKey } from './GeneratorKeys.js';
|
|
3
|
+
import type { WorkspacePath } from '../helpers/normalizeWorkspacePath.js';
|
|
3
4
|
type PendingDefinitionArgs = {
|
|
4
5
|
identifier: IdentifierBase;
|
|
5
|
-
exportPath:
|
|
6
|
+
exportPath: WorkspacePath;
|
|
6
7
|
generatorKey: GeneratorKey;
|
|
7
8
|
options: unknown;
|
|
8
9
|
projection: unknown;
|
|
@@ -24,7 +25,7 @@ type PendingDefinitionArgs = {
|
|
|
24
25
|
export declare class PendingDefinition {
|
|
25
26
|
identifier: IdentifierBase;
|
|
26
27
|
/** The file the Definition will go to, normalized. */
|
|
27
|
-
exportPath:
|
|
28
|
+
exportPath: WorkspacePath;
|
|
28
29
|
/** The key the Definition will carry: the identity check runs on the entry too. */
|
|
29
30
|
generatorKey: GeneratorKey;
|
|
30
31
|
/** The caller's options the projection is constructed with: identity, like the key. */
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { FindDefinitionArgs, GenerateContextType } from '../context/generateTypes.js';
|
|
2
|
+
import type { DefinitionBase } from './Definition.js';
|
|
3
|
+
import type { FileBase } from './FileBase.js';
|
|
4
|
+
import type { Lang } from './Lang.js';
|
|
5
|
+
import { type WorkspacePath } from '../helpers/normalizeWorkspacePath.js';
|
|
6
|
+
/** The file an import goes into: the file when it exists, its normalized path when it does not yet. */
|
|
7
|
+
export type ImportDestination = FileBase | WorkspacePath;
|
|
8
|
+
type ToImportDestinationArgs = {
|
|
9
|
+
context: GenerateContextType;
|
|
10
|
+
/** The file the imported symbol is declared in. */
|
|
11
|
+
exportPath: WorkspacePath;
|
|
12
|
+
/** The file that uses the symbol, as a generator spelled it. */
|
|
13
|
+
destinationPath: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Where an import from `exportPath` goes, or `undefined` when it goes
|
|
17
|
+
* nowhere: there is no destination, or the destination is `exportPath`'s own
|
|
18
|
+
* file, where the symbol is in scope. Creates nothing: {@link toImportFile}
|
|
19
|
+
* creates the file once the import is wanted.
|
|
20
|
+
*/
|
|
21
|
+
export declare const toImportDestination: ({ context, exportPath, destinationPath }: ToImportDestinationArgs) => ImportDestination | undefined;
|
|
22
|
+
type ToImportFileArgs = {
|
|
23
|
+
context: GenerateContextType;
|
|
24
|
+
lang: Lang;
|
|
25
|
+
destination: ImportDestination;
|
|
26
|
+
};
|
|
27
|
+
/** The file of `destination`, created through `lang` if it does not exist yet. */
|
|
28
|
+
export declare const toImportFile: ({ context, lang, destination }: ToImportFileArgs) => FileBase;
|
|
29
|
+
type EnsureFileArgs = {
|
|
30
|
+
context: GenerateContextType;
|
|
31
|
+
lang: Lang;
|
|
32
|
+
path: WorkspacePath;
|
|
33
|
+
};
|
|
34
|
+
/** The file at `path`, created through `lang` on first write. */
|
|
35
|
+
export declare const ensureFile: ({ context, lang, path }: EnsureFileArgs) => FileBase;
|
|
36
|
+
type FindDefinitionAtArgs = Omit<FindDefinitionArgs, 'exportPath'> & {
|
|
37
|
+
context: GenerateContextType;
|
|
38
|
+
exportPath: WorkspacePath;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* {@link GenerateContextType.findDefinition} for a normalized export path: a
|
|
42
|
+
* definition is in a file, so with no file at the path there is none, and
|
|
43
|
+
* the path is not normalized again to find that out.
|
|
44
|
+
*/
|
|
45
|
+
export declare const findDefinitionAt: ({ context, ...args }: FindDefinitionAtArgs) => DefinitionBase | undefined;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { normalizeWorkspacePath } from '../helpers/normalizeWorkspacePath.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where an import from `exportPath` goes, or `undefined` when it goes
|
|
4
|
+
* nowhere: there is no destination, or the destination is `exportPath`'s own
|
|
5
|
+
* file, where the symbol is in scope. Creates nothing: {@link toImportFile}
|
|
6
|
+
* creates the file once the import is wanted.
|
|
7
|
+
*/
|
|
8
|
+
export const toImportDestination = ({ context, exportPath, destinationPath }) => {
|
|
9
|
+
if (!destinationPath || destinationPath === exportPath) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
const file = context.getFile(destinationPath);
|
|
13
|
+
if (file !== undefined) {
|
|
14
|
+
return file.path === exportPath ? undefined : file;
|
|
15
|
+
}
|
|
16
|
+
const path = normalizeWorkspacePath(destinationPath);
|
|
17
|
+
return path === exportPath ? undefined : path;
|
|
18
|
+
};
|
|
19
|
+
/** The file of `destination`, created through `lang` if it does not exist yet. */
|
|
20
|
+
export const toImportFile = ({ context, lang, destination }) => typeof destination === 'string' ? ensureFile({ context, lang, path: destination }) : destination;
|
|
21
|
+
/** The file at `path`, created through `lang` on first write. */
|
|
22
|
+
export const ensureFile = ({ context, lang, path }) => context.getFileByWorkspacePath(path) ??
|
|
23
|
+
context.addFile(lang.createFile({ path, settings: context.settings }));
|
|
24
|
+
/**
|
|
25
|
+
* {@link GenerateContextType.findDefinition} for a normalized export path: a
|
|
26
|
+
* definition is in a file, so with no file at the path there is none, and
|
|
27
|
+
* the path is not normalized again to find that out.
|
|
28
|
+
*/
|
|
29
|
+
export const findDefinitionAt = ({ context, ...args }) => context.getFileByWorkspacePath(args.exportPath) === undefined
|
|
30
|
+
? undefined
|
|
31
|
+
: context.findDefinition(args);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ModelProjection } from './types.js';
|
|
2
2
|
import type { GenerateContextType, InsertModelOptions } from '../../context/generateTypes.js';
|
|
3
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
|
+
import type { WorkspacePath } from '../../helpers/normalizeWorkspacePath.js';
|
|
4
5
|
import type { GeneratedDefinition } from '../GeneratedValue.js';
|
|
5
6
|
import type { GeneratedValue } from '../GeneratedValue.js';
|
|
6
7
|
import { type RefParts } from '../../helpers/refFns.js';
|
|
@@ -44,13 +45,10 @@ export declare class ModelDriver<V extends GeneratedValue, EnrichmentType, Proje
|
|
|
44
45
|
constructor(args: CreateModelArgs<V, EnrichmentType, ProjectionOptions>, settings?: ContentSettings<EnrichmentType>);
|
|
45
46
|
private apply;
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* cache-hit path). Returns the normalized path.
|
|
48
|
+
* The code File at `path`, created on first use through the projection's
|
|
49
|
+
* language — the static read off the projection class at the use site,
|
|
50
|
+
* never persisted (works pre-construction on the cache-hit path).
|
|
51
51
|
*/
|
|
52
|
-
private ensureFile;
|
|
53
|
-
/** The code File at `path`, created through the projection's language on first use. */
|
|
54
52
|
private ensureCodeFile;
|
|
55
53
|
private getDefinition;
|
|
56
54
|
private affirmDefinition;
|
|
@@ -68,7 +66,7 @@ type IsReferencedBackArgs = {
|
|
|
68
66
|
identifier: {
|
|
69
67
|
name: string;
|
|
70
68
|
};
|
|
71
|
-
exportPath:
|
|
69
|
+
exportPath: WorkspacePath;
|
|
72
70
|
};
|
|
73
71
|
};
|
|
74
72
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ensureFile, findDefinitionAt, toImportDestination, toImportFile } from '../driverFiles.js';
|
|
2
2
|
import { toModelGeneratorKey } from '../GeneratorKeys.js';
|
|
3
3
|
import { toModelKey } from '../../helpers/refFns.js';
|
|
4
4
|
import { DEFAULT_VARIANT } from '../../types/Variant.js';
|
|
@@ -107,17 +107,12 @@ export class ModelDriver {
|
|
|
107
107
|
return definition;
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* cache-hit path). Returns the normalized path.
|
|
110
|
+
* The code File at `path`, created on first use through the projection's
|
|
111
|
+
* language — the static read off the projection class at the use site,
|
|
112
|
+
* never persisted (works pre-construction on the cache-hit path).
|
|
114
113
|
*/
|
|
115
|
-
ensureFile(path) {
|
|
116
|
-
return ensureFile({ context: this.context, lang: this.projection.lang, path });
|
|
117
|
-
}
|
|
118
|
-
/** The code File at `path`, created through the projection's language on first use. */
|
|
119
114
|
ensureCodeFile(path) {
|
|
120
|
-
const file = this.context
|
|
115
|
+
const file = ensureFile({ context: this.context, lang: this.projection.lang, path });
|
|
121
116
|
if (!(file instanceof CodeFileBase)) {
|
|
122
117
|
throw new Error(`File at '${path}' is not a code file: a model Definition cannot go there.`);
|
|
123
118
|
}
|
|
@@ -141,7 +136,7 @@ export class ModelDriver {
|
|
|
141
136
|
});
|
|
142
137
|
throw new Error(`'${identifier.name}' in file '${exportPath}' is being constructed further up the stack. A reference back to it goes through toModelRef, which returns it suspended; a second projection would never finish.`);
|
|
143
138
|
}
|
|
144
|
-
const found = this.context
|
|
139
|
+
const found = findDefinitionAt({ context: this.context, name: identifier.name, exportPath });
|
|
145
140
|
if (found !== undefined) {
|
|
146
141
|
if (this.affirmDefinition(found, exportPath)) {
|
|
147
142
|
return found;
|
|
@@ -153,7 +148,7 @@ export class ModelDriver {
|
|
|
153
148
|
// there, not a cache miss.
|
|
154
149
|
const marker = new PendingDefinition({
|
|
155
150
|
identifier,
|
|
156
|
-
exportPath
|
|
151
|
+
exportPath,
|
|
157
152
|
generatorKey,
|
|
158
153
|
options: this.options,
|
|
159
154
|
projection: this.projection
|
|
@@ -175,7 +170,7 @@ export class ModelDriver {
|
|
|
175
170
|
definition.reaches = marker.reaches;
|
|
176
171
|
// Added once the constructor returned, so the Definition renders after
|
|
177
172
|
// the models it refers to, and a constructor that throws adds no file.
|
|
178
|
-
const taken = this.context
|
|
173
|
+
const taken = findDefinitionAt({ context: this.context, name: identifier.name, exportPath });
|
|
179
174
|
if (taken !== undefined) {
|
|
180
175
|
assertSameKey({
|
|
181
176
|
name: identifier.name,
|
|
@@ -244,10 +239,7 @@ const whilePending = ({ context, marker }, construct) => {
|
|
|
244
239
|
* pending stack holds exactly the models whose constructors are running, so
|
|
245
240
|
* the search is as long as the chain of models being built.
|
|
246
241
|
*/
|
|
247
|
-
const findPending = ({ context, name, exportPath }) =>
|
|
248
|
-
const path = normalizeWorkspacePath(exportPath);
|
|
249
|
-
return context.pendingStack.find(pending => pending.identifier.name === name && pending.exportPath === path);
|
|
250
|
-
};
|
|
242
|
+
const findPending = ({ context, name, exportPath }) => context.pendingStack.find(pending => pending.identifier.name === name && pending.exportPath === exportPath);
|
|
251
243
|
/** A model under construction is this model only with the same key, projection class and options. */
|
|
252
244
|
const assertSamePending = ({ pending, name, exportPath, generatorKey, options, projection }) => {
|
|
253
245
|
assertSameKey({ name, exportPath, cachedKey: pending.generatorKey, generatorKey });
|
|
@@ -256,14 +248,6 @@ const assertSamePending = ({ pending, name, exportPath, generatorKey, options, p
|
|
|
256
248
|
}
|
|
257
249
|
assertSameOptions({ name, exportPath, cachedOptions: pending.options, options });
|
|
258
250
|
};
|
|
259
|
-
/** Ensure the file at `path` exists, creating it through `lang` on first write. Returns the normalized path. */
|
|
260
|
-
const ensureFile = ({ context, lang, path }) => {
|
|
261
|
-
const normalizedPath = normalizeWorkspacePath(path);
|
|
262
|
-
if (!context.getFile(normalizedPath)) {
|
|
263
|
-
context.addFile(lang.createFile({ path: normalizedPath, settings: context.settings }));
|
|
264
|
-
}
|
|
265
|
-
return normalizedPath;
|
|
266
|
-
};
|
|
267
251
|
/**
|
|
268
252
|
* Import a model's identifier from its export path into `destinationPath`,
|
|
269
253
|
* unless the two are one file. The language builds the import object
|
|
@@ -271,14 +255,13 @@ const ensureFile = ({ context, lang, path }) => {
|
|
|
271
255
|
* stores it via the pure-data `context.register`.
|
|
272
256
|
*/
|
|
273
257
|
const stitchModelImport = ({ context, lang, identifier, exportPath, destinationPath }) => {
|
|
274
|
-
|
|
275
|
-
|
|
258
|
+
const importInto = toImportDestination({ context, exportPath, destinationPath });
|
|
259
|
+
if (importInto === undefined) {
|
|
276
260
|
return;
|
|
277
261
|
}
|
|
278
|
-
ensureFile({ context, lang, path: destinationPath });
|
|
279
262
|
context.register({
|
|
280
263
|
imports: [lang.toImport({ identifier, module: exportPath })],
|
|
281
|
-
destinationPath
|
|
264
|
+
destinationPath: toImportFile({ context, lang, destination: importInto }).path
|
|
282
265
|
});
|
|
283
266
|
};
|
|
284
267
|
/** The models `definition`'s construction reached that are still pending. */
|
|
@@ -38,7 +38,7 @@ export declare class GqlOperationDriver<V extends GeneratedValue, EnrichmentType
|
|
|
38
38
|
* Ensure the file at `path` exists, creating it on first write through
|
|
39
39
|
* the projection's language — the static read off the projection class
|
|
40
40
|
* at the use site, never persisted (works pre-construction on the
|
|
41
|
-
* cache-hit path). Returns the
|
|
41
|
+
* cache-hit path). Returns the file.
|
|
42
42
|
*/
|
|
43
43
|
private ensureFile;
|
|
44
44
|
private getDefinition;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ensureFile, findDefinitionAt, toImportDestination, toImportFile } from '../../driverFiles.js';
|
|
2
2
|
import { toGqlOperationGeneratorKey } from '../../GeneratorKeys.js';
|
|
3
3
|
import { DEFAULT_VARIANT } from '../../../types/Variant.js';
|
|
4
4
|
import { readProjectionOptions, toValueOptions } from '../../../types/ProjectionOptions.js';
|
|
@@ -95,18 +95,21 @@ export class GqlOperationDriver {
|
|
|
95
95
|
apply({ destinationPath } = {}) {
|
|
96
96
|
const { identifier, exportPath } = this.settings;
|
|
97
97
|
const definition = this.getDefinition({ identifier, exportPath });
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
const importInto = toImportDestination({ context: this.context, exportPath, destinationPath });
|
|
99
|
+
if (importInto !== undefined) {
|
|
100
100
|
// Cross-file import of the peer's identifier from its export path.
|
|
101
101
|
// The language builds the import object (`toImport`) and creates the
|
|
102
102
|
// destination file on first write (caller-side); the engine stores
|
|
103
103
|
// via the pure-data `context.register`. The import lands in the
|
|
104
104
|
// caller's file (`destinationPath`); `insertOperation` only composes
|
|
105
105
|
// same-language generators, so the peer's `lang` is the caller's.
|
|
106
|
-
this.ensureFile(destinationPath);
|
|
107
106
|
this.context.register({
|
|
108
107
|
imports: [this.projection.lang.toImport({ identifier, module: exportPath })],
|
|
109
|
-
destinationPath
|
|
108
|
+
destinationPath: toImportFile({
|
|
109
|
+
context: this.context,
|
|
110
|
+
lang: this.projection.lang,
|
|
111
|
+
destination: importInto
|
|
112
|
+
}).path
|
|
110
113
|
});
|
|
111
114
|
}
|
|
112
115
|
return definition;
|
|
@@ -115,17 +118,17 @@ export class GqlOperationDriver {
|
|
|
115
118
|
* Ensure the file at `path` exists, creating it on first write through
|
|
116
119
|
* the projection's language — the static read off the projection class
|
|
117
120
|
* at the use site, never persisted (works pre-construction on the
|
|
118
|
-
* cache-hit path). Returns the
|
|
121
|
+
* cache-hit path). Returns the file.
|
|
119
122
|
*/
|
|
120
123
|
ensureFile(path) {
|
|
121
|
-
|
|
122
|
-
if (!this.context.getFile(normalizedPath)) {
|
|
123
|
-
this.context.addFile(this.projection.lang.createFile({ path: normalizedPath, settings: this.context.settings }));
|
|
124
|
-
}
|
|
125
|
-
return normalizedPath;
|
|
124
|
+
return ensureFile({ context: this.context, lang: this.projection.lang, path });
|
|
126
125
|
}
|
|
127
126
|
getDefinition({ identifier, exportPath }) {
|
|
128
|
-
const cachedDefinition =
|
|
127
|
+
const cachedDefinition = findDefinitionAt({
|
|
128
|
+
context: this.context,
|
|
129
|
+
name: identifier.name,
|
|
130
|
+
exportPath
|
|
131
|
+
});
|
|
129
132
|
if (this.affirmDefinition(cachedDefinition, exportPath)) {
|
|
130
133
|
return cachedDefinition;
|
|
131
134
|
}
|
|
@@ -39,7 +39,7 @@ export declare class OasOperationDriver<V extends GeneratedValue, EnrichmentType
|
|
|
39
39
|
* Ensure the file at `path` exists, creating it on first write through
|
|
40
40
|
* the projection's language — the static read off the projection class
|
|
41
41
|
* at the use site, never persisted (works pre-construction on the
|
|
42
|
-
* cache-hit path). Returns the
|
|
42
|
+
* cache-hit path). Returns the file.
|
|
43
43
|
*/
|
|
44
44
|
private ensureFile;
|
|
45
45
|
private getDefinition;
|
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _OasOperationDriver_into;
|
|
13
|
-
import {
|
|
13
|
+
import { ensureFile, findDefinitionAt, toImportDestination, toImportFile } from '../../driverFiles.js';
|
|
14
14
|
import invariant from 'tiny-invariant';
|
|
15
15
|
import { toOasOperationGeneratorKey } from '../../GeneratorKeys.js';
|
|
16
16
|
import { DEFAULT_VARIANT } from '../../../types/Variant.js';
|
|
@@ -134,10 +134,7 @@ export class OasOperationDriver {
|
|
|
134
134
|
const { identifier, exportPath } = this.settings;
|
|
135
135
|
// The file an import has to be stitched into, or `undefined` when there
|
|
136
136
|
// is none to stitch — no destination, or the projection's own file.
|
|
137
|
-
const importInto = destinationPath
|
|
138
|
-
normalizeWorkspacePath(exportPath) !== normalizeWorkspacePath(destinationPath)
|
|
139
|
-
? destinationPath
|
|
140
|
-
: undefined;
|
|
137
|
+
const importInto = toImportDestination({ context: this.context, exportPath, destinationPath });
|
|
141
138
|
// A member is declared inside its container, so it has no module-level
|
|
142
139
|
// name — an import of it would name a symbol its file never exports, and
|
|
143
140
|
// the `Inserted.toName()` handed back would be unresolvable. What a caller
|
|
@@ -154,10 +151,13 @@ export class OasOperationDriver {
|
|
|
154
151
|
// via the pure-data `context.register`. The import lands in the
|
|
155
152
|
// caller's file (`destinationPath`); `insertOperation` only composes
|
|
156
153
|
// same-language generators, so the peer's `lang` is the caller's.
|
|
157
|
-
this.ensureFile(importInto);
|
|
158
154
|
this.context.register({
|
|
159
155
|
imports: [this.projection.lang.toImport({ identifier, module: exportPath })],
|
|
160
|
-
destinationPath:
|
|
156
|
+
destinationPath: toImportFile({
|
|
157
|
+
context: this.context,
|
|
158
|
+
lang: this.projection.lang,
|
|
159
|
+
destination: importInto
|
|
160
|
+
}).path
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
return definition;
|
|
@@ -166,14 +166,10 @@ export class OasOperationDriver {
|
|
|
166
166
|
* Ensure the file at `path` exists, creating it on first write through
|
|
167
167
|
* the projection's language — the static read off the projection class
|
|
168
168
|
* at the use site, never persisted (works pre-construction on the
|
|
169
|
-
* cache-hit path). Returns the
|
|
169
|
+
* cache-hit path). Returns the file.
|
|
170
170
|
*/
|
|
171
171
|
ensureFile(path) {
|
|
172
|
-
|
|
173
|
-
if (!this.context.getFile(normalizedPath)) {
|
|
174
|
-
this.context.addFile(this.projection.lang.createFile({ path: normalizedPath, settings: this.context.settings }));
|
|
175
|
-
}
|
|
176
|
-
return normalizedPath;
|
|
172
|
+
return ensureFile({ context: this.context, lang: this.projection.lang, path });
|
|
177
173
|
}
|
|
178
174
|
getDefinition({ identifier, exportPath }) {
|
|
179
175
|
// A member's place is its container, resolved (and created, on the first
|
|
@@ -185,7 +181,8 @@ export class OasOperationDriver {
|
|
|
185
181
|
const into = __classPrivateFieldGet(this, _OasOperationDriver_into, "f");
|
|
186
182
|
// Spread rather than always-pass: a non-member's call shape is exactly
|
|
187
183
|
// what it was, so nothing downstream sees a key it never had.
|
|
188
|
-
const cachedDefinition =
|
|
184
|
+
const cachedDefinition = findDefinitionAt({
|
|
185
|
+
context: this.context,
|
|
189
186
|
name: identifier.name,
|
|
190
187
|
exportPath,
|
|
191
188
|
...(into !== undefined ? { into } : {})
|
|
@@ -36,7 +36,7 @@ export declare class WebhookDriver<V extends GeneratedValue, EnrichmentType = un
|
|
|
36
36
|
private apply;
|
|
37
37
|
/**
|
|
38
38
|
* Ensure the file at `path` exists, creating it on first write through the
|
|
39
|
-
* projection's language. Returns the
|
|
39
|
+
* projection's language. Returns the file.
|
|
40
40
|
*/
|
|
41
41
|
private ensureFile;
|
|
42
42
|
private getDefinition;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ensureFile, findDefinitionAt, toImportDestination, toImportFile } from '../driverFiles.js';
|
|
2
2
|
import { toWebhookGeneratorKey } from '../GeneratorKeys.js';
|
|
3
3
|
import { DEFAULT_VARIANT } from '../../types/Variant.js';
|
|
4
4
|
import { readProjectionOptions, toValueOptions } from '../../types/ProjectionOptions.js';
|
|
@@ -95,30 +95,33 @@ export class WebhookDriver {
|
|
|
95
95
|
apply({ destinationPath } = {}) {
|
|
96
96
|
const { identifier, exportPath } = this.settings;
|
|
97
97
|
const definition = this.getDefinition({ identifier, exportPath });
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
const importInto = toImportDestination({ context: this.context, exportPath, destinationPath });
|
|
99
|
+
if (importInto !== undefined) {
|
|
100
100
|
// Cross-file import of the peer's identifier from its export path.
|
|
101
|
-
this.ensureFile(destinationPath);
|
|
102
101
|
this.context.register({
|
|
103
102
|
imports: [this.projection.lang.toImport({ identifier, module: exportPath })],
|
|
104
|
-
destinationPath
|
|
103
|
+
destinationPath: toImportFile({
|
|
104
|
+
context: this.context,
|
|
105
|
+
lang: this.projection.lang,
|
|
106
|
+
destination: importInto
|
|
107
|
+
}).path
|
|
105
108
|
});
|
|
106
109
|
}
|
|
107
110
|
return definition;
|
|
108
111
|
}
|
|
109
112
|
/**
|
|
110
113
|
* Ensure the file at `path` exists, creating it on first write through the
|
|
111
|
-
* projection's language. Returns the
|
|
114
|
+
* projection's language. Returns the file.
|
|
112
115
|
*/
|
|
113
116
|
ensureFile(path) {
|
|
114
|
-
|
|
115
|
-
if (!this.context.getFile(normalizedPath)) {
|
|
116
|
-
this.context.addFile(this.projection.lang.createFile({ path: normalizedPath, settings: this.context.settings }));
|
|
117
|
-
}
|
|
118
|
-
return normalizedPath;
|
|
117
|
+
return ensureFile({ context: this.context, lang: this.projection.lang, path });
|
|
119
118
|
}
|
|
120
119
|
getDefinition({ identifier, exportPath }) {
|
|
121
|
-
const cachedDefinition =
|
|
120
|
+
const cachedDefinition = findDefinitionAt({
|
|
121
|
+
context: this.context,
|
|
122
|
+
name: identifier.name,
|
|
123
|
+
exportPath
|
|
124
|
+
});
|
|
122
125
|
if (this.affirmDefinition(cachedDefinition, exportPath)) {
|
|
123
126
|
return cachedDefinition;
|
|
124
127
|
}
|
|
@@ -37,7 +37,7 @@ export type AuditGenerator = {
|
|
|
37
37
|
readonly type: 'oasOperation' | 'gqlOperation' | 'model' | 'webhook';
|
|
38
38
|
};
|
|
39
39
|
type FinalizeArgs = {
|
|
40
|
-
/** The consumer's `
|
|
40
|
+
/** The consumer's `skmtc.config.json#settings.enrichments` record. */
|
|
41
41
|
enrichments: GeneratorEnrichments | undefined;
|
|
42
42
|
/** The generators configured for this run. */
|
|
43
43
|
generators: readonly AuditGenerator[];
|
|
@@ -48,7 +48,7 @@ export type EnrichmentWarningType = 'UNCONSUMED_ENRICHMENT' | 'UNKNOWN_GENERATOR
|
|
|
48
48
|
export declare const enrichmentWarningType: v.GenericSchema<EnrichmentWarningType>;
|
|
49
49
|
/**
|
|
50
50
|
* One enrichment-config warning. `path` is the routing key sequence under
|
|
51
|
-
* `
|
|
51
|
+
* `skmtc.config.json#settings.enrichments` locating the offending entry —
|
|
52
52
|
* `[generatorId, ...subjectSegments]` for addressing warnings, extended
|
|
53
53
|
* down to the leaf key for `UNKNOWN_ENRICHMENT_KEY`. `suggestion` carries
|
|
54
54
|
* the nearest known key when a close match exists (`submitLabl` →
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* gives correct "did you mean …?" suggestions — the intended key is in
|
|
14
14
|
* the schema's entries even when it is optional and absent from the
|
|
15
15
|
* parsed value. This is deliberately a warning layer, not
|
|
16
|
-
* `v.strictObject`: a shared
|
|
16
|
+
* `v.strictObject`: a shared skmtc.config.json paired with an older generator
|
|
17
17
|
* version stays survivable under version skew instead of hard-failing.
|
|
18
18
|
*
|
|
19
19
|
* The walk is fail-open: unions, intersections, loose objects, and any
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* gives correct "did you mean …?" suggestions — the intended key is in
|
|
14
14
|
* the schema's entries even when it is optional and absent from the
|
|
15
15
|
* parsed value. This is deliberately a warning layer, not
|
|
16
|
-
* `v.strictObject`: a shared
|
|
16
|
+
* `v.strictObject`: a shared skmtc.config.json paired with an older generator
|
|
17
17
|
* version stays survivable under version skew instead of hard-failing.
|
|
18
18
|
*
|
|
19
19
|
* The walk is fail-open: unions, intersections, loose objects, and any
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* expected, not typos.
|
|
20
20
|
*
|
|
21
21
|
* A wrong-typed value throws ({@link parseEnrichmentValue}), naming each
|
|
22
|
-
* wrong value's place in `
|
|
22
|
+
* wrong value's place in `skmtc.config.json`. Unknown-key detection runs first,
|
|
23
23
|
* so a throwing leaf doesn't hide a dropped key.
|
|
24
24
|
*
|
|
25
25
|
* @module parseEnrichmentUmbrella
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* expected, not typos.
|
|
20
20
|
*
|
|
21
21
|
* A wrong-typed value throws ({@link parseEnrichmentValue}), naming each
|
|
22
|
-
* wrong value's place in `
|
|
22
|
+
* wrong value's place in `skmtc.config.json`. Unknown-key detection runs first,
|
|
23
23
|
* so a throwing leaf doesn't hide a dropped key.
|
|
24
24
|
*
|
|
25
25
|
* @module parseEnrichmentUmbrella
|
|
@@ -4,14 +4,14 @@ type ParseEnrichmentValueArgs<EnrichmentType> = {
|
|
|
4
4
|
value: unknown;
|
|
5
5
|
/** The generator whose schema reads `value`; `undefined` for the shared `_stack` bag. */
|
|
6
6
|
generatorId: string | undefined;
|
|
7
|
-
/** The `
|
|
7
|
+
/** The `skmtc.config.json#settings.enrichments` routing path of the value at `path` inside `value`. */
|
|
8
8
|
toRoutingPath: (path: readonly string[]) => string[];
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* `value` parsed through a generator's enrichment schema. Enrichments are
|
|
12
12
|
* typed configuration, so a value that does not match throws, and the run
|
|
13
13
|
* fails. The message lists every value that does not match, at its place in
|
|
14
|
-
* `
|
|
14
|
+
* `skmtc.config.json`, so the user can fix them all in one pass.
|
|
15
15
|
*/
|
|
16
16
|
export declare const parseEnrichmentValue: <EnrichmentType>({ schema, value, generatorId, toRoutingPath }: ParseEnrichmentValueArgs<EnrichmentType>) => EnrichmentType;
|
|
17
17
|
export {};
|