@starci/eslint-canon-be 3.4.57 → 3.6.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.
Files changed (197) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +11 -2
  3. package/dist/ambient-id.d.ts +9 -0
  4. package/{ambient-id.mjs → dist/ambient-id.js} +43 -39
  5. package/dist/app-composition.d.ts +21 -0
  6. package/{app-composition.mjs → dist/app-composition.js} +396 -300
  7. package/dist/async-discipline.d.ts +9 -0
  8. package/dist/async-discipline.js +77 -0
  9. package/dist/authorization.d.ts +12 -0
  10. package/{authorization.mjs → dist/authorization.js} +53 -59
  11. package/dist/boundary-schema.d.ts +15 -0
  12. package/{boundary-schema.mjs → dist/boundary-schema.js} +120 -105
  13. package/dist/builders.d.ts +21 -0
  14. package/{builders.mjs → dist/builders.js} +162 -146
  15. package/dist/cli.d.ts +15 -0
  16. package/{cli.mjs → dist/cli.js} +97 -82
  17. package/dist/comments.d.ts +52 -0
  18. package/dist/comments.js +412 -0
  19. package/dist/config-owner.d.ts +24 -0
  20. package/{config-owner.mjs → dist/config-owner.js} +256 -219
  21. package/dist/connections.d.ts +12 -0
  22. package/{connections.mjs → dist/connections.js} +138 -140
  23. package/dist/cookies.d.ts +9 -0
  24. package/{cookies.mjs → dist/cookies.js} +58 -58
  25. package/dist/cqrs.d.ts +27 -0
  26. package/{cqrs.mjs → dist/cqrs.js} +341 -282
  27. package/dist/data-access.d.ts +50 -0
  28. package/{data-access.mjs → dist/data-access.js} +238 -243
  29. package/dist/default-deny.d.ts +15 -0
  30. package/{default-deny.mjs → dist/default-deny.js} +103 -88
  31. package/dist/e2e-flow.d.ts +25 -0
  32. package/{e2e-flow.mjs → dist/e2e-flow.js} +113 -112
  33. package/dist/edge-hardening.d.ts +10 -0
  34. package/dist/edge-hardening.js +173 -0
  35. package/dist/error-handling.d.ts +21 -0
  36. package/{error-handling.mjs → dist/error-handling.js} +289 -239
  37. package/dist/event-bus.d.ts +14 -0
  38. package/{event-bus.mjs → dist/event-bus.js} +146 -129
  39. package/dist/feature-thin.d.ts +12 -0
  40. package/{feature-thin.mjs → dist/feature-thin.js} +208 -191
  41. package/dist/function-budget.d.ts +7 -0
  42. package/{function-budget.mjs → dist/function-budget.js} +24 -27
  43. package/dist/health-ready.d.ts +10 -0
  44. package/dist/health-ready.js +703 -0
  45. package/dist/idempotency.d.ts +10 -0
  46. package/{idempotency.mjs → dist/idempotency.js} +296 -226
  47. package/dist/index.d.ts +54 -0
  48. package/{index.mjs → dist/index.js} +91 -109
  49. package/dist/infra-owner.d.ts +18 -0
  50. package/{infra-owner.mjs → dist/infra-owner.js} +58 -51
  51. package/dist/injection.d.ts +30 -0
  52. package/{injection.mjs → dist/injection.js} +397 -344
  53. package/dist/input-bounds.d.ts +15 -0
  54. package/{input-bounds.mjs → dist/input-bounds.js} +143 -132
  55. package/dist/jobs.d.ts +17 -0
  56. package/{jobs.mjs → dist/jobs.js} +116 -99
  57. package/dist/jwt-alg.d.ts +6 -0
  58. package/dist/jwt-alg.js +49 -0
  59. package/dist/lib/app-roles.d.ts +25 -0
  60. package/{lib/app-roles.mjs → dist/lib/app-roles.js} +15 -17
  61. package/dist/lib/ast.d.ts +40 -0
  62. package/dist/lib/ast.js +100 -0
  63. package/dist/lib/client-idempotency.d.ts +3 -0
  64. package/{lib/client-idempotency.mjs → dist/lib/client-idempotency.js} +316 -268
  65. package/dist/lib/config.d.ts +36 -0
  66. package/{lib/config.mjs → dist/lib/config.js} +24 -27
  67. package/dist/lib/db-writes.d.ts +29 -0
  68. package/{lib/db-writes.mjs → dist/lib/db-writes.js} +27 -27
  69. package/dist/lib/declared.d.ts +77 -0
  70. package/{lib/declared.mjs → dist/lib/declared.js} +83 -78
  71. package/dist/lib/doors.d.ts +50 -0
  72. package/{lib/doors.mjs → dist/lib/doors.js} +45 -50
  73. package/dist/lib/edition.d.ts +25 -0
  74. package/{lib/edition.mjs → dist/lib/edition.js} +15 -20
  75. package/dist/lib/entity-writes.d.ts +7 -0
  76. package/{lib/entity-writes.mjs → dist/lib/entity-writes.js} +31 -22
  77. package/dist/lib/hfs.d.ts +34 -0
  78. package/{lib/hfs.mjs → dist/lib/hfs.js} +31 -29
  79. package/dist/lib/import-source.d.ts +63 -0
  80. package/dist/lib/import-source.js +134 -0
  81. package/dist/lib/path.d.ts +8 -0
  82. package/{lib/path.mjs → dist/lib/path.js} +4 -7
  83. package/dist/lib/persistence.d.ts +115 -0
  84. package/{lib/persistence.mjs → dist/lib/persistence.js} +55 -66
  85. package/dist/lib/ports.d.ts +70 -0
  86. package/{lib/ports.mjs → dist/lib/ports.js} +62 -66
  87. package/dist/lib/rule.d.ts +31 -0
  88. package/dist/lib/rule.js +2 -0
  89. package/dist/lib/runtime-root.d.ts +4 -0
  90. package/dist/lib/runtime-root.js +10 -0
  91. package/dist/lib/schema-values.d.ts +13 -0
  92. package/{lib/schema-values.mjs → dist/lib/schema-values.js} +67 -59
  93. package/dist/lib/specifier.d.ts +12 -0
  94. package/dist/lib/specifier.js +29 -0
  95. package/dist/lib/subject-values.d.ts +4 -0
  96. package/dist/lib/subject-values.js +61 -0
  97. package/dist/lib/transactions.d.ts +18 -0
  98. package/{lib/transactions.mjs → dist/lib/transactions.js} +17 -15
  99. package/dist/lib/transport-slots.d.ts +17 -0
  100. package/{lib/transport-slots.mjs → dist/lib/transport-slots.js} +2 -4
  101. package/dist/lib/types.d.ts +96 -0
  102. package/dist/lib/types.js +150 -0
  103. package/dist/lib/unit-spec.d.ts +48 -0
  104. package/{lib/unit-spec.mjs → dist/lib/unit-spec.js} +35 -44
  105. package/dist/lib/webhook-ack.d.ts +4 -0
  106. package/{lib/webhook-ack.mjs → dist/lib/webhook-ack.js} +78 -62
  107. package/dist/lib/webhook-handoff-inbox.d.ts +3 -0
  108. package/{lib/webhook-handoff-inbox.mjs → dist/lib/webhook-handoff-inbox.js} +195 -167
  109. package/dist/lib/webhook-handoff-intake.d.ts +4 -0
  110. package/{lib/webhook-handoff-intake.mjs → dist/lib/webhook-handoff-intake.js} +125 -102
  111. package/dist/lib/webhook-handoff.d.ts +15 -0
  112. package/{lib/webhook-handoff.mjs → dist/lib/webhook-handoff.js} +107 -100
  113. package/dist/lib/webhook-verifiers.d.ts +20 -0
  114. package/{lib/webhook-verifiers.mjs → dist/lib/webhook-verifiers.js} +108 -104
  115. package/dist/lib/why.d.ts +9 -0
  116. package/{lib/why.mjs → dist/lib/why.js} +6 -6
  117. package/dist/log-safety.d.ts +20 -0
  118. package/dist/log-safety.js +308 -0
  119. package/dist/module-layering.d.ts +42 -0
  120. package/dist/module-layering.js +257 -0
  121. package/dist/module-shape.d.ts +47 -0
  122. package/{module-shape.mjs → dist/module-shape.js} +278 -236
  123. package/dist/naming.d.ts +49 -0
  124. package/dist/naming.js +246 -0
  125. package/dist/observability.d.ts +25 -0
  126. package/dist/observability.js +245 -0
  127. package/dist/operations.d.ts +23 -0
  128. package/{operations.mjs → dist/operations.js} +410 -332
  129. package/dist/project-graph.d.ts +9 -0
  130. package/{project-graph.mjs → dist/project-graph.js} +8 -13
  131. package/dist/projections.d.ts +11 -0
  132. package/{projections.mjs → dist/projections.js} +60 -57
  133. package/dist/query-safety.d.ts +21 -0
  134. package/{query-safety.mjs → dist/query-safety.js} +92 -108
  135. package/dist/realtime.d.ts +15 -0
  136. package/{realtime.mjs → dist/realtime.js} +108 -106
  137. package/dist/resilience.d.ts +15 -0
  138. package/dist/resilience.js +319 -0
  139. package/dist/schema-authority.d.ts +15 -0
  140. package/{schema-authority.mjs → dist/schema-authority.js} +256 -220
  141. package/dist/service-deps.d.ts +17 -0
  142. package/{service-deps.mjs → dist/service-deps.js} +133 -130
  143. package/dist/service-isolation.d.ts +8 -0
  144. package/dist/service-isolation.js +76 -0
  145. package/dist/size-budget.d.ts +9 -0
  146. package/{size-budget.mjs → dist/size-budget.js} +27 -27
  147. package/dist/sonar-parity.d.ts +5 -0
  148. package/{sonar-parity.mjs → dist/sonar-parity.js} +7 -7
  149. package/dist/spec-no-skip.d.ts +9 -0
  150. package/dist/spec-no-skip.js +81 -0
  151. package/dist/spec-quality.d.ts +10 -0
  152. package/{spec-quality.mjs → dist/spec-quality.js} +103 -87
  153. package/dist/suppression.d.ts +26 -0
  154. package/{suppression.mjs → dist/suppression.js} +30 -45
  155. package/dist/temporal.d.ts +9 -0
  156. package/{temporal.mjs → dist/temporal.js} +75 -65
  157. package/dist/test-world.d.ts +28 -0
  158. package/{test-world.mjs → dist/test-world.js} +102 -83
  159. package/dist/testing.d.ts +51 -0
  160. package/dist/testing.js +368 -0
  161. package/dist/third-party-owner.d.ts +8 -0
  162. package/{third-party-owner.mjs → dist/third-party-owner.js} +105 -91
  163. package/dist/transport.d.ts +24 -0
  164. package/{transport.mjs → dist/transport.js} +279 -240
  165. package/dist/type-safety.d.ts +25 -0
  166. package/dist/type-safety.js +297 -0
  167. package/dist/unit-spec.d.ts +30 -0
  168. package/{unit-spec.mjs → dist/unit-spec.js} +473 -399
  169. package/dist/uploads.d.ts +9 -0
  170. package/{uploads.mjs → dist/uploads.js} +62 -54
  171. package/dist/user-copy.d.ts +9 -0
  172. package/{user-copy.mjs → dist/user-copy.js} +76 -67
  173. package/dist/webhooks.d.ts +16 -0
  174. package/{webhooks.mjs → dist/webhooks.js} +243 -231
  175. package/package.json +17 -8
  176. package/runtime/knowledge/hfs/canon-pins.yaml +22 -14
  177. package/runtime/knowledge/hfs/rules.yaml +23 -0
  178. package/runtime/scripts/lib/package-at.mjs +5 -5
  179. package/async-discipline.mjs +0 -83
  180. package/comments.mjs +0 -416
  181. package/edge-hardening.mjs +0 -139
  182. package/health-ready.mjs +0 -539
  183. package/jwt-alg.mjs +0 -45
  184. package/lib/ast.mjs +0 -88
  185. package/lib/import-source.mjs +0 -104
  186. package/lib/specifier.mjs +0 -27
  187. package/lib/subject-values.mjs +0 -55
  188. package/lib/types.mjs +0 -133
  189. package/log-safety.mjs +0 -303
  190. package/module-layering.mjs +0 -270
  191. package/naming.mjs +0 -251
  192. package/observability.mjs +0 -241
  193. package/resilience.mjs +0 -304
  194. package/service-isolation.mjs +0 -75
  195. package/spec-no-skip.mjs +0 -85
  196. package/testing.mjs +0 -384
  197. package/type-safety.mjs +0 -323
@@ -0,0 +1,15 @@
1
+ import type { Recommended, RuleModule } from "./lib/rule.js";
2
+ /** A body or argument carries a declared type, never `unknown`, `any` or GraphQLJSON. */
3
+ export declare const noUntypedBody: RuleModule;
4
+ /** An open door states why it is open, from the closed `PublicReason` list of `domain/identity`. */
5
+ export declare const publicNeedsReason: RuleModule;
6
+ /** The identity enum and each public door use exactly the canon's four reasons. */
7
+ export declare const publicReasonClosed: RuleModule;
8
+ /** The rules this law contributes to the plugin. */
9
+ export declare const rules: {
10
+ "no-untyped-body": RuleModule;
11
+ "public-needs-reason": RuleModule;
12
+ "public-reason-closed": RuleModule;
13
+ };
14
+ /** Every rule starts at error: public doors and typed inputs hold the default-deny boundary. */
15
+ export declare const recommended: Recommended;
@@ -15,69 +15,77 @@
15
15
  * The `APP_GUARD` registration and the app-level guard live in the composition check, not here: a rule reading
16
16
  * one file cannot see which module the app registered.
17
17
  */
18
- import { isTransportSlot } from "./lib/transport-slots.mjs"
19
- import { decoratorName, keyName } from "./lib/ast.mjs"
20
- import { isOwnedBy, isOwnedEnumMember, isOwnedType, partsOf, typeOf } from "./lib/declared.mjs"
21
- import { hfsOf } from "./lib/hfs.mjs"
22
- import { isDeclarationFile, normalizePath } from "./lib/path.mjs"
23
- import { typed } from "./lib/types.mjs"
24
-
25
- const BODY_DECORATORS = new Set(["Body", "Args"])
26
- const PUBLIC_REASONS = new Set(["Health", "AuthHandshake", "SignedWebhook", "CatalogRead"])
27
- const REASON_WRAPPERS = new Set(["TSAsExpression", "TSTypeAssertion", "TSNonNullExpression", "TSSatisfiesExpression"])
28
-
18
+ import { isTransportSlot } from "./lib/transport-slots.js";
19
+ import { decoratorName, keyName } from "./lib/ast.js";
20
+ import { isOwnedBy, isOwnedEnumMember, isOwnedType, partsOf, typeOf } from "./lib/declared.js";
21
+ import { hfsOf } from "./lib/hfs.js";
22
+ import { isDeclarationFile, normalizePath } from "./lib/path.js";
23
+ import { typed } from "./lib/types.js";
24
+ import ts from "typescript";
25
+ import { isNode } from "./lib/rule.js";
26
+ const BODY_DECORATORS = new Set(["Body", "Args"]);
27
+ const PUBLIC_REASONS = new Set(["Health", "AuthHandshake", "SignedWebhook", "CatalogRead"]);
28
+ const REASON_WRAPPERS = new Set(["TSAsExpression", "TSTypeAssertion", "TSNonNullExpression", "TSSatisfiesExpression"]);
29
+ const isReasonWrapper = (node) => REASON_WRAPPERS.has(node.type);
29
30
  /** The reason expression supplied to a public decorator, or null when it supplies none. */
30
31
  const publicReasonOf = (node) => {
31
- const expression = node.expression
32
- const argument = expression.type === "CallExpression" ? expression.arguments[0] : undefined
33
- if (argument?.type !== "ObjectExpression") return null
34
- const property = argument.properties.find((item) => item.type === "Property" && !item.computed && keyName(item.key) === "reason")
35
- return property ? property.value : null
36
- }
37
-
32
+ const expression = node.expression;
33
+ const argument = expression.type === "CallExpression" ? expression.arguments[0] : undefined;
34
+ if (argument?.type !== "ObjectExpression")
35
+ return null;
36
+ const property = argument.properties.find((item) => item.type === "Property" && !item.computed && keyName(item.key) === "reason");
37
+ return property ? property.value : null;
38
+ };
38
39
  /** A static member name; a computed identifier is an expression rather than the member's name. */
39
40
  const staticMemberName = (node) => {
40
- if (node.computed && node.property.type !== "Literal") return null
41
- return keyName(node.property)
42
- }
43
-
41
+ if (node.computed && node.property.type !== "Literal")
42
+ return null;
43
+ return keyName(node.property);
44
+ };
44
45
  /** All declared names of the enum, including TypeScript's merged declarations. */
45
46
  const publicReasonNames = (context, node) => {
46
- const { checker, toTs } = typed(context)
47
- const declaration = toTs(node)
48
- const symbol = checker.getSymbolAtLocation(declaration.name)
49
- const members = (symbol?.declarations ?? []).flatMap((part) => part.members ?? [])
50
- return new Set(members.map((member) => member.name.text))
51
- }
52
-
47
+ const { checker, toTs } = typed(context);
48
+ const declaration = toTs(node);
49
+ const symbol = checker.getSymbolAtLocation(declaration.name);
50
+ const members = (symbol?.declarations ?? []).flatMap((part) => (ts.isEnumDeclaration(part) ? part.members : []));
51
+ return new Set(members.map((member) => ("text" in member.name ? member.name.text : undefined)));
52
+ };
53
53
  /** Reject added enum members even when the expression is an alias or a union of reasons. */
54
54
  const hasAddedPublicReason = (context, reason) => {
55
- let value = reason
56
- while (REASON_WRAPPERS.has(value.type)) value = value.expression
55
+ let value = reason;
56
+ while (isReasonWrapper(value))
57
+ value = value.expression;
57
58
  // A stale or not-yet-declared member has an error type, but its enum receiver still has an owner.
58
59
  if (value.type === "MemberExpression" && isOwnedType(context, value.object, "PublicReason", "domain", "identity")) {
59
- const name = staticMemberName(value)
60
- if (name !== null && !PUBLIC_REASONS.has(name)) return true
60
+ const name = staticMemberName(value);
61
+ if (name !== null && !PUBLIC_REASONS.has(name))
62
+ return true;
61
63
  }
62
64
  if (isOwnedEnumMember(context, reason, "PublicReason", "domain", "identity")) {
63
- return partsOf(typeOf(context, reason)).some((part) => !PUBLIC_REASONS.has(part.getSymbol()?.name))
65
+ return partsOf(typeOf(context, reason)).some((part) => {
66
+ const name = part.getSymbol()?.name;
67
+ return name === undefined || !PUBLIC_REASONS.has(name);
68
+ });
64
69
  }
65
- return false
66
- }
67
-
70
+ return false;
71
+ };
68
72
  const isUntyped = (annotation) => {
69
- if (!annotation) return true
70
- const type = annotation.typeAnnotation
71
- if (!type) return true
72
- if (["TSUnknownKeyword", "TSAnyKeyword", "TSObjectKeyword"].includes(type.type)) return true
73
- if (type.type === "TSTypeLiteral" && type.members.length === 0) return true
73
+ if (!annotation)
74
+ return true;
75
+ const type = annotation.typeAnnotation;
76
+ if (!type)
77
+ return true;
78
+ if (["TSUnknownKeyword", "TSAnyKeyword", "TSObjectKeyword"].includes(type.type))
79
+ return true;
80
+ if (type.type === "TSTypeLiteral" && type.members.length === 0)
81
+ return true;
74
82
  if (type.type === "TSTypeReference" && type.typeName.type === "Identifier" && type.typeName.name === "Record") {
75
- const value = type.typeArguments?.params?.[1] ?? type.typeParameters?.params?.[1]
76
- return value?.type === "TSUnknownKeyword" || value?.type === "TSAnyKeyword"
83
+ const legacy = Reflect.get(type, "typeParameters");
84
+ const value = type.typeArguments?.params?.[1] ?? (isNode(legacy) && legacy.type === "TSTypeParameterInstantiation" ? legacy : undefined)?.params?.[1];
85
+ return value?.type === "TSUnknownKeyword" || value?.type === "TSAnyKeyword";
77
86
  }
78
- return false
79
- }
80
-
87
+ return false;
88
+ };
81
89
  /** A body or argument carries a declared type, never `unknown`, `any` or GraphQLJSON. */
82
90
  export const noUntypedBody = {
83
91
  meta: {
@@ -91,38 +99,41 @@ export const noUntypedBody = {
91
99
  },
92
100
  },
93
101
  create(context) {
94
- const filename = normalizePath(context.filename || context.getFilename())
95
- if (isDeclarationFile(filename)) return {}
96
- const slot = hfsOf(context).slotOf(filename) ?? ""
97
- const inTransport = isTransportSlot(slot) || slot.startsWith("be.feature.transport.")
102
+ const filename = normalizePath(context.filename || context.getFilename());
103
+ if (isDeclarationFile(filename))
104
+ return {};
105
+ const slot = hfsOf(context).slotOf(filename) ?? "";
106
+ const inTransport = isTransportSlot(slot) || slot.startsWith("be.feature.transport.");
98
107
  return {
99
108
  Identifier(node) {
100
109
  if (node.name === "GraphQLJSON" && !/^Import.*Specifier$/.test(node.parent?.type ?? "")) {
101
- context.report({ node, messageId: "json" })
110
+ context.report({ node, messageId: "json" });
102
111
  }
103
112
  },
104
113
  SwitchStatement(node) {
105
- const discriminant = node.discriminant
114
+ const discriminant = node.discriminant;
106
115
  if (inTransport && discriminant.type === "MemberExpression" && keyName(discriminant.property) === "operation") {
107
- context.report({ node, messageId: "operationSwitch" })
116
+ context.report({ node, messageId: "operationSwitch" });
108
117
  }
109
118
  },
110
119
  Decorator(node) {
111
- const name = decoratorName(node)
112
- if (!BODY_DECORATORS.has(name)) return
113
- const parameter = node.parent
114
- if (!parameter) return
115
- const bound = parameter.type === "TSParameterProperty" ? parameter.parameter : parameter
116
- if (bound.type !== "Identifier" && bound.type !== "ObjectPattern" && bound.type !== "AssignmentPattern") return
117
- const annotated = bound.type === "AssignmentPattern" ? bound.left : bound
120
+ const name = decoratorName(node);
121
+ if (name === null || !BODY_DECORATORS.has(name))
122
+ return;
123
+ const parameter = node.parent;
124
+ if (!parameter)
125
+ return;
126
+ const bound = parameter.type === "TSParameterProperty" ? parameter.parameter : parameter;
127
+ if (bound.type !== "Identifier" && bound.type !== "ObjectPattern" && bound.type !== "AssignmentPattern")
128
+ return;
129
+ const annotated = bound.type === "AssignmentPattern" ? bound.left : bound;
118
130
  if (isUntyped(annotated.typeAnnotation)) {
119
- context.report({ node, messageId: "untyped", data: { decorator: name } })
131
+ context.report({ node, messageId: "untyped", data: { decorator: name } });
120
132
  }
121
133
  },
122
- }
134
+ };
123
135
  },
124
- }
125
-
136
+ };
126
137
  /** An open door states why it is open, from the closed `PublicReason` list of `domain/identity`. */
127
138
  export const publicNeedsReason = {
128
139
  meta: {
@@ -134,18 +145,20 @@ export const publicNeedsReason = {
134
145
  },
135
146
  },
136
147
  create(context) {
137
- const filename = normalizePath(context.filename || context.getFilename())
138
- if (isDeclarationFile(filename)) return {}
148
+ const filename = normalizePath(context.filename || context.getFilename());
149
+ if (isDeclarationFile(filename))
150
+ return {};
139
151
  return {
140
152
  Decorator(node) {
141
- if (decoratorName(node) !== "Public") return
142
- const reason = publicReasonOf(node)
143
- if (reason === null || !isOwnedEnumMember(context, reason, "PublicReason", "domain", "identity")) context.report({ node, messageId: "reason" })
153
+ if (decoratorName(node) !== "Public")
154
+ return;
155
+ const reason = publicReasonOf(node);
156
+ if (reason === null || !isOwnedEnumMember(context, reason, "PublicReason", "domain", "identity"))
157
+ context.report({ node, messageId: "reason" });
144
158
  },
145
- }
159
+ };
146
160
  },
147
- }
148
-
161
+ };
149
162
  /** The identity enum and each public door use exactly the canon's four reasons. */
150
163
  export const publicReasonClosed = {
151
164
  meta: {
@@ -157,36 +170,38 @@ export const publicReasonClosed = {
157
170
  },
158
171
  },
159
172
  create(context) {
160
- const filename = normalizePath(context.filename || context.getFilename())
161
- if (isDeclarationFile(filename)) return {}
162
- const inIdentity = isOwnedBy(hfsOf(context), filename, "domain", "identity")
173
+ const filename = normalizePath(context.filename || context.getFilename());
174
+ if (isDeclarationFile(filename))
175
+ return {};
176
+ const inIdentity = isOwnedBy(hfsOf(context), filename, "domain", "identity");
163
177
  return {
164
178
  TSEnumDeclaration(node) {
165
- if (!inIdentity || node.id.name !== "PublicReason") return
166
- const names = publicReasonNames(context, node)
179
+ if (!inIdentity || node.id.name !== "PublicReason")
180
+ return;
181
+ const names = publicReasonNames(context, node);
167
182
  if (names.size !== PUBLIC_REASONS.size || [...PUBLIC_REASONS].some((name) => !names.has(name))) {
168
- context.report({ node, messageId: "closed" })
183
+ context.report({ node, messageId: "closed" });
169
184
  }
170
185
  },
171
186
  Decorator(node) {
172
- if (decoratorName(node) !== "Public") return
173
- const reason = publicReasonOf(node)
174
- if (reason !== null && hasAddedPublicReason(context, reason)) context.report({ node, messageId: "closed" })
187
+ if (decoratorName(node) !== "Public")
188
+ return;
189
+ const reason = publicReasonOf(node);
190
+ if (reason !== null && hasAddedPublicReason(context, reason))
191
+ context.report({ node, messageId: "closed" });
175
192
  },
176
- }
193
+ };
177
194
  },
178
- }
179
-
195
+ };
180
196
  /** The rules this law contributes to the plugin. */
181
197
  export const rules = {
182
198
  "no-untyped-body": noUntypedBody,
183
199
  "public-needs-reason": publicNeedsReason,
184
200
  "public-reason-closed": publicReasonClosed,
185
- }
186
-
201
+ };
187
202
  /** Every rule starts at error: public doors and typed inputs hold the default-deny boundary. */
188
203
  export const recommended = {
189
204
  "starci-be/no-untyped-body": "error",
190
205
  "starci-be/public-needs-reason": "error",
191
206
  "starci-be/public-reason-closed": "error",
192
- }
207
+ };
@@ -0,0 +1,25 @@
1
+ import type { Recommended, RuleModule } from "./lib/rule.js";
2
+ /** E2E enters through production transport and never invokes an internal actor directly. */
3
+ export declare const e2eUsesProductionTransport: RuleModule;
4
+ /** A flow polls until the state settles; it never waits for a duration. */
5
+ export declare const noSleepInFlow: RuleModule;
6
+ /**
7
+ * A step asserts one outcome. A branch means the test is prepared for either, which is no assertion.
8
+ *
9
+ * The probe handed to `world.waitFor(label, probe)` is not a step: it is a polling predicate ("answer the row once it is
10
+ * there, else nothing"), and a test whose probe never becomes ready FAILS at the deadline, so no path passes by omission.
11
+ * A probe is recognised by the type of the receiver (`waitFor` on a value whose type is declared in the test world,
12
+ * slot `be.tests.world`), never by the name of a variable; a `waitFor` of any other type, and every branch outside the
13
+ * probe, is still a branch in a step.
14
+ */
15
+ export declare const noBranchInFlowStep: RuleModule;
16
+ /** A flow boots through the shared setup; it does not build its own copy of the app. */
17
+ export declare const noWiringInFlowSpec: RuleModule;
18
+ export declare const rules: {
19
+ "e2e-uses-production-transport": RuleModule;
20
+ "no-sleep-in-flow": RuleModule;
21
+ "no-branch-in-flow-step": RuleModule;
22
+ "no-wiring-in-flow-spec": RuleModule;
23
+ };
24
+ /** Every rule of this law ships at `error`. */
25
+ export declare const recommended: Recommended;