@filipebraida/adonis-function-points 0.4.0 → 0.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 (34) hide show
  1. package/CHANGELOG.md +155 -0
  2. package/README.md +101 -281
  3. package/build/{calibration-8eV8CEix.js → calibration-DVIf8hcE.js} +42 -3
  4. package/build/commands/main.js +6 -6
  5. package/build/{fp_calibrate-DLZP5bUp.js → fp_calibrate-EAuAtdbq.js} +1 -1
  6. package/build/{fp_count-DNSwaLUD.js → fp_count-CZ0cUUBQ.js} +1 -1
  7. package/build/{fp_diff-CCKxqGKh.js → fp_diff-BTg_LX0r.js} +1 -1
  8. package/build/{fp_explain-Dpiby5Qx.js → fp_explain-D6QvDLKQ.js} +1 -1
  9. package/build/{fp_inventory-DHwZzEQf.js → fp_inventory-C43fU39x.js} +1 -1
  10. package/build/{fp_metrics-M84qLYaE.js → fp_metrics-DEMPk4xC.js} +1 -1
  11. package/build/index.d.ts +8 -4
  12. package/build/index.js +4 -4
  13. package/build/{pipeline-Dm9KvUvF.js → pipeline-Cq4dNTNE.js} +841 -264
  14. package/build/{resolvers-vMahHkAd.js → resolvers-DlKJOZnk.js} +373 -63
  15. package/build/{runners-DetZGfh5.js → runners-FYmPIPub.js} +12 -4
  16. package/build/src/albrecht/counter.d.ts +31 -5
  17. package/build/src/albrecht/data_functions.d.ts +49 -3
  18. package/build/src/albrecht/diff.d.ts +27 -0
  19. package/build/src/albrecht/index.d.ts +1 -0
  20. package/build/src/albrecht/opaque.d.ts +90 -0
  21. package/build/src/albrecht/technical_filter.d.ts +18 -11
  22. package/build/src/albrecht/transactional_functions.d.ts +7 -0
  23. package/build/src/cli.js +2 -2
  24. package/build/src/define_config.d.ts +55 -57
  25. package/build/src/inventory/graph/call_graph.d.ts +39 -0
  26. package/build/src/inventory/graph/output_fields.d.ts +99 -0
  27. package/build/src/inventory/paths.d.ts +3 -0
  28. package/build/src/inventory/resolvers/index.d.ts +28 -0
  29. package/build/src/inventory/resolvers/index.js +2 -2
  30. package/build/src/inventory/resolvers/types.d.ts +19 -0
  31. package/build/src/pipeline.js +1 -1
  32. package/build/src/types.d.ts +32 -1
  33. package/build/stubs/config.stub +29 -16
  34. package/package.json +1 -1
@@ -45,6 +45,17 @@ export type Attribute = {
45
45
  name: string;
46
46
  type?: string;
47
47
  isIdentifier: boolean;
48
+ /**
49
+ * Maintained by the framework, not by the user: `autoCreate` / `autoUpdate`
50
+ * on a `@column.dateTime()`. Not a DET, on the same ground as the identifier —
51
+ * counting-decisions §6.
52
+ */
53
+ system?: boolean;
54
+ /**
55
+ * `serializeAs: null`: Lucid never serialises it, so it never leaves on an
56
+ * output. Still a DET of the data function — counting-decisions §6.
57
+ */
58
+ hidden?: boolean;
48
59
  provenance: Provenance;
49
60
  };
50
61
  /**
@@ -84,6 +95,8 @@ export type HandlerBehavior = {
84
95
  writes: boolean;
85
96
  /** DataStores reached (ids) */
86
97
  touches: string[];
98
+ /** of those, the ones this transaction writes — §6.5.4 is per store, not per request */
99
+ writtenStores: string[];
87
100
  /** declared input fields (validators) */
88
101
  inputFields: Field[];
89
102
  /**
@@ -103,8 +116,26 @@ export type HandlerBehavior = {
103
116
  requestFields: Field[];
104
117
  /** the transaction reads the request in a way that enumerates nothing */
105
118
  opaqueRequest: boolean;
106
- /** declared output fields (transformers, DTOs) */
119
+ /**
120
+ * What a transformer on the path emits — counting-decisions §6. Empty means no
121
+ * transformer was reached and the output is counted from the stores' columns.
122
+ */
107
123
  outputFields: Field[];
124
+ /** output spreads the analysis could not read: 1 DET each, a floor */
125
+ opaqueOutputFields: Field[];
126
+ /** stores a transformer on the path is for: their keys leave, not their columns */
127
+ transformedStores: string[];
128
+ /**
129
+ * How each store was read: rows whole, `.select()` columns, or one aggregate
130
+ * scalar; by its own chain (`direct`) or preloaded through another store (`via`).
131
+ */
132
+ outputReads: Record<string, {
133
+ whole: boolean;
134
+ selected: string[];
135
+ aggregate: boolean;
136
+ direct: boolean;
137
+ via: string[];
138
+ }>;
108
139
  /** path walked through the call graph — what `fp:explain` prints */
109
140
  trace: TraceStep[];
110
141
  /** calls no resolver knew how to follow */
@@ -24,31 +24,44 @@ export default defineConfig({
24
24
  business: [],
25
25
  },
26
26
 
27
- /** Logical subgroups (RET). `constant` pins it at 1, which is honest. */
28
- retStrategy: 'constant',
27
+ /**
28
+ * How tables fold into data functions (RET). `usage`, the default: a
29
+ * `hasMany`/`hasOne` child no application code addresses directly is a RET of
30
+ * its parent, not an ILF of its own. `none` keeps every table apart, at RET 1,
31
+ * to compare against a count made before 0.6.0.
32
+ */
33
+ // dataFunctions: { grouping: 'usage' },
29
34
 
30
- /** How far to follow the call graph from the handler. */
31
- maxDepth: 3,
35
+ /** How far to follow the call graph from the handler (default 3). */
36
+ // maxDepth: 3,
32
37
 
33
38
  /** Refuses to emit a count if tracing covers less than this. */
34
39
  minCoverage: 0.85,
35
40
 
36
41
  /**
37
- * Facts static analysis cannot read, declared with a required justification.
38
- *
39
- * The case this exists for: fields the user fills that live in a JSON column
40
- * whose schema is stored in the database. See counting-decisions §8 — and use
41
- * it sparingly, because `fp:count` reports what share of the total came from
42
- * here.
42
+ * DETs static analysis cannot read — a JSON column, an open validator field —
43
+ * count 1 each, a floor, and `fp:count` names them. Answer them here by ORIGIN,
44
+ * with a required justification, and the answer reaches every function carrying
45
+ * the DET. See counting-decisions §8; use it sparingly, because `fp:count`
46
+ * reports what share of the total came from here.
43
47
  */
44
- // overrides: {
45
- // // one schema, or several whose fields are unioned by leaf path
46
- // Form: { detFromSchema: ['intakeSchema', 'reviewSchema'], reason: 'one per template' },
48
+ // opaque: {
49
+ // // the fields live in a JSON Schema declared in the code: name it (or several,
50
+ // // unioned by leaf path), and the count keeps coming from the code
51
+ // 'Survey.answers': { schemas: ['surveySchema', 'feedbackSchema'], reason: 'one schema per survey template' },
52
+ // 'answerSurveyValidator.answers': { schemas: 'surveySchema', reason: 'the same form, submitted' },
47
53
  //
48
54
  // // 1 DET is a floor, and `fp:count` says so on every run. When 1 IS the right
49
- // // answer, record that someone checked — otherwise the warning becomes noise
50
- // // the team learns to scroll past. It moves no number.
51
- // Petition: { opaqueReviewed: ['schema', 'uiSchema'], reason: 'metadata; one field each' },
55
+ // // answer, record that someone checked — it moves no number
56
+ // 'Attachment.metadata': { reviewed: true, reason: 'size and mime type: one bag, one field' },
57
+ // },
58
+
59
+ /**
60
+ * A declared NUMBER for one function — the last resort, for a schema that lives
61
+ * only in the database. It freezes: prefer `opaque.<origin>.schemas`.
62
+ */
63
+ // overrides: {
64
+ // 'POST /surveys/:id/answers': { det: 42, reason: 'the form has 42 fields, defined in the database' },
52
65
  // },
53
66
 
54
67
  /**
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.4.0",
4
+ "version": "0.6.0",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },