@marinoscar/platform-contract 0.0.0-stage → 0.1.0-next.3
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 +33 -0
- package/LICENSE +21 -0
- package/README.md +145 -2
- package/dist/cjs/doctor/constants.d.ts +59 -0
- package/dist/cjs/doctor/constants.d.ts.map +1 -0
- package/dist/cjs/doctor/constants.js +57 -0
- package/dist/cjs/doctor/constants.js.map +1 -0
- package/dist/cjs/doctor/index.d.ts +5 -0
- package/dist/cjs/doctor/index.d.ts.map +1 -0
- package/dist/cjs/doctor/index.js +24 -0
- package/dist/cjs/doctor/index.js.map +1 -0
- package/dist/cjs/doctor/schemas.d.ts +186 -0
- package/dist/cjs/doctor/schemas.d.ts.map +1 -0
- package/dist/cjs/doctor/schemas.js +183 -0
- package/dist/cjs/doctor/schemas.js.map +1 -0
- package/dist/cjs/index.d.ts +13 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +16 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/telemetry/assistant.d.ts +173 -0
- package/dist/cjs/telemetry/assistant.d.ts.map +1 -0
- package/dist/cjs/telemetry/assistant.js +43 -0
- package/dist/cjs/telemetry/assistant.js.map +1 -0
- package/dist/cjs/telemetry/config.d.ts +92 -0
- package/dist/cjs/telemetry/config.d.ts.map +1 -0
- package/dist/cjs/telemetry/config.js +101 -0
- package/dist/cjs/telemetry/config.js.map +1 -0
- package/dist/cjs/telemetry/connection.d.ts +355 -0
- package/dist/cjs/telemetry/connection.d.ts.map +1 -0
- package/dist/cjs/telemetry/connection.js +451 -0
- package/dist/cjs/telemetry/connection.js.map +1 -0
- package/dist/cjs/telemetry/constants.d.ts +442 -0
- package/dist/cjs/telemetry/constants.d.ts.map +1 -0
- package/dist/cjs/telemetry/constants.js +400 -0
- package/dist/cjs/telemetry/constants.js.map +1 -0
- package/dist/cjs/telemetry/dashboard.d.ts +826 -0
- package/dist/cjs/telemetry/dashboard.d.ts.map +1 -0
- package/dist/cjs/telemetry/dashboard.js +697 -0
- package/dist/cjs/telemetry/dashboard.js.map +1 -0
- package/dist/cjs/telemetry/enum.d.ts +5 -0
- package/dist/cjs/telemetry/enum.d.ts.map +1 -0
- package/dist/cjs/telemetry/enum.js +12 -0
- package/dist/cjs/telemetry/enum.js.map +1 -0
- package/dist/cjs/telemetry/index.d.ts +5 -0
- package/dist/cjs/telemetry/index.d.ts.map +1 -0
- package/dist/cjs/telemetry/index.js +128 -0
- package/dist/cjs/telemetry/index.js.map +1 -0
- package/dist/cjs/telemetry/query.d.ts +147 -0
- package/dist/cjs/telemetry/query.d.ts.map +1 -0
- package/dist/cjs/telemetry/query.js +141 -0
- package/dist/cjs/telemetry/query.js.map +1 -0
- package/dist/cjs/telemetry/schemas.d.ts +17 -0
- package/dist/cjs/telemetry/schemas.d.ts.map +1 -0
- package/dist/cjs/telemetry/schemas.js +89 -0
- package/dist/cjs/telemetry/schemas.js.map +1 -0
- package/dist/cjs/telemetry/settings.d.ts +65 -0
- package/dist/cjs/telemetry/settings.d.ts.map +1 -0
- package/dist/cjs/telemetry/settings.js +77 -0
- package/dist/cjs/telemetry/settings.js.map +1 -0
- package/dist/cjs/telemetry/stack.d.ts +87 -0
- package/dist/cjs/telemetry/stack.d.ts.map +1 -0
- package/dist/cjs/telemetry/stack.js +93 -0
- package/dist/cjs/telemetry/stack.js.map +1 -0
- package/dist/cjs/telemetry/status.d.ts +65 -0
- package/dist/cjs/telemetry/status.d.ts.map +1 -0
- package/dist/cjs/telemetry/status.js +65 -0
- package/dist/cjs/telemetry/status.js.map +1 -0
- package/dist/esm/doctor/constants.d.ts +59 -0
- package/dist/esm/doctor/constants.d.ts.map +1 -0
- package/dist/esm/doctor/constants.js +54 -0
- package/dist/esm/doctor/constants.js.map +1 -0
- package/dist/esm/doctor/index.d.ts +5 -0
- package/dist/esm/doctor/index.d.ts.map +1 -0
- package/dist/esm/doctor/index.js +10 -0
- package/dist/esm/doctor/index.js.map +1 -0
- package/dist/esm/doctor/schemas.d.ts +186 -0
- package/dist/esm/doctor/schemas.d.ts.map +1 -0
- package/dist/esm/doctor/schemas.js +180 -0
- package/dist/esm/doctor/schemas.js.map +1 -0
- package/dist/esm/index.d.ts +13 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +13 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/telemetry/assistant.d.ts +173 -0
- package/dist/esm/telemetry/assistant.d.ts.map +1 -0
- package/dist/esm/telemetry/assistant.js +40 -0
- package/dist/esm/telemetry/assistant.js.map +1 -0
- package/dist/esm/telemetry/config.d.ts +92 -0
- package/dist/esm/telemetry/config.d.ts.map +1 -0
- package/dist/esm/telemetry/config.js +98 -0
- package/dist/esm/telemetry/config.js.map +1 -0
- package/dist/esm/telemetry/connection.d.ts +355 -0
- package/dist/esm/telemetry/connection.d.ts.map +1 -0
- package/dist/esm/telemetry/connection.js +447 -0
- package/dist/esm/telemetry/connection.js.map +1 -0
- package/dist/esm/telemetry/constants.d.ts +442 -0
- package/dist/esm/telemetry/constants.d.ts.map +1 -0
- package/dist/esm/telemetry/constants.js +397 -0
- package/dist/esm/telemetry/constants.js.map +1 -0
- package/dist/esm/telemetry/dashboard.d.ts +826 -0
- package/dist/esm/telemetry/dashboard.d.ts.map +1 -0
- package/dist/esm/telemetry/dashboard.js +690 -0
- package/dist/esm/telemetry/dashboard.js.map +1 -0
- package/dist/esm/telemetry/enum.d.ts +5 -0
- package/dist/esm/telemetry/enum.d.ts.map +1 -0
- package/dist/esm/telemetry/enum.js +9 -0
- package/dist/esm/telemetry/enum.js.map +1 -0
- package/dist/esm/telemetry/index.d.ts +5 -0
- package/dist/esm/telemetry/index.d.ts.map +1 -0
- package/dist/esm/telemetry/index.js +10 -0
- package/dist/esm/telemetry/index.js.map +1 -0
- package/dist/esm/telemetry/query.d.ts +147 -0
- package/dist/esm/telemetry/query.d.ts.map +1 -0
- package/dist/esm/telemetry/query.js +138 -0
- package/dist/esm/telemetry/query.js.map +1 -0
- package/dist/esm/telemetry/schemas.d.ts +17 -0
- package/dist/esm/telemetry/schemas.d.ts.map +1 -0
- package/dist/esm/telemetry/schemas.js +12 -0
- package/dist/esm/telemetry/schemas.js.map +1 -0
- package/dist/esm/telemetry/settings.d.ts +65 -0
- package/dist/esm/telemetry/settings.d.ts.map +1 -0
- package/dist/esm/telemetry/settings.js +74 -0
- package/dist/esm/telemetry/settings.js.map +1 -0
- package/dist/esm/telemetry/stack.d.ts +87 -0
- package/dist/esm/telemetry/stack.d.ts.map +1 -0
- package/dist/esm/telemetry/stack.js +90 -0
- package/dist/esm/telemetry/stack.js.map +1 -0
- package/dist/esm/telemetry/status.d.ts +65 -0
- package/dist/esm/telemetry/status.d.ts.map +1 -0
- package/dist/esm/telemetry/status.js +62 -0
- package/dist/esm/telemetry/status.js.map +1 -0
- package/package.json +78 -4
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// The Doctor's wire shapes (issue #634; moved here from
|
|
4
|
+
// `@marinoscar/platform-api/doctor` by #701)
|
|
5
|
+
// =============================================================================
|
|
6
|
+
//
|
|
7
|
+
// ALWAYS A 200 FOR AN AUTHORIZED CALLER. A failing check is a row with
|
|
8
|
+
// `status: 'fail'`, never an error status: the report is read precisely when
|
|
9
|
+
// something is wrong, and a 500 or a 503 would withhold the list of what.
|
|
10
|
+
//
|
|
11
|
+
// Every nullable field is present on every row (`null` rather than absent), so
|
|
12
|
+
// a client renders one shape without optional-chaining through it.
|
|
13
|
+
//
|
|
14
|
+
// ⚠ OpenAPI is generated from these schemas (nestjs-zod, through the DTOs of
|
|
15
|
+
// `@marinoscar/platform-api/doctor`). Field order, `.describe()` texts and the
|
|
16
|
+
// order of the status enum are part of the published document: change them
|
|
17
|
+
// only as a deliberate API change.
|
|
18
|
+
// =============================================================================
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.supportBundleSchema = exports.supportBundleSectionResultSchema = exports.doctorQuerySchema = exports.doctorReportSchema = exports.doctorCheckReportSchema = exports.doctorStatusSchema = void 0;
|
|
21
|
+
const zod_1 = require("zod");
|
|
22
|
+
const constants_js_1 = require("./constants.js");
|
|
23
|
+
/**
|
|
24
|
+
* A check's status on the wire.
|
|
25
|
+
*
|
|
26
|
+
* The enum lists the values in the order the OpenAPI document has always
|
|
27
|
+
* published (`pass, warn, fail, skip`), which is not the severity order of
|
|
28
|
+
* {@link DOCTOR_STATUSES}; rank statuses with {@link DOCTOR_STATUS_RANK}.
|
|
29
|
+
*
|
|
30
|
+
* @extensionPoint schema
|
|
31
|
+
* @stability stable
|
|
32
|
+
*/
|
|
33
|
+
exports.doctorStatusSchema = zod_1.z
|
|
34
|
+
.enum(['pass', 'warn', 'fail', 'skip'])
|
|
35
|
+
.describe('`pass` — verified healthy. `warn` — works, but needs attention. `fail` — broken. ' +
|
|
36
|
+
'`skip` — not evaluated: a check it depends on did not pass, or the capability is ' +
|
|
37
|
+
'intentionally switched off.');
|
|
38
|
+
/**
|
|
39
|
+
* One row of the report, as `GET /api/admin/doctor` returns it.
|
|
40
|
+
*
|
|
41
|
+
* Fields: `id` (stable dotted id, `storage.bucket`), `category` (`core`,
|
|
42
|
+
* `auth`, ...; an app may add its own), `label`, `settingsPath` (the web route
|
|
43
|
+
* that fixes it, or `null`), `status`, `detail` (one line: what was found),
|
|
44
|
+
* `remedy` (set on `warn` and `fail`, otherwise `null`), `error` (the
|
|
45
|
+
* underlying probe error, or `null`), `data` (small scalar facts, never secret
|
|
46
|
+
* material, or `null`) and `durationMs` (0 when skipped without running).
|
|
47
|
+
*
|
|
48
|
+
* @extensionPoint schema
|
|
49
|
+
* @stability stable
|
|
50
|
+
*/
|
|
51
|
+
exports.doctorCheckReportSchema = zod_1.z.object({
|
|
52
|
+
/** Stable dotted id, e.g. `storage.bucket`. */
|
|
53
|
+
id: zod_1.z.string(),
|
|
54
|
+
/** `core`, `auth`, `storage`, ... — a fork may add its own. */
|
|
55
|
+
category: zod_1.z.string(),
|
|
56
|
+
/** Short human label: "Object storage bucket". */
|
|
57
|
+
label: zod_1.z.string(),
|
|
58
|
+
/** The web route that fixes this check, when there is one. */
|
|
59
|
+
settingsPath: zod_1.z.string().nullable(),
|
|
60
|
+
/** `pass`, `warn`, `fail` or `skip`. */
|
|
61
|
+
status: exports.doctorStatusSchema,
|
|
62
|
+
/** One line: what was found. */
|
|
63
|
+
detail: zod_1.z.string(),
|
|
64
|
+
/** What to do about a `warn` or `fail`. Always set on those two. */
|
|
65
|
+
remedy: zod_1.z.string().nullable(),
|
|
66
|
+
/** The underlying error message, when a probe failed. */
|
|
67
|
+
error: zod_1.z.string().nullable(),
|
|
68
|
+
/** Small scalar facts: counts, versions, latencies. Never secret material. */
|
|
69
|
+
data: zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean(), zod_1.z.null()])).nullable(),
|
|
70
|
+
/** How long this check took; 0 when it was skipped without running. */
|
|
71
|
+
durationMs: zod_1.z.number().int(),
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* The whole report, as `GET /api/admin/doctor` returns it: `verdict` (the
|
|
75
|
+
* worst status in `checks`, `skip` when none ran), `generatedAt` (ISO 8601; a
|
|
76
|
+
* cached report keeps its original time), `durationMs` (wall time of the run)
|
|
77
|
+
* and `checks` (sorted by category, configured order first, then registration
|
|
78
|
+
* order).
|
|
79
|
+
*
|
|
80
|
+
* @extensionPoint schema
|
|
81
|
+
* @stability stable
|
|
82
|
+
*/
|
|
83
|
+
exports.doctorReportSchema = zod_1.z.object({
|
|
84
|
+
/** The worst status in `checks` (`pass < skip < warn < fail`); `skip` when none ran. */
|
|
85
|
+
verdict: exports.doctorStatusSchema,
|
|
86
|
+
/** When this report was produced. A cached report keeps its original time. */
|
|
87
|
+
generatedAt: zod_1.z.iso.datetime(),
|
|
88
|
+
/** Wall time of the whole run. */
|
|
89
|
+
durationMs: zod_1.z.number().int(),
|
|
90
|
+
/** Sorted by category (shipped order first), then registration order. */
|
|
91
|
+
checks: zod_1.z.array(exports.doctorCheckReportSchema),
|
|
92
|
+
});
|
|
93
|
+
// The query's `'true' | 'false'` parameter, typed through its named entries.
|
|
94
|
+
const booleanStringSchema = zod_1.z.enum(['true', 'false']);
|
|
95
|
+
/**
|
|
96
|
+
* `GET /api/admin/doctor` query: `category` (a lowercase identifier; only the
|
|
97
|
+
* checks in that category, plus, unreported, whatever they depend on) and
|
|
98
|
+
* `refresh` (`'true'` bypasses the 15-second report cache).
|
|
99
|
+
*
|
|
100
|
+
* `refresh` is `z.enum(['true','false']).transform(...)` and NOT
|
|
101
|
+
* `z.coerce.boolean()`: every query parameter is a string and
|
|
102
|
+
* `Boolean('false')` is `true`.
|
|
103
|
+
*
|
|
104
|
+
* @extensionPoint schema
|
|
105
|
+
* @stability stable
|
|
106
|
+
*/
|
|
107
|
+
exports.doctorQuerySchema = zod_1.z.object({
|
|
108
|
+
/** Only the checks in this category (plus, unreported, whatever they depend on). */
|
|
109
|
+
category: zod_1.z
|
|
110
|
+
.string()
|
|
111
|
+
.regex(/^[a-z0-9][a-z0-9_-]{0,63}$/, 'category must be a lowercase identifier')
|
|
112
|
+
.optional(),
|
|
113
|
+
/** `true` bypasses the 15-second report cache. */
|
|
114
|
+
refresh: booleanStringSchema
|
|
115
|
+
.transform((value) => value === 'true')
|
|
116
|
+
.optional(),
|
|
117
|
+
});
|
|
118
|
+
const statusEnumMatchesConstants = true;
|
|
119
|
+
const queryInputMatchesSchema = true;
|
|
120
|
+
void statusEnumMatchesConstants;
|
|
121
|
+
void queryInputMatchesSchema;
|
|
122
|
+
// -----------------------------------------------------------------------------
|
|
123
|
+
// The support bundle (issue #772): the envelope `GET /api/admin/doctor/support-bundle`
|
|
124
|
+
// returns. Each section's `data` is validated by that section's own strict
|
|
125
|
+
// schema on the server (`@marinoscar/platform-api/doctor`), so here it stays
|
|
126
|
+
// `unknown`.
|
|
127
|
+
// -----------------------------------------------------------------------------
|
|
128
|
+
/**
|
|
129
|
+
* One section of a bundle. `truncated: true` with `data: null` means the
|
|
130
|
+
* section was larger than its size cap and its data was dropped.
|
|
131
|
+
*
|
|
132
|
+
* @extensionPoint schema
|
|
133
|
+
* @stability experimental
|
|
134
|
+
*/
|
|
135
|
+
exports.supportBundleSectionResultSchema = zod_1.z.discriminatedUnion('status', [
|
|
136
|
+
zod_1.z.object({
|
|
137
|
+
/** Collected. */
|
|
138
|
+
status: zod_1.z.literal('ok'),
|
|
139
|
+
/** The section's data, validated by its strict schema and redacted; `null` when truncated. */
|
|
140
|
+
data: zod_1.z.unknown().describe("The section's data, already validated by its strict schema and redacted."),
|
|
141
|
+
/** `true` when a size cap dropped the data. */
|
|
142
|
+
truncated: zod_1.z.boolean().optional().describe('`true` when a size cap dropped the data (`data` is then `null`).'),
|
|
143
|
+
}),
|
|
144
|
+
zod_1.z.object({
|
|
145
|
+
/** Not collected. */
|
|
146
|
+
status: zod_1.z.literal('omitted'),
|
|
147
|
+
/** Why: a missing permission, a capability switched off. */
|
|
148
|
+
reason: zod_1.z.string().describe('Why the section was not collected (a missing permission, a capability switched off).'),
|
|
149
|
+
}),
|
|
150
|
+
zod_1.z.object({
|
|
151
|
+
/** Collected, but dropped. */
|
|
152
|
+
status: zod_1.z.literal('error'),
|
|
153
|
+
/** One redacted line saying why. */
|
|
154
|
+
error: zod_1.z.string().describe('One redacted line: a throw, a timeout or a schema violation. Never the raw value.'),
|
|
155
|
+
}),
|
|
156
|
+
]);
|
|
157
|
+
/**
|
|
158
|
+
* The support bundle: what `GET /api/admin/doctor/support-bundle` returns as a
|
|
159
|
+
* JSON attachment.
|
|
160
|
+
*
|
|
161
|
+
* @extensionPoint schema
|
|
162
|
+
* @stability experimental
|
|
163
|
+
*/
|
|
164
|
+
exports.supportBundleSchema = zod_1.z.object({
|
|
165
|
+
/** The bundle format version, {@link SUPPORT_BUNDLE_VERSION}. */
|
|
166
|
+
bundleVersion: zod_1.z.literal(constants_js_1.SUPPORT_BUNDLE_VERSION).describe('The bundle format version.'),
|
|
167
|
+
/** When the bundle was built (ISO 8601, UTC). */
|
|
168
|
+
generatedAt: zod_1.z.string().describe('When the bundle was built (ISO 8601, UTC).'),
|
|
169
|
+
/** The central redaction pass. */
|
|
170
|
+
redaction: zod_1.z
|
|
171
|
+
.object({
|
|
172
|
+
/** The rule set applied, {@link SUPPORT_BUNDLE_REDACTION_RULES}. */
|
|
173
|
+
rules: zod_1.z.literal(constants_js_1.SUPPORT_BUNDLE_REDACTION_RULES).describe('The redaction rule set applied.'),
|
|
174
|
+
/** How many values the pass replaced. */
|
|
175
|
+
replacements: zod_1.z.number().int().describe('How many values the redaction pass replaced.'),
|
|
176
|
+
})
|
|
177
|
+
.describe('The central redaction pass, applied on top of every section schema.'),
|
|
178
|
+
/** One result per registered section, keyed by section id. */
|
|
179
|
+
sections: zod_1.z
|
|
180
|
+
.record(zod_1.z.string(), exports.supportBundleSectionResultSchema)
|
|
181
|
+
.describe('One entry per registered section, keyed by section id.'),
|
|
182
|
+
});
|
|
183
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/doctor/schemas.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,wDAAwD;AACxD,6CAA6C;AAC7C,gFAAgF;AAChF,EAAE;AACF,uEAAuE;AACvE,6EAA6E;AAC7E,0EAA0E;AAC1E,EAAE;AACF,+EAA+E;AAC/E,mEAAmE;AACnE,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,2EAA2E;AAC3E,mCAAmC;AACnC,gFAAgF;;;AAEhF,6BAAwB;AAGxB,iDAAwF;AAkBxF;;;;;;;;;GASG;AACU,QAAA,kBAAkB,GAAgC,OAAC;KAC7D,IAAI,CAAC,CAAC,MAAM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package, which holds Zod DTOs and types shared by the platform API and web packages.
|
|
3
|
+
*
|
|
4
|
+
* The root entry exports only this name, so the smoke imports in CI have
|
|
5
|
+
* something to load end to end. Every slice is a subpath export
|
|
6
|
+
* (`@marinoscar/platform-contract/<slice>`, the first being `./doctor`) and is
|
|
7
|
+
* deliberately not re-exported here: a consumer loads only the slices it
|
|
8
|
+
* imports, and importing the root never loads zod.
|
|
9
|
+
*
|
|
10
|
+
* @stability experimental
|
|
11
|
+
*/
|
|
12
|
+
export declare const PLATFORM_PACKAGE: "@marinoscar/platform-contract";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,EAAG,+BAAwC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PLATFORM_PACKAGE = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The npm name of this package, which holds Zod DTOs and types shared by the platform API and web packages.
|
|
6
|
+
*
|
|
7
|
+
* The root entry exports only this name, so the smoke imports in CI have
|
|
8
|
+
* something to load end to end. Every slice is a subpath export
|
|
9
|
+
* (`@marinoscar/platform-contract/<slice>`, the first being `./doctor`) and is
|
|
10
|
+
* deliberately not re-exported here: a consumer loads only the slices it
|
|
11
|
+
* imports, and importing the root never loads zod.
|
|
12
|
+
*
|
|
13
|
+
* @stability experimental
|
|
14
|
+
*/
|
|
15
|
+
exports.PLATFORM_PACKAGE = '@marinoscar/platform-contract';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACU,QAAA,gBAAgB,GAAG,+BAAwC,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type TelemetryAssistantConfidence, type TelemetryAssistantReportStatus, type TelemetryAssistantSeverity, type TelemetryAssistantToolName } from './constants.js';
|
|
3
|
+
/**
|
|
4
|
+
* One earlier turn of the conversation: `role` (`user` or `assistant`) and
|
|
5
|
+
* `content` (at most {@link TELEMETRY_ASSISTANT_HISTORY_CONTENT_MAX} characters).
|
|
6
|
+
*
|
|
7
|
+
* @extensionPoint schema
|
|
8
|
+
* @stability stable
|
|
9
|
+
*/
|
|
10
|
+
export declare const telemetryAssistantTurnSchema: z.ZodObject<{
|
|
11
|
+
role: z.ZodEnum<import("./constants.js").TelemetryEnumEntries<"user" | "assistant">>;
|
|
12
|
+
content: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
/**
|
|
15
|
+
* One earlier turn of the conversation.
|
|
16
|
+
*
|
|
17
|
+
* @stability stable
|
|
18
|
+
*/
|
|
19
|
+
export type TelemetryAssistantTurn = z.infer<typeof telemetryAssistantTurnSchema>;
|
|
20
|
+
/**
|
|
21
|
+
* `POST /api/admin/telemetry/assistant/stream` body: `question` (trimmed,
|
|
22
|
+
* 1..{@link TELEMETRY_ASSISTANT_QUESTION_MAX} characters) and an optional
|
|
23
|
+
* `history` (oldest first, at most {@link TELEMETRY_ASSISTANT_HISTORY_MAX_TURNS}).
|
|
24
|
+
*
|
|
25
|
+
* @extensionPoint schema
|
|
26
|
+
* @stability stable
|
|
27
|
+
*/
|
|
28
|
+
export declare const telemetryAssistantRequestSchema: z.ZodObject<{
|
|
29
|
+
question: z.ZodString;
|
|
30
|
+
history: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
31
|
+
role: z.ZodEnum<import("./constants.js").TelemetryEnumEntries<"user" | "assistant">>;
|
|
32
|
+
content: z.ZodString;
|
|
33
|
+
}, z.core.$strip>>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
/**
|
|
36
|
+
* The `POST /api/admin/telemetry/assistant/stream` body.
|
|
37
|
+
*
|
|
38
|
+
* @stability stable
|
|
39
|
+
*/
|
|
40
|
+
export type TelemetryAssistantRequest = z.infer<typeof telemetryAssistantRequestSchema>;
|
|
41
|
+
/**
|
|
42
|
+
* `event: step` — one tool call the assistant made.
|
|
43
|
+
*
|
|
44
|
+
* @stability stable
|
|
45
|
+
*/
|
|
46
|
+
export interface TelemetryAssistantStepEvent {
|
|
47
|
+
/** 0-based, across the whole turn. */
|
|
48
|
+
index: number;
|
|
49
|
+
/** The tool called. */
|
|
50
|
+
tool: TelemetryAssistantToolName;
|
|
51
|
+
/** `group` is `metrics_overview`'s metric group (#603). */
|
|
52
|
+
input?: {
|
|
53
|
+
/** `describe_table`: the table. */
|
|
54
|
+
table?: string;
|
|
55
|
+
/** `run_query`: the statement. */
|
|
56
|
+
sql?: string;
|
|
57
|
+
/** The window an overview tool looked at. */
|
|
58
|
+
window?: string;
|
|
59
|
+
/** `get_trace`: the trace. */
|
|
60
|
+
traceId?: string;
|
|
61
|
+
/** `metrics_overview`: the metric group. */
|
|
62
|
+
group?: string;
|
|
63
|
+
};
|
|
64
|
+
/** `run_query` / `get_trace` only: rows the call returned (up to the row cap). */
|
|
65
|
+
rowCount?: number;
|
|
66
|
+
/** `run_query` / `get_trace` only: more rows matched than the row cap allowed. */
|
|
67
|
+
truncated?: boolean;
|
|
68
|
+
/** Wall time of the call. */
|
|
69
|
+
durationMs: number;
|
|
70
|
+
/** Why the call failed; the model was told the same and may retry. */
|
|
71
|
+
error?: string;
|
|
72
|
+
/** The model's interim reasoning for the round this call belongs to; only on the FIRST call of a round. Bounded to 1000 chars. */
|
|
73
|
+
thought?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* One finding of a report.
|
|
77
|
+
*
|
|
78
|
+
* @stability stable
|
|
79
|
+
*/
|
|
80
|
+
export interface TelemetryAssistantFinding {
|
|
81
|
+
/** One line naming the finding. */
|
|
82
|
+
title: string;
|
|
83
|
+
/** How bad it is. */
|
|
84
|
+
severity: TelemetryAssistantSeverity;
|
|
85
|
+
/** What in the data shows it. */
|
|
86
|
+
evidence: string;
|
|
87
|
+
/** Index into `report.queries` of the query that shows this finding. */
|
|
88
|
+
queryIndex?: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A supporting query of a report, which the user can re-run.
|
|
92
|
+
*
|
|
93
|
+
* @stability stable
|
|
94
|
+
*/
|
|
95
|
+
export interface TelemetryAssistantQuery {
|
|
96
|
+
/** What the query shows. */
|
|
97
|
+
title: string;
|
|
98
|
+
/** The statement. */
|
|
99
|
+
sql: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The investigation's structured result.
|
|
103
|
+
*
|
|
104
|
+
* @stability stable
|
|
105
|
+
*/
|
|
106
|
+
export interface TelemetryAssistantReport {
|
|
107
|
+
/** The outcome. */
|
|
108
|
+
status: TelemetryAssistantReportStatus;
|
|
109
|
+
/** A short summary. */
|
|
110
|
+
summary: string;
|
|
111
|
+
/** What was found, most important first. */
|
|
112
|
+
findings: TelemetryAssistantFinding[];
|
|
113
|
+
/** The root cause, or null when none was established. */
|
|
114
|
+
rootCause: string | null;
|
|
115
|
+
/** How sure the report is. */
|
|
116
|
+
confidence: TelemetryAssistantConfidence;
|
|
117
|
+
/** What to do next. */
|
|
118
|
+
recommendations: string[];
|
|
119
|
+
/** Supporting queries the user can re-run (at most 5); the first is the most useful. */
|
|
120
|
+
queries: TelemetryAssistantQuery[];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* `event: answer` — the final answer.
|
|
124
|
+
*
|
|
125
|
+
* @stability stable
|
|
126
|
+
*/
|
|
127
|
+
export interface TelemetryAssistantAnswerEvent {
|
|
128
|
+
/** Back-compat: queries[0].sql, or null. */
|
|
129
|
+
sql: string | null;
|
|
130
|
+
/** Back-compat: the report summary (or the raw text when the model did not return a report). */
|
|
131
|
+
explanation: string;
|
|
132
|
+
/** The structured report, or null when the model gave no parseable one. */
|
|
133
|
+
report: TelemetryAssistantReport | null;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* `event: error` — the turn failed after the stream opened.
|
|
137
|
+
*
|
|
138
|
+
* @stability stable
|
|
139
|
+
*/
|
|
140
|
+
export interface TelemetryAssistantErrorEvent {
|
|
141
|
+
/** A stable error code. */
|
|
142
|
+
code: string;
|
|
143
|
+
/** A message for the user. */
|
|
144
|
+
message: string;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Every event of the stream, by name, with its payload.
|
|
148
|
+
*
|
|
149
|
+
* @stability stable
|
|
150
|
+
*/
|
|
151
|
+
export interface TelemetryAssistantEventMap {
|
|
152
|
+
/** One tool call. */
|
|
153
|
+
step: TelemetryAssistantStepEvent;
|
|
154
|
+
/** The final answer. */
|
|
155
|
+
answer: TelemetryAssistantAnswerEvent;
|
|
156
|
+
/** The turn failed. */
|
|
157
|
+
error: TelemetryAssistantErrorEvent;
|
|
158
|
+
/** The stream ends. */
|
|
159
|
+
done: Record<string, never>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The name of a stream event.
|
|
163
|
+
*
|
|
164
|
+
* @stability stable
|
|
165
|
+
*/
|
|
166
|
+
export type TelemetryAssistantEventName = keyof TelemetryAssistantEventMap;
|
|
167
|
+
/**
|
|
168
|
+
* A function that writes one stream event (the server's side of the stream).
|
|
169
|
+
*
|
|
170
|
+
* @stability stable
|
|
171
|
+
*/
|
|
172
|
+
export type TelemetryAssistantEmit = <E extends TelemetryAssistantEventName>(event: E, data: TelemetryAssistantEventMap[E]) => void;
|
|
173
|
+
//# sourceMappingURL=assistant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant.d.ts","sourceRoot":"","sources":["../../../src/telemetry/assistant.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;A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,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,0BAA0B,CAAC;AAE3E;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,SAAS,2BAA2B,EACzE,KAAK,EAAE,CAAC,EACR,IAAI,EAAE,0BAA0B,CAAC,CAAC,CAAC,KAChC,IAAI,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// POST /api/admin/telemetry/assistant/stream (issue #536; moved here from the
|
|
4
|
+
// API's `telemetry/dto/telemetry-assistant.dto.ts` by #702)
|
|
5
|
+
// =============================================================================
|
|
6
|
+
//
|
|
7
|
+
// The request body is a zod schema. The response is a `text/event-stream`;
|
|
8
|
+
// its frame payloads are the binding web ↔ API contract and are TYPES (the
|
|
9
|
+
// API writes them, nothing parses them on the server), as they always were.
|
|
10
|
+
// =============================================================================
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.telemetryAssistantRequestSchema = exports.telemetryAssistantTurnSchema = void 0;
|
|
13
|
+
const zod_1 = require("zod");
|
|
14
|
+
const constants_js_1 = require("./constants.js");
|
|
15
|
+
const enum_js_1 = require("./enum.js");
|
|
16
|
+
/**
|
|
17
|
+
* One earlier turn of the conversation: `role` (`user` or `assistant`) and
|
|
18
|
+
* `content` (at most {@link TELEMETRY_ASSISTANT_HISTORY_CONTENT_MAX} characters).
|
|
19
|
+
*
|
|
20
|
+
* @extensionPoint schema
|
|
21
|
+
* @stability stable
|
|
22
|
+
*/
|
|
23
|
+
exports.telemetryAssistantTurnSchema = zod_1.z.object({
|
|
24
|
+
/** Who wrote the turn. */
|
|
25
|
+
role: (0, enum_js_1.wireEnum)(constants_js_1.TELEMETRY_ASSISTANT_TURN_ROLES),
|
|
26
|
+
/** The turn's text. */
|
|
27
|
+
content: zod_1.z.string().max(constants_js_1.TELEMETRY_ASSISTANT_HISTORY_CONTENT_MAX),
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* `POST /api/admin/telemetry/assistant/stream` body: `question` (trimmed,
|
|
31
|
+
* 1..{@link TELEMETRY_ASSISTANT_QUESTION_MAX} characters) and an optional
|
|
32
|
+
* `history` (oldest first, at most {@link TELEMETRY_ASSISTANT_HISTORY_MAX_TURNS}).
|
|
33
|
+
*
|
|
34
|
+
* @extensionPoint schema
|
|
35
|
+
* @stability stable
|
|
36
|
+
*/
|
|
37
|
+
exports.telemetryAssistantRequestSchema = zod_1.z.object({
|
|
38
|
+
/** The new question, in natural language. */
|
|
39
|
+
question: zod_1.z.string().trim().min(1).max(constants_js_1.TELEMETRY_ASSISTANT_QUESTION_MAX),
|
|
40
|
+
/** Earlier turns of this conversation, oldest first. */
|
|
41
|
+
history: zod_1.z.array(exports.telemetryAssistantTurnSchema).max(constants_js_1.TELEMETRY_ASSISTANT_HISTORY_MAX_TURNS).optional(),
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=assistant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant.js","sourceRoot":"","sources":["../../../src/telemetry/assistant.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,8EAA8E;AAC9E,4DAA4D;AAC5D,gFAAgF;AAChF,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,gFAAgF;;;AAEhF,6BAAwB;AAExB,iDASwB;AACxB,uCAAqC;AAErC;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAG,OAAC,CAAC,MAAM,CAAC;IACnD,0BAA0B;IAC1B,IAAI,EAAE,IAAA,kBAAQ,EAAC,6CAA8B,CAAC;IAC9C,uBAAuB;IACvB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,sDAAuC,CAAC;CACjE,CAAC,CAAC;AASH;;;;;;;GAOG;AACU,QAAA,+BAA+B,GAAG,OAAC,CAAC,MAAM,CAAC;IACtD,6CAA6C;IAC7C,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,+CAAgC,CAAC;IACxE,wDAAwD;IACxD,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,oCAA4B,CAAC,CAAC,GAAG,CAAC,oDAAqC,CAAC,CAAC,QAAQ,EAAE;CACrG,CAAC,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* `PUT /api/admin/telemetry/config` body: the stored namespace, with
|
|
4
|
+
* `instanceId` optional (absent keeps the stored value).
|
|
5
|
+
*
|
|
6
|
+
* @extensionPoint schema
|
|
7
|
+
* @stability stable
|
|
8
|
+
*/
|
|
9
|
+
export declare const updateTelemetryConfigSchema: z.ZodObject<{
|
|
10
|
+
enabled: z.ZodBoolean;
|
|
11
|
+
retentionDays: z.ZodNumber;
|
|
12
|
+
query: z.ZodObject<{
|
|
13
|
+
maxRows: z.ZodNumber;
|
|
14
|
+
timeoutSeconds: z.ZodNumber;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
assistant: z.ZodObject<{
|
|
17
|
+
enabled: z.ZodBoolean;
|
|
18
|
+
provider: z.ZodNullable<z.ZodString>;
|
|
19
|
+
modelId: z.ZodNullable<z.ZodString>;
|
|
20
|
+
shareResults: z.ZodBoolean;
|
|
21
|
+
maxResultRowsToModel: z.ZodNumber;
|
|
22
|
+
maxSteps: z.ZodNumber;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
instanceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
/**
|
|
27
|
+
* The `PUT /api/admin/telemetry/config` body.
|
|
28
|
+
*
|
|
29
|
+
* @stability stable
|
|
30
|
+
*/
|
|
31
|
+
export type UpdateTelemetryConfigInput = z.infer<typeof updateTelemetryConfigSchema>;
|
|
32
|
+
/**
|
|
33
|
+
* `GET /api/admin/telemetry/config` (and the `PUT` response): the stored
|
|
34
|
+
* namespace plus `available`, `retentionApplicable`, `instanceIdDefault`,
|
|
35
|
+
* `instanceIdEffective`, `version` (send it back as `If-Match`), `updatedAt`
|
|
36
|
+
* and `updatedBy`.
|
|
37
|
+
*
|
|
38
|
+
* @extensionPoint schema
|
|
39
|
+
* @stability stable
|
|
40
|
+
*/
|
|
41
|
+
export declare const telemetryConfigResponseSchema: z.ZodObject<{
|
|
42
|
+
enabled: z.ZodBoolean;
|
|
43
|
+
retentionDays: z.ZodNumber;
|
|
44
|
+
instanceId: z.ZodNullable<z.ZodString>;
|
|
45
|
+
query: z.ZodObject<{
|
|
46
|
+
maxRows: z.ZodNumber;
|
|
47
|
+
timeoutSeconds: z.ZodNumber;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
assistant: z.ZodObject<{
|
|
50
|
+
enabled: z.ZodBoolean;
|
|
51
|
+
provider: z.ZodNullable<z.ZodString>;
|
|
52
|
+
modelId: z.ZodNullable<z.ZodString>;
|
|
53
|
+
shareResults: z.ZodBoolean;
|
|
54
|
+
maxResultRowsToModel: z.ZodNumber;
|
|
55
|
+
maxSteps: z.ZodNumber;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
available: z.ZodBoolean;
|
|
58
|
+
retentionApplicable: z.ZodBoolean;
|
|
59
|
+
instanceIdDefault: z.ZodString;
|
|
60
|
+
instanceIdEffective: z.ZodString;
|
|
61
|
+
version: z.ZodNumber;
|
|
62
|
+
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
63
|
+
updatedBy: z.ZodNullable<z.ZodObject<{
|
|
64
|
+
id: z.ZodString;
|
|
65
|
+
email: z.ZodString;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
/**
|
|
69
|
+
* `GET /api/admin/telemetry/config`.
|
|
70
|
+
*
|
|
71
|
+
* @stability stable
|
|
72
|
+
*/
|
|
73
|
+
export type TelemetryConfigResponse = z.infer<typeof telemetryConfigResponseSchema>;
|
|
74
|
+
/**
|
|
75
|
+
* `GET /api/telemetry/config`: the feature flag every signed-in client reads
|
|
76
|
+
* (`available`, `enabled`, `assistantEnabled`).
|
|
77
|
+
*
|
|
78
|
+
* @extensionPoint schema
|
|
79
|
+
* @stability stable
|
|
80
|
+
*/
|
|
81
|
+
export declare const telemetryPublicConfigSchema: z.ZodObject<{
|
|
82
|
+
available: z.ZodBoolean;
|
|
83
|
+
enabled: z.ZodBoolean;
|
|
84
|
+
assistantEnabled: z.ZodBoolean;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
/**
|
|
87
|
+
* `GET /api/telemetry/config`.
|
|
88
|
+
*
|
|
89
|
+
* @stability stable
|
|
90
|
+
*/
|
|
91
|
+
export type TelemetryPublicConfig = z.infer<typeof telemetryPublicConfigSchema>;
|
|
92
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/telemetry/config.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;iBAGtC,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAErF;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqCxC,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B;;;;iBAUtC,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// /api/admin/telemetry/config and /api/telemetry/config (issue #534; moved
|
|
4
|
+
// here from the API's `telemetry/dto/telemetry-config.dto.ts` by #702)
|
|
5
|
+
// =============================================================================
|
|
6
|
+
//
|
|
7
|
+
// The PUT body IS the stored `telemetry` namespace, so a form can send back
|
|
8
|
+
// exactly what it loaded (minus the provenance fields the response adds).
|
|
9
|
+
// Full replace: `assistant.provider` / `assistant.modelId` sent as `null`
|
|
10
|
+
// clear a stored value.
|
|
11
|
+
//
|
|
12
|
+
// ONE EXCEPTION TO "FULL": `instanceId` (#565) is OPTIONAL in the PUT body.
|
|
13
|
+
// Absent keeps the stored value, `null` returns to the application-slug
|
|
14
|
+
// default, a string overrides it. A client written before it existed must not
|
|
15
|
+
// get a 400, nor silently reset an identity an administrator set, merely by
|
|
16
|
+
// saving the page. The response always carries it, plus `instanceIdDefault` /
|
|
17
|
+
// `instanceIdEffective` so a form can show what `null` currently means.
|
|
18
|
+
//
|
|
19
|
+
// No credential is part of any of these shapes and none may be added.
|
|
20
|
+
// =============================================================================
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.telemetryPublicConfigSchema = exports.telemetryConfigResponseSchema = exports.updateTelemetryConfigSchema = void 0;
|
|
23
|
+
const zod_1 = require("zod");
|
|
24
|
+
const settings_js_1 = require("./settings.js");
|
|
25
|
+
/**
|
|
26
|
+
* `PUT /api/admin/telemetry/config` body: the stored namespace, with
|
|
27
|
+
* `instanceId` optional (absent keeps the stored value).
|
|
28
|
+
*
|
|
29
|
+
* @extensionPoint schema
|
|
30
|
+
* @stability stable
|
|
31
|
+
*/
|
|
32
|
+
exports.updateTelemetryConfigSchema = settings_js_1.telemetrySettingsSchema.extend({
|
|
33
|
+
/** Optional here: absent keeps the stored value, `null` returns to the default, a string overrides it. */
|
|
34
|
+
instanceId: settings_js_1.telemetrySettingsSchema.shape.instanceId.optional(),
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* `GET /api/admin/telemetry/config` (and the `PUT` response): the stored
|
|
38
|
+
* namespace plus `available`, `retentionApplicable`, `instanceIdDefault`,
|
|
39
|
+
* `instanceIdEffective`, `version` (send it back as `If-Match`), `updatedAt`
|
|
40
|
+
* and `updatedBy`.
|
|
41
|
+
*
|
|
42
|
+
* @extensionPoint schema
|
|
43
|
+
* @stability stable
|
|
44
|
+
*/
|
|
45
|
+
exports.telemetryConfigResponseSchema = settings_js_1.telemetrySettingsSchema.extend({
|
|
46
|
+
/**
|
|
47
|
+
* Whether a telemetry store is configured (admin UI or deployment default):
|
|
48
|
+
* a host and the reader login with its password. While false, `enabled` is
|
|
49
|
+
* stored but nothing is exported or queryable.
|
|
50
|
+
*/
|
|
51
|
+
available: zod_1.z.boolean(),
|
|
52
|
+
/**
|
|
53
|
+
* Whether the GreptimeDB admin login is configured (admin UI or deployment
|
|
54
|
+
* default), which retention needs. While false, `retentionDays` is stored
|
|
55
|
+
* but not applied.
|
|
56
|
+
*/
|
|
57
|
+
retentionApplicable: zod_1.z.boolean(),
|
|
58
|
+
/**
|
|
59
|
+
* What a `null` `instanceId` resolves to: the application slug (`APP_SLUG`,
|
|
60
|
+
* derived from the product name). Read-only.
|
|
61
|
+
*/
|
|
62
|
+
instanceIdDefault: zod_1.z.string(),
|
|
63
|
+
/**
|
|
64
|
+
* The identifier currently stamped as the `app.instance.id` resource
|
|
65
|
+
* attribute on exported telemetry: `instanceId` when set, else
|
|
66
|
+
* `instanceIdDefault`. Read-only.
|
|
67
|
+
*/
|
|
68
|
+
instanceIdEffective: zod_1.z.string(),
|
|
69
|
+
/** The system-settings row version — send it back as `If-Match` on `PUT`. `0` when nothing is stored yet. */
|
|
70
|
+
version: zod_1.z.number().int(),
|
|
71
|
+
/** When the namespace was last saved, or `null` when nothing is stored yet. */
|
|
72
|
+
updatedAt: zod_1.z.iso.datetime().nullable(),
|
|
73
|
+
/** Who saved it last, or `null`. */
|
|
74
|
+
updatedBy: zod_1.z
|
|
75
|
+
.object({
|
|
76
|
+
/** The user's id. */
|
|
77
|
+
id: zod_1.z.string(),
|
|
78
|
+
/** The user's email. */
|
|
79
|
+
email: zod_1.z.string(),
|
|
80
|
+
})
|
|
81
|
+
.nullable(),
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* `GET /api/telemetry/config`: the feature flag every signed-in client reads
|
|
85
|
+
* (`available`, `enabled`, `assistantEnabled`).
|
|
86
|
+
*
|
|
87
|
+
* @extensionPoint schema
|
|
88
|
+
* @stability stable
|
|
89
|
+
*/
|
|
90
|
+
exports.telemetryPublicConfigSchema = zod_1.z.object({
|
|
91
|
+
/** A telemetry store is configured (admin UI or deployment default). False hides every telemetry surface. */
|
|
92
|
+
available: zod_1.z.boolean(),
|
|
93
|
+
/** `telemetry.enabled` — whether this deployment is currently collecting telemetry. */
|
|
94
|
+
enabled: zod_1.z.boolean(),
|
|
95
|
+
/**
|
|
96
|
+
* `telemetry.assistant.enabled` — whether the telemetry AI assistant is
|
|
97
|
+
* switched on. Whether the AI platform itself is on is `GET /api/ai/config`.
|
|
98
|
+
*/
|
|
99
|
+
assistantEnabled: zod_1.z.boolean(),
|
|
100
|
+
});
|
|
101
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/telemetry/config.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,2EAA2E;AAC3E,uEAAuE;AACvE,gFAAgF;AAChF,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,wBAAwB;AACxB,EAAE;AACF,4EAA4E;AAC5E,wEAAwE;AACxE,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;A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