@stacksjs/defaults 0.72.23 → 0.72.24

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.
@@ -167,7 +167,7 @@ export default new Action({
167
167
  .where('channel', '=', 'email')
168
168
  .where('created_at', '>=', previousStart.toISOString())
169
169
  .orderBy('created_at', 'desc')
170
- .execute() as Promise<DeliveryRow[]>,
170
+ .execute() as unknown as Promise<DeliveryRow[]>,
171
171
  ])
172
172
  }
173
173
  catch (error) {
@@ -79,7 +79,7 @@ export default new Action({
79
79
  .orderBy(sort as DeliverySort, direction)
80
80
  .limit(perPage)
81
81
  .offset((page - 1) * perPage)
82
- .execute() as Promise<NotificationDeliveryRow[]>,
82
+ .execute() as unknown as Promise<NotificationDeliveryRow[]>,
83
83
  ])
84
84
 
85
85
  const total = Number(countRow?.count || 0)
@@ -38,18 +38,18 @@ async function notificationDeliveryOverview() {
38
38
  .selectFrom('notification_deliveries')
39
39
  .select(['status', db.fn.count('id').as('count')])
40
40
  .groupBy('status')
41
- .execute() as Promise<StatusCountRow[]>,
41
+ .execute() as unknown as Promise<StatusCountRow[]>,
42
42
  db
43
43
  .selectFrom('notification_deliveries')
44
44
  .select(['channel', 'status', db.fn.count('id').as('count')])
45
45
  .groupBy(['channel', 'status'])
46
- .execute() as Promise<ChannelStatusCountRow[]>,
46
+ .execute() as unknown as Promise<ChannelStatusCountRow[]>,
47
47
  db
48
48
  .selectFrom('notification_deliveries')
49
49
  .selectAll()
50
50
  .orderBy('sent_at', 'desc')
51
51
  .limit(8)
52
- .execute() as Promise<NotificationDeliveryRow[]>,
52
+ .execute() as unknown as Promise<NotificationDeliveryRow[]>,
53
53
  ])
54
54
 
55
55
  const statuses = Object.fromEntries(
@@ -26,7 +26,7 @@ export default new Action({
26
26
  if (!row)
27
27
  return response.json({ message: 'Query log not found.' }, 404)
28
28
 
29
- return { query: mapDashboardQueryLog(row as QueryLogSourceRow) }
29
+ return { query: mapDashboardQueryLog(row as unknown as QueryLogSourceRow) }
30
30
  }
31
31
  catch (error) {
32
32
  return dashboardOperationalError(error, 'Query log could not be loaded.', 'QueryShowAction')
@@ -242,8 +242,15 @@ export default class QueryController extends Controller {
242
242
  throw new Error('Query not found')
243
243
 
244
244
  // Parse JSON fields (safely — data may be corrupted)
245
- const safeParse = (val: string | null | undefined, fallback: any = []) => {
246
- if (!val) return fallback
245
+ /*
246
+ * The row's fields arrive `unknown` - the query builder has no schema for
247
+ * this table - so this takes what it is given and decides. Reading a JSON
248
+ * column is exactly the place a value has to be checked rather than
249
+ * trusted: it is text somebody else wrote.
250
+ */
251
+ const safeParse = (val: unknown, fallback: unknown = []): unknown => {
252
+ if (typeof val !== 'string' || !val)
253
+ return fallback
247
254
  try { return JSON.parse(val) }
248
255
  catch { return fallback }
249
256
  }
@@ -349,7 +356,18 @@ export default class QueryController extends Controller {
349
356
  .limit(10)
350
357
  .execute()
351
358
 
352
- return results
359
+ /*
360
+ * An aggregate select's rows are named by its aliases rather than by the
361
+ * table, so they arrive unknown-valued. Read out here, once, rather than
362
+ * asserted: `count` really can be a string, a number or a bigint
363
+ * depending on the driver, which is why the return type says so.
364
+ */
365
+ return results.map(row => ({
366
+ normalized_query: String(row.normalized_query ?? ''),
367
+ count: (typeof row.count === 'number' || typeof row.count === 'bigint' ? row.count : String(row.count ?? '0')),
368
+ avg_duration: (typeof row.avg_duration === 'number' ? row.avg_duration : String(row.avg_duration ?? '0')),
369
+ max_duration: typeof row.max_duration === 'number' ? row.max_duration : undefined,
370
+ }))
353
371
  }
354
372
  catch (error: unknown) {
355
373
  const err = error as Error
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.72.23",
5
+ "version": "0.72.24",
6
6
  "description": "A modern Stacks development environment.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.72.23",
5
+ "version": "0.72.24",
6
6
  "description": "The complete managed Stacks application scaffold, including runtime defaults, AI guidance, editor metadata, and npm-backed project support files.",
7
7
  "author": "Chris Breuer",
8
8
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  "dependencies": {
47
47
  "@iconify-json/f7": "^1.2.2",
48
48
  "@iconify-json/hugeicons": "^1.2.27",
49
- "@stacksjs/mobile": "^0.72.23",
49
+ "@stacksjs/mobile": "^0.72.24",
50
50
  "@stacksjs/sanitizer": "^0.2.113"
51
51
  },
52
52
  "scripts": {