postgresai 0.16.0-rc.4 → 0.16.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 (85) hide show
  1. package/README.md +154 -0
  2. package/dist/bin/postgres-ai.js +2911 -255
  3. package/package.json +12 -3
  4. package/schemas/A002.schema.json +63 -0
  5. package/schemas/A003.schema.json +73 -0
  6. package/schemas/A004.schema.json +81 -0
  7. package/schemas/A007.schema.json +71 -0
  8. package/schemas/A013.schema.json +61 -0
  9. package/schemas/D001.schema.json +71 -0
  10. package/schemas/D004.schema.json +136 -0
  11. package/schemas/F001.schema.json +73 -0
  12. package/schemas/F002.schema.json +108 -0
  13. package/schemas/F003.schema.json +138 -0
  14. package/schemas/F004.schema.json +125 -0
  15. package/schemas/F005.schema.json +131 -0
  16. package/schemas/F009.schema.json +155 -0
  17. package/schemas/G001.schema.json +135 -0
  18. package/schemas/G003.schema.json +90 -0
  19. package/schemas/H001.schema.json +141 -0
  20. package/schemas/H002.schema.json +129 -0
  21. package/schemas/H004.schema.json +128 -0
  22. package/schemas/I001.schema.json +149 -0
  23. package/schemas/K001.schema.json +161 -0
  24. package/schemas/K003.schema.json +163 -0
  25. package/schemas/K004.schema.json +110 -0
  26. package/schemas/K005.schema.json +110 -0
  27. package/schemas/K006.schema.json +110 -0
  28. package/schemas/K007.schema.json +110 -0
  29. package/schemas/K008.schema.json +110 -0
  30. package/schemas/M001.schema.json +119 -0
  31. package/schemas/M002.schema.json +110 -0
  32. package/schemas/M003.schema.json +128 -0
  33. package/schemas/N001.schema.json +161 -0
  34. package/schemas/query.schema.json +62 -0
  35. package/CHANGELOG.md +0 -11
  36. package/bin/postgres-ai.ts +0 -5578
  37. package/bun.lock +0 -258
  38. package/bunfig.toml +0 -20
  39. package/lib/aas-onboard.ts +0 -251
  40. package/lib/auth-server.ts +0 -285
  41. package/lib/checkup-api.ts +0 -526
  42. package/lib/checkup-dictionary.ts +0 -103
  43. package/lib/checkup-summary.ts +0 -338
  44. package/lib/checkup.ts +0 -2261
  45. package/lib/config.ts +0 -171
  46. package/lib/init.ts +0 -1152
  47. package/lib/instances.ts +0 -245
  48. package/lib/issues.ts +0 -1060
  49. package/lib/mcp-server.ts +0 -667
  50. package/lib/metrics-loader.ts +0 -134
  51. package/lib/pkce.ts +0 -79
  52. package/lib/reports.ts +0 -373
  53. package/lib/storage.ts +0 -367
  54. package/lib/supabase.ts +0 -826
  55. package/lib/util.ts +0 -134
  56. package/packages/postgres-ai/README.md +0 -26
  57. package/packages/postgres-ai/bin/postgres-ai.js +0 -27
  58. package/packages/postgres-ai/package.json +0 -27
  59. package/scripts/embed-checkup-dictionary.ts +0 -115
  60. package/scripts/embed-metrics.ts +0 -160
  61. package/scripts/generate-release-notes.ts +0 -668
  62. package/test/PERMISSION_CHECK_TEST_SUMMARY.md +0 -139
  63. package/test/aas-onboard.test.ts +0 -301
  64. package/test/auth.test.ts +0 -287
  65. package/test/checkup.integration.test.ts +0 -413
  66. package/test/checkup.test.ts +0 -3626
  67. package/test/compose-cmd.test.ts +0 -120
  68. package/test/config-consistency.test.ts +0 -352
  69. package/test/init.integration.test.ts +0 -438
  70. package/test/init.test.ts +0 -1816
  71. package/test/issues.cli.test.ts +0 -1162
  72. package/test/issues.test.ts +0 -456
  73. package/test/mcp-server.test.ts +0 -2530
  74. package/test/monitoring.test.ts +0 -746
  75. package/test/permission-check-sql.test.ts +0 -116
  76. package/test/reports.cli.test.ts +0 -793
  77. package/test/reports.test.ts +0 -977
  78. package/test/schema-validation.test.ts +0 -231
  79. package/test/storage.test.ts +0 -935
  80. package/test/supabase.test.ts +0 -709
  81. package/test/targets-add-config.test.ts +0 -28
  82. package/test/test-utils.ts +0 -190
  83. package/test/upgrade.test.ts +0 -1056
  84. package/test/util.test.ts +0 -44
  85. package/tsconfig.json +0 -20
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "F001 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "F001" },
14
+ "checkTitle": { "const": "Autovacuum: current settings" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "setting": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "required": ["setting", "unit", "category", "context", "vartype", "pretty_value"],
48
+ "properties": {
49
+ "setting": { "type": "string" },
50
+ "unit": { "type": "string" },
51
+ "category": { "type": "string" },
52
+ "context": { "type": "string" },
53
+ "vartype": { "type": "string" },
54
+ "pretty_value": { "type": "string" }
55
+ }
56
+ },
57
+ "data": {
58
+ "type": "object",
59
+ "additionalProperties": { "$ref": "#/$defs/setting" }
60
+ },
61
+ "nodeResult": {
62
+ "type": "object",
63
+ "additionalProperties": false,
64
+ "required": ["data"],
65
+ "properties": {
66
+ "data": { "$ref": "#/$defs/data" },
67
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
68
+ }
69
+ }
70
+ }
71
+ }
72
+
73
+
@@ -0,0 +1,108 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "F002 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "version": { "type": ["string", "null"] },
9
+ "build_ts": { "type": ["string", "null"] },
10
+ "contract_version": { "type": ["string", "null"] },
11
+ "generation_mode": { "type": ["string", "null"], "enum": ["full", "express", null] },
12
+ "summary": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": ["status", "message"],
16
+ "properties": {
17
+ "status": { "enum": ["ok", "warning", "info"] },
18
+ "message": { "type": "string" }
19
+ }
20
+ },
21
+ "checkId": { "const": "F002" },
22
+ "checkTitle": { "const": "Autovacuum: transaction ID and MultiXact wraparound" },
23
+ "timestamptz": { "type": "string" },
24
+ "nodes": { "$ref": "#/$defs/nodes" },
25
+ "results": { "type": "object", "minProperties": 1, "additionalProperties": { "$ref": "#/$defs/nodeResult" } }
26
+ },
27
+ "$defs": {
28
+ "nodes": {
29
+ "type": "object", "additionalProperties": false, "required": ["primary", "standbys"],
30
+ "properties": { "primary": { "type": "string" }, "standbys": { "type": "array", "items": { "type": "string" } } }
31
+ },
32
+ "postgresVersion": {
33
+ "type": "object", "additionalProperties": false,
34
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
35
+ "properties": {
36
+ "version": { "type": "string" }, "server_version_num": { "type": "string" },
37
+ "server_major_ver": { "type": "string" }, "server_minor_ver": { "type": "string" }
38
+ }
39
+ },
40
+ "settings": {
41
+ "type": "object", "additionalProperties": false,
42
+ "required": ["autovacuum_freeze_max_age", "vacuum_freeze_min_age", "vacuum_freeze_table_age", "autovacuum_multixact_freeze_max_age", "vacuum_multixact_freeze_min_age", "vacuum_multixact_freeze_table_age", "vacuum_failsafe_age", "vacuum_multixact_failsafe_age"],
43
+ "properties": {
44
+ "autovacuum_freeze_max_age": { "type": "number" }, "vacuum_freeze_min_age": { "type": "number" },
45
+ "vacuum_freeze_table_age": { "type": "number" }, "autovacuum_multixact_freeze_max_age": { "type": "number" },
46
+ "vacuum_multixact_freeze_min_age": { "type": "number" }, "vacuum_multixact_freeze_table_age": { "type": "number" },
47
+ "vacuum_failsafe_age": { "type": ["number", "null"] }, "vacuum_multixact_failsafe_age": { "type": ["number", "null"] }
48
+ }
49
+ },
50
+ "risk": {
51
+ "type": "object", "additionalProperties": false,
52
+ "required": ["age", "emergency_age", "failsafe_age", "pct_towards_wraparound", "pct_towards_emergency", "pct_towards_failsafe", "severity"],
53
+ "properties": {
54
+ "age": { "type": "number" }, "emergency_age": { "type": "number" }, "failsafe_age": { "type": ["number", "null"] },
55
+ "pct_towards_wraparound": { "type": "number" }, "pct_towards_emergency": { "type": "number" },
56
+ "pct_towards_failsafe": { "type": ["number", "null"] },
57
+ "severity": { "type": "string", "enum": ["info", "warning", "high", "critical"] }
58
+ }
59
+ },
60
+ "database": {
61
+ "type": "object", "additionalProperties": false, "required": ["database_name", "xid", "multixact"],
62
+ "properties": { "database_name": { "type": "string" }, "xid": { "$ref": "#/$defs/risk" }, "multixact": { "$ref": "#/$defs/risk" } }
63
+ },
64
+ "table": {
65
+ "type": "object", "additionalProperties": false,
66
+ "required": ["database_name", "schema_name", "table_name", "ranked_by", "table_size_bytes", "table_size_pretty", "xid", "multixact"],
67
+ "properties": {
68
+ "database_name": { "type": "string" }, "schema_name": { "type": "string" }, "table_name": { "type": "string" },
69
+ "ranked_by": { "type": "array", "items": { "type": "string", "enum": ["xid", "multixact"] } },
70
+ "table_size_bytes": { "type": "number" }, "table_size_pretty": { "type": "string" },
71
+ "xid": { "$ref": "#/$defs/risk" }, "multixact": { "$ref": "#/$defs/risk" }
72
+ }
73
+ },
74
+ "thresholds": {
75
+ "type": "object", "additionalProperties": false,
76
+ "required": ["wraparound_limit", "critical_age", "failsafe_high_pct", "table_limit_per_age"],
77
+ "properties": {
78
+ "wraparound_limit": { "type": "number" }, "critical_age": { "type": "number" },
79
+ "failsafe_high_pct": { "type": "number" }, "table_limit_per_age": { "type": "integer" }
80
+ }
81
+ },
82
+ "multixactSize": {
83
+ "type": "object", "additionalProperties": false, "required": ["bytes", "size_pretty", "status_code"],
84
+ "properties": {
85
+ "bytes": { "type": ["number", "null"] }, "size_pretty": { "type": ["string", "null"] },
86
+ "status_code": { "type": "integer" }
87
+ }
88
+ },
89
+ "data": {
90
+ "type": "object", "additionalProperties": false,
91
+ "required": ["settings", "settings_available", "databases", "tables", "multixact_size", "severity", "thresholds", "conclusions", "recommendations"],
92
+ "properties": {
93
+ "settings": { "$ref": "#/$defs/settings" }, "settings_available": { "type": "boolean" },
94
+ "databases": { "type": "array", "items": { "$ref": "#/$defs/database" } },
95
+ "tables": { "type": "array", "items": { "$ref": "#/$defs/table" } },
96
+ "multixact_size": { "$ref": "#/$defs/multixactSize" },
97
+ "severity": { "type": "string", "enum": ["info", "warning", "high", "critical"] },
98
+ "thresholds": { "$ref": "#/$defs/thresholds" },
99
+ "conclusions": { "type": "array", "items": { "type": "string" } },
100
+ "recommendations": { "type": "array", "items": { "type": "string" } }
101
+ }
102
+ },
103
+ "nodeResult": {
104
+ "type": "object", "additionalProperties": false, "required": ["data"],
105
+ "properties": { "data": { "$ref": "#/$defs/data" }, "postgres_version": { "$ref": "#/$defs/postgresVersion" } }
106
+ }
107
+ }
108
+ }
@@ -0,0 +1,138 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "F003 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "F003" },
14
+ "checkTitle": { "const": "Autovacuum: dead tuples" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "deadTuplesTable": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "required": [
48
+ "schema_name",
49
+ "table_name",
50
+ "n_live_tup",
51
+ "n_dead_tup",
52
+ "dead_pct",
53
+ "last_autovacuum",
54
+ "last_autovacuum_epoch",
55
+ "last_vacuum",
56
+ "last_vacuum_epoch",
57
+ "autovacuum_count",
58
+ "vacuum_count",
59
+ "autovacuum_disabled",
60
+ "table_size_bytes",
61
+ "table_size_pretty",
62
+ "exceeds_dead_tuple_thresholds",
63
+ "autovacuum_disabled_flagged"
64
+ ],
65
+ "properties": {
66
+ "schema_name": { "type": "string" },
67
+ "table_name": { "type": "string" },
68
+ "n_live_tup": { "type": "number" },
69
+ "n_dead_tup": { "type": "number" },
70
+ "dead_pct": { "type": "number" },
71
+ "last_autovacuum": { "type": ["string", "null"] },
72
+ "last_autovacuum_epoch": { "type": "number" },
73
+ "last_vacuum": { "type": ["string", "null"] },
74
+ "last_vacuum_epoch": { "type": "number" },
75
+ "autovacuum_count": { "type": "number" },
76
+ "vacuum_count": { "type": "number" },
77
+ "autovacuum_disabled": { "type": "boolean" },
78
+ "table_size_bytes": { "type": "number" },
79
+ "table_size_pretty": { "type": "string" },
80
+ "exceeds_dead_tuple_thresholds": { "type": "boolean" },
81
+ "autovacuum_disabled_flagged": { "type": "boolean" }
82
+ }
83
+ },
84
+ "thresholds": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": ["dead_tuples_min", "dead_pct_min", "autovacuum_disabled_min_rows"],
88
+ "properties": {
89
+ "dead_tuples_min": { "type": "number" },
90
+ "dead_pct_min": { "type": "number" },
91
+ "autovacuum_disabled_min_rows": { "type": "number" }
92
+ }
93
+ },
94
+ "dbEntry": {
95
+ "type": "object",
96
+ "additionalProperties": false,
97
+ "required": [
98
+ "dead_tuples_tables",
99
+ "total_count",
100
+ "flagged_count",
101
+ "autovacuum_disabled_count",
102
+ "autovacuum_disabled_flagged_count",
103
+ "total_dead_tuples",
104
+ "thresholds",
105
+ "conclusions",
106
+ "recommendations",
107
+ "database_size_bytes",
108
+ "database_size_pretty"
109
+ ],
110
+ "properties": {
111
+ "dead_tuples_tables": { "type": "array", "items": { "$ref": "#/$defs/deadTuplesTable" } },
112
+ "total_count": { "type": "integer" },
113
+ "flagged_count": { "type": "integer" },
114
+ "autovacuum_disabled_count": { "type": "integer" },
115
+ "autovacuum_disabled_flagged_count": { "type": "integer" },
116
+ "total_dead_tuples": { "type": "number" },
117
+ "thresholds": { "$ref": "#/$defs/thresholds" },
118
+ "conclusions": { "type": "array", "items": { "type": "string" } },
119
+ "recommendations": { "type": "array", "items": { "type": "string" } },
120
+ "database_size_bytes": { "type": "number" },
121
+ "database_size_pretty": { "type": "string" }
122
+ }
123
+ },
124
+ "data": {
125
+ "type": "object",
126
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
127
+ },
128
+ "nodeResult": {
129
+ "type": "object",
130
+ "additionalProperties": false,
131
+ "required": ["data"],
132
+ "properties": {
133
+ "data": { "$ref": "#/$defs/data" },
134
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
135
+ }
136
+ }
137
+ }
138
+ }
@@ -0,0 +1,125 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "F004 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "F004" },
14
+ "checkTitle": { "const": "Autovacuum: heap bloat (estimated)" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "bloatedTable": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "required": [
48
+ "schema_name",
49
+ "table_name",
50
+ "real_size",
51
+ "extra_size",
52
+ "extra_pct",
53
+ "bloat_size",
54
+ "bloat_pct",
55
+ "fillfactor",
56
+ "last_vacuum",
57
+ "last_vacuum_epoch",
58
+ "real_size_pretty",
59
+ "extra_size_pretty",
60
+ "bloat_size_pretty"
61
+ ],
62
+ "properties": {
63
+ "schema_name": { "type": "string" },
64
+ "table_name": { "type": "string" },
65
+ "real_size": { "type": "number" },
66
+ "extra_size": { "type": "number" },
67
+ "extra_pct": { "type": "number" },
68
+ "bloat_size": { "type": "number" },
69
+ "bloat_pct": { "type": "number" },
70
+ "fillfactor": { "type": "number" },
71
+ "last_vacuum": { "type": ["string", "null"] },
72
+ "last_vacuum_epoch": { "type": "number" },
73
+ "real_size_pretty": { "type": "string" },
74
+ "extra_size_pretty": { "type": "string" },
75
+ "bloat_size_pretty": { "type": "string" }
76
+ }
77
+ },
78
+ "dbEntry": {
79
+ "type": "object",
80
+ "additionalProperties": false,
81
+ "required": [
82
+ "bloated_tables",
83
+ "total_count",
84
+ "total_bloat_size_bytes",
85
+ "total_bloat_size_pretty",
86
+ "database_size_bytes",
87
+ "database_size_pretty"
88
+ ],
89
+ "properties": {
90
+ "status": { "$ref": "#/$defs/status" },
91
+ "bloated_tables": { "type": "array", "items": { "$ref": "#/$defs/bloatedTable" } },
92
+ "total_count": { "type": "integer" },
93
+ "total_bloat_size_bytes": { "type": "number" },
94
+ "total_bloat_size_pretty": { "type": "string" },
95
+ "database_size_bytes": { "type": "number" },
96
+ "database_size_pretty": { "type": "string" }
97
+ }
98
+ },
99
+ "status": {
100
+ "type": "object",
101
+ "additionalProperties": false,
102
+ "required": ["ok", "reason", "error"],
103
+ "properties": {
104
+ "ok": { "type": "boolean" },
105
+ "reason": {
106
+ "enum": [null, "missing_schema", "missing_view", "missing_grant", "query_error"]
107
+ },
108
+ "error": { "type": ["string", "null"] }
109
+ }
110
+ },
111
+ "data": {
112
+ "type": "object",
113
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
114
+ },
115
+ "nodeResult": {
116
+ "type": "object",
117
+ "additionalProperties": false,
118
+ "required": ["data"],
119
+ "properties": {
120
+ "data": { "$ref": "#/$defs/data" },
121
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
122
+ }
123
+ }
124
+ }
125
+ }
@@ -0,0 +1,131 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "F005 report schema",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["checkId", "checkTitle", "timestamptz", "nodes", "results"],
7
+ "properties": {
8
+ "contract_version": { "type": ["string", "null"] },
9
+ "summary": { "type": "object", "additionalProperties": false, "required": ["status", "message"], "properties": { "status": { "enum": ["ok", "warning", "info"] }, "message": { "type": "string" } } },
10
+ "version": { "type": ["string", "null"] },
11
+ "build_ts": { "type": ["string", "null"] },
12
+ "generation_mode": { "type": ["string", "null"] },
13
+ "checkId": { "const": "F005" },
14
+ "checkTitle": { "const": "Autovacuum: index bloat (estimated)" },
15
+ "timestamptz": { "type": "string" },
16
+ "nodes": { "$ref": "#/$defs/nodes" },
17
+ "results": {
18
+ "type": "object",
19
+ "minProperties": 1,
20
+ "additionalProperties": { "$ref": "#/$defs/nodeResult" }
21
+ }
22
+ },
23
+ "$defs": {
24
+ "nodes": {
25
+ "type": "object",
26
+ "additionalProperties": false,
27
+ "required": ["primary", "standbys"],
28
+ "properties": {
29
+ "primary": { "type": "string" },
30
+ "standbys": { "type": "array", "items": { "type": "string" } }
31
+ }
32
+ },
33
+ "postgresVersion": {
34
+ "type": "object",
35
+ "additionalProperties": false,
36
+ "required": ["version", "server_version_num", "server_major_ver", "server_minor_ver"],
37
+ "properties": {
38
+ "version": { "type": "string" },
39
+ "server_version_num": { "type": "string" },
40
+ "server_major_ver": { "type": "string" },
41
+ "server_minor_ver": { "type": "string" }
42
+ }
43
+ },
44
+ "bloatedIndex": {
45
+ "type": "object",
46
+ "additionalProperties": false,
47
+ "required": [
48
+ "schema_name",
49
+ "table_name",
50
+ "index_name",
51
+ "real_size",
52
+ "table_size",
53
+ "extra_size",
54
+ "extra_pct",
55
+ "bloat_size",
56
+ "bloat_pct",
57
+ "fillfactor",
58
+ "last_vacuum",
59
+ "last_vacuum_epoch",
60
+ "real_size_pretty",
61
+ "table_size_pretty",
62
+ "extra_size_pretty",
63
+ "bloat_size_pretty"
64
+ ],
65
+ "properties": {
66
+ "schema_name": { "type": "string" },
67
+ "table_name": { "type": "string" },
68
+ "index_name": { "type": "string" },
69
+ "real_size": { "type": "number" },
70
+ "table_size": { "type": "number" },
71
+ "extra_size": { "type": "number" },
72
+ "extra_pct": { "type": "number" },
73
+ "bloat_size": { "type": "number" },
74
+ "bloat_pct": { "type": "number" },
75
+ "fillfactor": { "type": "number" },
76
+ "last_vacuum": { "type": ["string", "null"] },
77
+ "last_vacuum_epoch": { "type": "number" },
78
+ "real_size_pretty": { "type": "string" },
79
+ "table_size_pretty": { "type": "string" },
80
+ "extra_size_pretty": { "type": "string" },
81
+ "bloat_size_pretty": { "type": "string" }
82
+ }
83
+ },
84
+ "dbEntry": {
85
+ "type": "object",
86
+ "additionalProperties": false,
87
+ "required": [
88
+ "bloated_indexes",
89
+ "total_count",
90
+ "total_bloat_size_bytes",
91
+ "total_bloat_size_pretty",
92
+ "database_size_bytes",
93
+ "database_size_pretty"
94
+ ],
95
+ "properties": {
96
+ "status": { "$ref": "#/$defs/status" },
97
+ "bloated_indexes": { "type": "array", "items": { "$ref": "#/$defs/bloatedIndex" } },
98
+ "total_count": { "type": "integer" },
99
+ "total_bloat_size_bytes": { "type": "number" },
100
+ "total_bloat_size_pretty": { "type": "string" },
101
+ "database_size_bytes": { "type": "number" },
102
+ "database_size_pretty": { "type": "string" }
103
+ }
104
+ },
105
+ "status": {
106
+ "type": "object",
107
+ "additionalProperties": false,
108
+ "required": ["ok", "reason", "error"],
109
+ "properties": {
110
+ "ok": { "type": "boolean" },
111
+ "reason": {
112
+ "enum": [null, "missing_schema", "missing_view", "missing_grant", "query_error"]
113
+ },
114
+ "error": { "type": ["string", "null"] }
115
+ }
116
+ },
117
+ "data": {
118
+ "type": "object",
119
+ "additionalProperties": { "$ref": "#/$defs/dbEntry" }
120
+ },
121
+ "nodeResult": {
122
+ "type": "object",
123
+ "additionalProperties": false,
124
+ "required": ["data"],
125
+ "properties": {
126
+ "data": { "$ref": "#/$defs/data" },
127
+ "postgres_version": { "$ref": "#/$defs/postgresVersion" }
128
+ }
129
+ }
130
+ }
131
+ }