@stacksjs/types 0.75.755 → 0.75.764

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
+ injectHead?: boolean
12
+ injectHeadExcept?: readonly string[]
11
13
  enabled?: boolean
12
14
  environments?: readonly string[]
13
15
  drivers: {
package/dist/auth.d.ts CHANGED
@@ -130,6 +130,8 @@ export declare interface AuthOptions {
130
130
  emailVerification?: {
131
131
  expire?: number
132
132
  url?: string
133
+ redirectTo?: string
134
+ sendOnRegister?: boolean
133
135
  }
134
136
  session?: {
135
137
  lifetime?: number
@@ -141,6 +143,18 @@ export declare interface AuthOptions {
141
143
  perIp?: number | false
142
144
  perEmail?: number | false
143
145
  }
146
+ personalTeams?: boolean
147
+ }
148
+ apiKeys?: {
149
+ header?: string
150
+ prefixes?: { publishable?: string, secret?: string }
151
+ cacheTtlSeconds?: number
152
+ negativeCacheTtlSeconds?: number
153
+ usageFlushSeconds?: number
154
+ }
155
+ teams?: {
156
+ roles?: string[]
157
+ seatLimit?: (teamId: number) => number | null | undefined | Promise<number | null | undefined>
144
158
  }
145
159
  socials?: {
146
160
  matching?: 'link' | 'create' | 'refuse'
package/dist/cache.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Cache Options - Configuration for the caching system
3
3
  */
4
4
  export declare interface CacheOptions {
5
- driver: 'memory' | 'redis' | 'singlestore' | 'sqlite'
5
+ driver: 'memory' | 'redis' | 'singlestore' | 'sqlite' | 'lru'
6
6
  prefix: string
7
7
  ttl: number
8
8
  maxKeys?: number
@@ -35,6 +35,12 @@ export declare interface CacheOptions {
35
35
  path?: string
36
36
  table?: string
37
37
  }
38
+ lru?: {
39
+ maxKeys?: number
40
+ maxBytes?: number
41
+ sizeOf?: (value: unknown) => number
42
+ useClones?: boolean
43
+ }
38
44
  }
39
45
  }
40
46
  /**
@@ -61,6 +67,7 @@ export declare interface CacheDriver {
61
67
  remember: <T>(key: string, ttl: number, callback: () => T | Promise<T>) => Promise<T>
62
68
  rememberForever: <T>(key: string, callback: () => T | Promise<T>) => Promise<T>
63
69
  getStats: () => Promise<CacheStats>
70
+ stats: () => Promise<CacheStats>
64
71
  close: () => Promise<void>
65
72
  disconnect: () => Promise<void>
66
73
  tags?: (tags: readonly string[]) => TaggedCacheScope
@@ -88,5 +95,6 @@ export declare interface CacheStats {
88
95
  keys: number
89
96
  size?: number
90
97
  hitRate?: number
98
+ evictions?: number
91
99
  }
92
100
  export type CacheConfig = Partial<CacheOptions>;
package/dist/cli.d.ts CHANGED
@@ -282,6 +282,8 @@ export type GeneratorOption = | 'types'
282
282
  | 'coreSymlink'
283
283
  | 'openApiSpec'
284
284
  | 'pantryConfig'
285
+ /** `buddy generate --pantry` (-r): regenerate deps.yaml. */
286
+ | 'pantry'
285
287
  | 'openapi'
286
288
  | 'modelFiles'
287
289
  | 'images';
@@ -55,11 +55,46 @@ export declare interface DatabaseBackupOptions {
55
55
  retain?: number
56
56
  timeout?: number
57
57
  }
58
+ /**
59
+ * A named connection in `config/database.ts`: a database beside the default
60
+ * one, such as a read-only SQLite data file.
61
+ *
62
+ * ```ts
63
+ * addresses: {
64
+ * driver: 'sqlite',
65
+ * database: 'storage/data/addresses.sqlite',
66
+ * readonly: true,
67
+ * pragmas: { mmap_size: 268_435_456 },
68
+ * } satisfies NamedDatabaseConnectionOptions,
69
+ * ```
70
+ */
71
+ export declare interface NamedDatabaseConnectionOptions {
72
+ driver: 'sqlite' | 'postgres' | 'mysql'
73
+ database?: string
74
+ path?: string
75
+ url?: string
76
+ host?: string
77
+ port?: number
78
+ username?: string
79
+ password?: string
80
+ readonly?: boolean
81
+ immutable?: boolean
82
+ pragmas?: Record<string, string | number | boolean>
83
+ }
84
+ /**
85
+ * Named connections sit beside the driver-keyed ones. Typed loosely because a
86
+ * TypeScript index signature would otherwise constrain the built-in keys too;
87
+ * `satisfies NamedDatabaseConnectionOptions` types one, and the framework
88
+ * validates each at runtime.
89
+ */
90
+ export declare interface NamedDatabaseConnections {
91
+ [name: string]: unknown
92
+ }
58
93
  export declare interface DatabaseOptions {
59
94
  default: SupportedDialect | 'turso' | 'libsql'
60
95
  logging?: boolean
61
96
  backups?: DatabaseBackupOptions
62
- connections: {
97
+ connections: NamedDatabaseConnections & {
63
98
  mysql?: NetworkedConnectionOptions & {
64
99
  url?: string
65
100
  host?: string
package/dist/deploy.d.ts CHANGED
@@ -18,6 +18,7 @@ export declare interface DeployOptions extends CliOptions {
18
18
  site?: string
19
19
  docker?: boolean
20
20
  dryRun?: boolean
21
+ plan?: boolean
21
22
  holdDns?: boolean
22
23
  json?: boolean
23
24
  }
@@ -46,6 +47,7 @@ export declare interface DeploymentPreview {
46
47
  }
47
48
  provider: string
48
49
  mode: string
50
+ pipeline: 'box' | 'cloudformation' | 'fly'
49
51
  environment: string
50
52
  region: string
51
53
  target: {
@@ -54,6 +56,7 @@ export declare interface DeploymentPreview {
54
56
  attachTo: string | null
55
57
  }
56
58
  sites: DeploymentPreviewSite[]
59
+ services: string[]
57
60
  operations: DeploymentPreviewOperation[]
58
61
  warnings: string[]
59
62
  }
package/dist/index.d.ts CHANGED
@@ -50,6 +50,7 @@ export * from './library';
50
50
  export * from './lint';
51
51
  export * from './logging';
52
52
  export * from './malware';
53
+ export * from './maps';
53
54
  export * from './manifest';
54
55
  export * from './marketing';
55
56
  export * from './model';
package/dist/maps.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * **Maps Options** (`config/maps.ts`, stacksjs/stacks#3564)
3
+ *
4
+ * Which geocoding driver `@stacksjs/maps` uses, its options, and the tiles a
5
+ * map on the page loads. Switch providers here (or with `MAPS_DRIVER`), with
6
+ * no code change.
7
+ */
8
+ export declare interface MapsOptions {
9
+ driver: 'mapshq' | 'nominatim' | 'photon' | (string & {})
10
+ country?: string
11
+ language?: string
12
+ drivers?: {
13
+ mapshq?: { key?: string, url?: string }
14
+ nominatim?: { url?: string, userAgent?: string }
15
+ photon?: { url?: string }
16
+ }
17
+ tiles?: { url?: string, style?: string }
18
+ }
19
+ export type MapsConfig = Partial<MapsOptions>;
package/dist/saas.d.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  export declare interface SaasOption {
2
2
  plans: {
3
+ key?: string
4
+ free?: boolean
5
+ trialDays?: number
6
+ limits?: Record<string, number | null>
7
+ features?: string[]
8
+ overage?: Record<string, { meter: string, priceKey: string }>
3
9
  productName: string
4
10
  description: string
5
11
  pricing: {
@@ -7,9 +13,15 @@ export declare interface SaasOption {
7
13
  price: number
8
14
  interval?: 'day' | 'month' | 'week' | 'year'
9
15
  currency: string
16
+ meter?: string
17
+ tiers?: { upTo: number | null, unitAmount: number, flatAmount?: number }[]
10
18
  }[]
11
19
  metadata?: Record<string, string>
12
20
  }[]
21
+ billing?: {
22
+ owner?: 'user' | 'team'
23
+ }
24
+ meters?: string[]
13
25
  webhook: {
14
26
  endpoint: string
15
27
  secret: string
@@ -70,6 +70,78 @@ export declare interface SearchEngineOptions {
70
70
  export declare interface CreateIndexOptions extends IndexOptions {
71
71
  settings?: Settings
72
72
  sampleDocument?: Record<string, unknown>
73
+ schema?: SearchCollectionSchema
74
+ }
75
+ /** One field of a declared search schema. */
76
+ export declare interface SearchSchemaField {
77
+ name: string
78
+ type: SearchFieldType
79
+ facet?: boolean
80
+ index?: boolean
81
+ sort?: boolean
82
+ optional?: boolean
83
+ infix?: boolean
84
+ locale?: string
85
+ store?: boolean
86
+ }
87
+ /**
88
+ * A search collection declared up front.
89
+ *
90
+ * Inferring a schema from a sample document cannot produce a `geopoint` (a
91
+ * `[lat, lng]` pair reads as `float[]`), made every filterable field a facet,
92
+ * and had nowhere to say a display-only field should not be indexed. Declare
93
+ * the schema when any of that matters.
94
+ */
95
+ export declare interface SearchCollectionSchema {
96
+ fields: SearchSchemaField[]
97
+ defaultSortingField?: string
98
+ tokenSeparators?: string[]
99
+ symbolsToIndex?: string[]
100
+ }
101
+ /** A point on the globe, in degrees. */
102
+ export declare interface GeoPoint {
103
+ lat: number
104
+ lng: number
105
+ }
106
+ /**
107
+ * A portable geo search: within a radius or a bounding box, nearest first.
108
+ *
109
+ * Combines with the text query, the caller's `filter` (both must hold) and the
110
+ * caller's `sort` (the distance order comes after the caller's own rules, so
111
+ * `sort: '_text_match(buckets: 10):desc'` ranks by relevance bucket first and
112
+ * distance within a bucket).
113
+ */
114
+ export declare interface SearchGeoParams {
115
+ field: string
116
+ near?: GeoPoint
117
+ radiusKm?: number
118
+ box?: [number, number, number, number]
119
+ sort?: 'asc' | 'desc' | false
120
+ precisionKm?: number
121
+ }
122
+ /**
123
+ * What a driver can do beyond the core contract. A member called for a
124
+ * feature reported `false` here throws `SearchFeatureUnsupportedError`.
125
+ */
126
+ export declare interface SearchEngineCapabilities {
127
+ curation: boolean
128
+ presets: boolean
129
+ streamingImport: boolean
130
+ aliases: boolean
131
+ keys: {
132
+ manage: boolean
133
+ scoped: boolean
134
+ }
135
+ multiSearch: {
136
+ union: boolean
137
+ isolatedErrors: boolean
138
+ }
139
+ geo: {
140
+ radius: boolean
141
+ box: boolean
142
+ sort: boolean
143
+ precision: boolean
144
+ }
73
145
  }
74
146
  /**
75
147
  * The parameters every driver's `search()` reads.
@@ -81,8 +153,12 @@ export declare interface CreateIndexOptions extends IndexOptions {
81
153
  * names all of them honour.
82
154
  *
83
155
  * Paging is `limit` + `offset`, or `perPage` + `page` (1-based). When both are
84
- * given, `limit` / `offset` win. Unlisted keys are driver-specific extras
85
- * (Typesense's `query_by`, Meilisearch's `attributesToRetrieve`, ...).
156
+ * given, `limit` / `offset` win.
157
+ *
158
+ * Unlisted keys are driver-specific extras, handed to the engine unchanged:
159
+ * Typesense's `prefix`, `num_typos`, `query_by_weights`, `group_by`,
160
+ * `facet_by`, ...; Meilisearch's `attributesToRetrieve`, ... An array value is
161
+ * sent as a comma-separated list, as Typesense expects.
86
162
  */
87
163
  export declare interface SearchEngineSearchParams {
88
164
  q?: string
@@ -93,20 +169,165 @@ export declare interface SearchEngineSearchParams {
93
169
  perPage?: number
94
170
  filter?: SearchFilter
95
171
  sort?: SearchSort
172
+ geo?: SearchGeoParams
96
173
  query_by?: string | string[]
97
174
  queryBy?: string | string[]
98
175
  [key: string]: unknown
99
176
  }
177
+ /**
178
+ * What the engine said about one hit, besides the document itself.
179
+ *
180
+ * Read from `hit._meta`. A driver whose engine has no equivalent for a field
181
+ * leaves it undefined; `raw` is the engine's own per-hit envelope minus the
182
+ * document, for anything not mapped here.
183
+ */
184
+ export declare interface SearchHitMeta {
185
+ textMatch?: number
186
+ textMatchInfo?: Record<string, unknown>
187
+ geoDistanceMeters?: Record<string, number>
188
+ highlights?: unknown
189
+ raw?: Record<string, unknown>
190
+ }
191
+ /** One faceted field's value counts. */
192
+ export declare interface SearchFacetCount {
193
+ field: string
194
+ counts: Array<{ value: string, count: number, highlighted?: string }>
195
+ stats?: Record<string, number>
196
+ }
197
+ /** A group of hits sharing the values of the `group_by` fields. */
198
+ export declare interface SearchHitGroup<T extends Record<string, any> = Record<string, any>> {
199
+ groupKey: unknown[]
200
+ found?: number
201
+ hits: Array<SearchHit<T>>
202
+ }
203
+ export declare interface SearchEngineMultiSearchOptions {
204
+ union?: boolean
205
+ signal?: AbortSignal
206
+ }
207
+ export declare interface SearchEngineMultiSearchResponse {
208
+ results: SearchEngineMultiSearchResult[]
209
+ union?: SearchEngineSearchResponse
210
+ }
211
+ /** What `createSearchKey` mints: a search-only key on the engine. */
212
+ export declare interface SearchKeyOptions {
213
+ indexes: string[]
214
+ actions?: string[]
215
+ description?: string
216
+ expiresAt?: Date
217
+ }
218
+ /** A key as the engine lists it. The secret itself is only ever returned by `createSearchKey`. */
219
+ export declare interface SearchKeyInfo {
220
+ id: string
221
+ description?: string
222
+ actions: string[]
223
+ indexes: string[]
224
+ expiresAt?: Date
225
+ prefix?: string
226
+ }
227
+ /** A newly created key. `value` is the secret: shown once, never logged. */
228
+ export declare interface SearchKey extends SearchKeyInfo {
229
+ value: string
230
+ }
231
+ /**
232
+ * Restrictions embedded in a scoped key derived from a search-only parent.
233
+ *
234
+ * The engine enforces them on every search made with the scoped key, and the
235
+ * holder cannot lift them. A scoped key is derived locally, so it cannot be
236
+ * revoked on its own: revoke the parent, or let `expiresAt` end it.
237
+ */
238
+ export declare interface ScopedSearchKeyOptions {
239
+ filter?: SearchFilter
240
+ expiresAt?: Date
241
+ limitMultiSearches?: number
242
+ indexes?: string[]
243
+ parentKeyId?: string
244
+ }
245
+ /** A name that searches and writes resolve to another index, so the index behind it can be swapped atomically. */
246
+ export declare interface SearchAlias {
247
+ alias: string
248
+ index: string
249
+ }
250
+ export declare interface SearchImportOptions {
251
+ action?: 'create' | 'upsert' | 'update' | 'emplace'
252
+ batchSize?: number
253
+ concurrency?: number
254
+ onProgress?: (progress: { imported: number, failed: number }) => void
255
+ failureSampleSize?: number
256
+ failureLogPath?: string
257
+ params?: Record<string, string>
258
+ }
259
+ /** One document the engine (or the parser) refused. */
260
+ export declare interface SearchImportFailure {
261
+ line?: number
262
+ id?: unknown
263
+ error: string
264
+ }
265
+ export declare interface SearchImportResult {
266
+ imported: number
267
+ failed: number
268
+ failureSample: SearchImportFailure[]
269
+ failureLogPath?: string
270
+ }
271
+ /**
272
+ * A curation rule: for searches matching `query` (or `filterBy`), pin some
273
+ * documents to fixed positions and hide others.
274
+ */
275
+ export declare interface SearchCuration {
276
+ id: string
277
+ query?: string
278
+ match?: 'exact' | 'contains'
279
+ filterBy?: string
280
+ pin?: Array<{ id: string, position: number }>
281
+ hide?: string[]
282
+ filterCuratedHits?: boolean
283
+ stopProcessing?: boolean
284
+ removeMatchedTokens?: boolean
285
+ }
286
+ /** A named, stored set of search parameters, applied with `{ preset: name }`. */
287
+ export declare interface SearchPreset {
288
+ name: string
289
+ params: Record<string, unknown>
290
+ }
291
+ /** Whether the engine can serve searches right now. */
292
+ export declare interface SearchEngineHealth {
293
+ ok: boolean
294
+ detail?: string
295
+ }
296
+ /** Resource use as the engine reports it. Fields the engine does not report are absent. */
297
+ export declare interface SearchEngineMetrics {
298
+ memoryBytes?: number
299
+ diskBytes?: number
300
+ documents?: number
301
+ indexes?: Array<{ name: string, documents: number }>
302
+ raw: unknown
303
+ }
100
304
  export declare interface SearchEngineDriver {
101
305
  client: () => Meilisearch
102
306
  resetClient?: () => void
103
- search: (index: string, params?: SearchEngineSearchParams) => Promise<SearchResponse<Record<string, any>>>
307
+ capabilities: SearchEngineCapabilities
308
+ search: (index: string, params?: SearchEngineSearchParams) => Promise<SearchEngineSearchResponse>
309
+ multiSearch: (
310
+ searches: SearchEngineMultiSearchQuery[],
311
+ common?: SearchEngineSearchParams,
312
+ options?: SearchEngineMultiSearchOptions,
313
+ ) => Promise<SearchEngineMultiSearchResponse>
314
+ health: (options?: { timeoutMs?: number }) => Promise<SearchEngineHealth>
315
+ metrics: () => Promise<SearchEngineMetrics>
316
+ upsertAlias: (alias: string, index: string) => Promise<SearchAlias>
317
+ getAlias: (alias: string) => Promise<SearchAlias | null>
318
+ listAliases: () => Promise<SearchAlias[]>
319
+ deleteAlias: (alias: string) => Promise<void>
320
+ createSearchKey: (options: SearchKeyOptions) => Promise<SearchKey>
321
+ createScopedSearchKey: (parentKey: string, options?: ScopedSearchKeyOptions) => Promise<string>
322
+ listSearchKeys: () => Promise<SearchKeyInfo[]>
323
+ revokeSearchKey: (id: string) => Promise<void>
104
324
  createIndex: (name: string, options?: CreateIndexOptions) => MaybePromise<EnqueuedTask>
105
325
  getIndex: (name: string) => Promise<Index<Record<string, any>>>
106
326
  addDocument: (indexName: string, params: any) => Promise<EnqueuedTask>
107
327
  updateDocuments: (indexName: string, params: DocumentOptions[]) => Promise<EnqueuedTask>
108
328
  updateDocument: (indexName: string, params: DocumentOptions) => Promise<EnqueuedTask>
109
329
  addDocuments: (indexName: string, params: any[]) => Promise<EnqueuedTask>
330
+ importDocuments: (indexName: string, source: SearchImportSource, options?: SearchImportOptions) => Promise<SearchImportResult>
110
331
  getDocument: (indexName: string, id: number | string, fields?: any) => Promise<Record<string, any>>
111
332
  deleteDocument: (indexName: string, id: number) => Promise<EnqueuedTask>
112
333
  deleteDocuments: (indexName: string, filters: string | string[]) => Promise<EnqueuedTask>
@@ -136,6 +357,13 @@ export declare interface SearchEngineDriver {
136
357
  getSynonyms: (index: string) => Promise<any>
137
358
  updateSynonyms: (index: string, synonyms: Synonyms) => Promise<EnqueuedTask>
138
359
  resetSynonyms: (index: string) => Promise<EnqueuedTask>
360
+ listCurations: (index: string) => Promise<SearchCuration[]>
361
+ upsertCuration: (index: string, curation: SearchCuration) => Promise<SearchCuration>
362
+ deleteCuration: (index: string, id: string) => Promise<void>
363
+ upsertPreset: (name: string, params: SearchEngineSearchParams) => Promise<SearchPreset>
364
+ getPreset: (name: string) => Promise<SearchPreset | null>
365
+ listPresets: () => Promise<SearchPreset[]>
366
+ deletePreset: (name: string) => Promise<void>
139
367
  getRankingRules: (index: string) => Promise<string[]>
140
368
  updateRankingRules: (index: string, rankingRules: string[] | null) => Promise<EnqueuedTask>
141
369
  resetRankingRules: (index: string) => Promise<EnqueuedTask>
@@ -170,10 +398,28 @@ export declare interface SearchOptions {
170
398
  filterable: string[]
171
399
  options?: SearchEngineOptions
172
400
  denormalize?: Record<string, string>
401
+ schema?: SearchCollectionSchema
173
402
  shape?: (model: any) => Record<string, unknown> | null | undefined | Promise<Record<string, unknown> | null | undefined>
174
403
  shapeMany?: (models: any[]) => Record<string, unknown>[] | Promise<Record<string, unknown>[]>
175
404
  }
176
405
  export type SearchEngineConfig = Partial<SearchEngineOptions>;
406
+ /** The field types a declared search schema may use (Typesense's names). */
407
+ export type SearchFieldType = | 'string'
408
+ | 'string[]'
409
+ | 'int32'
410
+ | 'int32[]'
411
+ | 'int64'
412
+ | 'int64[]'
413
+ | 'float'
414
+ | 'float[]'
415
+ | 'bool'
416
+ | 'bool[]'
417
+ | 'geopoint'
418
+ | 'geopoint[]'
419
+ | 'object'
420
+ | 'object[]'
421
+ | 'string*'
422
+ | 'auto';
177
423
  /**
178
424
  * A search filter, in one of three shapes.
179
425
  *
@@ -195,3 +441,28 @@ export type SearchFilter = string | Array<string | string[]> | Record<string, un
195
441
  * `{ field: 'asc' | 'desc' }` map.
196
442
  */
197
443
  export type SearchSort = string | string[] | Record<string, string>;
444
+ /** A hit: the stored document, plus `_meta` when the engine reported ranking data. */
445
+ export type SearchHit<T extends Record<string, any> = Record<string, any>> = T & { _meta?: SearchHitMeta }
446
+ /**
447
+ * What every driver's `search()` resolves to.
448
+ *
449
+ * The Meilisearch response shape every caller already reads (`hits`,
450
+ * `estimatedTotalHits`, `limit`, `offset`, ...), with hit metadata on each
451
+ * hit and the facet counts and groups an engine may add. Hits are still the
452
+ * documents themselves, so code that reads them as plain documents is
453
+ * unaffected.
454
+ */
455
+ export type SearchEngineSearchResponse<T extends Record<string, any> = Record<string, any>> = Omit<SearchResponse<T>, 'hits'> & {
456
+ hits: Array<SearchHit<T>>
457
+ facetCounts?: SearchFacetCount[]
458
+ groups?: Array<SearchHitGroup<T>>
459
+ }
460
+ /** One search in a multi-search: an index plus the usual parameters. */
461
+ export type SearchEngineMultiSearchQuery = SearchEngineSearchParams & { index: string }
462
+ /** One search's result in a multi-search: its response, or the error it alone hit. */
463
+ export type SearchEngineMultiSearchResult = | (SearchEngineSearchResponse & { index: string, error?: undefined })
464
+ | { index: string, error: { message: string, status?: number }, hits?: undefined }
465
+ /** Documents to import: objects, or a byte stream of newline-delimited JSON (one document per line). */
466
+ export type SearchImportSource = | AsyncIterable<Record<string, unknown>>
467
+ | Iterable<Record<string, unknown>>
468
+ | ReadableStream<Uint8Array>;
@@ -13,6 +13,10 @@ export declare interface FirewallOptions {
13
13
  export declare interface ApiSecurityOptions {
14
14
  rowScoping: ApiRowScopingPolicy
15
15
  models: ModelApiSelection
16
+ openapi?: {
17
+ securitySchemes?: Record<string, { type: 'http' | 'apiKey' | 'oauth2' | 'openIdConnect' | 'mutualTLS', scheme?: string, bearerFormat?: string, in?: 'header' | 'query' | 'cookie', name?: string, description?: string, [extension: string]: unknown }>
18
+ middleware?: Record<string, string | string[] | null>
19
+ }
16
20
  }
17
21
  /** Application-level rate limits: route `.rateLimit()`, `rateLimit()` and the auth lockout. */
18
22
  export declare interface RateLimitSecurityOptions {
@@ -53,6 +57,12 @@ export declare interface SecurityOptions {
53
57
  firewall: FirewallOptions
54
58
  waf?: WafSecurityOptions
55
59
  api: ApiSecurityOptions
60
+ rateLimiters?: Record<string, {
61
+ key?: (request: any) => string | Promise<string>
62
+ limit: { max: number, per: 'second' | 'minute' | 'hour' | 'day' | number }
63
+ | ((request: any) => { max: number, per: 'second' | 'minute' | 'hour' | 'day' | number } | Promise<{ max: number, per: 'second' | 'minute' | 'hour' | 'day' | number }>)
64
+ cacheSeconds?: number
65
+ }>
56
66
  rateLimit: RateLimitSecurityOptions
57
67
  trustedProxies?: readonly string[]
58
68
  }
@@ -1,3 +1,13 @@
1
+ import type { HqServiceName } from '@stacksjs/hq/registry';
2
+ /**
3
+ * The HQ services an application can connect to, from the one list in
4
+ * `@stacksjs/hq/registry` (stacksjs/stacks#3563).
5
+ *
6
+ * They are separate products. Each keeps its own account, keys, plan and
7
+ * subscription, so every service carries its own credentials and nothing is
8
+ * shared between them.
9
+ */
10
+ export type { HqServiceName };
1
11
  /** One HQ service's entry in `config/services.ts`, written by `buddy hq:connect`. */
2
12
  export declare interface HqServiceOptions {
3
13
  url: string
@@ -15,7 +25,14 @@ export declare interface SupportHqOptions extends HqServiceOptions {
15
25
  expose?: readonly ('email' | 'name')[]
16
26
  messenger?: { enabled?: boolean, loaderUrl?: string, locale?: string }
17
27
  }
18
- export declare interface ServicesOptions {
28
+ /**
29
+ * `HqServicesConfig` is the HQ services' entries. Each is its own account with
30
+ * its own keys, which `buddy hq:connect` writes to `.env` and `buddy hq:status`
31
+ * reads usage with. `config/logging.ts` and `config/monitoring.ts` take their
32
+ * LogHQ and BugHQ settings from these entries, and the dashboard's `hq`
33
+ * provider reads with their read keys.
34
+ */
35
+ export declare interface ServicesOptions extends HqServicesConfig {
19
36
  algolia?: {
20
37
  appId: string
21
38
  apiKey: string
@@ -171,21 +188,6 @@ export declare interface ServicesOptions {
171
188
  apiKey?: string
172
189
  apiVersion?: string
173
190
  }
174
- bughq?: HqServiceOptions
175
- loghq?: HqServiceOptions
176
- analyticshq?: HqServiceOptions
177
- statushq?: HqServiceOptions
178
- commshq?: CommsHqOptions
179
- supporthq?: SupportHqOptions
180
- reportshq?: HqServiceOptions
181
191
  }
182
- /**
183
- * The HQ services an application can connect to.
184
- *
185
- * They are separate products. Each keeps its own account, keys, plan and
186
- * subscription, so every service carries its own credentials and nothing is
187
- * shared between them.
188
- */
189
- export type HqServiceName = 'bughq' | 'loghq' | 'analyticshq' | 'statushq' | 'commshq' | 'reportshq' | 'supporthq';
190
- export type HqServicesConfig = Partial<Record<HqServiceName, HqServiceOptions>> & { supporthq?: SupportHqOptions }
192
+ export type HqServicesConfig = Partial<Record<HqServiceName, HqServiceOptions>> & { commshq?: CommsHqOptions, supporthq?: SupportHqOptions }
191
193
  export type ServicesConfig = Partial<ServicesOptions>;
package/dist/stacks.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AiConfig, AnalyticsConfig, AppConfig, AuthConfig, BinaryConfig, CacheConfig, CloudConfig, CmsConfig, CommerceConfig, CorsConfig, DashboardConfig, DatabaseConfig, DebugbarConfig, DnsConfig, DocsConfig, EmailConfig, ErrorConfig, FeatureFlagsConfig, FilesystemsConfig, GitConfig, HashingConfig, ImagesConfig, LibraryConfig, LoggingConfig, MalwareConfig, MarketingConfig, MonitoringConfig, NotificationConfig, PaymentConfig, Ports, QueueConfig, RealtimeConfig, SaasConfig, SearchEngineConfig, FormsConfig, SitesConfig, SmsConfig, SocialsConfig, SecurityConfig, ServerConfig, ServicesConfig, Team, UiConfig } from './index';
1
+ import type { AiConfig, AnalyticsConfig, AppConfig, AuthConfig, BinaryConfig, CacheConfig, CloudConfig, CmsConfig, CommerceConfig, CorsConfig, DashboardConfig, DatabaseConfig, DebugbarConfig, DnsConfig, DocsConfig, EmailConfig, ErrorConfig, FeatureFlagsConfig, FilesystemsConfig, GitConfig, HashingConfig, ImagesConfig, LibraryConfig, LoggingConfig, MalwareConfig, MapsConfig, MarketingConfig, MonitoringConfig, NotificationConfig, PaymentConfig, Ports, QueueConfig, RealtimeConfig, SaasConfig, SearchEngineConfig, FormsConfig, SitesConfig, SmsConfig, SocialsConfig, SecurityConfig, ServerConfig, ServicesConfig, Team, UiConfig } from './index';
2
2
  /**
3
3
  * **Stacks Options**
4
4
  *
@@ -26,6 +26,7 @@ export declare interface StacksOptions {
26
26
  email: EmailConfig
27
27
  featureFlags: FeatureFlagsConfig
28
28
  malware: MalwareConfig
29
+ maps: MapsConfig
29
30
  errors: ErrorConfig
30
31
  git: GitConfig
31
32
  hashing: HashingConfig
@@ -51,4 +52,44 @@ export declare interface StacksOptions {
51
52
  team: Team
52
53
  ui: UiConfig
53
54
  }
55
+ /**
56
+ * **App config namespaces** (stacksjs/stacks#3582)
57
+ *
58
+ * Every `config/<name>.ts` an app adds that is not a framework or tool config
59
+ * file is loaded as `config.<name>`. Augment this interface to type it:
60
+ *
61
+ * // config/fleet.ts
62
+ * export interface FleetConfig { engine: 'typesense' | 'meilisearch' }
63
+ *
64
+ * declare module '@stacksjs/types' {
65
+ * interface ConfigNamespaces { fleet: FleetConfig }
66
+ * }
67
+ *
68
+ * export default { engine: 'typesense' } satisfies FleetConfig
69
+ *
70
+ * It is its own interface rather than an augmentation of `StacksOptions`
71
+ * because the framework's defaults are typed as a complete `StacksOptions`:
72
+ * a required key added there would be one the defaults lack, and an app that
73
+ * compiles the framework from source would fail to typecheck. `config` is
74
+ * typed `StacksOptions & ConfigNamespaces`, so both halves read the same way.
75
+ */
76
+ // eslint-disable-next-line ts/no-empty-object-type
77
+ export declare interface ConfigNamespaces {}
78
+ /** One problem a config file's `validate` export reports; `path` is relative to its section. */
79
+ export declare interface ConfigValidatorIssue {
80
+ path?: string
81
+ message: string
82
+ }
54
83
  export type StacksConfig = Partial<StacksOptions>;
84
+ /** What `config` from `@stacksjs/config` is: the framework's sections plus the app's own. */
85
+ export type LoadedConfig = StacksOptions & ConfigNamespaces;
86
+ /** What a config file's `validate` export returns: nothing or `true` when the section is fine. */
87
+ export type ConfigValidatorResult = void | undefined | null | boolean | string | Array<string | ConfigValidatorIssue>;
88
+ /*.ts` file. It receives the
89
+ * section the file exports and runs at boot with the framework's validators;
90
+ * anything it reports stops the boot like a framework config issue.
91
+ *
92
+ * export const validate: ConfigValidator<MapsConfig> = maps =>
93
+ * maps.engine ? undefined : 'engine is required'
94
+ */
95
+ export type ConfigValidator<T = unknown> = (section: T) => ConfigValidatorResult | Promise<ConfigValidatorResult>;
@@ -28,7 +28,8 @@ export type TraitTableName = | 'chat_conversations'
28
28
  | 'categorizables'
29
29
  | 'commentable_upvotes'
30
30
  | 'taggable_models'
31
- | 'categorizable_models';
31
+ | 'categorizable_models'
32
+ | 'model_audits';
32
33
  /**
33
34
  * Every table the framework owns that no model declares.
34
35
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.75.755",
4
+ "version": "0.75.764",
5
5
  "description": "The Stacks framework types.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -70,17 +70,18 @@
70
70
  "dependencies": {
71
71
  "@stacksjs/bunpress": "^0.2.36",
72
72
  "@stacksjs/clapp": "^0.2.17",
73
- "@stacksjs/events": "0.75.755",
74
- "@stacksjs/strings": "0.75.755",
75
- "@stacksjs/stx": "^0.2.969",
73
+ "@stacksjs/events": "0.75.764",
74
+ "@stacksjs/hq": "0.75.764",
75
+ "@stacksjs/strings": "0.75.764",
76
+ "@stacksjs/stx": "^0.2.983",
76
77
  "@stacksjs/ts-validation": "^0.5.7",
77
78
  "bun-query-builder": "^0.6.5",
78
79
  "meilisearch": "^0.62.0",
79
80
  "stripe": "23.0.0"
80
81
  },
81
82
  "devDependencies": {
82
- "@stacksjs/validation": "0.75.755",
83
- "better-dx": "^0.2.41"
83
+ "@stacksjs/validation": "0.75.764",
84
+ "better-dx": "^0.2.42"
84
85
  },
85
86
  "sideEffects": false,
86
87
  "publishConfig": {
@@ -111,7 +112,7 @@
111
112
  }
112
113
  },
113
114
  "peerDependencies": {
114
- "@stacksjs/actions": "0.75.755",
115
- "@stacksjs/scheduler": "0.75.755"
115
+ "@stacksjs/actions": "0.75.764",
116
+ "@stacksjs/scheduler": "0.75.764"
116
117
  }
117
118
  }