@lyrolab/nest-shared 1.10.0 → 1.11.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/CHANGELOG.md +2 -2
- package/dist/eslint/index.d.ts +9 -0
- package/dist/eslint/index.js +28 -0
- package/dist/eslint/index.js.map +1 -0
- package/dist/eslint/rules/no-export-repository-in-module.d.ts +4 -0
- package/dist/eslint/rules/no-export-repository-in-module.js +57 -0
- package/dist/eslint/rules/no-export-repository-in-module.js.map +1 -0
- package/dist/eslint/rules/no-repository-in-controller.d.ts +4 -0
- package/dist/eslint/rules/no-repository-in-controller.js +59 -0
- package/dist/eslint/rules/no-repository-in-controller.js.map +1 -0
- package/dist/eslint/rules/no-typeorm-in-non-repository.d.ts +6 -0
- package/dist/eslint/rules/no-typeorm-in-non-repository.js +71 -0
- package/dist/eslint/rules/no-typeorm-in-non-repository.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/eslint.config.mjs +8 -0
- package/package.json +11 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# [1.
|
|
1
|
+
# [1.11.0](https://github.com/lyrolab/nest-shared/compare/v1.10.0...v1.11.0) (2026-04-05)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Features
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* add ESLint rules for NestJS architecture to enforce repository usage ([1bb8684](https://github.com/lyrolab/nest-shared/commit/1bb8684791dbecb4db22b541a3949c13e0a1a2e1))
|
|
7
7
|
|
|
8
8
|
## [1.0.1](https://github.com/lyrolab/nest-shared/compare/v1.0.0...v1.0.1) (2025-04-10)
|
|
9
9
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TSESLint } from "@typescript-eslint/utils";
|
|
2
|
+
export declare const nestArchitecturePlugin: {
|
|
3
|
+
configs: {
|
|
4
|
+
recommended: TSESLint.FlatConfig.Config;
|
|
5
|
+
};
|
|
6
|
+
meta?: { [K in keyof TSESLint.FlatConfig.PluginMeta]?: TSESLint.FlatConfig.PluginMeta[K] | undefined; };
|
|
7
|
+
processors?: Partial<Record<string, TSESLint.FlatConfig.Processor>> | undefined;
|
|
8
|
+
rules?: Record<string, TSESLint.LooseRuleDefinition> | undefined;
|
|
9
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nestArchitecturePlugin = void 0;
|
|
4
|
+
const no_typeorm_in_non_repository_1 = require("./rules/no-typeorm-in-non-repository");
|
|
5
|
+
const no_repository_in_controller_1 = require("./rules/no-repository-in-controller");
|
|
6
|
+
const no_export_repository_in_module_1 = require("./rules/no-export-repository-in-module");
|
|
7
|
+
const plugin = {
|
|
8
|
+
meta: {
|
|
9
|
+
name: "@lyrolab/nestjs-architecture",
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
"no-typeorm-in-non-repository": no_typeorm_in_non_repository_1.noTypeormInNonRepository,
|
|
13
|
+
"no-repository-in-controller": no_repository_in_controller_1.noRepositoryInController,
|
|
14
|
+
"no-export-repository-in-module": no_export_repository_in_module_1.noExportRepositoryInModule,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const recommended = {
|
|
18
|
+
plugins: {
|
|
19
|
+
"@lyrolab/nestjs-architecture": plugin,
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
"@lyrolab/nestjs-architecture/no-typeorm-in-non-repository": "error",
|
|
23
|
+
"@lyrolab/nestjs-architecture/no-repository-in-controller": "error",
|
|
24
|
+
"@lyrolab/nestjs-architecture/no-export-repository-in-module": "error",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
exports.nestArchitecturePlugin = { ...plugin, configs: { recommended } };
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eslint/index.ts"],"names":[],"mappings":";;;AACA,uFAA+E;AAC/E,qFAA8E;AAC9E,2FAAmF;AAEnF,MAAM,MAAM,GAA+B;IACzC,IAAI,EAAE;QACJ,IAAI,EAAE,8BAA8B;KACrC;IACD,KAAK,EAAE;QACL,8BAA8B,EAAE,uDAAwB;QACxD,6BAA6B,EAAE,sDAAwB;QACvD,gCAAgC,EAAE,2DAA0B;KAC7D;CACF,CAAA;AAED,MAAM,WAAW,GAA+B;IAC9C,OAAO,EAAE;QACP,8BAA8B,EAAE,MAAM;KACvC;IACD,KAAK,EAAE;QACL,2DAA2D,EAAE,OAAO;QACpE,0DAA0D,EAAE,OAAO;QACnE,6DAA6D,EAAE,OAAO;KACvE;CACF,CAAA;AAEY,QAAA,sBAAsB,GAAG,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,EAAE,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noExportRepositoryInModule = void 0;
|
|
4
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
+
const createRule = utils_1.ESLintUtils.RuleCreator((name) => `https://github.com/lyrolab/nest-shared#${name}`);
|
|
6
|
+
exports.noExportRepositoryInModule = createRule({
|
|
7
|
+
name: "no-export-repository-in-module",
|
|
8
|
+
meta: {
|
|
9
|
+
type: "problem",
|
|
10
|
+
docs: {
|
|
11
|
+
description: "NestJS modules must not export Repository classes. Repositories should stay in providers. Expose a Service instead.",
|
|
12
|
+
},
|
|
13
|
+
messages: {
|
|
14
|
+
exportedRepository: "'{{ repositoryName }}' must not be exported from a module. Keep repositories private and expose a Service method instead.",
|
|
15
|
+
},
|
|
16
|
+
schema: [],
|
|
17
|
+
},
|
|
18
|
+
defaultOptions: [],
|
|
19
|
+
create(context) {
|
|
20
|
+
return {
|
|
21
|
+
ClassDeclaration(node) {
|
|
22
|
+
const decorators = node.decorators ?? [];
|
|
23
|
+
const moduleDecorator = decorators.find((d) => {
|
|
24
|
+
const expr = d.expression;
|
|
25
|
+
return (expr.type === utils_1.AST_NODE_TYPES.CallExpression &&
|
|
26
|
+
expr.callee.type === utils_1.AST_NODE_TYPES.Identifier &&
|
|
27
|
+
expr.callee.name === "Module");
|
|
28
|
+
});
|
|
29
|
+
if (!moduleDecorator)
|
|
30
|
+
return;
|
|
31
|
+
const expr = moduleDecorator.expression;
|
|
32
|
+
if (expr.type !== utils_1.AST_NODE_TYPES.CallExpression)
|
|
33
|
+
return;
|
|
34
|
+
const args = expr.arguments;
|
|
35
|
+
if (!args.length || args[0].type !== utils_1.AST_NODE_TYPES.ObjectExpression)
|
|
36
|
+
return;
|
|
37
|
+
const exportsProperty = args[0].properties.find((prop) => prop.type === utils_1.AST_NODE_TYPES.Property &&
|
|
38
|
+
prop.key.type === utils_1.AST_NODE_TYPES.Identifier &&
|
|
39
|
+
prop.key.name === "exports");
|
|
40
|
+
if (!exportsProperty ||
|
|
41
|
+
exportsProperty.value.type !== utils_1.AST_NODE_TYPES.ArrayExpression)
|
|
42
|
+
return;
|
|
43
|
+
for (const element of exportsProperty.value.elements) {
|
|
44
|
+
if (element?.type === utils_1.AST_NODE_TYPES.Identifier &&
|
|
45
|
+
element.name.endsWith("Repository")) {
|
|
46
|
+
context.report({
|
|
47
|
+
node: element,
|
|
48
|
+
messageId: "exportedRepository",
|
|
49
|
+
data: { repositoryName: element.name },
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=no-export-repository-in-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-export-repository-in-module.js","sourceRoot":"","sources":["../../../src/eslint/rules/no-export-repository-in-module.ts"],"names":[],"mappings":";;;AAAA,oDAAgF;AAEhF,MAAM,UAAU,GAAG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,EAA6B,EAAE,CAClC,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,QAAQ;oBACrC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,sBAAc,CAAC,UAAU;oBAC3C,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAC9B,CAAA;gBACD,IACE,CAAC,eAAe;oBAChB,eAAe,CAAC,KAAK,CAAC,IAAI,KAAK,sBAAc,CAAC,eAAe;oBAE7D,OAAM;gBAER,KAAK,MAAM,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;oBACrD,IACE,OAAO,EAAE,IAAI,KAAK,sBAAc,CAAC,UAAU;wBAC3C,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EACnC,CAAC;wBACD,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI,EAAE,OAAO;4BACb,SAAS,EAAE,oBAAoB;4BAC/B,IAAI,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,IAAI,EAAE;yBACvC,CAAC,CAAA;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noRepositoryInController = void 0;
|
|
4
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
+
const createRule = utils_1.ESLintUtils.RuleCreator((name) => `https://github.com/lyrolab/nest-shared#${name}`);
|
|
6
|
+
function getClassName(node) {
|
|
7
|
+
return node.id?.name;
|
|
8
|
+
}
|
|
9
|
+
function getConstructor(node) {
|
|
10
|
+
return node.body.body.find((member) => member.type === utils_1.AST_NODE_TYPES.MethodDefinition &&
|
|
11
|
+
member.kind === "constructor");
|
|
12
|
+
}
|
|
13
|
+
exports.noRepositoryInController = createRule({
|
|
14
|
+
name: "no-repository-in-controller",
|
|
15
|
+
meta: {
|
|
16
|
+
type: "problem",
|
|
17
|
+
docs: {
|
|
18
|
+
description: "Controllers must not inject Repository classes directly. Use a Service as intermediary.",
|
|
19
|
+
},
|
|
20
|
+
messages: {
|
|
21
|
+
repositoryInController: "'{{ repositoryName }}' must not be injected in a Controller. Controllers should depend on Services, not Repositories.",
|
|
22
|
+
},
|
|
23
|
+
schema: [],
|
|
24
|
+
},
|
|
25
|
+
defaultOptions: [],
|
|
26
|
+
create(context) {
|
|
27
|
+
return {
|
|
28
|
+
ClassDeclaration(node) {
|
|
29
|
+
const className = getClassName(node);
|
|
30
|
+
if (!className || !className.endsWith("Controller"))
|
|
31
|
+
return;
|
|
32
|
+
const ctor = getConstructor(node);
|
|
33
|
+
if (!ctor)
|
|
34
|
+
return;
|
|
35
|
+
const ctorValue = ctor.value;
|
|
36
|
+
if (ctorValue.type !== utils_1.AST_NODE_TYPES.FunctionExpression)
|
|
37
|
+
return;
|
|
38
|
+
for (const param of ctorValue.params) {
|
|
39
|
+
const actualParam = param.type === utils_1.AST_NODE_TYPES.TSParameterProperty
|
|
40
|
+
? param.parameter
|
|
41
|
+
: param;
|
|
42
|
+
const typeAnnotation = "typeAnnotation" in actualParam
|
|
43
|
+
? actualParam.typeAnnotation?.typeAnnotation
|
|
44
|
+
: undefined;
|
|
45
|
+
if (typeAnnotation?.type === utils_1.AST_NODE_TYPES.TSTypeReference &&
|
|
46
|
+
typeAnnotation.typeName.type === utils_1.AST_NODE_TYPES.Identifier &&
|
|
47
|
+
typeAnnotation.typeName.name.endsWith("Repository")) {
|
|
48
|
+
context.report({
|
|
49
|
+
node: param,
|
|
50
|
+
messageId: "repositoryInController",
|
|
51
|
+
data: { repositoryName: typeAnnotation.typeName.name },
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=no-repository-in-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-repository-in-controller.js","sourceRoot":"","sources":["../../../src/eslint/rules/no-repository-in-controller.ts"],"names":[],"mappings":";;;AAAA,oDAAgF;AAEhF,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,CAAC,IAAI,EAAE,EAAE,CAAC,0CAA0C,IAAI,EAAE,CAC3D,CAAA;AAID,SAAS,YAAY,CAAC,IAA+B;IACnD,OAAO,IAAI,CAAC,EAAE,EAAE,IAAI,CAAA;AACtB,CAAC;AAED,SAAS,cAAc,CACrB,IAA+B;IAE/B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACxB,CAAC,MAAM,EAAuC,EAAE,CAC9C,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,gBAAgB;QAC/C,MAAM,CAAC,IAAI,KAAK,aAAa,CAChC,CAAA;AACH,CAAC;AAEY,QAAA,wBAAwB,GAAG,UAAU,CAAiB;IACjE,IAAI,EAAE,6BAA6B;IACnC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,yFAAyF;SAC5F;QACD,QAAQ,EAAE;YACR,sBAAsB,EACpB,uHAAuH;SAC1H;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,gBAAgB,CAAC,IAAI;gBACnB,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;gBACpC,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC;oBAAE,OAAM;gBAE3D,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;gBACjC,IAAI,CAAC,IAAI;oBAAE,OAAM;gBAEjB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAA;gBAC5B,IAAI,SAAS,CAAC,IAAI,KAAK,sBAAc,CAAC,kBAAkB;oBAAE,OAAM;gBAEhE,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;oBACrC,MAAM,WAAW,GACf,KAAK,CAAC,IAAI,KAAK,sBAAc,CAAC,mBAAmB;wBAC/C,CAAC,CAAC,KAAK,CAAC,SAAS;wBACjB,CAAC,CAAC,KAAK,CAAA;oBACX,MAAM,cAAc,GAClB,gBAAgB,IAAI,WAAW;wBAC7B,CAAC,CAAC,WAAW,CAAC,cAAc,EAAE,cAAc;wBAC5C,CAAC,CAAC,SAAS,CAAA;oBAEf,IACE,cAAc,EAAE,IAAI,KAAK,sBAAc,CAAC,eAAe;wBACvD,cAAc,CAAC,QAAQ,CAAC,IAAI,KAAK,sBAAc,CAAC,UAAU;wBAC1D,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EACnD,CAAC;wBACD,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI,EAAE,KAAK;4BACX,SAAS,EAAE,wBAAwB;4BACnC,IAAI,EAAE,EAAE,cAAc,EAAE,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE;yBACvD,CAAC,CAAA;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
+
type MessageIds = "injectRepository" | "dataSource";
|
|
3
|
+
export declare const noTypeormInNonRepository: ESLintUtils.RuleModule<MessageIds, [], unknown, ESLintUtils.RuleListener> & {
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noTypeormInNonRepository = void 0;
|
|
4
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
+
const createRule = utils_1.ESLintUtils.RuleCreator((name) => `https://github.com/lyrolab/nest-shared#${name}`);
|
|
6
|
+
function getClassName(node) {
|
|
7
|
+
return node.id?.name;
|
|
8
|
+
}
|
|
9
|
+
function getConstructor(node) {
|
|
10
|
+
return node.body.body.find((member) => member.type === utils_1.AST_NODE_TYPES.MethodDefinition &&
|
|
11
|
+
member.kind === "constructor");
|
|
12
|
+
}
|
|
13
|
+
exports.noTypeormInNonRepository = createRule({
|
|
14
|
+
name: "no-typeorm-in-non-repository",
|
|
15
|
+
meta: {
|
|
16
|
+
type: "problem",
|
|
17
|
+
docs: {
|
|
18
|
+
description: "@InjectRepository() and DataSource injection are only allowed in Repository classes",
|
|
19
|
+
},
|
|
20
|
+
messages: {
|
|
21
|
+
injectRepository: "@InjectRepository() can only be used in classes ending with 'Repository'. Move data access logic to a Repository class.",
|
|
22
|
+
dataSource: "DataSource can only be injected in classes ending with 'Repository'. Move data access logic to a Repository class.",
|
|
23
|
+
},
|
|
24
|
+
schema: [],
|
|
25
|
+
},
|
|
26
|
+
defaultOptions: [],
|
|
27
|
+
create(context) {
|
|
28
|
+
return {
|
|
29
|
+
ClassDeclaration(node) {
|
|
30
|
+
const className = getClassName(node);
|
|
31
|
+
if (!className || className.endsWith("Repository"))
|
|
32
|
+
return;
|
|
33
|
+
const ctor = getConstructor(node);
|
|
34
|
+
if (!ctor)
|
|
35
|
+
return;
|
|
36
|
+
const ctorValue = ctor.value;
|
|
37
|
+
if (ctorValue.type !== utils_1.AST_NODE_TYPES.FunctionExpression)
|
|
38
|
+
return;
|
|
39
|
+
for (const param of ctorValue.params) {
|
|
40
|
+
const actualParam = param.type === utils_1.AST_NODE_TYPES.TSParameterProperty
|
|
41
|
+
? param.parameter
|
|
42
|
+
: param;
|
|
43
|
+
const decorators = "decorators" in param ? (param.decorators ?? []) : [];
|
|
44
|
+
for (const decorator of decorators) {
|
|
45
|
+
const expr = decorator.expression;
|
|
46
|
+
if (expr.type === utils_1.AST_NODE_TYPES.CallExpression &&
|
|
47
|
+
expr.callee.type === utils_1.AST_NODE_TYPES.Identifier &&
|
|
48
|
+
expr.callee.name === "InjectRepository") {
|
|
49
|
+
context.report({
|
|
50
|
+
node: decorator,
|
|
51
|
+
messageId: "injectRepository",
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const typeAnnotation = "typeAnnotation" in actualParam
|
|
56
|
+
? actualParam.typeAnnotation?.typeAnnotation
|
|
57
|
+
: undefined;
|
|
58
|
+
if (typeAnnotation?.type === utils_1.AST_NODE_TYPES.TSTypeReference &&
|
|
59
|
+
typeAnnotation.typeName.type === utils_1.AST_NODE_TYPES.Identifier &&
|
|
60
|
+
typeAnnotation.typeName.name === "DataSource") {
|
|
61
|
+
context.report({
|
|
62
|
+
node: param,
|
|
63
|
+
messageId: "dataSource",
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=no-typeorm-in-non-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-typeorm-in-non-repository.js","sourceRoot":"","sources":["../../../src/eslint/rules/no-typeorm-in-non-repository.ts"],"names":[],"mappings":";;;AAAA,oDAAgF;AAEhF,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,CAAC,IAAI,EAAE,EAAE,CAAC,0CAA0C,IAAI,EAAE,CAC3D,CAAA;AAID,SAAS,YAAY,CAAC,IAA+B;IACnD,OAAO,IAAI,CAAC,EAAE,EAAE,IAAI,CAAA;AACtB,CAAC;AAED,SAAS,cAAc,CACrB,IAA+B;IAE/B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACxB,CAAC,MAAM,EAAuC,EAAE,CAC9C,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,gBAAgB;QAC/C,MAAM,CAAC,IAAI,KAAK,aAAa,CAChC,CAAA;AACH,CAAC;AAEY,QAAA,wBA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