@stacksjs/types 0.70.162 → 0.70.164

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/README.md CHANGED
@@ -50,7 +50,7 @@ For help, discussion about best practices, or any other conversation that would
50
50
 
51
51
  For casual chit-chat with others using this package:
52
52
 
53
- [Join the Stacks Discord Server](https://discord.gg/stacksjs)
53
+ [Join the Stacks Discord Server](https://stacksjs.com/discord)
54
54
 
55
55
  ## 📄 License
56
56
 
package/dist/ai.d.ts CHANGED
@@ -6,9 +6,29 @@
6
6
  * have any questions, feel free to reach out via Discord or GitHub Discussions.
7
7
  */
8
8
  export declare interface AiOptions {
9
- default: AiModel
9
+ default: 'anthropic' | 'openai' | 'ollama' | AiModel
10
10
  models: AiModel[]
11
11
  deploy: boolean
12
+ drivers?: {
13
+ anthropic?: {
14
+ apiKey?: string
15
+ model?: string
16
+ maxTokens?: number
17
+ anthropicVersion?: string
18
+ }
19
+ openai?: {
20
+ apiKey?: string
21
+ model?: string
22
+ maxTokens?: number
23
+ baseUrl?: string
24
+ embeddingModel?: string
25
+ }
26
+ ollama?: {
27
+ host?: string
28
+ model?: string
29
+ embeddingModel?: string
30
+ }
31
+ }
12
32
  }
13
33
  declare type AiModel = | 'amazon.titan-embed-text-v1'
14
34
  | 'amazon.titan-embed-text-v2:0'
package/dist/cloud.d.ts CHANGED
@@ -22,6 +22,7 @@ export declare interface CloudOptions {
22
22
  path: string
23
23
  [site: string]: string | SiteConfig
24
24
  }
25
+ tenants: string[]
25
26
  infrastructure: InfrastructureOptions
26
27
  cdn: any
27
28
  api: any
package/dist/email.d.ts CHANGED
@@ -25,7 +25,6 @@ export declare interface EmailFilterRule {
25
25
  }
26
26
  export declare interface MailboxConfig {
27
27
  email?: string
28
- address?: string
29
28
  displayName?: string
30
29
  password?: string
31
30
  forwardTo?: string[]
@@ -46,7 +45,6 @@ export declare interface MailServerPortsConfig {
46
45
  imaps?: number
47
46
  pop3?: number
48
47
  pop3s?: number
49
- smtpStartTls?: number
50
48
  }
51
49
  export declare interface MailServerFeaturesConfig {
52
50
  imap?: boolean
package/dist/model.d.ts CHANGED
@@ -166,7 +166,7 @@ export declare interface ModelOptions extends Base {
166
166
  softDeletable?: boolean | SoftDeleteOptions
167
167
  categorizable?: boolean
168
168
  taggable?: boolean
169
- commentables?: boolean
169
+ commentable?: boolean
170
170
  useAuth?: boolean | UserAuthOptions
171
171
  authenticatable?: boolean | UserAuthOptions
172
172
  useSeeder?: boolean | SeedOptions
package/dist/request.d.ts CHANGED
@@ -113,7 +113,7 @@ export declare interface RequestInstance<TFields extends Record<string, any> = R
113
113
  key: K,
114
114
  defaultValue?: D,
115
115
  ) => K extends keyof TParams ? TParams[K] : (string | D)
116
- getParam: <K extends string>(key: K) => K extends NumericField ? number : string
116
+ getParam: (key: string) => string
117
117
  route: (key: string) => number | string | null
118
118
  getParams: () => TParams
119
119
  getParamAsInt: (key: string) => number | null
@@ -133,30 +133,6 @@ export declare interface RequestInstance<TFields extends Record<string, any> = R
133
133
  // open member bag reflects application-level traits that the framework's
134
134
  // default User definition cannot know about ahead of time.
135
135
  declare type UserJsonResponse = NonNullable<Awaited<ReturnType<typeof User.find>>> & Record<string, any>;
136
- /**
137
- * Loose route-param shape kept around for back-compat with code that
138
- * predates {@link RequestInstance}'s `TParams` generic. New code should
139
- * rely on the path-extracted `TParams` instead — see {@link ExtractParams}.
140
- *
141
- * @deprecated Use {@link ExtractParams}-driven typing on the action /
142
- * route signature instead. URL route params are always strings at
143
- * runtime; the `string | number` here misled callers into thinking
144
- * the framework coerced numbers automatically (it doesn't —
145
- * `Number(request.params.id)` is the correct pattern).
146
- */
147
- declare type RouteParams = { [key: string]: string | number } | null;
148
- /**
149
- * Legacy hard-coded list of param names treated as `number` by
150
- * {@link RequestInstance.getParam}. The name-match heuristic is
151
- * brittle (`'judgeId'`, `'user_id'`, etc. all silently fall through
152
- * to `string`) and will be retired in a future release.
153
- *
154
- * @deprecated The name-match returns `number` for these specific keys
155
- * only — pass the value through {@link Number} or
156
- * {@link RequestInstance.getParamAsInt} for explicit, predictable
157
- * coercion. See stacksjs/stacks#1851 Phase 3.
158
- */
159
- declare type NumericField = 'id' | 'age' | 'count' | 'quantity' | 'amount' | 'price' | 'total' | 'score' | 'rating' | 'duration' | 'size' | 'weight' | 'height' | 'width' | 'length' | 'distance' | 'speed' | 'temperature' | 'volume' | 'capacity' | 'density' | 'pressure' | 'force' | 'energy' | 'power' | 'frequency' | 'voltage' | 'current' | 'resistance' | 'time' | 'date' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond' | 'microsecond' | 'nanosecond';
160
136
  /**
161
137
  * Template-literal helper that extracts named route params from a
162
138
  * path string (stacksjs/stacks#1851 Phase 2a). Supports both Stacks's
package/dist/router.d.ts CHANGED
@@ -11,7 +11,11 @@ export declare interface ValidationField {
11
11
  export declare interface CustomAttributes {
12
12
  [key: string]: ValidationField
13
13
  }
14
- export declare interface RouteParams { [key: string]: string | number }
14
+ /**
15
+ * URL route parameters. Always strings at runtime - the router does no
16
+ * coercion. Use `Number(...)` or `getParamAsInt()` when you want a number.
17
+ */
18
+ export declare interface RouteParams { [key: string]: string }
15
19
  export declare interface Route {
16
20
  name: string
17
21
  uri: string
@@ -75,7 +79,7 @@ export declare interface RouterInstance {
75
79
  addBodies: (params: any) => void
76
80
  addParam: (param: RouteParam) => void
77
81
  addHeaders: (headerParams: Headers) => void
78
- get: <K extends string>(element: K, defaultValue?: K extends NumericField ? number : string) => K extends NumericField ? number : string
82
+ get: (element: string, defaultValue?: string) => string
79
83
  all: () => any
80
84
  validate: (attributes?: CustomAttributes) => Promise<void>
81
85
  has: (element: string) => boolean
@@ -84,7 +88,7 @@ export declare interface RouterInstance {
84
88
  header: (headerParam: string) => string | number | boolean | null
85
89
  getHeaders: () => any
86
90
  Header: (headerParam: string) => string | number | boolean | null
87
- getParam: <T>(key: string) => T
91
+ getParam: (key: string) => string
88
92
  route: (key: string) => number | string | null
89
93
  bearerToken: () => string | null | RouterAuthToken
90
94
  getParams: () => RouteParams
@@ -98,7 +102,6 @@ declare type ActionPath = string;
98
102
  // need to refactor before, after, view to be a part of some other type
99
103
  export type RouteCallback = ((_params?: Record<string, any>) => any | string | object) | ((req: any, res: any) => Promise<void>);
100
104
  export type RouterAuthToken = `${number}:${number}:${string}`;
101
- export type NumericField = 'id' | 'age' | 'count' | 'quantity' | 'amount' | 'price' | 'total' | 'score' | 'rating' | 'duration' | 'size' | 'weight' | 'height' | 'width' | 'length' | 'distance' | 'speed' | 'temperature' | 'volume' | 'capacity' | 'density' | 'pressure' | 'force' | 'energy' | 'power' | 'frequency' | 'voltage' | 'current' | 'resistance' | 'time' | 'date' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond' | 'microsecond' | 'nanosecond';
102
105
  export type StatusCode = 200 | 201 | 202 | 204 | 301 | 302 | 304 | 400 | 401 | 403 | 404 | 500;
103
106
  export type RedirectCode = Extract<StatusCode, 301 | 302>;
104
107
  export type MiddlewareFn = (_request: Request) => Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.70.162",
4
+ "version": "0.70.164",
5
5
  "description": "The Stacks framework types.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -53,7 +53,7 @@
53
53
  "dependencies": {
54
54
  "@stacksjs/bunpress": "^0.1.18",
55
55
  "@stacksjs/clapp": "^0.2.12",
56
- "@stacksjs/stx": "^0.2.99",
56
+ "@stacksjs/stx": "^0.2.100",
57
57
  "@stacksjs/ts-validation": "^0.5.0",
58
58
  "bun-query-builder": "^0.1.56"
59
59
  },
@@ -66,7 +66,7 @@
66
66
  }
67
67
  },
68
68
  "devDependencies": {
69
- "@stacksjs/validation": "0.70.162",
69
+ "@stacksjs/validation": "0.70.164",
70
70
  "@types/bun": "^1.3.11",
71
71
  "meilisearch": "^0.59.0",
72
72
  "typescript": "^7.0.2"