@skmtc/core 0.26.0 → 0.28.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/README.md +4 -2
- package/esm/anchors/ParserAdapter.d.ts +22 -3
- package/esm/anchors/ParserAdapter.d.ts.map +1 -1
- package/esm/anchors/attribute.d.ts.map +1 -1
- package/esm/anchors/buildSidecar.d.ts.map +1 -1
- package/esm/anchors/generationMap.d.ts.map +1 -1
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +4 -2
- package/esm/context/GenerateContext.d.ts +12 -0
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +117 -23
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/generateTypes.d.ts +31 -0
- package/esm/context/generateTypes.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/1.1.6/extname.d.ts +25 -0
- package/esm/deps/jsr.io/@std/path/1.1.6/extname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/1.1.6/extname.js +31 -0
- package/esm/deps/jsr.io/@std/path/1.1.6/posix/extname.d.ts +42 -0
- package/esm/deps/jsr.io/@std/path/1.1.6/posix/extname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/1.1.6/posix/extname.js +98 -0
- package/esm/deps/jsr.io/@std/path/1.1.6/windows/extname.d.ts +18 -0
- package/esm/deps/jsr.io/@std/path/1.1.6/windows/extname.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/path/1.1.6/windows/extname.js +83 -0
- package/esm/dsl/GeneratorKeys.d.ts.map +1 -1
- package/esm/dsl/Lang.d.ts.map +1 -1
- package/esm/dsl/model/ModelDriver.d.ts.map +1 -1
- package/esm/dsl/model/ModelDriver.js +1 -2
- package/esm/dsl/model/toModelProjectionBase.d.ts +1 -1
- package/esm/dsl/model/toModelProjectionBase.d.ts.map +1 -1
- package/esm/dsl/model/toModelProjectionBase.js +9 -9
- package/esm/dsl/operation/gql/GqlOperationDriver.d.ts.map +1 -1
- package/esm/dsl/operation/gql/GqlOperationDriver.js +1 -3
- package/esm/dsl/operation/gql/toGqlOperationProjectionBase.d.ts +1 -1
- package/esm/dsl/operation/gql/toGqlOperationProjectionBase.d.ts.map +1 -1
- package/esm/dsl/operation/gql/toGqlOperationProjectionBase.js +9 -9
- package/esm/dsl/operation/oas/OasOperationDriver.d.ts.map +1 -1
- package/esm/dsl/operation/oas/OasOperationDriver.js +1 -3
- package/esm/dsl/operation/oas/toOasOperationProjectionBase.d.ts +1 -1
- package/esm/dsl/operation/oas/toOasOperationProjectionBase.d.ts.map +1 -1
- package/esm/dsl/operation/oas/toOasOperationProjectionBase.js +9 -15
- package/esm/dsl/webhook/WebhookDriver.d.ts.map +1 -1
- package/esm/dsl/webhook/WebhookDriver.js +1 -3
- package/esm/dsl/webhook/toWebhookProjectionBase.d.ts +1 -1
- package/esm/dsl/webhook/toWebhookProjectionBase.d.ts.map +1 -1
- package/esm/dsl/webhook/toWebhookProjectionBase.js +9 -15
- package/esm/enrichments/EnrichmentAudit.d.ts +79 -0
- package/esm/enrichments/EnrichmentAudit.d.ts.map +1 -0
- package/esm/enrichments/EnrichmentAudit.js +210 -0
- package/esm/enrichments/EnrichmentWarning.d.ts +72 -0
- package/esm/enrichments/EnrichmentWarning.d.ts.map +1 -0
- package/esm/enrichments/EnrichmentWarning.js +50 -0
- package/esm/enrichments/findUnknownKeys.d.ts +40 -0
- package/esm/enrichments/findUnknownKeys.d.ts.map +1 -0
- package/esm/enrichments/findUnknownKeys.js +80 -0
- package/esm/enrichments/parseEnrichmentUmbrella.d.ts +63 -0
- package/esm/enrichments/parseEnrichmentUmbrella.d.ts.map +1 -0
- package/esm/enrichments/parseEnrichmentUmbrella.js +66 -0
- package/esm/enrichments/toEnrichmentDescriptor.d.ts.map +1 -1
- package/esm/enrichments/toEnrichmentDescriptor.js +1 -20
- package/esm/enrichments/valibotShape.d.ts +51 -0
- package/esm/enrichments/valibotShape.d.ts.map +1 -0
- package/esm/enrichments/valibotShape.js +37 -0
- package/esm/enrichments/validateConfig.d.ts.map +1 -1
- package/esm/gql/_helpers/unwrapType.d.ts.map +1 -1
- package/esm/gql/enum/toEnumType.d.ts.map +1 -1
- package/esm/gql/field/toFieldSchema.d.ts.map +1 -1
- package/esm/gql/input/toInputType.d.ts.map +1 -1
- package/esm/gql/interface/toInterfaceUnion.d.ts.map +1 -1
- package/esm/gql/object/toObjectType.d.ts.map +1 -1
- package/esm/gql/operation/toRootField.d.ts.map +1 -1
- package/esm/gql/union/toUnionType.d.ts.map +1 -1
- package/esm/helpers/applyGeneratedSuffix.d.ts +43 -0
- package/esm/helpers/applyGeneratedSuffix.d.ts.map +1 -0
- package/esm/helpers/applyGeneratedSuffix.js +79 -0
- package/esm/helpers/nearestKey.d.ts +18 -0
- package/esm/helpers/nearestKey.d.ts.map +1 -0
- package/esm/helpers/nearestKey.js +60 -0
- package/esm/helpers/strings.d.ts.map +1 -1
- package/esm/mod.d.ts +3 -0
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +3 -0
- package/esm/oas/boolean/Boolean.d.ts.map +1 -1
- package/esm/oas/document/Document.d.ts.map +1 -1
- package/esm/oas/integer/Integer.d.ts.map +1 -1
- package/esm/oas/ref/Ref.d.ts.map +1 -1
- package/esm/oas/schemaPath/traverseSchema.d.ts.map +1 -1
- package/esm/oas/schemaPath/traverseSchema.js +3 -1
- package/esm/parse/v3-0/array/toArray.d.ts.map +1 -1
- package/esm/parse/v3-0/boolean/toBoolean.d.ts.map +1 -1
- package/esm/parse/v3-0/integer/toInteger.d.ts.map +1 -1
- package/esm/parse/v3-0/operation/toOperationsV3.d.ts.map +1 -1
- package/esm/parse/v3-0/ref/toRefV31.d.ts.map +1 -1
- package/esm/parse/v3-0/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/parse/v3-0/schema/toSchemasV3.js +7 -1
- package/esm/parse/v3-0/securitySchemes/toSecuritySchemes.d.ts.map +1 -1
- package/esm/parse/v3-0/string/toString.d.ts.map +1 -1
- package/esm/parse/v3-0/union/toUnion.d.ts.map +1 -1
- package/esm/parse/v3-0/unknown/toUnknown.d.ts.map +1 -1
- package/esm/parse/v3-0/webhook/toWebhooksV3.d.ts.map +1 -1
- package/esm/parse/v3-1/array/toArray.d.ts.map +1 -1
- package/esm/parse/v3-1/boolean/toBoolean.d.ts.map +1 -1
- package/esm/parse/v3-1/integer/toInteger.d.ts.map +1 -1
- package/esm/parse/v3-1/operation/toOperationsV3.d.ts.map +1 -1
- package/esm/parse/v3-1/ref/toRefV31.d.ts.map +1 -1
- package/esm/parse/v3-1/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/parse/v3-1/schema/toSchemasV3.js +7 -1
- package/esm/parse/v3-1/securitySchemes/toSecuritySchemes.d.ts.map +1 -1
- package/esm/parse/v3-1/string/toString.d.ts.map +1 -1
- package/esm/parse/v3-1/union/toUnion.d.ts.map +1 -1
- package/esm/parse/v3-1/unknown/toUnknown.d.ts.map +1 -1
- package/esm/parse/v3-1/webhook/toWebhooksV3.d.ts.map +1 -1
- package/esm/run/toArtifacts.d.ts.map +1 -1
- package/esm/run/toArtifacts.js +2 -1
- package/esm/types/Manifest.d.ts +17 -0
- package/esm/types/Manifest.d.ts.map +1 -1
- package/esm/types/Manifest.js +4 -1
- package/esm/types/Settings.d.ts +37 -3
- package/esm/types/Settings.d.ts.map +1 -1
- package/esm/types/Settings.js +15 -20
- package/package.json +1 -1
- package/script/anchors/ParserAdapter.d.ts +22 -3
- package/script/anchors/ParserAdapter.d.ts.map +1 -1
- package/script/anchors/attribute.d.ts.map +1 -1
- package/script/anchors/buildSidecar.d.ts.map +1 -1
- package/script/anchors/generationMap.d.ts.map +1 -1
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +4 -2
- package/script/context/GenerateContext.d.ts +12 -0
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +117 -23
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/generateTypes.d.ts +31 -0
- package/script/context/generateTypes.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/1.1.6/extname.d.ts +25 -0
- package/script/deps/jsr.io/@std/path/1.1.6/extname.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/path/1.1.6/extname.js +34 -0
- package/script/deps/jsr.io/@std/path/1.1.6/posix/extname.d.ts +42 -0
- package/script/deps/jsr.io/@std/path/1.1.6/posix/extname.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/path/1.1.6/posix/extname.js +101 -0
- package/script/deps/jsr.io/@std/path/1.1.6/windows/extname.d.ts +18 -0
- package/script/deps/jsr.io/@std/path/1.1.6/windows/extname.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/path/1.1.6/windows/extname.js +86 -0
- package/script/dsl/GeneratorKeys.d.ts.map +1 -1
- package/script/dsl/Lang.d.ts.map +1 -1
- package/script/dsl/model/ModelDriver.d.ts.map +1 -1
- package/script/dsl/model/ModelDriver.js +1 -5
- package/script/dsl/model/toModelProjectionBase.d.ts +1 -1
- package/script/dsl/model/toModelProjectionBase.d.ts.map +1 -1
- package/script/dsl/model/toModelProjectionBase.js +9 -45
- package/script/dsl/operation/gql/GqlOperationDriver.d.ts.map +1 -1
- package/script/dsl/operation/gql/GqlOperationDriver.js +1 -6
- package/script/dsl/operation/gql/toGqlOperationProjectionBase.d.ts +1 -1
- package/script/dsl/operation/gql/toGqlOperationProjectionBase.d.ts.map +1 -1
- package/script/dsl/operation/gql/toGqlOperationProjectionBase.js +9 -45
- package/script/dsl/operation/oas/OasOperationDriver.d.ts.map +1 -1
- package/script/dsl/operation/oas/OasOperationDriver.js +1 -6
- package/script/dsl/operation/oas/toOasOperationProjectionBase.d.ts +1 -1
- package/script/dsl/operation/oas/toOasOperationProjectionBase.d.ts.map +1 -1
- package/script/dsl/operation/oas/toOasOperationProjectionBase.js +9 -51
- package/script/dsl/webhook/WebhookDriver.d.ts.map +1 -1
- package/script/dsl/webhook/WebhookDriver.js +1 -6
- package/script/dsl/webhook/toWebhookProjectionBase.d.ts +1 -1
- package/script/dsl/webhook/toWebhookProjectionBase.d.ts.map +1 -1
- package/script/dsl/webhook/toWebhookProjectionBase.js +9 -51
- package/script/enrichments/EnrichmentAudit.d.ts +79 -0
- package/script/enrichments/EnrichmentAudit.d.ts.map +1 -0
- package/script/enrichments/EnrichmentAudit.js +215 -0
- package/script/enrichments/EnrichmentWarning.d.ts +72 -0
- package/script/enrichments/EnrichmentWarning.d.ts.map +1 -0
- package/script/enrichments/EnrichmentWarning.js +87 -0
- package/script/enrichments/findUnknownKeys.d.ts +40 -0
- package/script/enrichments/findUnknownKeys.d.ts.map +1 -0
- package/script/enrichments/findUnknownKeys.js +84 -0
- package/script/enrichments/parseEnrichmentUmbrella.d.ts +63 -0
- package/script/enrichments/parseEnrichmentUmbrella.d.ts.map +1 -0
- package/script/enrichments/parseEnrichmentUmbrella.js +103 -0
- package/script/enrichments/toEnrichmentDescriptor.d.ts.map +1 -1
- package/script/enrichments/toEnrichmentDescriptor.js +10 -29
- package/script/enrichments/valibotShape.d.ts +51 -0
- package/script/enrichments/valibotShape.d.ts.map +1 -0
- package/script/enrichments/valibotShape.js +44 -0
- package/script/enrichments/validateConfig.d.ts.map +1 -1
- package/script/gql/_helpers/unwrapType.d.ts.map +1 -1
- package/script/gql/enum/toEnumType.d.ts.map +1 -1
- package/script/gql/field/toFieldSchema.d.ts.map +1 -1
- package/script/gql/input/toInputType.d.ts.map +1 -1
- package/script/gql/interface/toInterfaceUnion.d.ts.map +1 -1
- package/script/gql/object/toObjectType.d.ts.map +1 -1
- package/script/gql/operation/toRootField.d.ts.map +1 -1
- package/script/gql/union/toUnionType.d.ts.map +1 -1
- package/script/helpers/applyGeneratedSuffix.d.ts +43 -0
- package/script/helpers/applyGeneratedSuffix.d.ts.map +1 -0
- package/script/helpers/applyGeneratedSuffix.js +84 -0
- package/script/helpers/nearestKey.d.ts +18 -0
- package/script/helpers/nearestKey.d.ts.map +1 -0
- package/script/helpers/nearestKey.js +64 -0
- package/script/helpers/strings.d.ts.map +1 -1
- package/script/mod.d.ts +3 -0
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +3 -0
- package/script/oas/boolean/Boolean.d.ts.map +1 -1
- package/script/oas/document/Document.d.ts.map +1 -1
- package/script/oas/integer/Integer.d.ts.map +1 -1
- package/script/oas/ref/Ref.d.ts.map +1 -1
- package/script/oas/schemaPath/traverseSchema.d.ts.map +1 -1
- package/script/oas/schemaPath/traverseSchema.js +3 -1
- package/script/parse/v3-0/array/toArray.d.ts.map +1 -1
- package/script/parse/v3-0/boolean/toBoolean.d.ts.map +1 -1
- package/script/parse/v3-0/integer/toInteger.d.ts.map +1 -1
- package/script/parse/v3-0/operation/toOperationsV3.d.ts.map +1 -1
- package/script/parse/v3-0/ref/toRefV31.d.ts.map +1 -1
- package/script/parse/v3-0/schema/toSchemasV3.d.ts.map +1 -1
- package/script/parse/v3-0/schema/toSchemasV3.js +7 -1
- package/script/parse/v3-0/securitySchemes/toSecuritySchemes.d.ts.map +1 -1
- package/script/parse/v3-0/string/toString.d.ts.map +1 -1
- package/script/parse/v3-0/union/toUnion.d.ts.map +1 -1
- package/script/parse/v3-0/unknown/toUnknown.d.ts.map +1 -1
- package/script/parse/v3-0/webhook/toWebhooksV3.d.ts.map +1 -1
- package/script/parse/v3-1/array/toArray.d.ts.map +1 -1
- package/script/parse/v3-1/boolean/toBoolean.d.ts.map +1 -1
- package/script/parse/v3-1/integer/toInteger.d.ts.map +1 -1
- package/script/parse/v3-1/operation/toOperationsV3.d.ts.map +1 -1
- package/script/parse/v3-1/ref/toRefV31.d.ts.map +1 -1
- package/script/parse/v3-1/schema/toSchemasV3.d.ts.map +1 -1
- package/script/parse/v3-1/schema/toSchemasV3.js +7 -1
- package/script/parse/v3-1/securitySchemes/toSecuritySchemes.d.ts.map +1 -1
- package/script/parse/v3-1/string/toString.d.ts.map +1 -1
- package/script/parse/v3-1/union/toUnion.d.ts.map +1 -1
- package/script/parse/v3-1/unknown/toUnknown.d.ts.map +1 -1
- package/script/parse/v3-1/webhook/toWebhooksV3.d.ts.map +1 -1
- package/script/run/toArtifacts.d.ts.map +1 -1
- package/script/run/toArtifacts.js +2 -1
- package/script/types/Manifest.d.ts +17 -0
- package/script/types/Manifest.d.ts.map +1 -1
- package/script/types/Manifest.js +4 -1
- package/script/types/Settings.d.ts +37 -3
- package/script/types/Settings.d.ts.map +1 -1
- package/script/types/Settings.js +12 -17
|
@@ -1,47 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.toOasOperationProjectionBase = void 0;
|
|
40
4
|
const GeneratorKeys_js_1 = require("../../GeneratorKeys.js");
|
|
41
|
-
const v = __importStar(require("valibot"));
|
|
42
|
-
const get_js_1 = __importDefault(require("lodash-es/get.js"));
|
|
43
5
|
const Variant_js_1 = require("../../../types/Variant.js");
|
|
44
|
-
const
|
|
6
|
+
const parseEnrichmentUmbrella_js_1 = require("../../../enrichments/parseEnrichmentUmbrella.js");
|
|
45
7
|
/**
|
|
46
8
|
* Build an OAS operation projection base class from a per-generator config.
|
|
47
9
|
*
|
|
@@ -187,18 +149,14 @@ const toOasOperationProjectionBase = (base, config) => {
|
|
|
187
149
|
// the engine has already asserted `'main'` exists; generator and stack
|
|
188
150
|
// are run-constants (`[id][_generator]`, `[_stack]`). The required
|
|
189
151
|
// composite schema parses the raw umbrella once — typed, cast-free.
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
generator: (0, get_js_1.default)(context.settings, ['enrichments', config.id, Enrichments_js_1.GENERATOR_ENRICHMENT_KEY]),
|
|
199
|
-
stack: (0, get_js_1.default)(context.settings, ['enrichments', Enrichments_js_1.STACK_ENRICHMENT_KEY])
|
|
200
|
-
};
|
|
201
|
-
return v.parse(config.toEnrichmentSchema(), raw);
|
|
152
|
+
// The helper routes the reads through the recording accessor
|
|
153
|
+
// (consumption audit) and reports schema-dropped keys.
|
|
154
|
+
return (0, parseEnrichmentUmbrella_js_1.parseEnrichmentUmbrella)({
|
|
155
|
+
context,
|
|
156
|
+
generatorId: config.id,
|
|
157
|
+
subjectSegments: [operation.path, operation.method, variant],
|
|
158
|
+
schema: config.toEnrichmentSchema()
|
|
159
|
+
});
|
|
202
160
|
}
|
|
203
161
|
}),
|
|
204
162
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/webhook/WebhookDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAI5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"WebhookDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/webhook/WebhookDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAI5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AAGzE,KAAK,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAAE,cAAc,GAAG,SAAS,IAAI;IAC7E,OAAO,EAAE,mBAAmB,CAAA;IAC5B,UAAU,EAAE,iBAAiB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAA;IAChD,OAAO,EAAE,UAAU,CAAA;IACnB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAWD;;;;;;;;GAQG;AACH,qBAAa,aAAa,CAAC,CAAC,SAAS,cAAc,EAAE,cAAc,GAAG,SAAS;IAC7E,OAAO,EAAE,mBAAmB,CAAA;IAC5B,UAAU,EAAE,iBAAiB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAA;IAChD,OAAO,EAAE,UAAU,CAAA;IACnB,QAAQ,EAAE,eAAe,CAAC,cAAc,CAAC,CAAA;IACzC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;gBAEH,EACV,OAAO,EACP,UAAU,EACV,OAAO,EACP,eAAe,EACf,QAAQ,EACR,OAAyB,EAC1B,EAAE,iBAAiB,CAAC,CAAC,EAAE,cAAc,CAAC;IA0BvC,OAAO,CAAC,KAAK;IAiBb;;;OAGG;IACH,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,aAAa;IAgCrB,OAAO,CAAC,gBAAgB;CAsBzB"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.WebhookDriver = void 0;
|
|
7
4
|
const normalize_js_1 = require("../../deps/jsr.io/@std/path/1.1.6/normalize.js");
|
|
8
5
|
const GeneratorKeys_js_1 = require("../GeneratorKeys.js");
|
|
9
6
|
const Variant_js_1 = require("../../types/Variant.js");
|
|
10
|
-
const get_js_1 = __importDefault(require("lodash-es/get.js"));
|
|
11
7
|
/**
|
|
12
8
|
* Driver for the webhook insertion lifecycle.
|
|
13
9
|
*
|
|
@@ -162,8 +158,7 @@ const assertPeerVariantExists = ({ context, generatorId, webhook, variant }) =>
|
|
|
162
158
|
if (variant === Variant_js_1.DEFAULT_VARIANT) {
|
|
163
159
|
return;
|
|
164
160
|
}
|
|
165
|
-
const webhookEnrichments =
|
|
166
|
-
'enrichments',
|
|
161
|
+
const webhookEnrichments = context.readEnrichment([
|
|
167
162
|
generatorId,
|
|
168
163
|
webhook.name,
|
|
169
164
|
webhook.method
|
|
@@ -14,7 +14,7 @@ import type { OasSchema } from '../../oas/schema/Schema.js';
|
|
|
14
14
|
import type { OasRef } from '../../oas/ref/Ref.js';
|
|
15
15
|
import type { OasVoid } from '../../oas/void/Void.js';
|
|
16
16
|
import type { WebhookProjectionConstructorArgs, ToWebhookIdentifierNameArgs, ToWebhookExportPathArgs } from './types.js';
|
|
17
|
-
import * as v from 'valibot';
|
|
17
|
+
import type * as v from 'valibot';
|
|
18
18
|
/**
|
|
19
19
|
* Configuration for {@link toWebhookProjectionBase}.
|
|
20
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toWebhookProjectionBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/webhook/toWebhookProjectionBase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,O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AC,EAAE,iBAAiB,CAAC,YAC3E,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,SAAS,CAAC,GACxD,2BAA2B,CAAC,CAAC,EAAE,MAAM,CAAC;;;;;;;UAlG3B,SAAS;6EA3DgD,MAAM;gCAMnD,UAAU,WAAW,mBAAmB;qEACH,MAAM;wBAoBlD;QAAE,OAAO,EAAE,UAAU,CAAC;QAAC,OAAO,EAAE,mBAAmB,CAAA;KAAE,KAAK,OAAO;oBAwC5D,+BAA+B,iBAAiB,KAAG,cAAc;IAiBzF;;;;OAIG;2BAC4B,MAAM,iBAAiB,KAAG,cAAc,GAAG,SAAS;;CAmFtF,CAAA"}
|
|
@@ -1,47 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.toWebhookProjectionBase = void 0;
|
|
40
4
|
const GeneratorKeys_js_1 = require("../GeneratorKeys.js");
|
|
41
|
-
const v = __importStar(require("valibot"));
|
|
42
|
-
const get_js_1 = __importDefault(require("lodash-es/get.js"));
|
|
43
5
|
const Variant_js_1 = require("../../types/Variant.js");
|
|
44
|
-
const
|
|
6
|
+
const parseEnrichmentUmbrella_js_1 = require("../../enrichments/parseEnrichmentUmbrella.js");
|
|
45
7
|
/**
|
|
46
8
|
* Build a webhook projection base class from a per-generator config.
|
|
47
9
|
*
|
|
@@ -170,18 +132,14 @@ const toWebhookProjectionBase = (base, config) => {
|
|
|
170
132
|
// the engine has already asserted `'main'` exists; generator and stack
|
|
171
133
|
// are run-constants (`[id][_generator]`, `[_stack]`). The required
|
|
172
134
|
// composite schema parses the raw umbrella once — typed, cast-free.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
generator: (0, get_js_1.default)(context.settings, ['enrichments', config.id, Enrichments_js_1.GENERATOR_ENRICHMENT_KEY]),
|
|
182
|
-
stack: (0, get_js_1.default)(context.settings, ['enrichments', Enrichments_js_1.STACK_ENRICHMENT_KEY])
|
|
183
|
-
};
|
|
184
|
-
return v.parse(config.toEnrichmentSchema(), raw);
|
|
135
|
+
// The helper routes the reads through the recording accessor
|
|
136
|
+
// (consumption audit) and reports schema-dropped keys.
|
|
137
|
+
return (0, parseEnrichmentUmbrella_js_1.parseEnrichmentUmbrella)({
|
|
138
|
+
context,
|
|
139
|
+
generatorId: config.id,
|
|
140
|
+
subjectSegments: [webhook.name, webhook.method, variant],
|
|
141
|
+
schema: config.toEnrichmentSchema()
|
|
142
|
+
});
|
|
185
143
|
}
|
|
186
144
|
}),
|
|
187
145
|
/**
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The enrichment consumption audit.
|
|
3
|
+
*
|
|
4
|
+
* The engine already performs every enrichment lookup during the generate
|
|
5
|
+
* walk — the dispatch loops read each `[generatorId][...subject]` block to
|
|
6
|
+
* enumerate variants, the projection statics read each subject leaf and
|
|
7
|
+
* the run-constant scopes, and the Drivers read peer blocks for the
|
|
8
|
+
* variant guard. `EnrichmentAudit` records those lookups (every read is
|
|
9
|
+
* routed through `GenerateContext.readEnrichment`, the single choke
|
|
10
|
+
* point) and, post-walk, diffs them against the paths actually present in
|
|
11
|
+
* `settings.enrichments`. A configured path no lookup touched is dead
|
|
12
|
+
* config — a typo'd generator id / path / method / model name, or an
|
|
13
|
+
* entry orphaned by spec evolution — and becomes an
|
|
14
|
+
* `UNCONSUMED_ENRICHMENT` warning on the manifest.
|
|
15
|
+
*
|
|
16
|
+
* Consumption is recorded prefix-closed: consuming
|
|
17
|
+
* `[id, '/pets', 'post', 'main']` also marks `[id, '/pets', 'post']`,
|
|
18
|
+
* `[id, '/pets']`, and `[id]`. The present-path enumeration walks each
|
|
19
|
+
* generator's slice to the block depth its entry type dictates (model:
|
|
20
|
+
* `[refName]`; operation / webhook / GQL: two segments), so the diff
|
|
21
|
+
* compares like with like. Reserved keys (`_generator`, `_stack`) are
|
|
22
|
+
* engine-owned constants and never flagged.
|
|
23
|
+
*
|
|
24
|
+
* Everything here is warn-level and fail-open — the audit can only add
|
|
25
|
+
* warnings to the manifest, never change generation output.
|
|
26
|
+
*
|
|
27
|
+
* @module EnrichmentAudit
|
|
28
|
+
*/
|
|
29
|
+
import { type GeneratorEnrichments } from '../types/Enrichments.js';
|
|
30
|
+
import { type EnrichmentWarning } from './EnrichmentWarning.js';
|
|
31
|
+
/**
|
|
32
|
+
* The slice of a generator entry the audit needs: its id and the entry
|
|
33
|
+
* type that dictates its enrichment routing depth.
|
|
34
|
+
*/
|
|
35
|
+
export type AuditGenerator = {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly type: 'oasOperation' | 'gqlOperation' | 'model' | 'webhook';
|
|
38
|
+
};
|
|
39
|
+
type FinalizeArgs = {
|
|
40
|
+
/** The consumer's `client.json#settings.enrichments` record. */
|
|
41
|
+
enrichments: GeneratorEnrichments | undefined;
|
|
42
|
+
/** The generators configured for this run. */
|
|
43
|
+
generators: readonly AuditGenerator[];
|
|
44
|
+
/**
|
|
45
|
+
* Generator ids the consumer skipped wholesale (string entries in
|
|
46
|
+
* `settings.skip`). Their slices are reported as info, not warnings —
|
|
47
|
+
* a temporary skip is legitimate, not dead config.
|
|
48
|
+
*/
|
|
49
|
+
skippedGeneratorIds: readonly string[];
|
|
50
|
+
};
|
|
51
|
+
export declare class EnrichmentAudit {
|
|
52
|
+
#private;
|
|
53
|
+
/**
|
|
54
|
+
* Record one enrichment lookup. Every prefix of `segments` is marked
|
|
55
|
+
* consumed, so block-level and leaf-level reads land in one namespace.
|
|
56
|
+
*/
|
|
57
|
+
consume(segments: readonly string[]): void;
|
|
58
|
+
/**
|
|
59
|
+
* Add a warning, deduplicated on `(type, path)` — the same lookup can
|
|
60
|
+
* repeat many times per run (one per insert call) and must produce one
|
|
61
|
+
* warning.
|
|
62
|
+
*/
|
|
63
|
+
report(warning: EnrichmentWarning): void;
|
|
64
|
+
/**
|
|
65
|
+
* Diff the configured enrichment paths against the consumed set and
|
|
66
|
+
* return every warning gathered during the run plus the addressing
|
|
67
|
+
* misses found here. Called once, after the generate walk.
|
|
68
|
+
*/
|
|
69
|
+
finalize({ enrichments, generators, skippedGeneratorIds }: FinalizeArgs): EnrichmentWarning[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Whether an enrichment block declares the given variant — the presence
|
|
73
|
+
* probe behind `SKIPPED_SUBJECT_ENRICHMENT` info lines. Exported for the
|
|
74
|
+
* dispatch loops; a non-record block (absent or malformed) has no
|
|
75
|
+
* variants.
|
|
76
|
+
*/
|
|
77
|
+
export declare const hasVariantEnrichment: (block: unknown, variant: string) => boolean;
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=EnrichmentAudit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnrichmentAudit.d.ts","sourceRoot":"","sources":["../../src/enrichments/EnrichmentAudit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAGrF;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc,GAAG,OAAO,GAAG,SAAS,CAAA;CACrE,CAAA;AAED,KAAK,YAAY,GAAG;IAClB,gEAAgE;IAChE,WAAW,EAAE,oBAAoB,GAAG,SAAS,CAAA;IAC7C,8CAA8C;IAC9C,UAAU,EAAE,SAAS,cAAc,EAAE,CAAA;IACrC;;;;OAIG;IACH,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAA;CACvC,CAAA;AAOD,qBAAa,eAAe;;IAS1B;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAkB1C;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IA6CxC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,EAAE,YAAY,GAAG,iBAAiB,EAAE;CAgG9F;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,OAAO,EAAE,SAAS,MAAM,KAAG,OAClC,CAAA"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview The enrichment consumption audit.
|
|
4
|
+
*
|
|
5
|
+
* The engine already performs every enrichment lookup during the generate
|
|
6
|
+
* walk — the dispatch loops read each `[generatorId][...subject]` block to
|
|
7
|
+
* enumerate variants, the projection statics read each subject leaf and
|
|
8
|
+
* the run-constant scopes, and the Drivers read peer blocks for the
|
|
9
|
+
* variant guard. `EnrichmentAudit` records those lookups (every read is
|
|
10
|
+
* routed through `GenerateContext.readEnrichment`, the single choke
|
|
11
|
+
* point) and, post-walk, diffs them against the paths actually present in
|
|
12
|
+
* `settings.enrichments`. A configured path no lookup touched is dead
|
|
13
|
+
* config — a typo'd generator id / path / method / model name, or an
|
|
14
|
+
* entry orphaned by spec evolution — and becomes an
|
|
15
|
+
* `UNCONSUMED_ENRICHMENT` warning on the manifest.
|
|
16
|
+
*
|
|
17
|
+
* Consumption is recorded prefix-closed: consuming
|
|
18
|
+
* `[id, '/pets', 'post', 'main']` also marks `[id, '/pets', 'post']`,
|
|
19
|
+
* `[id, '/pets']`, and `[id]`. The present-path enumeration walks each
|
|
20
|
+
* generator's slice to the block depth its entry type dictates (model:
|
|
21
|
+
* `[refName]`; operation / webhook / GQL: two segments), so the diff
|
|
22
|
+
* compares like with like. Reserved keys (`_generator`, `_stack`) are
|
|
23
|
+
* engine-owned constants and never flagged.
|
|
24
|
+
*
|
|
25
|
+
* Everything here is warn-level and fail-open — the audit can only add
|
|
26
|
+
* warnings to the manifest, never change generation output.
|
|
27
|
+
*
|
|
28
|
+
* @module EnrichmentAudit
|
|
29
|
+
*/
|
|
30
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
31
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
32
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
33
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
34
|
+
};
|
|
35
|
+
var _EnrichmentAudit_instances, _EnrichmentAudit_consumed, _EnrichmentAudit_children, _EnrichmentAudit_warnings, _EnrichmentAudit_reported, _EnrichmentAudit_isConsumed, _EnrichmentAudit_divergenceSuggestion, _EnrichmentAudit_checkBlock;
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.hasVariantEnrichment = exports.EnrichmentAudit = void 0;
|
|
38
|
+
const Enrichments_js_1 = require("../types/Enrichments.js");
|
|
39
|
+
const EnrichmentWarning_js_1 = require("./EnrichmentWarning.js");
|
|
40
|
+
const nearestKey_js_1 = require("../helpers/nearestKey.js");
|
|
41
|
+
const toPathKey = (segments) => JSON.stringify(segments);
|
|
42
|
+
const isRecord = (input) => typeof input === 'object' && input !== null && !Array.isArray(input);
|
|
43
|
+
class EnrichmentAudit {
|
|
44
|
+
constructor() {
|
|
45
|
+
_EnrichmentAudit_instances.add(this);
|
|
46
|
+
/** Prefix-closed set of consumed routing paths, keyed by {@link toPathKey}. */
|
|
47
|
+
_EnrichmentAudit_consumed.set(this, new Set()
|
|
48
|
+
/** Consumed child segments per parent path — the suggestion candidates. */
|
|
49
|
+
);
|
|
50
|
+
/** Consumed child segments per parent path — the suggestion candidates. */
|
|
51
|
+
_EnrichmentAudit_children.set(this, new Map());
|
|
52
|
+
_EnrichmentAudit_warnings.set(this, []
|
|
53
|
+
/** Identity keys of reported warnings — reads repeat, warnings must not. */
|
|
54
|
+
);
|
|
55
|
+
/** Identity keys of reported warnings — reads repeat, warnings must not. */
|
|
56
|
+
_EnrichmentAudit_reported.set(this, new Set()
|
|
57
|
+
/**
|
|
58
|
+
* Record one enrichment lookup. Every prefix of `segments` is marked
|
|
59
|
+
* consumed, so block-level and leaf-level reads land in one namespace.
|
|
60
|
+
*/
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Record one enrichment lookup. Every prefix of `segments` is marked
|
|
65
|
+
* consumed, so block-level and leaf-level reads land in one namespace.
|
|
66
|
+
*/
|
|
67
|
+
consume(segments) {
|
|
68
|
+
let parentKey = toPathKey([]);
|
|
69
|
+
for (let end = 1; end <= segments.length; end++) {
|
|
70
|
+
const key = toPathKey(segments.slice(0, end));
|
|
71
|
+
__classPrivateFieldGet(this, _EnrichmentAudit_consumed, "f").add(key);
|
|
72
|
+
const siblings = __classPrivateFieldGet(this, _EnrichmentAudit_children, "f").get(parentKey);
|
|
73
|
+
if (siblings) {
|
|
74
|
+
siblings.add(segments[end - 1]);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
__classPrivateFieldGet(this, _EnrichmentAudit_children, "f").set(parentKey, new Set([segments[end - 1]]));
|
|
78
|
+
}
|
|
79
|
+
parentKey = key;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Add a warning, deduplicated on `(type, path)` — the same lookup can
|
|
84
|
+
* repeat many times per run (one per insert call) and must produce one
|
|
85
|
+
* warning.
|
|
86
|
+
*/
|
|
87
|
+
report(warning) {
|
|
88
|
+
const key = toPathKey([warning.type, ...warning.path]);
|
|
89
|
+
if (__classPrivateFieldGet(this, _EnrichmentAudit_reported, "f").has(key))
|
|
90
|
+
return;
|
|
91
|
+
__classPrivateFieldGet(this, _EnrichmentAudit_reported, "f").add(key);
|
|
92
|
+
__classPrivateFieldGet(this, _EnrichmentAudit_warnings, "f").push(warning);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Diff the configured enrichment paths against the consumed set and
|
|
96
|
+
* return every warning gathered during the run plus the addressing
|
|
97
|
+
* misses found here. Called once, after the generate walk.
|
|
98
|
+
*/
|
|
99
|
+
finalize({ enrichments, generators, skippedGeneratorIds }) {
|
|
100
|
+
if (!isRecord(enrichments))
|
|
101
|
+
return [...__classPrivateFieldGet(this, _EnrichmentAudit_warnings, "f")];
|
|
102
|
+
const generatorsById = new Map(generators.map(generator => [generator.id, generator]));
|
|
103
|
+
const skipped = new Set(skippedGeneratorIds);
|
|
104
|
+
for (const [generatorId, slot] of Object.entries(enrichments)) {
|
|
105
|
+
if (generatorId === Enrichments_js_1.STACK_ENRICHMENT_KEY)
|
|
106
|
+
continue;
|
|
107
|
+
// Other `_`-prefixed keys are structurally invalid — the
|
|
108
|
+
// `generatorEnrichments` schema flags those at config load.
|
|
109
|
+
if ((0, Enrichments_js_1.isReservedEnrichmentKey)(generatorId))
|
|
110
|
+
continue;
|
|
111
|
+
if (skipped.has(generatorId)) {
|
|
112
|
+
this.report({
|
|
113
|
+
level: 'info',
|
|
114
|
+
type: 'SKIPPED_GENERATOR_ENRICHMENT',
|
|
115
|
+
path: [generatorId],
|
|
116
|
+
message: `generator '${generatorId}' is skipped in this run — ` +
|
|
117
|
+
`its enrichments were not applied`
|
|
118
|
+
});
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const generator = generatorsById.get(generatorId);
|
|
122
|
+
if (!generator) {
|
|
123
|
+
// An insert-only peer (reached via insertOperation / insertModel
|
|
124
|
+
// without an entry of its own) still consumes its slice through
|
|
125
|
+
// the projection statics — a consumed prefix means the slice is
|
|
126
|
+
// live, and without an entry type its depth is unknowable, so the
|
|
127
|
+
// audit leaves it alone.
|
|
128
|
+
if (__classPrivateFieldGet(this, _EnrichmentAudit_instances, "m", _EnrichmentAudit_isConsumed).call(this, [generatorId]))
|
|
129
|
+
continue;
|
|
130
|
+
const suggestion = (0, nearestKey_js_1.nearestKey)(generatorId, generatorsById.keys());
|
|
131
|
+
this.report({
|
|
132
|
+
level: 'warning',
|
|
133
|
+
type: 'UNKNOWN_GENERATOR_ID',
|
|
134
|
+
path: [generatorId],
|
|
135
|
+
message: `enrichments are configured for '${generatorId}' but no generator ` +
|
|
136
|
+
`with that id is in this run` +
|
|
137
|
+
(suggestion !== undefined ? ` (did you mean '${suggestion}'?)` : ''),
|
|
138
|
+
...(suggestion !== undefined ? { suggestion } : {})
|
|
139
|
+
});
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (!isRecord(slot))
|
|
143
|
+
continue;
|
|
144
|
+
// The generator is in the run but consumed nothing at all — the
|
|
145
|
+
// document has no subjects of its type (or the wrong protocol).
|
|
146
|
+
// Per-entry warnings would fall back to cross-generator siblings for
|
|
147
|
+
// their "did you mean …?" and could name an unrelated generator, so
|
|
148
|
+
// collapse to one generator-level warning that says what happened.
|
|
149
|
+
const hasSubjectEntries = Object.keys(slot).some(key => !(0, Enrichments_js_1.isReservedEnrichmentKey)(key));
|
|
150
|
+
if (!__classPrivateFieldGet(this, _EnrichmentAudit_instances, "m", _EnrichmentAudit_isConsumed).call(this, [generatorId]) && hasSubjectEntries) {
|
|
151
|
+
this.report({
|
|
152
|
+
level: 'warning',
|
|
153
|
+
type: 'UNCONSUMED_ENRICHMENT',
|
|
154
|
+
path: [generatorId],
|
|
155
|
+
message: `enrichments are configured for '${generatorId}' but it matched ` +
|
|
156
|
+
`no subjects in this run — its enrichments were never read`
|
|
157
|
+
});
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
// Block depth per entry type: `[refName]` for models,
|
|
161
|
+
// `[path][method]` / `[name][method]` / `[rootKind][fieldName]`
|
|
162
|
+
// for the operation-shaped types.
|
|
163
|
+
const subjectDepth = generator.type === 'model' ? 1 : 2;
|
|
164
|
+
for (const [subjectKey, subjectValue] of Object.entries(slot)) {
|
|
165
|
+
// `_generator` (and any other reserved key) is engine-owned — read
|
|
166
|
+
// through the dedicated helpers by known key, always consumed.
|
|
167
|
+
if ((0, Enrichments_js_1.isReservedEnrichmentKey)(subjectKey))
|
|
168
|
+
continue;
|
|
169
|
+
if (subjectDepth === 1 ||
|
|
170
|
+
!isRecord(subjectValue) ||
|
|
171
|
+
Object.keys(subjectValue).length === 0) {
|
|
172
|
+
__classPrivateFieldGet(this, _EnrichmentAudit_instances, "m", _EnrichmentAudit_checkBlock).call(this, [generatorId, subjectKey]);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
for (const methodKey of Object.keys(subjectValue)) {
|
|
176
|
+
__classPrivateFieldGet(this, _EnrichmentAudit_instances, "m", _EnrichmentAudit_checkBlock).call(this, [generatorId, subjectKey, methodKey]);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return [...__classPrivateFieldGet(this, _EnrichmentAudit_warnings, "f")];
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
exports.EnrichmentAudit = EnrichmentAudit;
|
|
184
|
+
_EnrichmentAudit_consumed = new WeakMap(), _EnrichmentAudit_children = new WeakMap(), _EnrichmentAudit_warnings = new WeakMap(), _EnrichmentAudit_reported = new WeakMap(), _EnrichmentAudit_instances = new WeakSet(), _EnrichmentAudit_isConsumed = function _EnrichmentAudit_isConsumed(segments) {
|
|
185
|
+
return __classPrivateFieldGet(this, _EnrichmentAudit_consumed, "f").has(toPathKey(segments));
|
|
186
|
+
}, _EnrichmentAudit_divergenceSuggestion = function _EnrichmentAudit_divergenceSuggestion(path) {
|
|
187
|
+
for (let depth = 0; depth < path.length; depth++) {
|
|
188
|
+
if (__classPrivateFieldGet(this, _EnrichmentAudit_instances, "m", _EnrichmentAudit_isConsumed).call(this, path.slice(0, depth + 1)))
|
|
189
|
+
continue;
|
|
190
|
+
const siblings = __classPrivateFieldGet(this, _EnrichmentAudit_children, "f").get(toPathKey(path.slice(0, depth)));
|
|
191
|
+
return siblings ? (0, nearestKey_js_1.nearestKey)(path[depth], siblings) : undefined;
|
|
192
|
+
}
|
|
193
|
+
return undefined;
|
|
194
|
+
}, _EnrichmentAudit_checkBlock = function _EnrichmentAudit_checkBlock(path) {
|
|
195
|
+
if (__classPrivateFieldGet(this, _EnrichmentAudit_instances, "m", _EnrichmentAudit_isConsumed).call(this, path))
|
|
196
|
+
return;
|
|
197
|
+
const suggestion = __classPrivateFieldGet(this, _EnrichmentAudit_instances, "m", _EnrichmentAudit_divergenceSuggestion).call(this, path);
|
|
198
|
+
this.report({
|
|
199
|
+
level: 'warning',
|
|
200
|
+
type: 'UNCONSUMED_ENRICHMENT',
|
|
201
|
+
path,
|
|
202
|
+
message: `enrichment entry '${(0, EnrichmentWarning_js_1.formatEnrichmentPath)(path)}' was never consumed — ` +
|
|
203
|
+
`no matching generator or subject in this run` +
|
|
204
|
+
(suggestion !== undefined ? ` (did you mean '${suggestion}'?)` : ''),
|
|
205
|
+
...(suggestion !== undefined ? { suggestion } : {})
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Whether an enrichment block declares the given variant — the presence
|
|
210
|
+
* probe behind `SKIPPED_SUBJECT_ENRICHMENT` info lines. Exported for the
|
|
211
|
+
* dispatch loops; a non-record block (absent or malformed) has no
|
|
212
|
+
* variants.
|
|
213
|
+
*/
|
|
214
|
+
const hasVariantEnrichment = (block, variant) => isRecord(block) && variant in block;
|
|
215
|
+
exports.hasVariantEnrichment = hasVariantEnrichment;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The enrichment-warning surface — the manifest's record of
|
|
3
|
+
* enrichment config that did not do what the consumer intended.
|
|
4
|
+
*
|
|
5
|
+
* Three validation layers precede this one: structural validation at CLI
|
|
6
|
+
* load (`generatorEnrichments`), the per-leaf Valibot parse at generate
|
|
7
|
+
* time (a wrongly-typed value in a reached leaf throws), and the
|
|
8
|
+
* missing-`'main'` variant throw (`toVariantList`). All three are loud.
|
|
9
|
+
* What they cannot see is *addressing*: a typo'd generator id, path,
|
|
10
|
+
* method, or model name makes `get()` miss silently — defaults apply and
|
|
11
|
+
* the config entry is dead. Unknown leaf keys are equally silent:
|
|
12
|
+
* `v.object` strips them before the generator sees them.
|
|
13
|
+
*
|
|
14
|
+
* `EnrichmentWarning` is the shared shape for both detectors:
|
|
15
|
+
*
|
|
16
|
+
* - the **consumption audit** (`EnrichmentAudit`) — records every
|
|
17
|
+
* enrichment lookup the engine performs during the generate walk and,
|
|
18
|
+
* post-walk, flags configured entries no lookup ever touched;
|
|
19
|
+
* - **unknown-key detection** (`findUnknownKeys`, run inside
|
|
20
|
+
* `parseEnrichmentUmbrella`) — flags leaf keys the generator's schema
|
|
21
|
+
* does not declare.
|
|
22
|
+
*
|
|
23
|
+
* Both are warn-level and fail-open: generation output is never affected.
|
|
24
|
+
* The warnings ride the manifest (`manifest.enrichmentWarnings`) so
|
|
25
|
+
* post-run diagnostics can re-read them without re-running.
|
|
26
|
+
*
|
|
27
|
+
* @module EnrichmentWarning
|
|
28
|
+
*/
|
|
29
|
+
import * as v from 'valibot';
|
|
30
|
+
/**
|
|
31
|
+
* Discriminates what went wrong with an enrichment entry:
|
|
32
|
+
*
|
|
33
|
+
* - `UNCONSUMED_ENRICHMENT` — a configured routing path no engine lookup
|
|
34
|
+
* consumed (typo'd path / method / model name, or an entry orphaned by
|
|
35
|
+
* spec evolution). Warning.
|
|
36
|
+
* - `UNKNOWN_GENERATOR_ID` — a top-level enrichment key that matches no
|
|
37
|
+
* generator in the run (and no insert-only peer consumed it). Warning.
|
|
38
|
+
* - `UNKNOWN_ENRICHMENT_KEY` — a leaf key the generator's enrichment
|
|
39
|
+
* schema does not declare; Valibot strips it silently. Warning.
|
|
40
|
+
* - `SKIPPED_SUBJECT_ENRICHMENT` — the entry is addressed correctly but
|
|
41
|
+
* its subject was excluded by `skip`/`include`. Info: temporary skips
|
|
42
|
+
* are legitimate, so this is not treated as dead config.
|
|
43
|
+
* - `SKIPPED_GENERATOR_ENRICHMENT` — the whole generator is skipped
|
|
44
|
+
* (string entry in `settings.skip`) while enrichments for it exist.
|
|
45
|
+
* Info, for the same reason.
|
|
46
|
+
*/
|
|
47
|
+
export type EnrichmentWarningType = 'UNCONSUMED_ENRICHMENT' | 'UNKNOWN_GENERATOR_ID' | 'UNKNOWN_ENRICHMENT_KEY' | 'SKIPPED_SUBJECT_ENRICHMENT' | 'SKIPPED_GENERATOR_ENRICHMENT';
|
|
48
|
+
export declare const enrichmentWarningType: v.GenericSchema<EnrichmentWarningType>;
|
|
49
|
+
/**
|
|
50
|
+
* One enrichment-config warning. `path` is the routing key sequence under
|
|
51
|
+
* `client.json#settings.enrichments` locating the offending entry —
|
|
52
|
+
* `[generatorId, ...subjectSegments]` for addressing warnings, extended
|
|
53
|
+
* down to the leaf key for `UNKNOWN_ENRICHMENT_KEY`. `suggestion` carries
|
|
54
|
+
* the nearest known key when a close match exists (`submitLabl` →
|
|
55
|
+
* `submitLabel`); the human-readable `message` already folds it in.
|
|
56
|
+
*/
|
|
57
|
+
export type EnrichmentWarning = {
|
|
58
|
+
level: 'warning' | 'info';
|
|
59
|
+
type: EnrichmentWarningType;
|
|
60
|
+
path: readonly string[];
|
|
61
|
+
message: string;
|
|
62
|
+
suggestion?: string;
|
|
63
|
+
};
|
|
64
|
+
export declare const enrichmentWarning: v.GenericSchema<EnrichmentWarning>;
|
|
65
|
+
/**
|
|
66
|
+
* Render a routing path for warning messages:
|
|
67
|
+
* `['@skmtc/gen-shadcn-form', '/pets', 'post']` →
|
|
68
|
+
* `'@skmtc/gen-shadcn-form → /pets → post'`. The arrow separator keeps
|
|
69
|
+
* segments visually distinct even when they contain dots or slashes.
|
|
70
|
+
*/
|
|
71
|
+
export declare const formatEnrichmentPath: (path: readonly string[]) => string;
|
|
72
|
+
//# sourceMappingURL=EnrichmentWarning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnrichmentWarning.d.ts","sourceRoot":"","sources":["../../src/enrichments/EnrichmentWarning.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,qBAAqB,GAC7B,uBAAuB,GACvB,sBAAsB,GACtB,wBAAwB,GACxB,4BAA4B,GAC5B,8BAA8B,CAAA;AAElC,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,aAAa,CAAC,qBAAqB,CAMvE,CAAA;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,SAAS,GAAG,MAAM,CAAA;IACzB,IAAI,EAAE,qBAAqB,CAAA;IAC3B,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,aAAa,CAAC,iBAAiB,CAM/D,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,SAAS,MAAM,EAAE,KAAG,MAA0B,CAAA"}
|