@clipboard-health/oxlint-plugin 1.7.1 → 1.8.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 +15 -0
- package/package.json +3 -3
- package/src/index.d.ts +1 -0
- package/src/index.js +2 -0
- package/src/index.js.map +1 -1
- package/src/lib/rules/require-to-declared-error/index.d.ts +23 -0
- package/src/lib/rules/require-to-declared-error/index.js +225 -0
- package/src/lib/rules/require-to-declared-error/index.js.map +1 -0
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ ESLint.
|
|
|
21
21
|
- `require-contract-response-parse`
|
|
22
22
|
- `require-http-module-factory`
|
|
23
23
|
- `require-run-validators-with-upsert`
|
|
24
|
+
- `require-to-declared-error`
|
|
24
25
|
- `require-zod-import-in-contracts`
|
|
25
26
|
|
|
26
27
|
## Configuration
|
|
@@ -50,3 +51,17 @@ bounded-concurrency helpers must name them, or those call sites go unchecked:
|
|
|
50
51
|
|
|
51
52
|
Exclude tests: app-level session objects such as `session.sessionUserId` share the name but are
|
|
52
53
|
unrelated to MongoDB sessions.
|
|
54
|
+
|
|
55
|
+
`require-to-declared-error` is opt-in while services adopt oRPC. In a handler passed to oRPC's
|
|
56
|
+
`implement(...).handler()`, every `throw` in a branch that handles a failed `ServiceResult` must
|
|
57
|
+
throw `toDeclaredError({ errors, error })` from `@clipboard-health/api-nestjs`, or one of the
|
|
58
|
+
handler's `errors` constructors, so the response keeps the status the contract declares. The branch
|
|
59
|
+
may still `return`. The rule is syntactic: its file comment lists the conditions it recognizes and
|
|
60
|
+
the forms it skips. Enable it on controllers:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
{
|
|
64
|
+
files: ["**/*.controller.ts"],
|
|
65
|
+
rules: { "@clipboard-health/require-to-declared-error": "error" },
|
|
66
|
+
},
|
|
67
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clipboard-health/oxlint-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Clipboard's Oxlint plugin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oxlint",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@oxlint/plugins": "1.
|
|
23
|
+
"@oxlint/plugins": "1.89.0",
|
|
24
24
|
"tslib": "2.8.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"oxlint": "1.
|
|
27
|
+
"oxlint": "1.89.0"
|
|
28
28
|
},
|
|
29
29
|
"types": "./src/index.d.ts"
|
|
30
30
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export declare const rules: {
|
|
|
10
10
|
"require-contract-response-parse": import("@oxlint/plugins").Rule;
|
|
11
11
|
"require-http-module-factory": import("@oxlint/plugins").Rule;
|
|
12
12
|
"require-run-validators-with-upsert": import("@oxlint/plugins").Rule;
|
|
13
|
+
"require-to-declared-error": import("@oxlint/plugins").Rule;
|
|
13
14
|
"require-zod-import-in-contracts": import("@oxlint/plugins").Rule;
|
|
14
15
|
};
|
package/src/index.js
CHANGED
|
@@ -13,6 +13,7 @@ const require_contract_fixture_construction_1 = tslib_1.__importDefault(require(
|
|
|
13
13
|
const require_contract_response_parse_1 = tslib_1.__importDefault(require("./lib/rules/require-contract-response-parse"));
|
|
14
14
|
const require_http_module_factory_1 = tslib_1.__importDefault(require("./lib/rules/require-http-module-factory"));
|
|
15
15
|
const require_run_validators_with_upsert_1 = tslib_1.__importDefault(require("./lib/rules/require-run-validators-with-upsert"));
|
|
16
|
+
const require_to_declared_error_1 = tslib_1.__importDefault(require("./lib/rules/require-to-declared-error"));
|
|
16
17
|
const require_zod_import_in_contracts_1 = tslib_1.__importDefault(require("./lib/rules/require-zod-import-in-contracts"));
|
|
17
18
|
exports.rules = {
|
|
18
19
|
"enforce-contract-in-controllers": enforce_contract_in_controllers_1.default,
|
|
@@ -26,6 +27,7 @@ exports.rules = {
|
|
|
26
27
|
"require-contract-response-parse": require_contract_response_parse_1.default,
|
|
27
28
|
"require-http-module-factory": require_http_module_factory_1.default,
|
|
28
29
|
"require-run-validators-with-upsert": require_run_validators_with_upsert_1.default,
|
|
30
|
+
"require-to-declared-error": require_to_declared_error_1.default,
|
|
29
31
|
"require-zod-import-in-contracts": require_zod_import_in_contracts_1.default,
|
|
30
32
|
};
|
|
31
33
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/oxlint-plugin/src/index.ts"],"names":[],"mappings":";;;;AAAA,0HAAuF;AACvF,wHAAoF;AACpF,gIAA6F;AAC7F,8GAA2E;AAC3E,sGAAmE;AACnE,sHAAkF;AAClF,sHAAkF;AAClF,sIAAmG;AACnG,0HAAuF;AACvF,kHAA+E;AAC/E,gIAA4F;AAC5F,0HAAsF;AAEzE,QAAA,KAAK,GAAG;IACnB,iCAAiC,EAAE,yCAA4B;IAC/D,gCAAgC,EAAE,wCAA0B;IAC5D,oCAAoC,EAAE,4CAA+B;IACrE,uBAAuB,EAAE,+BAAkB;IAC3C,2BAA2B,EAAE,mCAAsB;IACnD,+BAA+B,EAAE,uCAAyB;IAC1D,+BAA+B,EAAE,uCAAyB;IAC1D,uCAAuC,EAAE,+CAAkC;IAC3E,iCAAiC,EAAE,yCAA4B;IAC/D,6BAA6B,EAAE,qCAAwB;IACvD,oCAAoC,EAAE,4CAA8B;IACpE,iCAAiC,EAAE,yCAA2B;CAC/D,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/oxlint-plugin/src/index.ts"],"names":[],"mappings":";;;;AAAA,0HAAuF;AACvF,wHAAoF;AACpF,gIAA6F;AAC7F,8GAA2E;AAC3E,sGAAmE;AACnE,sHAAkF;AAClF,sHAAkF;AAClF,sIAAmG;AACnG,0HAAuF;AACvF,kHAA+E;AAC/E,gIAA4F;AAC5F,8GAA2E;AAC3E,0HAAsF;AAEzE,QAAA,KAAK,GAAG;IACnB,iCAAiC,EAAE,yCAA4B;IAC/D,gCAAgC,EAAE,wCAA0B;IAC5D,oCAAoC,EAAE,4CAA+B;IACrE,uBAAuB,EAAE,+BAAkB;IAC3C,2BAA2B,EAAE,mCAAsB;IACnD,+BAA+B,EAAE,uCAAyB;IAC1D,+BAA+B,EAAE,uCAAyB;IAC1D,uCAAuC,EAAE,+CAAkC;IAC3E,iCAAiC,EAAE,yCAA4B;IAC/D,6BAA6B,EAAE,qCAAwB;IACvD,oCAAoC,EAAE,4CAA8B;IACpE,2BAA2B,EAAE,mCAAsB;IACnD,iCAAiC,EAAE,yCAA2B;CAC/D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Require oRPC handlers to throw a failed `ServiceResult` as a declared error.
|
|
3
|
+
*
|
|
4
|
+
* In a handler passed to `implement(...).handler()`, a failure branch is the body of
|
|
5
|
+
* `if (isFailure(result))`, `if (!isSuccess(result))` or `if (!result.isSuccess)`, or the `else` of
|
|
6
|
+
* `if (isSuccess(result))`, `if (result.isSuccess)` or `if (!isFailure(result))`. Every `throw` in
|
|
7
|
+
* it must throw `toDeclaredError({ errors, error })` or one of the handler's own `errors`
|
|
8
|
+
* constructors, so the response keeps the status and body the contract declares. A failure branch
|
|
9
|
+
* may still `return`, for a handler that answers a failure with a success response.
|
|
10
|
+
*
|
|
11
|
+
* The rule is syntactic. It recognizes `implement` from `@orpc/nest` or `@orpc/server`, `isFailure`
|
|
12
|
+
* and `isSuccess` from `@clipboard-health/util-ts`, and `toDeclaredError` from
|
|
13
|
+
* `@clipboard-health/api-nestjs` by their named imports. The `result.isSuccess` form matches any
|
|
14
|
+
* object's `isSuccess` property. Out of scope:
|
|
15
|
+
* - throws outside a failure branch, such as a `catch` block's or one after an early
|
|
16
|
+
* `if (isSuccess(result)) return`;
|
|
17
|
+
* - compound conditions, such as `isFailure(a) || isFailure(b)`;
|
|
18
|
+
* - throws inside a function defined in the branch, such as a callback's;
|
|
19
|
+
* - a handler reached through a variable, such as `const os = implement(contract)`.
|
|
20
|
+
*/
|
|
21
|
+
import type { Rule } from "@oxlint/plugins";
|
|
22
|
+
declare const rule: Rule;
|
|
23
|
+
export default rule;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const findVariable_1 = require("../../internal/findVariable");
|
|
4
|
+
/** The imports the rule tracks: package, then imported name. */
|
|
5
|
+
const TRACKED_IMPORTS = new Map([
|
|
6
|
+
["@orpc/nest", new Map([["implement", "implement"]])],
|
|
7
|
+
["@orpc/server", new Map([["implement", "implement"]])],
|
|
8
|
+
[
|
|
9
|
+
"@clipboard-health/util-ts",
|
|
10
|
+
new Map([
|
|
11
|
+
["isFailure", "isFailure"],
|
|
12
|
+
["isSuccess", "isSuccess"],
|
|
13
|
+
]),
|
|
14
|
+
],
|
|
15
|
+
["@clipboard-health/api-nestjs", new Map([["toDeclaredError", "toDeclaredError"]])],
|
|
16
|
+
]);
|
|
17
|
+
function unwrap(node) {
|
|
18
|
+
let current = node ?? undefined;
|
|
19
|
+
while (current?.type === "ChainExpression" ||
|
|
20
|
+
current?.type === "TSAsExpression" ||
|
|
21
|
+
current?.type === "TSNonNullExpression" ||
|
|
22
|
+
current?.type === "TSSatisfiesExpression") {
|
|
23
|
+
current = current.expression;
|
|
24
|
+
}
|
|
25
|
+
return current;
|
|
26
|
+
}
|
|
27
|
+
function isFunctionNode(node) {
|
|
28
|
+
return (node.type === "ArrowFunctionExpression" ||
|
|
29
|
+
node.type === "FunctionDeclaration" ||
|
|
30
|
+
node.type === "FunctionExpression");
|
|
31
|
+
}
|
|
32
|
+
function memberPropertyName(node) {
|
|
33
|
+
return !node.computed && node.property.type === "Identifier" ? node.property.name : undefined;
|
|
34
|
+
}
|
|
35
|
+
function importedName(specifier) {
|
|
36
|
+
if (specifier.type !== "ImportSpecifier") {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return specifier.imported.type === "Identifier"
|
|
40
|
+
? specifier.imported.name
|
|
41
|
+
: String(specifier.imported.value);
|
|
42
|
+
}
|
|
43
|
+
const rule = {
|
|
44
|
+
meta: {
|
|
45
|
+
type: "problem",
|
|
46
|
+
docs: {
|
|
47
|
+
description: "Require oRPC handlers to throw a failed ServiceResult with toDeclaredError so it keeps its declared status",
|
|
48
|
+
url: "https://github.com/ClipboardHealth/core-utils/tree/main/packages/oxlint-plugin/src/lib/rules/require-to-declared-error",
|
|
49
|
+
},
|
|
50
|
+
schema: [],
|
|
51
|
+
messages: {
|
|
52
|
+
throwDeclaredError: "Throw `toDeclaredError({ errors, error })` from @clipboard-health/api-nestjs in an oRPC handler's failure branch, so the response keeps the status and body the contract declares.",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
create(context) {
|
|
56
|
+
const bindings = {
|
|
57
|
+
implement: new Set(),
|
|
58
|
+
isFailure: new Set(),
|
|
59
|
+
isSuccess: new Set(),
|
|
60
|
+
toDeclaredError: new Set(),
|
|
61
|
+
};
|
|
62
|
+
const handlers = new Set();
|
|
63
|
+
/** Each handler's `errors`, or its options parameter when it isn't destructured. */
|
|
64
|
+
const errorsBindings = new Set();
|
|
65
|
+
const optionsBindings = new Set();
|
|
66
|
+
function variableOf(node) {
|
|
67
|
+
const current = unwrap(node);
|
|
68
|
+
return current?.type === "Identifier" ? (0, findVariable_1.findVariable)(context.sourceCode, current) : undefined;
|
|
69
|
+
}
|
|
70
|
+
function isBound(node, set) {
|
|
71
|
+
const variable = variableOf(node);
|
|
72
|
+
return variable !== undefined && set.has(variable);
|
|
73
|
+
}
|
|
74
|
+
function isCallTo(node, binding) {
|
|
75
|
+
const current = unwrap(node);
|
|
76
|
+
return current?.type === "CallExpression" && isBound(current.callee, bindings[binding]);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `implement(contract)`, through builder calls such as `.use(middleware)` and router members
|
|
80
|
+
* such as `implement(contract).shifts.list`.
|
|
81
|
+
*/
|
|
82
|
+
function isImplementBuilder(node) {
|
|
83
|
+
let current = unwrap(node);
|
|
84
|
+
while (current) {
|
|
85
|
+
if (current.type === "CallExpression") {
|
|
86
|
+
if (isBound(current.callee, bindings.implement)) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
current = unwrap(current.callee);
|
|
90
|
+
}
|
|
91
|
+
else if (current.type === "MemberExpression") {
|
|
92
|
+
current = unwrap(current.object);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
function recordErrorsBinding(handler) {
|
|
101
|
+
const [options] = handler.params;
|
|
102
|
+
if (options?.type === "Identifier") {
|
|
103
|
+
const variable = (0, findVariable_1.findVariable)(context.sourceCode, options);
|
|
104
|
+
if (variable) {
|
|
105
|
+
optionsBindings.add(variable);
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (options?.type !== "ObjectPattern") {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
for (const property of options.properties) {
|
|
113
|
+
if (property.type === "Property" &&
|
|
114
|
+
!property.computed &&
|
|
115
|
+
property.key.type === "Identifier" &&
|
|
116
|
+
property.key.name === "errors" &&
|
|
117
|
+
property.value.type === "Identifier") {
|
|
118
|
+
const variable = (0, findVariable_1.findVariable)(context.sourceCode, property.value);
|
|
119
|
+
if (variable) {
|
|
120
|
+
errorsBindings.add(variable);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function isSuccessCheck(node) {
|
|
126
|
+
const current = unwrap(node);
|
|
127
|
+
if (current?.type === "MemberExpression") {
|
|
128
|
+
return memberPropertyName(current) === "isSuccess";
|
|
129
|
+
}
|
|
130
|
+
return isCallTo(current, "isSuccess");
|
|
131
|
+
}
|
|
132
|
+
/** The statement that runs when the `if` sees a failed `ServiceResult`, if it tests one. */
|
|
133
|
+
function failureBranch(node) {
|
|
134
|
+
const test = unwrap(node.test);
|
|
135
|
+
const alternate = node.alternate ?? undefined;
|
|
136
|
+
if (isCallTo(test, "isFailure")) {
|
|
137
|
+
return node.consequent;
|
|
138
|
+
}
|
|
139
|
+
if (test?.type === "UnaryExpression" && test.operator === "!") {
|
|
140
|
+
if (isSuccessCheck(test.argument)) {
|
|
141
|
+
return node.consequent;
|
|
142
|
+
}
|
|
143
|
+
return isCallTo(test.argument, "isFailure") ? alternate : undefined;
|
|
144
|
+
}
|
|
145
|
+
return isSuccessCheck(test) ? alternate : undefined;
|
|
146
|
+
}
|
|
147
|
+
function isInFailureBranch(node) {
|
|
148
|
+
let child = node;
|
|
149
|
+
let parent = node.parent;
|
|
150
|
+
while (parent && !isFunctionNode(parent)) {
|
|
151
|
+
if (parent.type === "IfStatement" && failureBranch(parent) === child) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
child = parent;
|
|
155
|
+
({ parent } = parent);
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
function isInHandler(node) {
|
|
160
|
+
let parent = node.parent;
|
|
161
|
+
while (parent) {
|
|
162
|
+
if (isFunctionNode(parent) && handlers.has(parent)) {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
({ parent } = parent);
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
/** `errors.CODE` or `options.errors.CODE` from the handler's options. */
|
|
170
|
+
function isErrorsConstructor(node) {
|
|
171
|
+
const callee = unwrap(node);
|
|
172
|
+
if (callee?.type !== "MemberExpression") {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
const owner = unwrap(callee.object);
|
|
176
|
+
if (isBound(owner, errorsBindings)) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
return (owner?.type === "MemberExpression" &&
|
|
180
|
+
memberPropertyName(owner) === "errors" &&
|
|
181
|
+
isBound(owner.object, optionsBindings));
|
|
182
|
+
}
|
|
183
|
+
function isDeclaredError(node) {
|
|
184
|
+
const thrown = unwrap(node);
|
|
185
|
+
return (thrown?.type === "CallExpression" &&
|
|
186
|
+
(isBound(thrown.callee, bindings.toDeclaredError) || isErrorsConstructor(thrown.callee)));
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
ImportDeclaration(node) {
|
|
190
|
+
const tracked = TRACKED_IMPORTS.get(node.source.value);
|
|
191
|
+
if (!tracked) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
for (const specifier of node.specifiers) {
|
|
195
|
+
const binding = tracked.get(importedName(specifier) ?? "");
|
|
196
|
+
const [variable] = context.sourceCode.getDeclaredVariables(specifier);
|
|
197
|
+
if (binding && variable) {
|
|
198
|
+
bindings[binding].add(variable);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
CallExpression(node) {
|
|
203
|
+
const callee = unwrap(node.callee);
|
|
204
|
+
if (callee?.type !== "MemberExpression" ||
|
|
205
|
+
memberPropertyName(callee) !== "handler" ||
|
|
206
|
+
!isImplementBuilder(callee.object)) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const handler = unwrap(node.arguments[0]);
|
|
210
|
+
if (handler && isFunctionNode(handler)) {
|
|
211
|
+
handlers.add(handler);
|
|
212
|
+
recordErrorsBinding(handler);
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
ThrowStatement(node) {
|
|
216
|
+
if (isDeclaredError(node.argument) || !isInFailureBranch(node) || !isInHandler(node)) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
context.report({ node, messageId: "throwDeclaredError" });
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
exports.default = rule;
|
|
225
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/oxlint-plugin/src/lib/rules/require-to-declared-error/index.ts"],"names":[],"mappings":";;AAsBA,8DAA2D;AAK3D,gEAAgE;AAChE,MAAM,eAAe,GAAG,IAAI,GAAG,CAAuC;IACpE,CAAC,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC,cAAc,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACvD;QACE,2BAA2B;QAC3B,IAAI,GAAG,CAAkB;YACvB,CAAC,WAAW,EAAE,WAAW,CAAC;YAC1B,CAAC,WAAW,EAAE,WAAW,CAAC;SAC3B,CAAC;KACH;IACD,CAAC,8BAA8B,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;CACpF,CAAC,CAAC;AAEH,SAAS,MAAM,CAAC,IAAoC;IAClD,IAAI,OAAO,GAAG,IAAI,IAAI,SAAS,CAAC;IAEhC,OACE,OAAO,EAAE,IAAI,KAAK,iBAAiB;QACnC,OAAO,EAAE,IAAI,KAAK,gBAAgB;QAClC,OAAO,EAAE,IAAI,KAAK,qBAAqB;QACvC,OAAO,EAAE,IAAI,KAAK,uBAAuB,EACzC,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IAC/B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,cAAc,CAAC,IAAiB;IACvC,OAAO,CACL,IAAI,CAAC,IAAI,KAAK,yBAAyB;QACvC,IAAI,CAAC,IAAI,KAAK,qBAAqB;QACnC,IAAI,CAAC,IAAI,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