@filipebraida/adonis-function-points 0.7.0 → 0.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.
@@ -380,11 +380,26 @@ function classOfReceiver(receiver) {
380
380
  return target.isKind(SyntaxKind.Identifier) ? target.getText() : null;
381
381
  }
382
382
  if (receiver.isKind(SyntaxKind.Identifier)) {
383
- const init = (receiver.getSymbol()?.getDeclarations().find((d) => d.isKind(SyntaxKind.VariableDeclaration)))?.asKind(SyntaxKind.VariableDeclaration)?.getInitializer();
383
+ let init = (receiver.getSymbol()?.getDeclarations().find((d) => d.isKind(SyntaxKind.VariableDeclaration)))?.asKind(SyntaxKind.VariableDeclaration)?.getInitializer();
384
+ while (init?.isKind(SyntaxKind.AwaitExpression) || init?.isKind(SyntaxKind.ParenthesizedExpression)) init = init.getExpression();
384
385
  if (init?.isKind(SyntaxKind.NewExpression)) {
385
386
  const target = init.getExpression();
386
387
  return target.isKind(SyntaxKind.Identifier) ? target.getText() : null;
387
388
  }
389
+ /**
390
+ * `const svc = await app.container.make(IntakeService)`: the container hands
391
+ * back an instance of the class named — the same binding as `new`, written the
392
+ * way a controller writes it when the service has dependencies of its own. On a
393
+ * reviewed application this shape carried the write of `POST /gestao/atribuicao`
394
+ * and 31 more sites, and none was followed (plan 0.8 §B).
395
+ */
396
+ if (init?.isKind(SyntaxKind.CallExpression)) {
397
+ const callee = init.getExpression();
398
+ if (callee.isKind(SyntaxKind.PropertyAccessExpression) && callee.getName() === "make" && callee.getExpression().isKind(SyntaxKind.PropertyAccessExpression) && callee.getExpression().asKind(SyntaxKind.PropertyAccessExpression).getName() === "container") {
399
+ const made = init.getArguments()[0];
400
+ return made?.isKind(SyntaxKind.Identifier) ? made.getText() : null;
401
+ }
402
+ }
388
403
  }
389
404
  return null;
390
405
  }
@@ -1,6 +1,6 @@
1
1
  import { c as IncomparableSourcesError, d as DEFAULTS, f as defineConfig, i as measureStructure, n as parseSamples, o as FACTOR_PRESETS, r as measureConformance, s as IncomparableRulesetsError, t as calibrate, u as diffCounts } from "./calibration-DVIf8hcE.js";
2
- import { y as toPosix } from "./resolvers-DaU4uAqT.js";
3
- import { n as analyze } from "./pipeline-DO2301fV.js";
2
+ import { y as toPosix } from "./resolvers-DhJO-qvQ.js";
3
+ import { n as analyze } from "./pipeline-C6kHKB9-.js";
4
4
  import { readFile, writeFile } from "node:fs/promises";
5
5
  import path from "node:path";
6
6
  import { existsSync } from "node:fs";
@@ -40,13 +40,17 @@ export declare const RULESET = "afp";
40
40
  * Three in 1.6.0: an output's DETs are what the transaction DELIVERS (the render
41
41
  * props, the response payload, what a command prints) read back to their origin;
42
42
  * a function of the same file and a `.map(fn)` by reference are followed, so
43
- * FTRs move; and ace commands are transactions, with flags as input.
43
+ * FTRs move; and ace commands are transactions, with flags as input. One in
44
+ * 1.7.0, wide: a write binds to what the variable IS — a destructured named
45
+ * interface, a followed method's return, a relation off a row, a loop over rows,
46
+ * the guard's user, a service the container made — and a write nobody can type is
47
+ * an unresolved call instead of silence.
44
48
  *
45
49
  * Without the bump, a baseline saved by the previous version compares cleanly
46
50
  * against this one and bills the tool's own improvement as work done. The guard
47
51
  * exists for exactly that, and only this constant arms it.
48
52
  */
49
- export declare const RULESET_VERSION = "1.6.0";
53
+ export declare const RULESET_VERSION = "1.7.0";
50
54
  export type CountInput = {
51
55
  app: AppContext;
52
56
  stores: CollectedDataStore[];
package/build/src/cli.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as CoverageTooLowError } from "../pipeline-DO2301fV.js";
2
- import { a as runInventory, c as ConfigLoadError, i as runExplain, n as runCount, o as runMetrics, r as runDiff, s as printResult, t as runCalibrate } from "../runners-Dm7cWGa-.js";
1
+ import { t as CoverageTooLowError } from "../pipeline-C6kHKB9-.js";
2
+ import { a as runInventory, c as ConfigLoadError, i as runExplain, n as runCount, o as runMetrics, r as runDiff, s as printResult, t as runCalibrate } from "../runners-BpBJsGMj.js";
3
3
  import path from "node:path";
4
4
  import { existsSync, readFileSync } from "node:fs";
5
5
  import { fileURLToPath } from "node:url";
@@ -97,6 +97,13 @@ export type Behavior = {
97
97
  opaqueFields: string[];
98
98
  stores: string[];
99
99
  };
100
+ /**
101
+ * Of the stores delivered raw to a page, the columns the page reads off them
102
+ * (plan 0.8 §D). A store absent here leaves whole; one in `unreadablePages` leaves
103
+ * whole because the page could not be read, and says why.
104
+ */
105
+ pageReads: Record<string, string[]>;
106
+ unreadablePages: Record<string, string>;
100
107
  trace: TraceStep[];
101
108
  /** bodies reached, for `fp:diff` */
102
109
  scope: ScopeEntry[];
@@ -1,6 +1,7 @@
1
1
  import { Node } from 'ts-morph';
2
2
  import type { CallExpression, SourceFile } from 'ts-morph';
3
3
  import type { RelationMap, StoreSymbols } from '../detectors/lucid.js';
4
+ import type { PageRef } from './pages.js';
4
5
  import type { HandlerRef } from '../../types.js';
5
6
  /**
6
7
  * What a transaction DELIVERS — counting-decisions §6, plan 0.7 §A′.
@@ -18,7 +19,11 @@ import type { HandlerRef } from '../../types.js';
18
19
  * body returns — the graph does that in `run()`, once the bodies are known; this
19
20
  * module only says WHAT was delivered and where it came from.
20
21
  */
21
- export type Delivery =
22
+ export type Delivery = DeliveredValue & {
23
+ /** the page or template this value was handed to, when it was a render — what the page shows of it is read there */
24
+ via?: PageRef;
25
+ };
26
+ type DeliveredValue =
22
27
  /** a variable bound to a store: its columns leave */
23
28
  {
24
29
  kind: 'store';
@@ -86,3 +91,4 @@ export type BodyDeliveries = {
86
91
  * response method, and what a `return` hands back that is not one of those calls.
87
92
  */
88
93
  export declare function deliveriesIn(ctx: DeliveryContext): BodyDeliveries;
94
+ export {};
@@ -0,0 +1,44 @@
1
+ import type { Project } from 'ts-morph';
2
+ import type { RelationMap } from '../detectors/lucid.js';
3
+ import type { CollectedDataStore } from '../sources/data_stores.js';
4
+ /**
5
+ * What the page SHOWS of a store handed to it raw — plan 0.7 §B / 0.8 §D,
6
+ * counting-decisions §6.
7
+ *
8
+ * The delivery rule (§A′) says which store leaves; a transformer or a `.select()`
9
+ * says which columns. With neither, the store left whole — and the CPM defines an
10
+ * output's DETs by what the user sees. The page is TypeScript (`.tsx`) or Edge,
11
+ * and the same reader that opened the controller can open it: from the
12
+ * component's props to every member read off a row, one child component deep.
13
+ *
14
+ * Where it cannot read — a second level of components, a spread, a package's
15
+ * component, two files answering to one page name — the store leaves whole and
16
+ * the transaction is REPORTED with the reason. Overestimating in the open, never a
17
+ * floor: a floor would undercount what the user sees.
18
+ */
19
+ export type PageRef = {
20
+ engine: 'inertia' | 'edge';
21
+ page: string;
22
+ };
23
+ /** a store handed raw to a page, at a key path of its props (`vagas.data`) */
24
+ export type RawDelivery = PageRef & {
25
+ store: string;
26
+ path: string;
27
+ };
28
+ export type PageReading = {
29
+ /** store -> columns the page reads off its rows */
30
+ columns: Map<string, Set<string>>;
31
+ /** store -> why the page could not be read for it (the store then leaves whole) */
32
+ unreadable: Map<string, string>;
33
+ /** store -> members the page reads that are NOT its columns (`inventor.nomeCompleto`, computed on the way) */
34
+ unknownMembers: Map<string, Set<string>>;
35
+ };
36
+ export type PageEnvironment = {
37
+ root: string;
38
+ project: Project;
39
+ stores: Map<string, CollectedDataStore>;
40
+ relations: RelationMap;
41
+ /** the application's subpath imports (`#tecnologias/ui/components/x`), as the graph resolves them */
42
+ resolveSpecifier: (specifier: string) => string | null;
43
+ };
44
+ export declare function readPages(deliveries: RawDelivery[], env: PageEnvironment): PageReading;
@@ -1,2 +1,2 @@
1
- import { i as resolveCall, n as ignoreCalls, r as isTechnicalWrite, t as BUILTIN_CALL_RESOLVERS } from "../../../resolvers-DaU4uAqT.js";
1
+ import { i as resolveCall, n as ignoreCalls, r as isTechnicalWrite, t as BUILTIN_CALL_RESOLVERS } from "../../../resolvers-DhJO-qvQ.js";
2
2
  export { BUILTIN_CALL_RESOLVERS, ignoreCalls, isTechnicalWrite, resolveCall };
@@ -1,2 +1,2 @@
1
- import { n as analyze, t as CoverageTooLowError } from "../pipeline-DO2301fV.js";
1
+ import { n as analyze, t as CoverageTooLowError } from "../pipeline-C6kHKB9-.js";
2
2
  export { CoverageTooLowError, analyze };
@@ -144,6 +144,10 @@ export type HandlerBehavior = {
144
144
  opaqueFields: string[];
145
145
  stores: string[];
146
146
  };
147
+ /** of the stores delivered raw to a page, the columns the page reads off them (§6, plan 0.8 §D) */
148
+ pageReads?: Record<string, string[]>;
149
+ /** stores a page could not be read for, and why: they leave whole */
150
+ unreadablePages?: Record<string, string>;
147
151
  /**
148
152
  * How each store was read: rows whole, `.select()` columns, or one aggregate
149
153
  * scalar; by its own chain (`direct`) or preloaded through another store (`via`).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@filipebraida/adonis-function-points",
3
3
  "description": "Automated function point counting and code metrics for AdonisJS applications.",
4
- "version": "0.7.0",
4
+ "version": "0.8.0",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },