@starci/eslint-canon-be 3.5.0 → 3.6.1
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 +21 -0
- package/README.md +13 -2
- package/dist/ambient-id.d.ts +9 -0
- package/{ambient-id.mjs → dist/ambient-id.js} +43 -39
- package/dist/app-composition.d.ts +21 -0
- package/{app-composition.mjs → dist/app-composition.js} +396 -300
- package/dist/async-discipline.d.ts +9 -0
- package/dist/async-discipline.js +77 -0
- package/dist/authorization.d.ts +12 -0
- package/{authorization.mjs → dist/authorization.js} +53 -59
- package/dist/boundary-schema.d.ts +15 -0
- package/{boundary-schema.mjs → dist/boundary-schema.js} +120 -105
- package/dist/builders.d.ts +21 -0
- package/{builders.mjs → dist/builders.js} +162 -146
- package/dist/cli.d.ts +15 -0
- package/{cli.mjs → dist/cli.js} +97 -82
- package/dist/comments.d.ts +52 -0
- package/dist/comments.js +412 -0
- package/dist/config-owner.d.ts +24 -0
- package/{config-owner.mjs → dist/config-owner.js} +256 -219
- package/dist/connections.d.ts +12 -0
- package/{connections.mjs → dist/connections.js} +138 -140
- package/dist/cookies.d.ts +9 -0
- package/{cookies.mjs → dist/cookies.js} +58 -58
- package/dist/cqrs.d.ts +27 -0
- package/{cqrs.mjs → dist/cqrs.js} +341 -282
- package/dist/data-access.d.ts +50 -0
- package/{data-access.mjs → dist/data-access.js} +238 -243
- package/dist/default-deny.d.ts +15 -0
- package/{default-deny.mjs → dist/default-deny.js} +103 -88
- package/dist/e2e-flow.d.ts +25 -0
- package/{e2e-flow.mjs → dist/e2e-flow.js} +113 -112
- package/dist/edge-hardening.d.ts +10 -0
- package/dist/edge-hardening.js +173 -0
- package/dist/error-handling.d.ts +21 -0
- package/{error-handling.mjs → dist/error-handling.js} +289 -239
- package/dist/event-bus.d.ts +14 -0
- package/{event-bus.mjs → dist/event-bus.js} +146 -129
- package/dist/feature-thin.d.ts +12 -0
- package/{feature-thin.mjs → dist/feature-thin.js} +208 -191
- package/dist/function-budget.d.ts +7 -0
- package/{function-budget.mjs → dist/function-budget.js} +24 -27
- package/dist/health-ready.d.ts +10 -0
- package/dist/health-ready.js +703 -0
- package/dist/idempotency.d.ts +10 -0
- package/{idempotency.mjs → dist/idempotency.js} +296 -226
- package/dist/index.d.ts +54 -0
- package/{index.mjs → dist/index.js} +91 -109
- package/dist/infra-owner.d.ts +18 -0
- package/{infra-owner.mjs → dist/infra-owner.js} +58 -51
- package/dist/injection.d.ts +30 -0
- package/{injection.mjs → dist/injection.js} +397 -344
- package/dist/input-bounds.d.ts +15 -0
- package/{input-bounds.mjs → dist/input-bounds.js} +143 -132
- package/dist/jobs.d.ts +17 -0
- package/{jobs.mjs → dist/jobs.js} +116 -99
- package/dist/jwt-alg.d.ts +6 -0
- package/dist/jwt-alg.js +49 -0
- package/dist/lib/app-roles.d.ts +25 -0
- package/{lib/app-roles.mjs → dist/lib/app-roles.js} +15 -17
- package/dist/lib/ast.d.ts +40 -0
- package/dist/lib/ast.js +100 -0
- package/dist/lib/client-idempotency.d.ts +3 -0
- package/{lib/client-idempotency.mjs → dist/lib/client-idempotency.js} +316 -268
- package/dist/lib/config.d.ts +36 -0
- package/{lib/config.mjs → dist/lib/config.js} +24 -27
- package/dist/lib/db-writes.d.ts +29 -0
- package/{lib/db-writes.mjs → dist/lib/db-writes.js} +27 -27
- package/dist/lib/declared.d.ts +77 -0
- package/{lib/declared.mjs → dist/lib/declared.js} +83 -78
- package/dist/lib/doors.d.ts +50 -0
- package/{lib/doors.mjs → dist/lib/doors.js} +45 -50
- package/dist/lib/edition.d.ts +25 -0
- package/{lib/edition.mjs → dist/lib/edition.js} +15 -20
- package/dist/lib/entity-writes.d.ts +7 -0
- package/{lib/entity-writes.mjs → dist/lib/entity-writes.js} +31 -22
- package/dist/lib/hfs-view.d.ts +127 -0
- package/dist/lib/hfs-view.js +1 -0
- package/dist/lib/hfs.d.ts +34 -0
- package/{lib/hfs.mjs → dist/lib/hfs.js} +31 -29
- package/dist/lib/import-source.d.ts +63 -0
- package/dist/lib/import-source.js +134 -0
- package/dist/lib/path.d.ts +8 -0
- package/{lib/path.mjs → dist/lib/path.js} +4 -7
- package/dist/lib/persistence.d.ts +115 -0
- package/{lib/persistence.mjs → dist/lib/persistence.js} +55 -66
- package/dist/lib/ports.d.ts +70 -0
- package/{lib/ports.mjs → dist/lib/ports.js} +62 -66
- package/dist/lib/rule.d.ts +31 -0
- package/dist/lib/rule.js +2 -0
- package/dist/lib/runtime-root.d.ts +4 -0
- package/dist/lib/runtime-root.js +10 -0
- package/dist/lib/schema-values.d.ts +13 -0
- package/{lib/schema-values.mjs → dist/lib/schema-values.js} +67 -59
- package/dist/lib/specifier.d.ts +12 -0
- package/dist/lib/specifier.js +29 -0
- package/dist/lib/subject-values.d.ts +4 -0
- package/dist/lib/subject-values.js +61 -0
- package/dist/lib/transactions.d.ts +18 -0
- package/{lib/transactions.mjs → dist/lib/transactions.js} +17 -15
- package/dist/lib/transport-slots.d.ts +17 -0
- package/{lib/transport-slots.mjs → dist/lib/transport-slots.js} +2 -4
- package/dist/lib/types.d.ts +96 -0
- package/dist/lib/types.js +150 -0
- package/dist/lib/unit-spec.d.ts +48 -0
- package/{lib/unit-spec.mjs → dist/lib/unit-spec.js} +35 -44
- package/dist/lib/webhook-ack.d.ts +4 -0
- package/{lib/webhook-ack.mjs → dist/lib/webhook-ack.js} +78 -62
- package/dist/lib/webhook-handoff-inbox.d.ts +3 -0
- package/{lib/webhook-handoff-inbox.mjs → dist/lib/webhook-handoff-inbox.js} +195 -167
- package/dist/lib/webhook-handoff-intake.d.ts +4 -0
- package/{lib/webhook-handoff-intake.mjs → dist/lib/webhook-handoff-intake.js} +125 -102
- package/dist/lib/webhook-handoff.d.ts +15 -0
- package/{lib/webhook-handoff.mjs → dist/lib/webhook-handoff.js} +107 -100
- package/dist/lib/webhook-verifiers.d.ts +20 -0
- package/{lib/webhook-verifiers.mjs → dist/lib/webhook-verifiers.js} +108 -104
- package/dist/lib/why.d.ts +9 -0
- package/{lib/why.mjs → dist/lib/why.js} +6 -6
- package/dist/log-safety.d.ts +20 -0
- package/dist/log-safety.js +308 -0
- package/dist/module-layering.d.ts +42 -0
- package/dist/module-layering.js +257 -0
- package/dist/module-shape.d.ts +47 -0
- package/{module-shape.mjs → dist/module-shape.js} +278 -236
- package/dist/naming.d.ts +49 -0
- package/dist/naming.js +246 -0
- package/dist/observability.d.ts +25 -0
- package/dist/observability.js +245 -0
- package/dist/operations.d.ts +23 -0
- package/{operations.mjs → dist/operations.js} +410 -332
- package/dist/project-graph.d.ts +9 -0
- package/{project-graph.mjs → dist/project-graph.js} +8 -13
- package/dist/projections.d.ts +11 -0
- package/{projections.mjs → dist/projections.js} +60 -57
- package/dist/query-safety.d.ts +21 -0
- package/{query-safety.mjs → dist/query-safety.js} +92 -108
- package/dist/realtime.d.ts +15 -0
- package/{realtime.mjs → dist/realtime.js} +108 -106
- package/dist/resilience.d.ts +15 -0
- package/dist/resilience.js +319 -0
- package/dist/schema-authority.d.ts +15 -0
- package/{schema-authority.mjs → dist/schema-authority.js} +256 -220
- package/dist/service-deps.d.ts +17 -0
- package/{service-deps.mjs → dist/service-deps.js} +133 -130
- package/dist/service-isolation.d.ts +8 -0
- package/dist/service-isolation.js +76 -0
- package/dist/size-budget.d.ts +9 -0
- package/{size-budget.mjs → dist/size-budget.js} +27 -27
- package/dist/sonar-parity.d.ts +5 -0
- package/{sonar-parity.mjs → dist/sonar-parity.js} +7 -7
- package/dist/spec-no-skip.d.ts +9 -0
- package/dist/spec-no-skip.js +81 -0
- package/dist/spec-quality.d.ts +10 -0
- package/{spec-quality.mjs → dist/spec-quality.js} +103 -87
- package/dist/suppression.d.ts +26 -0
- package/{suppression.mjs → dist/suppression.js} +30 -45
- package/dist/temporal.d.ts +9 -0
- package/{temporal.mjs → dist/temporal.js} +75 -65
- package/dist/test-world.d.ts +28 -0
- package/{test-world.mjs → dist/test-world.js} +102 -83
- package/dist/testing.d.ts +51 -0
- package/dist/testing.js +368 -0
- package/dist/third-party-owner.d.ts +8 -0
- package/{third-party-owner.mjs → dist/third-party-owner.js} +105 -91
- package/dist/transport.d.ts +24 -0
- package/{transport.mjs → dist/transport.js} +279 -240
- package/dist/type-safety.d.ts +25 -0
- package/dist/type-safety.js +297 -0
- package/dist/unit-spec.d.ts +30 -0
- package/{unit-spec.mjs → dist/unit-spec.js} +473 -399
- package/dist/uploads.d.ts +9 -0
- package/{uploads.mjs → dist/uploads.js} +62 -54
- package/dist/user-copy.d.ts +9 -0
- package/{user-copy.mjs → dist/user-copy.js} +76 -67
- package/dist/webhooks.d.ts +16 -0
- package/{webhooks.mjs → dist/webhooks.js} +243 -231
- package/package.json +23 -8
- package/runtime/knowledge/hfs/canon-pins.yaml +18 -11
- package/runtime/scripts/hfs/repo-identity.mjs +5 -4
- package/async-discipline.mjs +0 -83
- package/comments.mjs +0 -416
- package/edge-hardening.mjs +0 -139
- package/health-ready.mjs +0 -539
- package/jwt-alg.mjs +0 -45
- package/lib/ast.mjs +0 -88
- package/lib/import-source.mjs +0 -104
- package/lib/specifier.mjs +0 -27
- package/lib/subject-values.mjs +0 -55
- package/lib/types.mjs +0 -133
- package/log-safety.mjs +0 -303
- package/module-layering.mjs +0 -270
- package/naming.mjs +0 -251
- package/observability.mjs +0 -241
- package/resilience.mjs +0 -304
- package/service-isolation.mjs +0 -75
- package/spec-no-skip.mjs +0 -85
- package/testing.mjs +0 -384
- package/type-safety.mjs +0 -323
|
@@ -38,283 +38,344 @@
|
|
|
38
38
|
* lookalikes, spread handoffs, protected or replaced helpers, and callbacks handing work to another object are refused.
|
|
39
39
|
* Effects hidden inside free functions or getters and helpers called past the first one stay review questions.
|
|
40
40
|
*/
|
|
41
|
-
import ts from "typescript"
|
|
42
|
-
import { hfsOf } from "./lib/hfs.
|
|
43
|
-
import { keyName, walk } from "./lib/ast.
|
|
44
|
-
import { baseName, isOwnedType, ownerNameOf } from "./lib/ports.
|
|
45
|
-
import { resolveVariable } from "./lib/transactions.
|
|
46
|
-
import { typeOrigins, typed } from "./lib/types.
|
|
47
|
-
import { mutationIdempotent } from "./lib/client-idempotency.
|
|
48
|
-
|
|
41
|
+
import ts from "typescript";
|
|
42
|
+
import { hfsOf } from "./lib/hfs.js";
|
|
43
|
+
import { keyName, walk } from "./lib/ast.js";
|
|
44
|
+
import { baseName, isOwnedType, ownerNameOf } from "./lib/ports.js";
|
|
45
|
+
import { resolveVariable } from "./lib/transactions.js";
|
|
46
|
+
import { childNode, typeOrigins, typed } from "./lib/types.js";
|
|
47
|
+
import { mutationIdempotent } from "./lib/client-idempotency.js";
|
|
48
|
+
/** The function a class member holds: a method's own function, or a property initialised with a function; null for any other value. */
|
|
49
|
+
const functionOf = (member) => {
|
|
50
|
+
const value = member.value;
|
|
51
|
+
return value?.type === "ArrowFunctionExpression" || value?.type === "FunctionExpression" || value?.type === "TSEmptyBodyFunctionExpression" ? value : null;
|
|
52
|
+
};
|
|
53
|
+
/** The `body` a member's value holds (`member.value?.body`), undefined when the value holds none. */
|
|
54
|
+
const valueBody = (member) => {
|
|
55
|
+
const value = member.value;
|
|
56
|
+
return value && "body" in value ? value.body : undefined;
|
|
57
|
+
};
|
|
58
|
+
/** The `params` a member's value holds (`member.value?.params`), undefined when the value holds none. */
|
|
59
|
+
const valueParams = (member) => {
|
|
60
|
+
const value = member.value;
|
|
61
|
+
return value && "params" in value ? value.params : undefined;
|
|
62
|
+
};
|
|
49
63
|
/** The `Inbox` port of `platform/inbox`. */
|
|
50
|
-
const isInboxType = (context, node) => isOwnedType(context, node, { name: "Inbox", capability: "inbox", tier: "platform" })
|
|
51
|
-
|
|
64
|
+
const isInboxType = (context, node) => isOwnedType(context, node, { name: "Inbox", capability: "inbox", tier: "platform" });
|
|
52
65
|
/** A `return` statement, or a block that ends in one. */
|
|
53
|
-
const returns = (statement) =>
|
|
54
|
-
statement?.type === "ReturnStatement"
|
|
55
|
-
|| (statement?.type === "BlockStatement" && statement.body.at(-1)?.type === "ReturnStatement")
|
|
56
|
-
|
|
66
|
+
const returns = (statement) => statement?.type === "ReturnStatement"
|
|
67
|
+
|| (statement?.type === "BlockStatement" && statement.body.at(-1)?.type === "ReturnStatement");
|
|
57
68
|
/** Whether `test` is `!<expression>` or `<expression> === false` around `target` (the awaited claim, or the identifier holding it). */
|
|
58
69
|
const refusesOn = (test, target) => {
|
|
59
|
-
if (test.type === "UnaryExpression" && test.operator === "!")
|
|
70
|
+
if (test.type === "UnaryExpression" && test.operator === "!")
|
|
71
|
+
return test.argument === target || (test.argument.type === "Identifier" && target.type === "Identifier" && test.argument.name === target.name);
|
|
60
72
|
if (test.type === "BinaryExpression" && (test.operator === "===" || test.operator === "==")) {
|
|
61
|
-
const [left, right] = [test.left, test.right]
|
|
62
|
-
const isFalse = (node) => node.type === "Literal" && node.value === false
|
|
63
|
-
return (left === target && isFalse(right)) || (right === target && isFalse(left))
|
|
73
|
+
const [left, right] = [test.left, test.right];
|
|
74
|
+
const isFalse = (node) => node.type === "Literal" && node.value === false;
|
|
75
|
+
return (left === target && isFalse(right)) || (right === target && isFalse(left));
|
|
64
76
|
}
|
|
65
|
-
return false
|
|
66
|
-
}
|
|
67
|
-
|
|
77
|
+
return false;
|
|
78
|
+
};
|
|
68
79
|
/** Where the awaited claim sits: the statement that tests it, or the declaration that stores it followed by that test. */
|
|
80
|
+
/** The statements of the block or program a node holds as its `body` list, else null. */
|
|
81
|
+
const statementsOf = (node) => {
|
|
82
|
+
if (!node || !("body" in node))
|
|
83
|
+
return null;
|
|
84
|
+
const body = node.body;
|
|
85
|
+
return Array.isArray(body) ? body : null;
|
|
86
|
+
};
|
|
69
87
|
const returnsOnFalse = (awaited) => {
|
|
70
|
-
const node = awaited
|
|
71
|
-
const parent = node.parent
|
|
88
|
+
const node = awaited;
|
|
89
|
+
const parent = node.parent;
|
|
72
90
|
if (parent.type === "UnaryExpression" || parent.type === "BinaryExpression") {
|
|
73
|
-
const statement = parent.parent
|
|
74
|
-
return statement.type === "IfStatement" && statement.test === parent && refusesOn(parent, node) && returns(statement.consequent)
|
|
91
|
+
const statement = parent.parent;
|
|
92
|
+
return statement.type === "IfStatement" && statement.test === parent && refusesOn(parent, node) && returns(statement.consequent);
|
|
75
93
|
}
|
|
76
94
|
if (parent.type === "VariableDeclarator" && parent.id.type === "Identifier") {
|
|
77
|
-
const declaration = parent.parent
|
|
78
|
-
const siblings = declaration.parent
|
|
79
|
-
if (!
|
|
80
|
-
|
|
81
|
-
|
|
95
|
+
const declaration = parent.parent;
|
|
96
|
+
const siblings = statementsOf(declaration.parent);
|
|
97
|
+
if (!siblings)
|
|
98
|
+
return false;
|
|
99
|
+
const next = siblings[siblings.indexOf(declaration) + 1];
|
|
100
|
+
return next?.type === "IfStatement" && refusesOn(next.test, parent.id) && returns(next.consequent);
|
|
82
101
|
}
|
|
83
|
-
return false
|
|
84
|
-
}
|
|
85
|
-
|
|
102
|
+
return false;
|
|
103
|
+
};
|
|
86
104
|
/** The awaited expression that completes first in a body, ignoring nested functions; null when the body awaits nothing. */
|
|
87
105
|
const firstAwait = (body) => {
|
|
88
|
-
|
|
106
|
+
const found = { first: null };
|
|
89
107
|
walk(body, (node) => {
|
|
90
|
-
if (node.type === "AwaitExpression" && (first === null || node.range[1] < first.range[1]))
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
108
|
+
if (node.type === "AwaitExpression" && (found.first === null || node.range[1] < found.first.range[1]))
|
|
109
|
+
found.first = node;
|
|
110
|
+
}, { intoFunctions: false });
|
|
111
|
+
return found.first;
|
|
112
|
+
};
|
|
95
113
|
/** True when an expression evaluates a call, construction or write before the designated call completes. */
|
|
96
114
|
const hasPriorEffect = (expression, call) => {
|
|
97
|
-
let found = false
|
|
115
|
+
let found = false;
|
|
98
116
|
walk(expression, (node) => {
|
|
99
117
|
if (["CallExpression", "NewExpression", "AssignmentExpression", "UpdateExpression"].includes(node.type)
|
|
100
|
-
&& node !== call && node.range[1] < call.range[1])
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
118
|
+
&& node !== call && node.range[1] < call.range[1])
|
|
119
|
+
found = true;
|
|
120
|
+
}, { intoFunctions: false });
|
|
121
|
+
return found;
|
|
122
|
+
};
|
|
105
123
|
/** A transaction port the `platform/database` owner declares: a receiver typed by that owner, never by its name. */
|
|
106
124
|
const isDatabasePort = (context, node) => {
|
|
107
|
-
const hfs = hfsOf(context)
|
|
108
|
-
const origins = typeOrigins(context, node)
|
|
109
|
-
return origins.length > 0 && origins.every((origin) =>
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
125
|
+
const hfs = hfsOf(context);
|
|
126
|
+
const origins = typeOrigins(context, node);
|
|
127
|
+
return origins.length > 0 && origins.every((origin) => origin.module === null && hfs.tierOf(origin.file) === "platform" && ownerNameOf(hfs, origin.file) === "database");
|
|
128
|
+
};
|
|
113
129
|
/** Every declared alternative must be TypeORM's manager: one genuine union member cannot vouch for a lookalike. */
|
|
114
130
|
const isEntityManager = (context, node) => {
|
|
115
|
-
const origins = typeOrigins(context, node)
|
|
116
|
-
return origins.length > 0 && origins.every((origin) => origin.name === "EntityManager" && origin.module === "typeorm")
|
|
117
|
-
}
|
|
118
|
-
|
|
131
|
+
const origins = typeOrigins(context, node);
|
|
132
|
+
return origins.length > 0 && origins.every((origin) => origin.name === "EntityManager" && origin.module === "typeorm");
|
|
133
|
+
};
|
|
119
134
|
/** TypeScript erases a `this` parameter, so only these parameters receive call arguments at runtime. */
|
|
120
|
-
const runtimeParams = (
|
|
121
|
-
|
|
135
|
+
const runtimeParams = (params) => params.filter((param) => !(param.type === "Identifier" && param.name === "this"));
|
|
122
136
|
/** The callback a sole, returned or awaited `.transaction(...)` runs on an EntityManager or the database port, and its manager parameter. */
|
|
137
|
+
const ISOLATION_LEVELS = ["READ UNCOMMITTED", "READ COMMITTED", "REPEATABLE READ", "SERIALIZABLE"];
|
|
123
138
|
const soleTransactionCallback = (context, body) => {
|
|
124
|
-
|
|
125
|
-
|
|
139
|
+
const outer = body.body[0];
|
|
140
|
+
if (body.body.length !== 1 || !outer)
|
|
141
|
+
return null;
|
|
126
142
|
const expression = outer.type === "ReturnStatement" ? outer.argument
|
|
127
|
-
: outer.type === "ExpressionStatement" && outer.expression.type === "AwaitExpression" ? outer.expression : null
|
|
128
|
-
const call = expression?.type === "AwaitExpression" ? expression.argument : expression
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
: outer.type === "ExpressionStatement" && outer.expression.type === "AwaitExpression" ? outer.expression : null;
|
|
144
|
+
const call = expression?.type === "AwaitExpression" ? expression.argument : expression;
|
|
145
|
+
if (call?.type !== "CallExpression")
|
|
146
|
+
return null;
|
|
147
|
+
const callee = call.callee;
|
|
148
|
+
if (callee.type !== "MemberExpression" || callee.computed
|
|
149
|
+
|| callee.property.type !== "Identifier" || callee.property.name !== "transaction" || hasPriorEffect(call, call))
|
|
150
|
+
return null;
|
|
151
|
+
let callback = null;
|
|
133
152
|
if (isEntityManager(context, callee.object)) {
|
|
134
153
|
// TypeORM runs arg0 when it is a function, otherwise arg1. Never accept a later, ignored callback.
|
|
135
|
-
const isolation = call.arguments[0]
|
|
154
|
+
const isolation = call.arguments[0];
|
|
136
155
|
callback = call.arguments.length === 1 ? isolation
|
|
137
|
-
: call.arguments.length === 2 && isolation
|
|
138
|
-
&&
|
|
139
|
-
? call.arguments[1] : null
|
|
140
|
-
}
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
156
|
+
: call.arguments.length === 2 && isolation?.type === "Literal"
|
|
157
|
+
&& ISOLATION_LEVELS.includes(isolation.value)
|
|
158
|
+
? call.arguments[1] : null;
|
|
159
|
+
}
|
|
160
|
+
else if (isDatabasePort(context, callee.object) && call.arguments.length === 1)
|
|
161
|
+
callback = call.arguments[0];
|
|
162
|
+
if (!callback || (callback.type !== "ArrowFunctionExpression" && callback.type !== "FunctionExpression") || callback.params.length !== 1)
|
|
163
|
+
return null;
|
|
164
|
+
const manager = callback.params[0];
|
|
165
|
+
if (manager?.type !== "Identifier" || !isEntityManager(context, manager))
|
|
166
|
+
return null;
|
|
167
|
+
return { callback, manager };
|
|
168
|
+
};
|
|
147
169
|
/** True when `argument` is the identifier bound to the parameter `param`; with `unwritten`, that parameter is also never reassigned. */
|
|
148
170
|
const isParameter = (context, argument, param, { unwritten = false } = {}) => {
|
|
149
|
-
const binding = resolveVariable(context.sourceCode, param)
|
|
150
|
-
const argumentBinding = argument?.type === "Identifier" ? resolveVariable(context.sourceCode, argument) : null
|
|
171
|
+
const binding = resolveVariable(context.sourceCode, param);
|
|
172
|
+
const argumentBinding = argument?.type === "Identifier" ? resolveVariable(context.sourceCode, argument) : null;
|
|
151
173
|
return !!binding && binding.defs[0]?.name === param && argumentBinding === binding
|
|
152
|
-
&& !(unwritten && binding.references.some((reference) => reference.isWrite()))
|
|
153
|
-
}
|
|
154
|
-
|
|
174
|
+
&& !(unwritten && binding.references.some((reference) => reference.isWrite()));
|
|
175
|
+
};
|
|
155
176
|
/** The statement of a block that holds its first await as the claim it tests, stores or awaits; null when that await sits deeper. */
|
|
156
177
|
const claimStatement = (block) => {
|
|
157
|
-
const awaited = firstAwait(block)
|
|
158
|
-
const parent = awaited?.parent
|
|
178
|
+
const awaited = firstAwait(block);
|
|
179
|
+
const parent = awaited?.parent;
|
|
159
180
|
const statement = parent?.type === "VariableDeclarator" && parent.init === awaited
|
|
160
181
|
&& parent.parent.declarations.length === 1 ? parent.parent
|
|
161
|
-
:
|
|
162
|
-
: parent?.type === "ExpressionStatement" ? parent : null
|
|
163
|
-
return statement?.parent === block ? { awaited, statement } : null
|
|
164
|
-
}
|
|
165
|
-
|
|
182
|
+
: parent?.type === "UnaryExpression" || parent?.type === "BinaryExpression" ? parent.parent
|
|
183
|
+
: parent?.type === "ExpressionStatement" ? parent : null;
|
|
184
|
+
return awaited && statement?.parent === block ? { awaited, statement } : null;
|
|
185
|
+
};
|
|
166
186
|
/** The claim that opens the inline async callback with its own manager, as its first statement. */
|
|
167
187
|
const inlineClaim = (context, { callback, manager }) => {
|
|
168
|
-
if (!callback.async || callback.body.type !== "BlockStatement")
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
188
|
+
if (!callback.async || callback.body.type !== "BlockStatement")
|
|
189
|
+
return null;
|
|
190
|
+
const found = claimStatement(callback.body);
|
|
191
|
+
if (!found || found.statement !== callback.body.body[0])
|
|
192
|
+
return null;
|
|
193
|
+
const claim = found.awaited.argument;
|
|
194
|
+
if (claim?.type !== "CallExpression" || !isParameter(context, claim.arguments[2], manager) || hasPriorEffect(found.statement, claim))
|
|
195
|
+
return null;
|
|
196
|
+
return found.awaited;
|
|
197
|
+
};
|
|
176
198
|
/** The `this.<method>(...)` call an arrow callback hands its whole work to: its expression body, or its sole returned or awaited statement. */
|
|
177
199
|
const handedCall = (callback) => {
|
|
178
|
-
if (callback.type !== "ArrowFunctionExpression")
|
|
179
|
-
|
|
200
|
+
if (callback.type !== "ArrowFunctionExpression")
|
|
201
|
+
return null;
|
|
202
|
+
let expression = callback.body;
|
|
180
203
|
if (expression.type === "BlockStatement") {
|
|
181
|
-
const [sole] = expression.body
|
|
182
|
-
if (expression.body.length !== 1)
|
|
183
|
-
|
|
184
|
-
|
|
204
|
+
const [sole] = expression.body;
|
|
205
|
+
if (expression.body.length !== 1)
|
|
206
|
+
return null;
|
|
207
|
+
expression = sole?.type === "ReturnStatement" ? sole.argument
|
|
208
|
+
: sole?.type === "ExpressionStatement" && sole.expression.type === "AwaitExpression" ? sole.expression : null;
|
|
185
209
|
}
|
|
186
|
-
const call = expression?.type === "AwaitExpression" ? expression.argument : expression
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
210
|
+
const call = expression?.type === "AwaitExpression" ? expression.argument : expression;
|
|
211
|
+
if (call?.type !== "CallExpression")
|
|
212
|
+
return null;
|
|
213
|
+
const callee = call.callee;
|
|
214
|
+
return callee.type === "MemberExpression" && !callee.computed
|
|
215
|
+
&& callee.object.type === "ThisExpression" && ["Identifier", "PrivateIdentifier"].includes(callee.property.type) ? call : null;
|
|
216
|
+
};
|
|
192
217
|
/** Argument preparation cannot start instance or transactional work before the inbox claim. */
|
|
193
218
|
const preparesArguments = (context, statement, manager) => {
|
|
194
|
-
if (statement.type !== "VariableDeclaration" || statement.kind !== "const")
|
|
195
|
-
|
|
219
|
+
if (statement.type !== "VariableDeclaration" || statement.kind !== "const")
|
|
220
|
+
return false;
|
|
221
|
+
let safe = true;
|
|
196
222
|
walk(statement, (node) => {
|
|
197
223
|
if (node.type === "ThisExpression" || (node.type === "Identifier" && isParameter(context, node, manager))
|
|
198
224
|
|| ["AwaitExpression", "NewExpression", "AssignmentExpression", "UpdateExpression"].includes(node.type)
|
|
199
|
-
|| (node.type === "CallExpression" && node.callee.type !== "Identifier"))
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
225
|
+
|| (node.type === "CallExpression" && node.callee.type !== "Identifier"))
|
|
226
|
+
safe = false;
|
|
227
|
+
}, { intoFunctions: false });
|
|
228
|
+
return safe;
|
|
229
|
+
};
|
|
204
230
|
/** An assignment anywhere in the class can replace the method that the checker resolved for the handoff. */
|
|
205
231
|
const replacesHelper = (classBody, helper) => {
|
|
206
|
-
let replaced = false
|
|
232
|
+
let replaced = false;
|
|
207
233
|
walk(classBody, (node) => {
|
|
208
|
-
if (node.type !== "AssignmentExpression")
|
|
209
|
-
|
|
234
|
+
if (node.type !== "AssignmentExpression")
|
|
235
|
+
return;
|
|
236
|
+
const target = node.left;
|
|
210
237
|
if (target.type === "MemberExpression" && target.object.type === "ThisExpression"
|
|
211
238
|
&& (!target.computed || target.property.type === "Literal")
|
|
212
239
|
&& (target.property.type === "PrivateIdentifier") === (helper.key.type === "PrivateIdentifier")
|
|
213
|
-
&& keyName(target.property) === keyName(helper.key))
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
240
|
+
&& keyName(target.property) === keyName(helper.key))
|
|
241
|
+
replaced = true;
|
|
242
|
+
});
|
|
243
|
+
return replaced;
|
|
244
|
+
};
|
|
218
245
|
/** The helper body must claim first with its unchanged runtime manager, after only argument preparation. */
|
|
219
246
|
const helperClaim = (context, helper, param) => {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
if (
|
|
227
|
-
|
|
247
|
+
const fn = functionOf(helper);
|
|
248
|
+
if (!fn?.async || fn.body?.type !== "BlockStatement"
|
|
249
|
+
|| param?.type !== "Identifier" || !isEntityManager(context, param))
|
|
250
|
+
return null;
|
|
251
|
+
const body = fn.body;
|
|
252
|
+
const found = claimStatement(body);
|
|
253
|
+
if (!found)
|
|
254
|
+
return null;
|
|
255
|
+
const statements = body.body;
|
|
256
|
+
const before = statements.slice(0, statements.indexOf(found.statement));
|
|
257
|
+
if (before.some((statement) => !preparesArguments(context, statement, param)))
|
|
258
|
+
return null;
|
|
259
|
+
const claim = found.awaited.argument;
|
|
228
260
|
if (claim?.type !== "CallExpression" || !isParameter(context, claim.arguments[2], param, { unwritten: true })
|
|
229
|
-
|| hasPriorEffect(found.statement, claim))
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
261
|
+
|| hasPriorEffect(found.statement, claim))
|
|
262
|
+
return null;
|
|
263
|
+
return found.awaited;
|
|
264
|
+
};
|
|
233
265
|
/**
|
|
234
266
|
* The claim of a typed helper the callback delegates to: a method of the delivery's own class, resolved by the checker, that receives
|
|
235
267
|
* the callback's manager, awaits nothing before the claim, claims with that parameter at its top level and runs no statement but `const`
|
|
236
268
|
* argument preparation before it.
|
|
237
269
|
*/
|
|
238
270
|
const delegatedClaim = (context, delivery, { callback, manager }) => {
|
|
239
|
-
const call = handedCall(callback)
|
|
240
|
-
if (!call || call.arguments.some((argument) => argument.type === "SpreadElement") || hasPriorEffect(call, call))
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
271
|
+
const call = handedCall(callback);
|
|
272
|
+
if (!call || call.arguments.some((argument) => argument.type === "SpreadElement") || hasPriorEffect(call, call))
|
|
273
|
+
return null;
|
|
274
|
+
const position = call.arguments.findIndex((argument) => argument.type === "Identifier" && argument.name === manager.name);
|
|
275
|
+
if (position < 0 || !isParameter(context, call.arguments[position], manager))
|
|
276
|
+
return null;
|
|
277
|
+
// handedCall answers only a call whose callee is a member expression
|
|
278
|
+
const callee = call.callee;
|
|
279
|
+
if (callee.type !== "MemberExpression")
|
|
280
|
+
return null;
|
|
281
|
+
const { checker, toTs } = typed(context);
|
|
282
|
+
const declarations = checker.getSymbolAtLocation(toTs(callee.property))?.getDeclarations?.() ?? [];
|
|
245
283
|
const helper = declarations.length === 1
|
|
246
|
-
? delivery.parent.body.find((member) => member.type === "MethodDefinition" && toTs(member) === declarations[0]) : undefined
|
|
247
|
-
if (!helper || helper === delivery || helper.kind !== "method" || helper.static || !helper.value.async || !helper.value.body)
|
|
248
|
-
|
|
284
|
+
? delivery.parent.body.find((member) => member.type === "MethodDefinition" && toTs(member) === declarations[0]) : undefined;
|
|
285
|
+
if (!helper || helper === delivery || helper.kind !== "method" || helper.static || !helper.value.async || !helper.value.body)
|
|
286
|
+
return null;
|
|
287
|
+
const params = runtimeParams(helper.value.params);
|
|
249
288
|
// A public delivery contract carries its claim and manager obligations into every override.
|
|
250
289
|
if (helper.accessibility === "protected" || (helper.accessibility !== "private" && helper.key.type !== "PrivateIdentifier"
|
|
251
|
-
&& (!params[0] || !isDeliveryParam(context, params[0]))) || replacesHelper(delivery.parent, helper))
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
290
|
+
&& (!params[0] || !isDeliveryParam(context, params[0]))) || replacesHelper(delivery.parent, helper))
|
|
291
|
+
return null;
|
|
292
|
+
return helperClaim(context, helper, params[position]);
|
|
293
|
+
};
|
|
255
294
|
/** The first awaited claim of a delivery that runs as one transaction: inline in its callback, or in the typed helper that callback delegates to. */
|
|
256
295
|
const transactionClaim = (context, delivery) => {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
296
|
+
// judgeClaim asks only of a member whose value holds a block body
|
|
297
|
+
const body = valueBody(delivery);
|
|
298
|
+
if (body?.type !== "BlockStatement")
|
|
299
|
+
return null;
|
|
300
|
+
const transaction = soleTransactionCallback(context, body);
|
|
301
|
+
if (!transaction)
|
|
302
|
+
return null;
|
|
303
|
+
return inlineClaim(context, transaction) ?? delegatedClaim(context, delivery, transaction);
|
|
304
|
+
};
|
|
262
305
|
/** A delivery's type, including a union alternative, exposes the sender's `eventId`. */
|
|
263
|
-
const hasEventId = (checker, type) =>
|
|
264
|
-
(type.isUnion() ? type.types : [type]).some((part) => checker.getPropertyOfType(part, "eventId") !== undefined)
|
|
265
|
-
|
|
306
|
+
const hasEventId = (checker, type) => (type.isUnion() ? type.types : [type]).some((part) => checker.getPropertyOfType(part, "eventId") !== undefined);
|
|
266
307
|
/** Whether a parameter's type has an `eventId` property: the shape of a delivery. */
|
|
267
308
|
const isDeliveryParam = (context, param) => {
|
|
268
|
-
const target = param.type === "TSParameterProperty" ? param.parameter : param.type === "AssignmentPattern" ? param.left : param
|
|
269
|
-
const { checker, toTs } = typed(context)
|
|
270
|
-
const tsNode = toTs(target)
|
|
271
|
-
if (!tsNode)
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
309
|
+
const target = param.type === "TSParameterProperty" ? param.parameter : param.type === "AssignmentPattern" ? param.left : param;
|
|
310
|
+
const { checker, toTs } = typed(context);
|
|
311
|
+
const tsNode = toTs(target);
|
|
312
|
+
if (!tsNode)
|
|
313
|
+
return false;
|
|
314
|
+
return hasEventId(checker, checker.getTypeAtLocation(tsNode));
|
|
315
|
+
};
|
|
275
316
|
/** The runtime parameter the declared signature's first awaited claim uses, including declarations in another source file. */
|
|
276
317
|
const claimedManagerPosition = (checker, signature) => {
|
|
277
|
-
|
|
318
|
+
const found = { awaited: null };
|
|
278
319
|
const visit = (node) => {
|
|
279
|
-
if (ts.isAwaitExpression(node) && (!awaited || node.end < awaited.end))
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const
|
|
320
|
+
if (ts.isAwaitExpression(node) && (!found.awaited || node.end < found.awaited.end))
|
|
321
|
+
found.awaited = node;
|
|
322
|
+
ts.forEachChild(node, (child) => { if (!ts.isFunctionLike(child))
|
|
323
|
+
visit(child); });
|
|
324
|
+
};
|
|
325
|
+
const body = childNode(signature.getDeclaration(), "body");
|
|
326
|
+
if (body)
|
|
327
|
+
visit(body);
|
|
328
|
+
const claim = found.awaited?.expression;
|
|
285
329
|
if (!claim || !ts.isCallExpression(claim) || !ts.isPropertyAccessExpression(claim.expression)
|
|
286
|
-
|| claim.expression.name.text !== "claim"
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
330
|
+
|| claim.expression.name.text !== "claim")
|
|
331
|
+
return -1;
|
|
332
|
+
const managerArgument = claim.arguments[2];
|
|
333
|
+
if (!managerArgument)
|
|
334
|
+
return -1;
|
|
335
|
+
const manager = checker.getSymbolAtLocation(managerArgument);
|
|
336
|
+
return manager ? signature.parameters.indexOf(manager) : -1;
|
|
337
|
+
};
|
|
338
|
+
/** Whether the checker can list a type's base types: a tuple, or a class or interface type (what `getBaseTypes` accepts). */
|
|
339
|
+
const listsBaseTypes = (type) => ("objectFlags" in type && typeof type.objectFlags === "number" && (type.objectFlags & ts.ObjectFlags.Tuple) !== 0)
|
|
340
|
+
|| ((type.getSymbol()?.flags ?? 0) & (ts.SymbolFlags.Class | ts.SymbolFlags.Interface)) !== 0;
|
|
341
|
+
/** The base types of a class or interface type; any other type stops the run as the checker itself does. */
|
|
342
|
+
const baseTypesOf = (checker, type) => {
|
|
343
|
+
if (!listsBaseTypes(type))
|
|
344
|
+
throw new TypeError("type must be class or interface");
|
|
345
|
+
return checker.getBaseTypes(type) ?? [];
|
|
346
|
+
};
|
|
291
347
|
/** An override preserves inherited delivery and transaction-manager obligations even when it widens its own parameter. */
|
|
292
348
|
const inheritedDelivery = (context, method) => {
|
|
293
|
-
const name = keyName(method.key)
|
|
294
|
-
const result = { delivery: false, managers: new Set() }
|
|
295
|
-
if (name === null)
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
const
|
|
349
|
+
const name = keyName(method.key);
|
|
350
|
+
const result = { delivery: false, managers: new Set() };
|
|
351
|
+
if (name === null)
|
|
352
|
+
return result;
|
|
353
|
+
const { checker, toTs } = typed(context);
|
|
354
|
+
const location = toTs(method);
|
|
355
|
+
const seen = new Set();
|
|
299
356
|
const visit = (type) => {
|
|
300
|
-
if (seen.has(type))
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const
|
|
357
|
+
if (seen.has(type))
|
|
358
|
+
return;
|
|
359
|
+
seen.add(type);
|
|
360
|
+
const member = checker.getPropertyOfType(type, name);
|
|
361
|
+
const signatures = member ? checker.getTypeOfSymbolAtLocation(member, location).getCallSignatures() : [];
|
|
304
362
|
for (const signature of signatures) {
|
|
305
|
-
const param = signature.parameters[0]
|
|
306
|
-
if (!param || !hasEventId(checker, checker.getTypeOfSymbolAtLocation(param, location)))
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
363
|
+
const param = signature.parameters[0];
|
|
364
|
+
if (!param || !hasEventId(checker, checker.getTypeOfSymbolAtLocation(param, location)))
|
|
365
|
+
continue;
|
|
366
|
+
result.delivery = true;
|
|
367
|
+
const manager = claimedManagerPosition(checker, signature);
|
|
368
|
+
if (manager >= 0)
|
|
369
|
+
result.managers.add(manager);
|
|
310
370
|
}
|
|
311
|
-
for (const base of checker
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
371
|
+
for (const base of baseTypesOf(checker, type))
|
|
372
|
+
visit(base);
|
|
373
|
+
};
|
|
374
|
+
const owner = checker.getTypeAtLocation(toTs(method.parent.parent));
|
|
375
|
+
for (const base of baseTypesOf(checker, owner))
|
|
376
|
+
visit(base);
|
|
377
|
+
return result;
|
|
378
|
+
};
|
|
318
379
|
/** A service method that takes a delivery claims the event through the shared inbox before it acts. */
|
|
319
380
|
export const inboxDedupeRequired = {
|
|
320
381
|
meta: {
|
|
@@ -327,56 +388,65 @@ export const inboxDedupeRequired = {
|
|
|
327
388
|
},
|
|
328
389
|
},
|
|
329
390
|
create(context) {
|
|
330
|
-
const hfs = hfsOf(context)
|
|
331
|
-
const filename = context.filename || context.getFilename()
|
|
332
|
-
const slot = hfs.slotOf(filename)
|
|
333
|
-
if (!baseName(filename).endsWith(".service.ts") || !slot || slot.startsWith("be.tests."))
|
|
391
|
+
const hfs = hfsOf(context);
|
|
392
|
+
const filename = context.filename || context.getFilename();
|
|
393
|
+
const slot = hfs.slotOf(filename);
|
|
394
|
+
if (!baseName(filename).endsWith(".service.ts") || !slot || slot.startsWith("be.tests."))
|
|
395
|
+
return {};
|
|
334
396
|
// The event bus publishes events (their shape carries an `eventId`) and its runtime claims the inbox before a consumer runs: no delivery method here.
|
|
335
|
-
if (slot.startsWith("be.platform") && ownerNameOf(hfs, filename) === "event-bus")
|
|
397
|
+
if (slot.startsWith("be.platform") && ownerNameOf(hfs, filename) === "event-bus")
|
|
398
|
+
return {};
|
|
336
399
|
const judgeClaim = (node, inherited) => {
|
|
337
|
-
const body = node
|
|
338
|
-
let awaited = body?.type === "BlockStatement" ? transactionClaim(context, node) ?? firstAwait(body) : null
|
|
400
|
+
const body = valueBody(node);
|
|
401
|
+
let awaited = body?.type === "BlockStatement" ? transactionClaim(context, node) ?? firstAwait(body) : null;
|
|
339
402
|
if (inherited.managers.size > 0) {
|
|
340
|
-
const
|
|
341
|
-
|
|
403
|
+
const fnParams = valueParams(node);
|
|
404
|
+
const params = fnParams ? runtimeParams(fnParams) : [];
|
|
405
|
+
if (![...inherited.managers].every((position) => helperClaim(context, node, params[position]) === awaited))
|
|
406
|
+
awaited = null;
|
|
342
407
|
}
|
|
343
|
-
const call = awaited?.argument
|
|
408
|
+
const call = awaited?.argument;
|
|
344
409
|
const claims = call?.type === "CallExpression"
|
|
345
410
|
&& call.callee.type === "MemberExpression"
|
|
346
411
|
&& !call.callee.computed
|
|
347
412
|
&& call.callee.property.type === "Identifier"
|
|
348
413
|
&& call.callee.property.name === "claim"
|
|
349
414
|
&& call.arguments.length >= 2
|
|
350
|
-
&& isInboxType(context, call.callee.object)
|
|
351
|
-
if (!claims)
|
|
352
|
-
|
|
353
|
-
|
|
415
|
+
&& isInboxType(context, call.callee.object);
|
|
416
|
+
if (!claims)
|
|
417
|
+
context.report({ node: node.key, messageId: "noClaim" });
|
|
418
|
+
else if (!awaited || !returnsOnFalse(awaited))
|
|
419
|
+
context.report({ node: node.key, messageId: "noEarlyReturn" });
|
|
420
|
+
};
|
|
354
421
|
return {
|
|
355
422
|
MethodDefinition(node) {
|
|
356
|
-
if (node.kind !== "method" || node.static || node.key.type === "PrivateIdentifier" || !node.value.body)
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
423
|
+
if (node.kind !== "method" || node.static || node.key.type === "PrivateIdentifier" || !node.value.body)
|
|
424
|
+
return;
|
|
425
|
+
if (node.accessibility === "private" || node.accessibility === "protected")
|
|
426
|
+
return;
|
|
427
|
+
const first = runtimeParams(node.value.params)[0];
|
|
428
|
+
const inherited = inheritedDelivery(context, node);
|
|
429
|
+
if (!(first && isDeliveryParam(context, first)) && !inherited.delivery)
|
|
430
|
+
return;
|
|
431
|
+
judgeClaim(node, inherited);
|
|
362
432
|
},
|
|
363
433
|
PropertyDefinition(node) {
|
|
364
|
-
if (node.static || node.key.type === "PrivateIdentifier" || node.accessibility === "private" || node.accessibility === "protected")
|
|
365
|
-
|
|
366
|
-
|
|
434
|
+
if (node.static || node.key.type === "PrivateIdentifier" || node.accessibility === "private" || node.accessibility === "protected")
|
|
435
|
+
return;
|
|
436
|
+
const inherited = inheritedDelivery(context, node);
|
|
437
|
+
if (inherited.delivery)
|
|
438
|
+
judgeClaim(node, inherited);
|
|
367
439
|
},
|
|
368
|
-
}
|
|
440
|
+
};
|
|
369
441
|
},
|
|
370
|
-
}
|
|
371
|
-
|
|
442
|
+
};
|
|
372
443
|
/** The rule this law contributes to the plugin. */
|
|
373
444
|
export const rules = {
|
|
374
445
|
"inbox-dedupe-required": inboxDedupeRequired,
|
|
375
446
|
"mutation-idempotent": mutationIdempotent,
|
|
376
|
-
}
|
|
377
|
-
|
|
447
|
+
};
|
|
378
448
|
/** Starts at error: a duplicate charge or a duplicate side effect is never a warning. */
|
|
379
449
|
export const recommended = {
|
|
380
450
|
"starci-be/inbox-dedupe-required": "error",
|
|
381
451
|
"starci-be/mutation-idempotent": "error",
|
|
382
|
-
}
|
|
452
|
+
};
|