@platformatic/watt-admin 0.1.2 → 0.3.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.
- package/CLAUDE.md +32 -0
- package/package.json +11 -8
- package/watt.json +1 -1
- package/web/backend/dist/routes/root.js +151 -12
- package/web/backend/dist/routes/root.js.map +1 -1
- package/web/backend/dist/schemas/index.js +119 -0
- package/web/backend/dist/schemas/index.js.map +1 -0
- package/web/backend/dist/utils/calc.js +133 -85
- package/web/backend/dist/utils/calc.js.map +1 -1
- package/web/backend/dist/utils/client.openapi.js +31 -0
- package/web/backend/dist/utils/client.openapi.js.map +1 -0
- package/web/backend/openapi.json +805 -0
- package/web/backend/platformatic.json +1 -1
- package/web/composer/platformatic.json +1 -1
- package/web/frontend/dist/assets/index-B3873nEo.js +267 -0
- package/web/frontend/dist/assets/index-B3873nEo.js.map +1 -0
- package/web/frontend/dist/assets/{index-D-ld0Cou.css → index-DM7peTyq.css} +1 -1
- package/web/frontend/dist/index.html +2 -2
- package/web/frontend/watt.json +2 -2
- package/web/frontend/dist/.platformatic-build.json +0 -1
- package/web/frontend/dist/assets/index-BfyK1jrk.js +0 -267
- package/web/frontend/dist/assets/index-BfyK1jrk.js.map +0 -1
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Watt Admin Development Guide
|
|
2
|
+
|
|
3
|
+
## Build/Test/Lint Commands
|
|
4
|
+
```bash
|
|
5
|
+
# Development
|
|
6
|
+
npm run dev # Start development server
|
|
7
|
+
npm run build # Build for production
|
|
8
|
+
npm run start # Start in production mode
|
|
9
|
+
npm run clean # Remove build artifacts
|
|
10
|
+
|
|
11
|
+
# Testing
|
|
12
|
+
npm run test # Run all tests
|
|
13
|
+
npm run test:cli # Run CLI tests only
|
|
14
|
+
npm run test:backend # Run backend tests only
|
|
15
|
+
npm run test:frontend # Run frontend tests only
|
|
16
|
+
node --test test/path/to/file.test.js # Run single Node.js test file
|
|
17
|
+
cd web/frontend && vitest run path/to/file.test.ts # Run single frontend test
|
|
18
|
+
|
|
19
|
+
# Linting
|
|
20
|
+
npm run lint # Lint all code
|
|
21
|
+
npm run lint:fix # Fix linting issues automatically
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Code Style Guidelines
|
|
25
|
+
- **Formatting**: Project uses neostandard via ESLint (strict mode)
|
|
26
|
+
- **TypeScript**: Use explicit types for function params, returns, interfaces
|
|
27
|
+
- **Imports**: Group related imports, alphabetize within groups
|
|
28
|
+
- **Naming**: camelCase for variables/functions, PascalCase for components/classes/interfaces/types
|
|
29
|
+
- **Error Handling**: Log errors with fastify.log, handle async errors with try/catch
|
|
30
|
+
- **React**: Functional components with hooks, use React.ReactElement return types
|
|
31
|
+
- **Testing**: Node.js test module for backend, Vitest for frontend
|
|
32
|
+
- **Backend**: Follow Fastify conventions with typed routes using JsonSchemaToTsProvider
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/watt-admin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepublishOnly": "npm run build",
|
|
6
6
|
"dev": "wattpm dev",
|
|
7
7
|
"build": "wattpm build",
|
|
8
8
|
"start": "wattpm start",
|
|
9
|
+
"client:openapi": "cd web/backend && node --experimental-strip-types utils/client.openapi.ts",
|
|
10
|
+
"client:generate": "./node_modules/.bin/plt-client ./web/backend/openapi.json --name backend --folder web/frontend/src/client --language ts --frontend --full --skip-config-update --props-optional",
|
|
9
11
|
"test": "npm run test:cli && npm run test:backend && npm run test:frontend",
|
|
10
12
|
"test:cli": "node --test test/cli.test.js test/start.test.js test/cli-integration.test.js",
|
|
11
13
|
"test:backend": "cd web/backend && borp --concurrency 1",
|
|
@@ -16,15 +18,15 @@
|
|
|
16
18
|
},
|
|
17
19
|
"dependencies": {
|
|
18
20
|
"@inquirer/prompts": "^7.3.3",
|
|
19
|
-
"@platformatic/composer": "^2.
|
|
20
|
-
"@platformatic/runtime": "^2.
|
|
21
|
-
"@platformatic/service": "^2.
|
|
22
|
-
"@platformatic/control": "^2.
|
|
23
|
-
"@platformatic/vite": "^2.
|
|
21
|
+
"@platformatic/composer": "^2.60.0",
|
|
22
|
+
"@platformatic/runtime": "^2.60.0",
|
|
23
|
+
"@platformatic/service": "^2.60.0",
|
|
24
|
+
"@platformatic/control": "^2.60.0",
|
|
25
|
+
"@platformatic/vite": "^2.60.0",
|
|
24
26
|
"proxyquire": "^2.1.3",
|
|
25
27
|
"split2": "4.2.0",
|
|
26
28
|
"fastify": "^5.0.0",
|
|
27
|
-
"wattpm": "^2.
|
|
29
|
+
"wattpm": "^2.60.0"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
30
32
|
"@fastify/type-provider-json-schema-to-ts": "^5.0.0",
|
|
@@ -36,7 +38,8 @@
|
|
|
36
38
|
"eslint": "^9.22.0",
|
|
37
39
|
"typescript": "^5.5.4",
|
|
38
40
|
"neostandard": "^0.12.1",
|
|
39
|
-
"@platformatic/
|
|
41
|
+
"@platformatic/client-cli": "^2.58.0",
|
|
42
|
+
"@platformatic/ui-components": "^0.15.2",
|
|
40
43
|
"@types/d3": "^7.4.3",
|
|
41
44
|
"@types/react-dom": "^19.0.4",
|
|
42
45
|
"@vitejs/plugin-react": "^4.3.3",
|
package/watt.json
CHANGED
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const control_1 = require("@platformatic/control");
|
|
5
5
|
const log_1 = require("../utils/log");
|
|
6
|
+
const schemas_1 = require("../schemas");
|
|
6
7
|
async function default_1(fastify) {
|
|
7
8
|
const typedFastify = fastify.withTypeProvider();
|
|
8
9
|
const api = new control_1.RuntimeApiClient();
|
|
10
|
+
const emptyMetrics = { dataCpu: [], dataLatency: [], dataMem: [], dataReq: [] };
|
|
9
11
|
typedFastify.get('/runtimes', {
|
|
10
12
|
schema: {
|
|
11
13
|
querystring: {
|
|
@@ -17,6 +19,7 @@ async function default_1(fastify) {
|
|
|
17
19
|
},
|
|
18
20
|
},
|
|
19
21
|
},
|
|
22
|
+
response: { 200: { type: 'array', items: schemas_1.selectableRuntimeSchema } }
|
|
20
23
|
}
|
|
21
24
|
}, async (request) => {
|
|
22
25
|
const runtimes = await api.getRuntimes();
|
|
@@ -25,33 +28,168 @@ async function default_1(fastify) {
|
|
|
25
28
|
if (!request.query.includeAdmin && runtime.packageName === 'watt-admin') {
|
|
26
29
|
continue;
|
|
27
30
|
}
|
|
31
|
+
let selected = true;
|
|
28
32
|
if (process.env.SELECTED_RUNTIME) {
|
|
29
|
-
|
|
30
|
-
selectableRuntimes.push({ ...runtime, selected });
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
selectableRuntimes.push({ ...runtime, selected: true });
|
|
33
|
+
selected = process.env.SELECTED_RUNTIME === runtime.pid.toString();
|
|
34
34
|
}
|
|
35
|
+
selectableRuntimes.push({ ...runtime, packageName: runtime.packageName || '', packageVersion: runtime.packageVersion || '', url: runtime.url || '', selected });
|
|
35
36
|
}
|
|
36
37
|
return selectableRuntimes;
|
|
37
38
|
});
|
|
38
|
-
typedFastify.get('/runtimes/:pid/
|
|
39
|
+
typedFastify.get('/runtimes/:pid/health', {
|
|
39
40
|
schema: {
|
|
40
|
-
params: { type: 'object', properties: { pid: { type: 'number' } }, required: ['pid'] }
|
|
41
|
+
params: { type: 'object', properties: { pid: { type: 'number' } }, required: ['pid'] },
|
|
42
|
+
response: {
|
|
43
|
+
200: {
|
|
44
|
+
type: 'object',
|
|
45
|
+
additionalProperties: false,
|
|
46
|
+
properties: {
|
|
47
|
+
status: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
enum: ['OK', 'KO'],
|
|
50
|
+
description: "Status can only be 'OK' or 'KO'"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
required: ['status']
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, async ({ params: { pid } }) => {
|
|
58
|
+
try {
|
|
59
|
+
const result = await api.getMatchingRuntime({ pid: pid.toString() });
|
|
60
|
+
if (result.pid === pid) {
|
|
61
|
+
return { status: 'OK' };
|
|
62
|
+
}
|
|
63
|
+
return { status: 'KO' };
|
|
41
64
|
}
|
|
65
|
+
catch {
|
|
66
|
+
return { status: 'KO' };
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
typedFastify.get('/runtimes/:pid/metrics', {
|
|
70
|
+
schema: {
|
|
71
|
+
params: { type: 'object', properties: { pid: { type: 'number' } }, required: ['pid'] },
|
|
72
|
+
response: { 200: schemas_1.metricResponseSchema }
|
|
73
|
+
},
|
|
42
74
|
}, async ({ params: { pid } }) => {
|
|
43
|
-
return typedFastify.mappedMetrics[pid]?.aggregated ||
|
|
75
|
+
return typedFastify.mappedMetrics[pid]?.aggregated || emptyMetrics;
|
|
44
76
|
});
|
|
45
77
|
typedFastify.get('/runtimes/:pid/metrics/:serviceId', {
|
|
46
78
|
schema: {
|
|
47
|
-
params: {
|
|
79
|
+
params: {
|
|
80
|
+
type: 'object',
|
|
81
|
+
properties: {
|
|
82
|
+
pid: { type: 'number' },
|
|
83
|
+
serviceId: { type: 'string' }
|
|
84
|
+
},
|
|
85
|
+
required: ['pid', 'serviceId']
|
|
86
|
+
},
|
|
87
|
+
response: { 200: schemas_1.metricResponseSchema }
|
|
48
88
|
}
|
|
49
89
|
}, async ({ params: { pid, serviceId } }) => {
|
|
50
|
-
return fastify.mappedMetrics[pid]?.services[serviceId] ||
|
|
90
|
+
return fastify.mappedMetrics[pid]?.services[serviceId]?.all || emptyMetrics;
|
|
91
|
+
});
|
|
92
|
+
typedFastify.get('/runtimes/:pid/metrics/:serviceId/:workerId', {
|
|
93
|
+
schema: {
|
|
94
|
+
params: {
|
|
95
|
+
type: 'object',
|
|
96
|
+
properties: {
|
|
97
|
+
pid: { type: 'number' },
|
|
98
|
+
serviceId: { type: 'string' },
|
|
99
|
+
workerId: { type: 'number' },
|
|
100
|
+
},
|
|
101
|
+
required: ['pid', 'serviceId', 'workerId']
|
|
102
|
+
},
|
|
103
|
+
response: { 200: schemas_1.metricResponseSchema }
|
|
104
|
+
}
|
|
105
|
+
}, async ({ params: { pid, serviceId, workerId } }) => {
|
|
106
|
+
return fastify.mappedMetrics[pid]?.services[serviceId]?.[workerId] || emptyMetrics;
|
|
51
107
|
});
|
|
52
108
|
typedFastify.get('/runtimes/:pid/services', {
|
|
53
109
|
schema: {
|
|
54
|
-
params: { type: 'object', properties: { pid: { type: 'number' } }, required: ['pid'] }
|
|
110
|
+
params: { type: 'object', properties: { pid: { type: 'number' } }, required: ['pid'] },
|
|
111
|
+
response: {
|
|
112
|
+
200: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
additionalProperties: false,
|
|
115
|
+
required: ['entrypoint', 'production', 'services'],
|
|
116
|
+
properties: {
|
|
117
|
+
entrypoint: {
|
|
118
|
+
type: 'string'
|
|
119
|
+
},
|
|
120
|
+
production: {
|
|
121
|
+
type: 'boolean'
|
|
122
|
+
},
|
|
123
|
+
services: {
|
|
124
|
+
type: 'array',
|
|
125
|
+
items: {
|
|
126
|
+
anyOf: [
|
|
127
|
+
{
|
|
128
|
+
type: 'object',
|
|
129
|
+
required: ['id', 'type', 'status', 'version', 'localUrl', 'entrypoint', 'dependencies'],
|
|
130
|
+
properties: {
|
|
131
|
+
id: {
|
|
132
|
+
type: 'string'
|
|
133
|
+
},
|
|
134
|
+
type: {
|
|
135
|
+
type: 'string'
|
|
136
|
+
},
|
|
137
|
+
status: {
|
|
138
|
+
type: 'string'
|
|
139
|
+
},
|
|
140
|
+
version: {
|
|
141
|
+
type: 'string'
|
|
142
|
+
},
|
|
143
|
+
localUrl: {
|
|
144
|
+
type: 'string'
|
|
145
|
+
},
|
|
146
|
+
entrypoint: {
|
|
147
|
+
type: 'boolean'
|
|
148
|
+
},
|
|
149
|
+
workers: {
|
|
150
|
+
type: 'number'
|
|
151
|
+
},
|
|
152
|
+
url: {
|
|
153
|
+
type: 'string'
|
|
154
|
+
},
|
|
155
|
+
dependencies: {
|
|
156
|
+
type: 'array',
|
|
157
|
+
items: {
|
|
158
|
+
type: 'object',
|
|
159
|
+
required: ['id', 'url', 'local'],
|
|
160
|
+
properties: {
|
|
161
|
+
id: {
|
|
162
|
+
type: 'string'
|
|
163
|
+
},
|
|
164
|
+
url: {
|
|
165
|
+
type: 'string'
|
|
166
|
+
},
|
|
167
|
+
local: {
|
|
168
|
+
type: 'boolean'
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
type: 'object',
|
|
177
|
+
required: ['id', 'status'],
|
|
178
|
+
properties: {
|
|
179
|
+
id: {
|
|
180
|
+
type: 'string'
|
|
181
|
+
},
|
|
182
|
+
status: {
|
|
183
|
+
type: 'string'
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
55
193
|
}
|
|
56
194
|
}, async (request) => {
|
|
57
195
|
return api.getRuntimeServices(request.params.pid);
|
|
@@ -70,7 +208,8 @@ async function default_1(fastify) {
|
|
|
70
208
|
});
|
|
71
209
|
typedFastify.post('/runtimes/:pid/restart', {
|
|
72
210
|
schema: {
|
|
73
|
-
params: { type: 'object', properties: { pid: { type: 'number' } }, required: ['pid'] }
|
|
211
|
+
params: { type: 'object', properties: { pid: { type: 'number' } }, required: ['pid'] },
|
|
212
|
+
body: { type: 'object' }
|
|
74
213
|
}
|
|
75
214
|
}, async (request) => {
|
|
76
215
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../routes/root.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":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AAO,GAAG,EAAE,CAAC;YAEb,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,8BAA8B,CAAC,CAAA;QAC3D,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectableRuntimeSchema = exports.metricResponseSchema = void 0;
|
|
4
|
+
const dateSchema = { type: 'string', format: 'date-time' };
|
|
5
|
+
const memoryDataPointSchema = {
|
|
6
|
+
type: 'object',
|
|
7
|
+
additionalProperties: false,
|
|
8
|
+
properties: {
|
|
9
|
+
date: dateSchema,
|
|
10
|
+
rss: { type: 'number' },
|
|
11
|
+
totalHeap: { type: 'number' },
|
|
12
|
+
usedHeap: { type: 'number' },
|
|
13
|
+
newSpace: { type: 'number' },
|
|
14
|
+
oldSpace: { type: 'number' }
|
|
15
|
+
},
|
|
16
|
+
required: ['date', 'rss', 'totalHeap', 'usedHeap', 'newSpace', 'oldSpace']
|
|
17
|
+
};
|
|
18
|
+
const cpuDataPointSchema = {
|
|
19
|
+
type: 'object',
|
|
20
|
+
additionalProperties: false,
|
|
21
|
+
properties: {
|
|
22
|
+
date: dateSchema,
|
|
23
|
+
cpu: { type: 'number' },
|
|
24
|
+
eventLoop: { type: 'number' }
|
|
25
|
+
},
|
|
26
|
+
required: ['date', 'cpu', 'eventLoop']
|
|
27
|
+
};
|
|
28
|
+
const latencyDataPointSchema = {
|
|
29
|
+
type: 'object',
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
properties: {
|
|
32
|
+
date: { type: 'string', format: 'date-time' },
|
|
33
|
+
p90: { type: 'number' },
|
|
34
|
+
p95: { type: 'number' },
|
|
35
|
+
p99: { type: 'number' }
|
|
36
|
+
},
|
|
37
|
+
required: ['date', 'p90', 'p95', 'p99']
|
|
38
|
+
};
|
|
39
|
+
const requestDataPointSchema = {
|
|
40
|
+
type: 'object',
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
properties: {
|
|
43
|
+
date: { type: 'string', format: 'date-time' },
|
|
44
|
+
count: { type: 'number' },
|
|
45
|
+
rps: { type: 'number' }
|
|
46
|
+
},
|
|
47
|
+
required: ['date', 'count', 'rps']
|
|
48
|
+
};
|
|
49
|
+
exports.metricResponseSchema = {
|
|
50
|
+
type: 'object',
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
properties: {
|
|
53
|
+
dataMem: { type: 'array', items: memoryDataPointSchema },
|
|
54
|
+
dataCpu: { type: 'array', items: cpuDataPointSchema },
|
|
55
|
+
dataLatency: { type: 'array', items: latencyDataPointSchema },
|
|
56
|
+
dataReq: { type: 'array', items: requestDataPointSchema }
|
|
57
|
+
},
|
|
58
|
+
required: ['dataMem', 'dataCpu', 'dataLatency', 'dataReq']
|
|
59
|
+
};
|
|
60
|
+
exports.selectableRuntimeSchema = {
|
|
61
|
+
type: 'object',
|
|
62
|
+
additionalProperties: false,
|
|
63
|
+
properties: {
|
|
64
|
+
pid: {
|
|
65
|
+
type: 'integer'
|
|
66
|
+
},
|
|
67
|
+
cwd: {
|
|
68
|
+
type: 'string'
|
|
69
|
+
},
|
|
70
|
+
argv: {
|
|
71
|
+
type: 'array',
|
|
72
|
+
items: {
|
|
73
|
+
type: 'string'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
uptimeSeconds: {
|
|
77
|
+
type: 'number'
|
|
78
|
+
},
|
|
79
|
+
execPath: {
|
|
80
|
+
type: 'string'
|
|
81
|
+
},
|
|
82
|
+
nodeVersion: {
|
|
83
|
+
type: 'string'
|
|
84
|
+
},
|
|
85
|
+
projectDir: {
|
|
86
|
+
type: 'string'
|
|
87
|
+
},
|
|
88
|
+
packageName: {
|
|
89
|
+
type: 'string'
|
|
90
|
+
},
|
|
91
|
+
packageVersion: {
|
|
92
|
+
type: 'string'
|
|
93
|
+
},
|
|
94
|
+
url: {
|
|
95
|
+
type: 'string'
|
|
96
|
+
},
|
|
97
|
+
platformaticVersion: {
|
|
98
|
+
type: 'string'
|
|
99
|
+
},
|
|
100
|
+
selected: {
|
|
101
|
+
type: 'boolean'
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
required: [
|
|
105
|
+
'pid',
|
|
106
|
+
'cwd',
|
|
107
|
+
'argv',
|
|
108
|
+
'uptimeSeconds',
|
|
109
|
+
'execPath',
|
|
110
|
+
'nodeVersion',
|
|
111
|
+
'projectDir',
|
|
112
|
+
'packageName',
|
|
113
|
+
'packageVersion',
|
|
114
|
+
'url',
|
|
115
|
+
'platformaticVersion',
|
|
116
|
+
'selected'
|
|
117
|
+
]
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../schemas/index.ts"],"names":[],"mappings":";;;AAEA,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAW,CAAA;AAEnE,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvB,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC7B,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC7B;IACD,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC;CAClE,CAAA;AAGV,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAA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