@cmflow/atlas 3.4.0-beta.6 → 3.4.0-beta.8
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 +139 -7
- package/dist/bin/atlas.mjs +203 -386
- package/dist/index.d.mts +23 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/routeBackendTopologyService-DkNyCtKt.mjs +815 -0
- package/dist/rules/cleanObjectRule.d.mts +1 -1
- package/dist/rules/cmsI18nFieldRule.d.mts +1 -1
- package/dist/rules/dateConversionRule.d.mts +1 -1
- package/dist/rules/lodashGetRule.d.mts +1 -1
- package/dist/rules/mappingUtilityRule.d.mts +1 -1
- package/dist/rules/mappingUtilityRule.mjs.map +1 -1
- package/dist/rules/memberGetFieldRule.d.mts +1 -1
- package/dist/rules/memberGetFieldRule.mjs.map +1 -1
- package/dist/rules/quableI18nFieldRule.d.mts +1 -1
- package/dist/{types-3y34Gf8R.d.mts → types-smD5SZe9.d.mts} +18 -3
- package/dist/workers/routeBackendTopologyWorker.mjs +29 -0
- package/knowledges/cms-and-directus-indirect-routes.md +5 -3
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as FieldExtractionRule } from "../types-smD5SZe9.mjs";
|
|
2
2
|
//#region src/rules/cmsI18nFieldRule.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* `CmsI18n#get`/`getAll` reads a localized field off the translations array passed to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappingUtilityRule.mjs","names":[],"sources":["../../src/rules/mappingUtilityRule.ts"],"sourcesContent":["import { Node } from \"ts-morph\";\nimport { defineExpressionRule } from \"../utils/defineExpressionRule\";\n\nconst mapperTypes = new Set([\"string\", \"number\", \"boolean\", \"date\", \"datetime\", \"enum\", \"array\", \"object\"]);\n\nexport const mappingUtilityRule = defineExpressionRule({\n name: \"mapping-utility-wrapper\",\n match: (expression, config) => {\n if (!Node.isCallExpression(expression)) return false;\n\n const callee = expression.getExpression().getText();\n return config.analysis.neutralExpressionMatchers.some((matcher) => callee.startsWith(matcher.prefix));\n },\n parse: (expression, config) => {\n if (!Node.isCallExpression(expression)) return undefined;\n\n const callee = expression.getExpression().getText();\n const matcher = config.analysis.neutralExpressionMatchers.find((item) => callee.startsWith(item.prefix));\n const mapperType = callee.split(\".\").find((segment) => mapperTypes.has(segment));\n\n return {\n transparent: true,\n mapperType,\n apiMapping: matcher?.apiMapping ?? false\n };\n }\n});\n"],"mappings":"yFAGA,MAAM,EAAc,IAAI,IAAI,CAAC,SAAU,SAAU,UAAW,OAAQ,WAAY,OAAQ,QAAS,QAAQ,CAAC,EAE7F,EAAqB,EAAqB,CACrD,KAAM,0BACN,OAAQ,EAAY,IAAW,CAC7B,GAAI,CAAC,EAAK,iBAAiB,CAAU,
|
|
1
|
+
{"version":3,"file":"mappingUtilityRule.mjs","names":[],"sources":["../../src/rules/mappingUtilityRule.ts"],"sourcesContent":["import { Node } from \"ts-morph\";\nimport { defineExpressionRule } from \"../utils/defineExpressionRule\";\n\nconst mapperTypes = new Set([\"string\", \"number\", \"boolean\", \"date\", \"datetime\", \"enum\", \"array\", \"object\"]);\n\nexport const mappingUtilityRule = defineExpressionRule({\n name: \"mapping-utility-wrapper\",\n match: (expression, config) => {\n if (!Node.isCallExpression(expression)) {\n return false;\n }\n\n const callee = expression.getExpression().getText();\n return config.analysis.neutralExpressionMatchers.some((matcher) => callee.startsWith(matcher.prefix));\n },\n parse: (expression, config) => {\n if (!Node.isCallExpression(expression)) {\n return undefined;\n }\n\n const callee = expression.getExpression().getText();\n const matcher = config.analysis.neutralExpressionMatchers.find((item) => callee.startsWith(item.prefix));\n const mapperType = callee.split(\".\").find((segment) => mapperTypes.has(segment));\n\n return {\n transparent: true,\n mapperType,\n apiMapping: matcher?.apiMapping ?? false\n };\n }\n});\n"],"mappings":"yFAGA,MAAM,EAAc,IAAI,IAAI,CAAC,SAAU,SAAU,UAAW,OAAQ,WAAY,OAAQ,QAAS,QAAQ,CAAC,EAE7F,EAAqB,EAAqB,CACrD,KAAM,0BACN,OAAQ,EAAY,IAAW,CAC7B,GAAI,CAAC,EAAK,iBAAiB,CAAU,EACnC,MAAO,GAGT,IAAM,EAAS,EAAW,cAAc,CAAC,CAAC,QAAQ,EAClD,OAAO,EAAO,SAAS,0BAA0B,KAAM,GAAY,EAAO,WAAW,EAAQ,MAAM,CAAC,CACtG,EACA,OAAQ,EAAY,IAAW,CAC7B,GAAI,CAAC,EAAK,iBAAiB,CAAU,EACnC,OAGF,IAAM,EAAS,EAAW,cAAc,CAAC,CAAC,QAAQ,EAC5C,EAAU,EAAO,SAAS,0BAA0B,KAAM,GAAS,EAAO,WAAW,EAAK,MAAM,CAAC,EAGvG,MAAO,CACL,YAAa,GACb,WAJiB,EAAO,MAAM,GAAG,CAAC,CAAC,KAAM,GAAY,EAAY,IAAI,CAAO,CAInE,EACT,WAAY,GAAS,YAAc,EACrC,CACF,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memberGetFieldRule.mjs","names":[],"sources":["../../src/rules/memberGetFieldRule.ts"],"sourcesContent":["import { Node } from \"ts-morph\";\nimport { defineExpressionRule } from \"../utils/defineExpressionRule\";\n\nexport const memberGetFieldRule = defineExpressionRule({\n name: \"member-get-field\",\n match: (expression) => {\n if (!Node.isCallExpression(expression)) return false;\n\n const target = expression.getExpression();\n const field = expression\n .getArguments()\n .find((argument) => Node.isStringLiteral(argument) || Node.isNoSubstitutionTemplateLiteral(argument));\n return Node.isPropertyAccessExpression(target) && [\"get\", \"getAll\"].includes(target.getName()) && Boolean(field);\n },\n parse: (expression) => {\n if (!Node.isCallExpression(expression)) return undefined;\n\n const target = expression.getExpression();\n const field = expression\n .getArguments()\n .find((argument) => Node.isStringLiteral(argument) || Node.isNoSubstitutionTemplateLiteral(argument));\n if (!Node.isPropertyAccessExpression(target) || (!Node.isStringLiteral(field) && !Node.isNoSubstitutionTemplateLiteral(field))) {\n return undefined;\n }\n\n return { backendField: `${target.getExpression().getText()}.${field.getLiteralValue()}` };\n }\n});\n"],"mappings":"yFAGA,MAAa,EAAqB,EAAqB,CACrD,KAAM,mBACN,MAAQ,GAAe,CACrB,GAAI,CAAC,EAAK,iBAAiB,CAAU,
|
|
1
|
+
{"version":3,"file":"memberGetFieldRule.mjs","names":[],"sources":["../../src/rules/memberGetFieldRule.ts"],"sourcesContent":["import { Node } from \"ts-morph\";\nimport { defineExpressionRule } from \"../utils/defineExpressionRule\";\n\nexport const memberGetFieldRule = defineExpressionRule({\n name: \"member-get-field\",\n match: (expression) => {\n if (!Node.isCallExpression(expression)) {\n return false;\n }\n\n const target = expression.getExpression();\n const field = expression\n .getArguments()\n .find((argument) => Node.isStringLiteral(argument) || Node.isNoSubstitutionTemplateLiteral(argument));\n return Node.isPropertyAccessExpression(target) && [\"get\", \"getAll\"].includes(target.getName()) && Boolean(field);\n },\n parse: (expression) => {\n if (!Node.isCallExpression(expression)) {\n return undefined;\n }\n\n const target = expression.getExpression();\n const field = expression\n .getArguments()\n .find((argument) => Node.isStringLiteral(argument) || Node.isNoSubstitutionTemplateLiteral(argument));\n if (!Node.isPropertyAccessExpression(target) || (!Node.isStringLiteral(field) && !Node.isNoSubstitutionTemplateLiteral(field))) {\n return undefined;\n }\n\n return { backendField: `${target.getExpression().getText()}.${field.getLiteralValue()}` };\n }\n});\n"],"mappings":"yFAGA,MAAa,EAAqB,EAAqB,CACrD,KAAM,mBACN,MAAQ,GAAe,CACrB,GAAI,CAAC,EAAK,iBAAiB,CAAU,EACnC,MAAO,GAGT,IAAM,EAAS,EAAW,cAAc,EAClC,EAAQ,EACX,aAAa,CAAC,CACd,KAAM,GAAa,EAAK,gBAAgB,CAAQ,GAAK,EAAK,gCAAgC,CAAQ,CAAC,EACtG,OAAO,EAAK,2BAA2B,CAAM,GAAK,CAAC,MAAO,QAAQ,CAAC,CAAC,SAAS,EAAO,QAAQ,CAAC,GAAK,EAAQ,CAC5G,EACA,MAAQ,GAAe,CACrB,GAAI,CAAC,EAAK,iBAAiB,CAAU,EACnC,OAGF,IAAM,EAAS,EAAW,cAAc,EAClC,EAAQ,EACX,aAAa,CAAC,CACd,KAAM,GAAa,EAAK,gBAAgB,CAAQ,GAAK,EAAK,gCAAgC,CAAQ,CAAC,EAClG,MAAC,EAAK,2BAA2B,CAAM,GAAM,CAAC,EAAK,gBAAgB,CAAK,GAAK,CAAC,EAAK,gCAAgC,CAAK,GAI5H,MAAO,CAAE,aAAc,GAAG,EAAO,cAAc,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAM,gBAAgB,GAAI,CAC1F,CACF,CAAC"}
|
|
@@ -18,6 +18,21 @@ interface NeutralExpressionMatcher {
|
|
|
18
18
|
prefix: string;
|
|
19
19
|
apiMapping?: boolean;
|
|
20
20
|
}
|
|
21
|
+
type BackendProperty = {
|
|
22
|
+
document: string;
|
|
23
|
+
field: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
} | {
|
|
26
|
+
route: string;
|
|
27
|
+
method: string;
|
|
28
|
+
field: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
};
|
|
31
|
+
interface BackendSource {
|
|
32
|
+
name: string;
|
|
33
|
+
resolve?: () => Promise<BackendProperty[]>;
|
|
34
|
+
rules?: FieldExtractionRule[];
|
|
35
|
+
}
|
|
21
36
|
interface UserConfig {
|
|
22
37
|
/**
|
|
23
38
|
* Absolute path to the root of the repository to analyze (e.g. the digital-api repo).
|
|
@@ -59,7 +74,7 @@ interface UserConfig {
|
|
|
59
74
|
*/
|
|
60
75
|
analysis: {
|
|
61
76
|
/** Backend identifiers used by the API project. */
|
|
62
|
-
backends: string
|
|
77
|
+
backends: Array<string | BackendSource>;
|
|
63
78
|
/**
|
|
64
79
|
* Glob patterns excluded from `analysis_files`.
|
|
65
80
|
* Use this to hide technical plumbing files that add noise to route review documents.
|
|
@@ -98,5 +113,5 @@ interface UserConfig {
|
|
|
98
113
|
};
|
|
99
114
|
}
|
|
100
115
|
//#endregion
|
|
101
|
-
export { FieldExtractionRule as n,
|
|
102
|
-
//# sourceMappingURL=types-
|
|
116
|
+
export { defineExpressionRule as a, FieldExtractionRule as i, BackendSource as n, UserConfig as r, BackendProperty as t };
|
|
117
|
+
//# sourceMappingURL=types-smD5SZe9.d.mts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { t as generateBackendTopologyArtifacts } from "../routeBackendTopologyService-DkNyCtKt.mjs";
|
|
2
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
3
|
+
//#region src/workers/routeBackendTopologyWorker.ts
|
|
4
|
+
const data = workerData;
|
|
5
|
+
generateBackendTopologyArtifacts({
|
|
6
|
+
cwd: data.cwd,
|
|
7
|
+
routeSelectors: data.routeSelectors,
|
|
8
|
+
onRouteProgress: ({ route, stage }) => {
|
|
9
|
+
if (stage !== "completed") return;
|
|
10
|
+
parentPort?.postMessage({
|
|
11
|
+
type: "progress",
|
|
12
|
+
route
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
onArtifact: async (artifact) => {
|
|
16
|
+
parentPort?.postMessage({
|
|
17
|
+
type: "artifact",
|
|
18
|
+
artifact
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}).catch((error) => {
|
|
22
|
+
parentPort?.postMessage({
|
|
23
|
+
type: "error",
|
|
24
|
+
message: error instanceof Error ? error.message : String(error)
|
|
25
|
+
});
|
|
26
|
+
process.exitCode = 1;
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export {};
|
|
@@ -97,9 +97,11 @@ Cette limite explique les valeurs `method: null` et `route: unknown` observées
|
|
|
97
97
|
Avec `@directus/sdk`, le code métier ne manipule généralement pas de route HTTP explicite. Il décrit une opération :
|
|
98
98
|
|
|
99
99
|
```ts
|
|
100
|
-
client.request(
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
client.request(
|
|
101
|
+
readItems("offers", {
|
|
102
|
+
fields: ["id", "label"]
|
|
103
|
+
})
|
|
104
|
+
);
|
|
103
105
|
```
|
|
104
106
|
|
|
105
107
|
La méthode et l'URL HTTP sont construites par le SDK. Chercher uniquement un littéral de route dans le code ne peut donc pas produire un résultat fiable.
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmflow/atlas",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.8",
|
|
4
4
|
"description": "API-to-backend mapping catalogue for Club Med Flow",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "romakita",
|
|
7
|
-
"email": "rom.lenzotti@gmail.com",
|
|
8
7
|
"bin": "./dist/bin/atlas.mjs",
|
|
9
8
|
"type": "module",
|
|
10
9
|
"main": "./dist/index.mjs",
|
|
@@ -46,6 +45,7 @@
|
|
|
46
45
|
"typescript": "^7.0.2",
|
|
47
46
|
"vitest": "^3.0.8"
|
|
48
47
|
},
|
|
48
|
+
"email": "rom.lenzotti@gmail.com",
|
|
49
49
|
"peerDependencies": {},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"tag": "beta"
|