@stacksjs/types 0.74.3 → 0.74.5

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.
@@ -61,6 +61,35 @@ export declare interface DashboardOptions {
61
61
  retentionHours?: number
62
62
  }
63
63
  }
64
+ providers?: DashboardProviderOptions
65
+ }
66
+ /**
67
+ * Credentials and endpoint for a hosted HQ product.
68
+ *
69
+ * `token` must be a READ token. A product's ingest key (the `loghq_...` value
70
+ * an app uses to SEND logs) grants no read access at all, so pasting one here
71
+ * produces an unauthorized response rather than data. The hosted read APIs
72
+ * currently authenticate a user rather than a machine, which is why this is
73
+ * separate from whatever ingest key `config/logging.ts` carries.
74
+ */
75
+ export declare interface DashboardHqDriverOptions {
76
+ baseUrl?: string
77
+ token?: string
78
+ project?: string
79
+ timeoutMs?: number
80
+ }
81
+ /** One domain's provider choice, plus per-driver settings. */
82
+ export declare interface DashboardProviderSelection {
83
+ driver?: DashboardProviderName
84
+ drivers?: {
85
+ hq?: DashboardHqDriverOptions
86
+ }
87
+ }
88
+ /** Per-domain provider selection. Omit a domain to leave it local. */
89
+ export declare interface DashboardProviderOptions {
90
+ logs?: DashboardProviderSelection
91
+ errors?: DashboardProviderSelection
92
+ analytics?: DashboardProviderSelection
64
93
  }
65
94
  /**
66
95
  * Per-model dashboard configuration (stacksjs/stacks#1843).
@@ -115,4 +144,11 @@ export declare interface DashboardModelOptions {
115
144
  roles?: string[]
116
145
  description?: string
117
146
  }
147
+ /**
148
+ * The backends a dashboard section can read from.
149
+ *
150
+ * `local` reads this application's own database and is the default.
151
+ * `hq` reads the matching hosted product (loghq, bughq, analyticshq).
152
+ */
153
+ export type DashboardProviderName = 'local' | 'hq';
118
154
  export type DashboardConfig = Partial<DashboardOptions>;
package/dist/request.d.ts CHANGED
@@ -1,7 +1,38 @@
1
- import { User } from '@stacksjs/orm';
2
1
  import type { AuthToken } from '@stacksjs/types';
3
2
  import type { Infer, IsRequired } from '@stacksjs/ts-validation';
4
3
  import type { UploadedFile } from '@stacksjs/storage';
4
+ /**
5
+ * The row `request.user()` resolves to.
6
+ *
7
+ * Declared here rather than derived from `@stacksjs/orm`'s `User`, which is
8
+ * what this used to be. That single line put the ORM underneath everything
9
+ * that needs a type: `@stacksjs/logging` depends on this package, so logging
10
+ * transitively depended on the ORM, and the ORM depends on the router, which
11
+ * depends on this package again. A types package sits at the bottom of a
12
+ * stack or it drags whatever it imports down there with it.
13
+ *
14
+ * Nothing is lost in practice. The old type was intersected with
15
+ * `Record<string, any>` already, because the model proxy attaches trait
16
+ * methods ahead of time and an application's own User columns are its own -
17
+ * so every property access resolved through the index signature regardless.
18
+ *
19
+ * It is an interface so an application can have the precision back where it
20
+ * wants it:
21
+ *
22
+ * ```ts
23
+ * declare module '@stacksjs/types' {
24
+ * interface AuthenticatedUser {
25
+ * email: string
26
+ * team_id: number
27
+ * }
28
+ * }
29
+ * ```
30
+ */
31
+ export declare interface AuthenticatedUser {
32
+ id: number
33
+ email: string
34
+ [key: string]: any
35
+ }
5
36
  declare interface RequestData {
6
37
  [key: string]: any
7
38
  }
@@ -142,10 +173,7 @@ export declare interface RequestInstance<TFields extends Record<string, any> = R
142
173
  getMethod: () => HttpMethod
143
174
  user: () => Promise<UserJsonResponse | undefined>
144
175
  }
145
- // Trait methods are attached dynamically by the Stacks model proxy. The
146
- // open member bag reflects application-level traits that the framework's
147
- // default User definition cannot know about ahead of time.
148
- declare type UserJsonResponse = NonNullable<Awaited<ReturnType<typeof User.find>>> & Record<string, any>;
176
+ declare type UserJsonResponse = AuthenticatedUser;
149
177
  /**
150
178
  * Template-literal helper that extracts named route params from a
151
179
  * path string (stacksjs/stacks#1851 Phase 2a). Supports both Stacks's
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.74.3",
4
+ "version": "0.74.5",
5
5
  "description": "The Stacks framework types.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -58,12 +58,11 @@
58
58
  "dependencies": {
59
59
  "@stacksjs/bunpress": "^0.2.8",
60
60
  "@stacksjs/clapp": "^0.2.12",
61
- "@stacksjs/events": "0.74.3",
62
- "@stacksjs/orm": "0.74.3",
63
- "@stacksjs/strings": "0.74.3",
61
+ "@stacksjs/events": "0.74.5",
62
+ "@stacksjs/strings": "0.74.5",
64
63
  "@stacksjs/stx": "^0.2.253",
65
64
  "@stacksjs/ts-validation": "^0.5.6",
66
- "bun-query-builder": "^0.2.53"
65
+ "bun-query-builder": "^0.2.62"
67
66
  },
68
67
  "peerDependencies": {
69
68
  "meilisearch": "^0.59.0"
@@ -74,7 +73,7 @@
74
73
  }
75
74
  },
76
75
  "devDependencies": {
77
- "@stacksjs/validation": "0.74.3",
76
+ "@stacksjs/validation": "0.74.5",
78
77
  "better-dx": "^0.2.24",
79
78
  "meilisearch": "^0.59.0"
80
79
  },