@cmflow/atlas 3.4.0-beta.3 → 3.4.0-beta.4

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.
@@ -0,0 +1,6 @@
1
+ import { t as UserConfig } from "./types-Dl8rY7PV.mjs";
2
+ //#region src/utils/defineConfig.d.ts
3
+ declare function defineConfig(config: UserConfig): UserConfig;
4
+ //#endregion
5
+ export { type UserConfig, defineConfig };
6
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ function e(e){return e}export{e as defineConfig};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/utils/defineConfig.ts"],"sourcesContent":["import type { UserConfig } from \"../models/types\";\n\nexport function defineConfig(config: UserConfig): UserConfig {\n return config;\n}\n"],"mappings":"AAEA,SAAgB,EAAa,EAAgC,CAC3D,OAAO,CACT"}
@@ -0,0 +1,6 @@
1
+ import { n as FieldExtractionRule } from "../types-Dl8rY7PV.mjs";
2
+ //#region src/rules/cleanObjectRule.d.ts
3
+ declare const cleanObjectRule: FieldExtractionRule;
4
+ //#endregion
5
+ export { cleanObjectRule };
6
+ //# sourceMappingURL=cleanObjectRule.d.mts.map
@@ -0,0 +1,2 @@
1
+ import{t as e}from"../defineRule-Dfvzj6n2.mjs";import{Node as t}from"ts-morph";const n=e({name:`clean-object-wrapper`,match:e=>t.isCallExpression(e)&&/^(?:(?:MappingUtils\.)?cleanObject|clean)$/.test(e.getExpression().getText()),parse:()=>({transparent:!0})});export{n as cleanObjectRule};
2
+ //# sourceMappingURL=cleanObjectRule.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanObjectRule.mjs","names":[],"sources":["../../src/rules/cleanObjectRule.ts"],"sourcesContent":["import { Node } from \"ts-morph\";\nimport { defineExpressionRule } from \"../utils/defineRule\";\n\nexport const cleanObjectRule = defineExpressionRule({\n name: \"clean-object-wrapper\",\n match: (expression) =>\n Node.isCallExpression(expression) && /^(?:(?:MappingUtils\\.)?cleanObject|clean)$/.test(expression.getExpression().getText()),\n parse: () => ({ transparent: true })\n});\n"],"mappings":"+EAGA,MAAa,EAAkB,EAAqB,CAClD,KAAM,uBACN,MAAQ,GACN,EAAK,iBAAiB,CAAU,GAAK,6CAA6C,KAAK,EAAW,cAAc,CAAC,CAAC,QAAQ,CAAC,EAC7H,WAAc,CAAE,YAAa,EAAK,EACpC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { n as FieldExtractionRule } from "../types-Dl8rY7PV.mjs";
2
+ //#region src/rules/cmsI18nFieldRule.d.ts
3
+ /**
4
+ * `CmsI18n#get`/`getAll` reads a localized field off the translations array passed to the
5
+ * constructor (e.g. `new CmsI18n(offer.translations)`). Resolving to `i18n.field` breaks
6
+ * domain-path matching downstream because the receiver name ("i18n") is not the domain root
7
+ * ("offer"); resolving through the constructor argument restores that root.
8
+ */
9
+ declare const cmsI18nFieldRule: FieldExtractionRule;
10
+ //#endregion
11
+ export { cmsI18nFieldRule };
12
+ //# sourceMappingURL=cmsI18nFieldRule.d.mts.map
@@ -0,0 +1,2 @@
1
+ import{t as e}from"../defineRule-Dfvzj6n2.mjs";import{Node as t}from"ts-morph";function n(e){if(!t.isIdentifier(e))return;let n=(e.getSymbol()?.getDeclarations().find(t.isVariableDeclaration))?.getInitializer();if(!n||!t.isNewExpression(n)||n.getExpression().getText()!==`CmsI18n`)return;let r=n.getArguments()[0];return r&&t.isExpression(r)?r.getText():void 0}function r(e){if(!t.isCallExpression(e))return;let r=e.getExpression();if(!t.isPropertyAccessExpression(r)||![`get`,`getAll`].includes(r.getName()))return;let i=e.getArguments().find(e=>t.isStringLiteral(e)||t.isNoSubstitutionTemplateLiteral(e));if(!i||!t.isStringLiteral(i)&&!t.isNoSubstitutionTemplateLiteral(i))return;let a=n(r.getExpression());return a?`${a}[locale].${i.getLiteralValue()}`:void 0}const i=e({name:`cms-i18n-field`,match:e=>!!r(e),parse:e=>{let t=r(e);return t?{backendField:t}:void 0}});export{i as cmsI18nFieldRule};
2
+ //# sourceMappingURL=cmsI18nFieldRule.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cmsI18nFieldRule.mjs","names":[],"sources":["../../src/rules/cmsI18nFieldRule.ts"],"sourcesContent":["import { type Expression, Node } from \"ts-morph\";\nimport { defineExpressionRule } from \"../utils/defineRule\";\n\nconst CMS_I18N_CLASS_NAME = \"CmsI18n\";\n\nfunction resolveCmsI18nSource(receiver: Expression): string | undefined {\n if (!Node.isIdentifier(receiver)) {\n return undefined;\n }\n\n const declaration = receiver.getSymbol()?.getDeclarations().find(Node.isVariableDeclaration);\n const initializer = declaration?.getInitializer();\n if (!initializer || !Node.isNewExpression(initializer)) {\n return undefined;\n }\n\n if (initializer.getExpression().getText() !== CMS_I18N_CLASS_NAME) {\n return undefined;\n }\n\n const constructorArgument = initializer.getArguments()[0];\n return constructorArgument && Node.isExpression(constructorArgument) ? constructorArgument.getText() : undefined;\n}\n\nfunction parseCmsI18nField(expression: Expression): string | undefined {\n if (!Node.isCallExpression(expression)) {\n return undefined;\n }\n\n const target = expression.getExpression();\n if (!Node.isPropertyAccessExpression(target) || ![\"get\", \"getAll\"].includes(target.getName())) {\n return undefined;\n }\n\n const field = expression\n .getArguments()\n .find((argument) => Node.isStringLiteral(argument) || Node.isNoSubstitutionTemplateLiteral(argument));\n if (!field || (!Node.isStringLiteral(field) && !Node.isNoSubstitutionTemplateLiteral(field))) {\n return undefined;\n }\n\n const source = resolveCmsI18nSource(target.getExpression());\n return source ? `${source}[locale].${field.getLiteralValue()}` : undefined;\n}\n\n/**\n * `CmsI18n#get`/`getAll` reads a localized field off the translations array passed to the\n * constructor (e.g. `new CmsI18n(offer.translations)`). Resolving to `i18n.field` breaks\n * domain-path matching downstream because the receiver name (\"i18n\") is not the domain root\n * (\"offer\"); resolving through the constructor argument restores that root.\n */\nexport const cmsI18nFieldRule = defineExpressionRule({\n name: \"cms-i18n-field\",\n match: (expression) => Boolean(parseCmsI18nField(expression)),\n parse: (expression) => {\n const backendField = parseCmsI18nField(expression);\n return backendField ? { backendField } : undefined;\n }\n});\n"],"mappings":"+EAKA,SAAS,EAAqB,EAA0C,CACtE,GAAI,CAAC,EAAK,aAAa,CAAQ,EAC7B,OAIF,IAAM,GADc,EAAS,UAAU,CAAC,EAAE,gBAAgB,CAAC,CAAC,KAAK,EAAK,qBAAqB,EAAA,EAC1D,eAAe,EAKhD,GAJI,CAAC,GAAe,CAAC,EAAK,gBAAgB,CAAW,GAIjD,EAAY,cAAc,CAAC,CAAC,QAAQ,IAAM,UAC5C,OAGF,IAAM,EAAsB,EAAY,aAAa,CAAC,CAAC,GACvD,OAAO,GAAuB,EAAK,aAAa,CAAmB,EAAI,EAAoB,QAAQ,EAAI,IAAA,EACzG,CAEA,SAAS,EAAkB,EAA4C,CACrE,GAAI,CAAC,EAAK,iBAAiB,CAAU,EACnC,OAGF,IAAM,EAAS,EAAW,cAAc,EACxC,GAAI,CAAC,EAAK,2BAA2B,CAAM,GAAK,CAAC,CAAC,MAAO,QAAQ,CAAC,CAAC,SAAS,EAAO,QAAQ,CAAC,EAC1F,OAGF,IAAM,EAAQ,EACX,aAAa,CAAC,CACd,KAAM,GAAa,EAAK,gBAAgB,CAAQ,GAAK,EAAK,gCAAgC,CAAQ,CAAC,EACtG,GAAI,CAAC,GAAU,CAAC,EAAK,gBAAgB,CAAK,GAAK,CAAC,EAAK,gCAAgC,CAAK,EACxF,OAGF,IAAM,EAAS,EAAqB,EAAO,cAAc,CAAC,EAC1D,OAAO,EAAS,GAAG,EAAO,WAAW,EAAM,gBAAgB,IAAM,IAAA,EACnE,CAQA,MAAa,EAAmB,EAAqB,CACnD,KAAM,iBACN,MAAQ,GAAe,EAAQ,EAAkB,CAAU,EAC3D,MAAQ,GAAe,CACrB,IAAM,EAAe,EAAkB,CAAU,EACjD,OAAO,EAAe,CAAE,cAAa,EAAI,IAAA,EAC3C,CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { n as FieldExtractionRule } from "../types-Dl8rY7PV.mjs";
2
+ //#region src/rules/dateConversionRule.d.ts
3
+ declare const dateConversionRule: FieldExtractionRule;
4
+ //#endregion
5
+ export { dateConversionRule };
6
+ //# sourceMappingURL=dateConversionRule.d.mts.map
@@ -0,0 +1,2 @@
1
+ import{t as e}from"../defineRule-Dfvzj6n2.mjs";import{Node as t}from"ts-morph";const n=e({name:`date-utils-wrapper`,match:e=>t.isCallExpression(e)&&e.getExpression().getText().startsWith(`DateUtils.`),parse:()=>({transparent:!0})});export{n as dateConversionRule};
2
+ //# sourceMappingURL=dateConversionRule.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateConversionRule.mjs","names":[],"sources":["../../src/rules/dateConversionRule.ts"],"sourcesContent":["import { Node } from \"ts-morph\";\nimport { defineExpressionRule } from \"../utils/defineRule\";\n\nexport const dateConversionRule = defineExpressionRule({\n name: \"date-utils-wrapper\",\n match: (expression) => Node.isCallExpression(expression) && expression.getExpression().getText().startsWith(\"DateUtils.\"),\n parse: () => ({ transparent: true })\n});\n"],"mappings":"+EAGA,MAAa,EAAqB,EAAqB,CACrD,KAAM,qBACN,MAAQ,GAAe,EAAK,iBAAiB,CAAU,GAAK,EAAW,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW,YAAY,EACxH,WAAc,CAAE,YAAa,EAAK,EACpC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { n as FieldExtractionRule } from "../types-Dl8rY7PV.mjs";
2
+ //#region src/rules/lodashGetRule.d.ts
3
+ declare const lodashGetRule: FieldExtractionRule;
4
+ //#endregion
5
+ export { lodashGetRule };
6
+ //# sourceMappingURL=lodashGetRule.d.mts.map
@@ -0,0 +1,2 @@
1
+ import{t as e}from"../defineRule-Dfvzj6n2.mjs";import{Node as t}from"ts-morph";const n=e({name:`lodash-get`,match:e=>{if(!t.isCallExpression(e)||e.getExpression().getText()!==`get`)return!1;let n=e.getArguments()[1];return t.isStringLiteral(n)||t.isNoSubstitutionTemplateLiteral(n)},parse:e=>{if(!t.isCallExpression(e))return;let[n,r]=e.getArguments();if(!(!n||!t.isExpression(n)||!t.isStringLiteral(r)&&!t.isNoSubstitutionTemplateLiteral(r)))return{backendField:`${n.getText()}.${r.getLiteralValue()}`}}});export{n as lodashGetRule};
2
+ //# sourceMappingURL=lodashGetRule.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lodashGetRule.mjs","names":[],"sources":["../../src/rules/lodashGetRule.ts"],"sourcesContent":["import { Node } from \"ts-morph\";\nimport { defineExpressionRule } from \"../utils/defineRule\";\n\nexport const lodashGetRule = defineExpressionRule({\n name: \"lodash-get\",\n match: (expression) => {\n if (!Node.isCallExpression(expression) || expression.getExpression().getText() !== \"get\") {\n return false;\n }\n\n const path = expression.getArguments()[1];\n return Node.isStringLiteral(path) || Node.isNoSubstitutionTemplateLiteral(path);\n },\n parse: (expression) => {\n if (!Node.isCallExpression(expression)) {\n return undefined;\n }\n\n const [object, path] = expression.getArguments();\n if (!object || !Node.isExpression(object) || (!Node.isStringLiteral(path) && !Node.isNoSubstitutionTemplateLiteral(path))) {\n return undefined;\n }\n\n return { backendField: `${object.getText()}.${path.getLiteralValue()}` };\n }\n});\n"],"mappings":"+EAGA,MAAa,EAAgB,EAAqB,CAChD,KAAM,aACN,MAAQ,GAAe,CACrB,GAAI,CAAC,EAAK,iBAAiB,CAAU,GAAK,EAAW,cAAc,CAAC,CAAC,QAAQ,IAAM,MACjF,MAAO,GAGT,IAAM,EAAO,EAAW,aAAa,CAAC,CAAC,GACvC,OAAO,EAAK,gBAAgB,CAAI,GAAK,EAAK,gCAAgC,CAAI,CAChF,EACA,MAAQ,GAAe,CACrB,GAAI,CAAC,EAAK,iBAAiB,CAAU,EACnC,OAGF,GAAM,CAAC,EAAQ,GAAQ,EAAW,aAAa,EAC3C,MAAC,GAAU,CAAC,EAAK,aAAa,CAAM,GAAM,CAAC,EAAK,gBAAgB,CAAI,GAAK,CAAC,EAAK,gCAAgC,CAAI,GAIvH,MAAO,CAAE,aAAc,GAAG,EAAO,QAAQ,EAAE,GAAG,EAAK,gBAAgB,GAAI,CACzE,CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { n as FieldExtractionRule } from "../types-Dl8rY7PV.mjs";
2
+ //#region src/rules/mappingUtilityRule.d.ts
3
+ declare const mappingUtilityRule: FieldExtractionRule;
4
+ //#endregion
5
+ export { mappingUtilityRule };
6
+ //# sourceMappingURL=mappingUtilityRule.d.mts.map
@@ -0,0 +1,2 @@
1
+ import{t as e}from"../defineRule-Dfvzj6n2.mjs";import{Node as t}from"ts-morph";const n=new Set([`string`,`number`,`boolean`,`date`,`datetime`,`enum`,`array`,`object`]),r=e({name:`mapping-utility-wrapper`,match:(e,n)=>{if(!t.isCallExpression(e))return!1;let r=e.getExpression().getText();return n.analysis.neutralExpressionMatchers.some(e=>r.startsWith(e.prefix))},parse:(e,r)=>{if(!t.isCallExpression(e))return;let i=e.getExpression().getText(),a=r.analysis.neutralExpressionMatchers.find(e=>i.startsWith(e.prefix));return{transparent:!0,mapperType:i.split(`.`).find(e=>n.has(e)),apiMapping:a?.apiMapping??!1}}});export{r as mappingUtilityRule};
2
+ //# sourceMappingURL=mappingUtilityRule.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mappingUtilityRule.mjs","names":[],"sources":["../../src/rules/mappingUtilityRule.ts"],"sourcesContent":["import { Node } from \"ts-morph\";\nimport { defineExpressionRule } from \"../utils/defineRule\";\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":"+EAGA,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,EAAG,MAAO,GAE/C,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,EAAG,OAExC,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"}
@@ -0,0 +1,6 @@
1
+ import { n as FieldExtractionRule } from "../types-Dl8rY7PV.mjs";
2
+ //#region src/rules/memberGetFieldRule.d.ts
3
+ declare const memberGetFieldRule: FieldExtractionRule;
4
+ //#endregion
5
+ export { memberGetFieldRule };
6
+ //# sourceMappingURL=memberGetFieldRule.d.mts.map
@@ -0,0 +1,2 @@
1
+ import{t as e}from"../defineRule-Dfvzj6n2.mjs";import{Node as t}from"ts-morph";const n=e({name:`member-get-field`,match:e=>{if(!t.isCallExpression(e))return!1;let n=e.getExpression(),r=e.getArguments().find(e=>t.isStringLiteral(e)||t.isNoSubstitutionTemplateLiteral(e));return t.isPropertyAccessExpression(n)&&[`get`,`getAll`].includes(n.getName())&&!!r},parse:e=>{if(!t.isCallExpression(e))return;let n=e.getExpression(),r=e.getArguments().find(e=>t.isStringLiteral(e)||t.isNoSubstitutionTemplateLiteral(e));if(!(!t.isPropertyAccessExpression(n)||!t.isStringLiteral(r)&&!t.isNoSubstitutionTemplateLiteral(r)))return{backendField:`${n.getExpression().getText()}.${r.getLiteralValue()}`}}});export{n as memberGetFieldRule};
2
+ //# sourceMappingURL=memberGetFieldRule.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memberGetFieldRule.mjs","names":[],"sources":["../../src/rules/memberGetFieldRule.ts"],"sourcesContent":["import { Node } from \"ts-morph\";\nimport { defineExpressionRule } from \"../utils/defineRule\";\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":"+EAGA,MAAa,EAAqB,EAAqB,CACrD,KAAM,mBACN,MAAQ,GAAe,CACrB,GAAI,CAAC,EAAK,iBAAiB,CAAU,EAAG,MAAO,GAE/C,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,EAAG,OAExC,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"}
@@ -0,0 +1,6 @@
1
+ import { n as FieldExtractionRule } from "../types-Dl8rY7PV.mjs";
2
+ //#region src/rules/quableI18nFieldRule.d.ts
3
+ declare const quableI18nFieldRule: FieldExtractionRule;
4
+ //#endregion
5
+ export { quableI18nFieldRule };
6
+ //# sourceMappingURL=quableI18nFieldRule.d.mts.map
@@ -0,0 +1,2 @@
1
+ import{t as e}from"../defineRule-Dfvzj6n2.mjs";import{Node as t}from"ts-morph";function n(e){if(!t.isPropertyAccessExpression(e))return;let n=e.getExpression();if(!t.isElementAccessExpression(n))return;let r=n.getExpression();if(!t.isCallExpression(r))return;let i=r.getExpression(),a=r.getArguments().find(e=>t.isStringLiteral(e)||t.isNoSubstitutionTemplateLiteral(e));if(!(!t.isPropertyAccessExpression(i)||i.getName()!==`getAll`||!a||!t.isStringLiteral(a)&&!t.isNoSubstitutionTemplateLiteral(a)))return`${a.getLiteralValue()}[locale].${e.getName()}`}const r=e({name:`quable-i18n-field`,match:e=>!!n(e),parse:e=>{let t=n(e);return t?{backendField:t}:void 0}});export{r as quableI18nFieldRule};
2
+ //# sourceMappingURL=quableI18nFieldRule.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quableI18nFieldRule.mjs","names":[],"sources":["../../src/rules/quableI18nFieldRule.ts"],"sourcesContent":["import { type Expression, Node } from \"ts-morph\";\nimport { defineExpressionRule } from \"../utils/defineRule\";\n\nfunction parseLocalizedI18nField(expression: Expression): string | undefined {\n if (!Node.isPropertyAccessExpression(expression)) {\n return undefined;\n }\n\n const elementAccess = expression.getExpression();\n\n if (!Node.isElementAccessExpression(elementAccess)) {\n return undefined;\n }\n\n const getAllCall = elementAccess.getExpression();\n\n if (!Node.isCallExpression(getAllCall)) {\n return undefined;\n }\n\n const target = getAllCall.getExpression();\n const field = getAllCall\n .getArguments()\n .find((argument) => Node.isStringLiteral(argument) || Node.isNoSubstitutionTemplateLiteral(argument));\n\n if (\n !Node.isPropertyAccessExpression(target) ||\n target.getName() !== \"getAll\" ||\n !field ||\n (!Node.isStringLiteral(field) && !Node.isNoSubstitutionTemplateLiteral(field))\n ) {\n return undefined;\n }\n\n return `${field.getLiteralValue()}[locale].${expression.getName()}`;\n}\n\nexport const quableI18nFieldRule = defineExpressionRule({\n name: \"quable-i18n-field\",\n match: (expression) => Boolean(parseLocalizedI18nField(expression)),\n parse: (expression) => {\n const backendField = parseLocalizedI18nField(expression);\n return backendField ? { backendField } : undefined;\n }\n});\n"],"mappings":"+EAGA,SAAS,EAAwB,EAA4C,CAC3E,GAAI,CAAC,EAAK,2BAA2B,CAAU,EAC7C,OAGF,IAAM,EAAgB,EAAW,cAAc,EAE/C,GAAI,CAAC,EAAK,0BAA0B,CAAa,EAC/C,OAGF,IAAM,EAAa,EAAc,cAAc,EAE/C,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,EAGpG,MAAC,EAAK,2BAA2B,CAAM,GACvC,EAAO,QAAQ,IAAM,UACrB,CAAC,GACA,CAAC,EAAK,gBAAgB,CAAK,GAAK,CAAC,EAAK,gCAAgC,CAAK,GAK9E,MAAO,GAAG,EAAM,gBAAgB,EAAE,WAAW,EAAW,QAAQ,GAClE,CAEA,MAAa,EAAsB,EAAqB,CACtD,KAAM,oBACN,MAAQ,GAAe,EAAQ,EAAwB,CAAU,EACjE,MAAQ,GAAe,CACrB,IAAM,EAAe,EAAwB,CAAU,EACvD,OAAO,EAAe,CAAE,cAAa,EAAI,IAAA,EAC3C,CACF,CAAC"}
@@ -0,0 +1,97 @@
1
+ import { Expression } from "ts-morph";
2
+ //#region src/utils/defineRule.d.ts
3
+ type FieldExtractionRuleResult = {
4
+ backendField?: string;
5
+ transparent?: boolean;
6
+ mapperType?: string;
7
+ apiMapping?: boolean;
8
+ };
9
+ type FieldExtractionRule = {
10
+ name: string;
11
+ match: (expression: Expression, config: UserConfig) => boolean;
12
+ parse: (expression: Expression, config: UserConfig) => FieldExtractionRuleResult | undefined;
13
+ };
14
+ //#endregion
15
+ //#region src/models/types.d.ts
16
+ interface NeutralExpressionMatcher {
17
+ prefix: string;
18
+ apiMapping?: boolean;
19
+ }
20
+ interface UserConfig {
21
+ /**
22
+ * Absolute path to the root of the repository to analyze (e.g. the digital-api repo).
23
+ * Can be set via the ATLAS_CWD environment variable.
24
+ */
25
+ repoRoot?: string;
26
+ /** Path, relative to `cwd`, to the file declaring backend identifiers. */
27
+ backendTypesFile: string;
28
+ /**
29
+ * Default OpenAPI document URL used to extract the public contract exposed by the API.
30
+ * The CLI can still override this value with `--openapi-url`.
31
+ */
32
+ openapiUrl: string;
33
+ /** Maximum duration allowed to connect to and download the OpenAPI document. */
34
+ openapiTimeoutMs: number;
35
+ /** Default Directus base URL used by `push` when no CLI option or environment variable overrides it. */
36
+ directusUrl: string;
37
+ /** Module aliases resolved while traversing static-analysis dependencies. Paths are relative to the repository root. */
38
+ resolver: {
39
+ alias: Record<string, string>;
40
+ };
41
+ /** Defaults used by the optional AI pass that reviews unresolved static mappings. */
42
+ inference: {
43
+ /** ai/sdk model used for structured mapping suggestions. */
44
+ model: string;
45
+ /** ai/sdk HTTP API base URL. */
46
+ baseUrl: string;
47
+ /** Minimum model confidence required to replace a `needs_review` mapping. */
48
+ minimumConfidence: number;
49
+ /** Maximum duration of one route-level AI request before aborting it. */
50
+ timeoutMs: number;
51
+ /** Maximum number of route-level AI requests run concurrently. */
52
+ workers: number;
53
+ };
54
+ /**
55
+ * Static analysis options used to keep generated artifacts focused on business-relevant files and fields.
56
+ */
57
+ analysis: {
58
+ /**
59
+ * Glob patterns excluded from `analysis_files`.
60
+ * Use this to hide technical plumbing files that add noise to route review documents.
61
+ */
62
+ excluded: string[];
63
+ /**
64
+ * Input root fields considered transverse to the API, such as access headers or generic list filters.
65
+ * These fields are kept in the extracted contract but are not flagged as `needs_review`
66
+ * when they do not map to a backend property. A detected backend mapping always takes precedence.
67
+ */
68
+ transversalInputs: string[];
69
+ /** Output field paths omitted from catalogues and coverage checks, including nested fields. */
70
+ ignoredOutputs: string[];
71
+ /** Technical property-access prefixes that must not be treated as backend fields. */
72
+ backendFieldAccess: {
73
+ excludedPrefixes: string[];
74
+ };
75
+ /** Mapper naming conventions used to infer mapping direction and domain roots. */
76
+ mapperNaming: {
77
+ inputPatterns: RegExp[];
78
+ outputPatterns: RegExp[];
79
+ domainToBackendPattern: RegExp;
80
+ domainNameFromToDomainPattern: RegExp;
81
+ constructedTypeToDomainPattern: (constructorName: string) => RegExp;
82
+ };
83
+ /** Expressions that are transparent while tracing a field through a mapping. */
84
+ neutralExpressionMatchers: NeutralExpressionMatcher[];
85
+ rules: FieldExtractionRule[];
86
+ };
87
+ /** Route-level minimum resolved-field coverage accepted by the static-analysis regression check. */
88
+ test: {
89
+ coverage: Array<{
90
+ route: string;
91
+ minimum_coverage: number | string;
92
+ }>;
93
+ };
94
+ }
95
+ //#endregion
96
+ export { FieldExtractionRule as n, UserConfig as t };
97
+ //# sourceMappingURL=types-Dl8rY7PV.d.mts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmflow/atlas",
3
- "version": "3.4.0-beta.3",
3
+ "version": "3.4.0-beta.4",
4
4
  "description": "API-to-backend mapping catalogue for Club Med Flow",
5
5
  "license": "MIT",
6
6
  "author": "romakita",
@@ -9,9 +9,16 @@
9
9
  "type": "module",
10
10
  "main": "./dist/index.mjs",
11
11
  "module": "./dist/index.mjs",
12
+ "types": "./dist/index.d.mts",
12
13
  "exports": {
13
- ".": "./dist/index.mjs",
14
- "./rules/*": "./dist/rules/*.mjs"
14
+ ".": {
15
+ "types": "./dist/index.d.mts",
16
+ "import": "./dist/index.mjs"
17
+ },
18
+ "./rules/*": {
19
+ "types": "./dist/rules/*.d.mts",
20
+ "import": "./dist/rules/*.mjs"
21
+ }
15
22
  },
16
23
  "scripts": {
17
24
  "build": "tsdown",