@mgamadeus/ddd-web 0.11.0 → 0.13.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/.claude/skills/ddd-web-specialist/SKILL.md +1 -1
- package/.claude/skills/ddd-web-specialist/references/consumer.md +2 -2
- package/CHANGELOG.md +20 -0
- package/dist/api/index.d.ts +3 -66
- package/dist/api/index.js +7 -74
- package/dist/api/index.js.map +1 -1
- package/dist/{chunk-XXMTSCOZ.js → chunk-J2RLNVKK.js} +32 -19
- package/dist/chunk-J2RLNVKK.js.map +1 -0
- package/dist/chunk-WZTEQOE6.js +82 -0
- package/dist/chunk-WZTEQOE6.js.map +1 -0
- package/dist/codegen/cli.js +1 -1
- package/dist/codegen/index.d.ts +6 -0
- package/dist/codegen/index.js +1 -1
- package/dist/contract/index.d.ts +1 -1
- package/dist/contract/index.js +12 -0
- package/dist/contract/index.js.map +1 -1
- package/dist/error-normalization-ytMgz5HP.d.ts +86 -0
- package/package.json +1 -1
- package/dist/chunk-XXMTSCOZ.js.map +0 -1
- package/dist/errors-B4KabvNa.d.ts +0 -22
|
@@ -666,7 +666,7 @@ function findDocumentModel(rtkName, documentModels) {
|
|
|
666
666
|
function enumKeyOf(value) {
|
|
667
667
|
if (value.trim() === "") return "EMPTY";
|
|
668
668
|
const key = value.replace(/-+([A-Za-z0-9])/g, (_, next) => next.toUpperCase()).replace(/[ /\\]+/g, "_");
|
|
669
|
-
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? key : JSON.stringify(
|
|
669
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? key : JSON.stringify(value);
|
|
670
670
|
}
|
|
671
671
|
function applyEnumConsts(body, modelName, model, options = {}) {
|
|
672
672
|
const { schema, schemaKey } = model;
|
|
@@ -1372,6 +1372,7 @@ function extractModels(input) {
|
|
|
1372
1372
|
logger.warn(`Re-extracted type "${name}" not in rename map \u2014 skipping.`);
|
|
1373
1373
|
continue;
|
|
1374
1374
|
}
|
|
1375
|
+
if (input.modelsOnly && path4.relative(modelsDir, filePath).split(path4.sep)[0] === "_endpoints") continue;
|
|
1375
1376
|
entries.push({ name, body: text, filePath });
|
|
1376
1377
|
}
|
|
1377
1378
|
const pathByName = new Map(entries.map((entry) => [entry.name, entry.filePath]));
|
|
@@ -1405,7 +1406,7 @@ function extractModels(input) {
|
|
|
1405
1406
|
typedBody = applied.body;
|
|
1406
1407
|
const fileKey = path4.resolve(filePath).toLowerCase();
|
|
1407
1408
|
const fileConsts2 = constsByFile.get(fileKey) ?? /* @__PURE__ */ new Map();
|
|
1408
|
-
for (const [constName, text] of applied.consts) fileConsts2.set(constName, text);
|
|
1409
|
+
for (const [constName, text] of applied.consts) if (!fileConsts2.has(constName)) fileConsts2.set(constName, text);
|
|
1409
1410
|
if (fileConsts2.size > 0) constsByFile.set(fileKey, fileConsts2);
|
|
1410
1411
|
}
|
|
1411
1412
|
if (kind === "text") {
|
|
@@ -2039,6 +2040,33 @@ async function generateSdk(options = {}) {
|
|
|
2039
2040
|
(rtkName) => preparedEndpoints.endpointNamesByPlaceholder.get(rtkName) ?? rtkName
|
|
2040
2041
|
);
|
|
2041
2042
|
const rtk = restoreEndpointNames(generated.code, generated.locations, preparedEndpoints.endpointNamesByPlaceholder);
|
|
2043
|
+
const extractOptions = {
|
|
2044
|
+
apiFilePath: api.outputFile,
|
|
2045
|
+
modelsDir,
|
|
2046
|
+
registry,
|
|
2047
|
+
files,
|
|
2048
|
+
logger,
|
|
2049
|
+
esm: api.config.esmExtensions === true,
|
|
2050
|
+
documentModels: prepared.documentModels,
|
|
2051
|
+
enumConsts: modelOptions.enums === "const",
|
|
2052
|
+
constsByFile,
|
|
2053
|
+
modelOptions,
|
|
2054
|
+
writeIndex: modelOptions.index !== false,
|
|
2055
|
+
uniqueNameByPath
|
|
2056
|
+
};
|
|
2057
|
+
if (modelOptions.scope === "all" && api.config.filterEndpoints !== void 0) {
|
|
2058
|
+
const unfiltered = await runRtkCodegen(
|
|
2059
|
+
{ ...api, config: { ...api.config, filterEndpoints: void 0 } },
|
|
2060
|
+
preparedEndpoints.doc,
|
|
2061
|
+
index,
|
|
2062
|
+
path9.join(specDir, `${i}-all.json`),
|
|
2063
|
+
prettierConfigFile,
|
|
2064
|
+
(rtkName) => preparedEndpoints.endpointNamesByPlaceholder.get(rtkName) ?? rtkName
|
|
2065
|
+
);
|
|
2066
|
+
const unfilteredCode = restoreEndpointNames(unfiltered.code, unfiltered.locations, preparedEndpoints.endpointNamesByPlaceholder).code;
|
|
2067
|
+
extractModels({ ...extractOptions, apiSource: unfilteredCode, modelsOnly: true });
|
|
2068
|
+
logger.info(" models of all operations written (models.scope all)");
|
|
2069
|
+
}
|
|
2042
2070
|
const endpoints = parseApiEndpoints(rtk.code, logger, rtk.locations);
|
|
2043
2071
|
const handlerEndpoints = detectResponseHandlerEndpoints(doc, endpoints, api.responseHandlers);
|
|
2044
2072
|
const responseKinds = /* @__PURE__ */ new Map();
|
|
@@ -2051,22 +2079,7 @@ async function generateSdk(options = {}) {
|
|
|
2051
2079
|
const multipart = injectMultipartBodies(rtk.code, detectMultipartEndpoints(doc, endpoints), logger);
|
|
2052
2080
|
if (multipart.injected.length > 0) logger.info(` ${multipart.injected.length} multipart endpoint(s) (multipartFiles)`);
|
|
2053
2081
|
const esm = api.config.esmExtensions === true;
|
|
2054
|
-
const apiSource = extractModels({
|
|
2055
|
-
apiSource: multipart.source,
|
|
2056
|
-
apiFilePath: api.outputFile,
|
|
2057
|
-
modelsDir,
|
|
2058
|
-
registry,
|
|
2059
|
-
files,
|
|
2060
|
-
logger,
|
|
2061
|
-
esm,
|
|
2062
|
-
responseKinds,
|
|
2063
|
-
documentModels: prepared.documentModels,
|
|
2064
|
-
enumConsts: modelOptions.enums === "const",
|
|
2065
|
-
constsByFile,
|
|
2066
|
-
modelOptions,
|
|
2067
|
-
writeIndex: modelOptions.index !== false,
|
|
2068
|
-
uniqueNameByPath
|
|
2069
|
-
});
|
|
2082
|
+
const apiSource = extractModels({ ...extractOptions, apiSource: multipart.source, responseKinds });
|
|
2070
2083
|
if (!write) continue;
|
|
2071
2084
|
const withHandlers = injectResponseHandlers(apiSource, handlerEndpoints);
|
|
2072
2085
|
files.set(api.outputFile, multipart.injected.length > 0 ? `${MULTIPART_IMPORT}
|
|
@@ -2182,4 +2195,4 @@ export {
|
|
|
2182
2195
|
generateSdk,
|
|
2183
2196
|
linkSkills
|
|
2184
2197
|
};
|
|
2185
|
-
//# sourceMappingURL=chunk-
|
|
2198
|
+
//# sourceMappingURL=chunk-J2RLNVKK.js.map
|