@stacksjs/types 0.70.293 → 0.70.295

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.
@@ -99,6 +99,9 @@ export declare interface DatabaseOptions {
99
99
  }
100
100
  migrations: string
101
101
  migrationLocks: string
102
+ models?: {
103
+ includeFrameworkDefaults?: boolean
104
+ }
102
105
  reads?: ReadPolicyOptions
103
106
  safety?: {
104
107
  confirmMigrate?: boolean
package/dist/model.d.ts CHANGED
@@ -156,7 +156,7 @@ export declare interface Relations {
156
156
  }
157
157
  export declare interface ApiSettings {
158
158
  uri: string
159
- middleware: string[]
159
+ middleware: ApiMiddleware
160
160
  routes:
161
161
  | {
162
162
  [key in ApiRoutes]: Action
@@ -306,6 +306,25 @@ export type ApiRoutes = 'index' | 'show' | 'store' | 'update' | 'destroy';
306
306
  export type SocialProviders = 'google' | 'github' | 'apple' | 'twitter' | 'facebook';
307
307
  declare type LogAttribute = string;
308
308
  export type SocialOptions = SocialProviders[];
309
+ /**
310
+ * Middleware for the auto-generated REST routes.
311
+ *
312
+ * Omit it and both reads and writes get `auth` — an undeclared read route is
313
+ * how a customer list leaks (stacksjs/stacks#2224). A flat list applies to
314
+ * both sides; the split form states them separately, which is the only way to
315
+ * express the common "public catalog, authenticated writes" shape:
316
+ *
317
+ * ```ts
318
+ * middleware: ['auth'] // both sides
319
+ * middleware: [] // both sides public (warns at boot)
320
+ * middleware: { read: [], write: ['auth'] } // public reads, guarded writes
321
+ * ```
322
+ *
323
+ * An omitted side of the split form falls back to `auth`, not to public.
324
+ */
325
+ export type ApiMiddleware = | string
326
+ | string[]
327
+ | { read?: string | string[], write?: string | string[] }
309
328
  declare type ApiOptions = DeepPartial<ApiSettings>;
310
329
  /**
311
330
  * The attribute VALUES of one model row, as handed to a computed getter or
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.70.293",
4
+ "version": "0.70.295",
5
5
  "description": "The Stacks framework types.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -71,7 +71,7 @@
71
71
  }
72
72
  },
73
73
  "devDependencies": {
74
- "@stacksjs/validation": "0.70.293",
74
+ "@stacksjs/validation": "0.70.295",
75
75
  "better-dx": "^0.2.17",
76
76
  "meilisearch": "^0.59.0"
77
77
  },