@stacksjs/types 0.74.70 → 0.75.1

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.
@@ -8,6 +8,8 @@
8
8
  export declare interface AnalyticsOptions {
9
9
  driver: 'google-analytics' | 'fathom' | 'plausible' | 'self-hosted' | 'analyticshq'
10
10
  capturePageviews?: boolean
11
+ enabled?: boolean
12
+ environments?: readonly string[]
11
13
  drivers: {
12
14
  analyticshq?: {
13
15
  siteId: string
package/dist/request.d.ts CHANGED
@@ -11,27 +11,35 @@ import type { UploadedFile } from '@stacksjs/storage';
11
11
  * depends on this package again. A types package sits at the bottom of a
12
12
  * stack or it drags whatever it imports down there with it.
13
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.
14
+ * The index signature is `unknown`, not `any`. It was `any`, on the reasoning
15
+ * that the old type was intersected with `Record<string, any>` anyway, so
16
+ * "every property access resolved through the index signature regardless".
17
+ * That was the problem, not the excuse. Every field and every method was
18
+ * accepted unchecked, so apps wrote `(user as any).name` and never learned
19
+ * whether `name` existed, and the framework's own payment actions called
20
+ * `user.asStripeUser()`, `user.paymentIntent()` and five other methods no
21
+ * user has ever had - each one a `TypeError: ... is not a function` at
22
+ * runtime that the compiler waved through. With `unknown`, reading a field this interface does
23
+ * not declare still compiles, but using it means saying what it is.
18
24
  *
19
- * It is an interface so an application can have the precision back where it
20
- * wants it:
25
+ * An application rarely has to: `storage/framework/types/authenticated-user.d.ts`
26
+ * augments this interface with the columns of the app's own User model (and
27
+ * its billable methods, when it declares the trait), derived from the model
28
+ * so there is nothing to keep in step. It is an interface so anything else
29
+ * can be declared the same way:
21
30
  *
22
31
  * ```ts
23
32
  * declare module '@stacksjs/types' {
24
33
  * interface AuthenticatedUser {
25
- * email: string
26
34
  * team_id: number
27
35
  * }
28
36
  * }
29
37
  * ```
30
38
  */
31
39
  export declare interface AuthenticatedUser {
32
- id: number
40
+ id: number | string
33
41
  email: string
34
- [key: string]: any
42
+ [key: string]: unknown
35
43
  }
36
44
  declare interface RequestData {
37
45
  [key: string]: any
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.74.70",
4
+ "version": "0.75.1",
5
5
  "description": "The Stacks framework types.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -58,8 +58,8 @@
58
58
  "dependencies": {
59
59
  "@stacksjs/bunpress": "^0.2.8",
60
60
  "@stacksjs/clapp": "^0.2.12",
61
- "@stacksjs/events": "0.74.70",
62
- "@stacksjs/strings": "0.74.70",
61
+ "@stacksjs/events": "0.75.1",
62
+ "@stacksjs/strings": "0.75.1",
63
63
  "@stacksjs/stx": "^0.2.307",
64
64
  "@stacksjs/ts-validation": "^0.5.6",
65
65
  "bun-query-builder": "^0.2.70"
@@ -73,7 +73,7 @@
73
73
  }
74
74
  },
75
75
  "devDependencies": {
76
- "@stacksjs/validation": "0.74.70",
76
+ "@stacksjs/validation": "0.75.1",
77
77
  "better-dx": "^0.2.24",
78
78
  "meilisearch": "^0.59.0"
79
79
  },