@stacksjs/orm 0.70.228 → 0.70.230

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.
@@ -44,6 +44,19 @@ export declare function mapWriteError(err: unknown, modelName: string, op: 'crea
44
44
  export declare function toSnakeCase(s: string): string;
45
45
  /** Map every key of a write payload to its snake_case column spelling. */
46
46
  export declare function toSnakeCaseKeys(data: Record<string, any>): Record<string, any>;
47
+ /**
48
+ * Resolve the model fields accepted by generated store/update routes.
49
+ *
50
+ * Declared fillable attributes remain the primary allowlist. A `belongsTo`
51
+ * declaration also defines a real foreign-key column in model-driven
52
+ * migrations, so its `<relation>Id` attribute is writable through `useApi`
53
+ * without requiring a bespoke action for every relationship. No undeclared
54
+ * body key is admitted, and hasMany/hasOne relations never contribute keys.
55
+ */
56
+ export declare function getWritableFields(model: {
57
+ attributes?: Record<string, { fillable?: boolean }>
58
+ belongsTo?: unknown[]
59
+ } | null | undefined): string[];
47
60
  /**
48
61
  * Filter a request body down to fillable fields. Accepts BOTH the
49
62
  * attribute-name spelling and its snake_case column spelling on input, so
@@ -52,6 +65,14 @@ export declare function toSnakeCaseKeys(data: Record<string, any>): Record<strin
52
65
  * validation rules all look fields up by that spelling.
53
66
  */
54
67
  export declare function filterFillable(body: any, fillableFields: string[]): Record<string, any>;
68
+ /**
69
+ * Normalize JSON-safe values for validators whose in-process type cannot be
70
+ * represented directly in a request body. `schema.date()` validates a Date
71
+ * instance, while browser forms submit an ISO calendar date string. Keep the
72
+ * stored write payload unchanged and normalize only the value passed to the
73
+ * validator.
74
+ */
75
+ export declare function normalizeValidationValue(rule: any, value: unknown): unknown;
55
76
  /**
56
77
  * Drop attribute keys flagged `hidden: true` from an incoming write body.
57
78
  * Must drop BOTH spellings — accepting the snake spelling in filterFillable
package/dist/index.d.ts CHANGED
@@ -47,8 +47,13 @@ export declare const User: boolean;
47
47
  export declare const Job: boolean;
48
48
  export declare const FailedJob: boolean;
49
49
  export declare const Activity: boolean;
50
+ export declare const AnalyticsEvent: boolean;
50
51
  export declare const Author: boolean;
52
+ export declare const Board: boolean;
53
+ export declare const BoardColumn: boolean;
51
54
  export declare const Campaign: boolean;
55
+ export declare const Card: boolean;
56
+ export declare const CardComment: boolean;
52
57
  export declare const Cart: boolean;
53
58
  export declare const CartItem: boolean;
54
59
  export declare const Category: boolean;
@@ -64,13 +69,17 @@ export declare const EmailList: boolean;
64
69
  export declare const EmailListSubscriber: boolean;
65
70
  export declare const ErrorModel: boolean;
66
71
  export declare const GiftCard: boolean;
72
+ export declare const Label: boolean;
67
73
  export declare const LicenseKey: boolean;
68
74
  export declare const Log: boolean;
69
75
  export declare const LoyaltyPoint: boolean;
70
76
  export declare const LoyaltyReward: boolean;
77
+ export declare const MailPreference: boolean;
71
78
  export declare const Manufacturer: boolean;
72
79
  export declare const Notification: boolean;
80
+ export declare const NotificationDelivery: boolean;
73
81
  export declare const Order: boolean;
82
+ export declare const OrderIdempotency: boolean;
74
83
  export declare const OrderItem: boolean;
75
84
  export declare const Page: boolean;
76
85
  export declare const Payment: boolean;
@@ -82,6 +91,7 @@ export declare const PrintDevice: boolean;
82
91
  export declare const Product: boolean;
83
92
  export declare const ProductUnit: boolean;
84
93
  export declare const ProductVariant: boolean;
94
+ export declare const QueryLog: boolean;
85
95
  export declare const Receipt: boolean;
86
96
  export declare const Release: boolean;
87
97
  export declare const Request: boolean;
@@ -96,6 +106,8 @@ export declare const Subscription: boolean;
96
106
  export declare const Tag: boolean;
97
107
  export declare const TaxRate: boolean;
98
108
  export declare const Team: boolean;
109
+ export declare const TeamInvitation: boolean;
110
+ export declare const TeamMember: boolean;
99
111
  export declare const Transaction: boolean;
100
112
  export declare const WaitlistProduct: boolean;
101
113
  export declare const WaitlistRestaurant: boolean;
@@ -201,7 +213,7 @@ export { setAuditUser, createAuditMethods } from './traits/audit';
201
213
  // './auto-crud' via other barrels. `isUniqueViolation` is re-exported by
202
214
  // `@stacksjs/auth`'s './rbac-store-bqb' for back-compat; `mapWriteError`
203
215
  // powers the auto-CRUD store/update 409 mapping.
204
- export { isUniqueViolation, mapWriteError } from './auto-crud';
216
+ export { filterFillable, getWritableFields, isUniqueViolation, mapWriteError, toSnakeCaseKeys } from './auto-crud';
205
217
  export * from './batch-loader';
206
218
  export * from './db';
207
219
  export * from './subquery';