@rebasepro/types 0.13.1-canary.gf57a27e → 0.14.0

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.
@@ -211,11 +211,16 @@ export interface BaseCollectionConfig<M extends Record<string, unknown> = Record
211
211
  * Whether a write naming a field this collection does not declare is
212
212
  * rejected with a 400. Defaults to `true`.
213
213
  *
214
- * Set to `false` to let unknown keys through to the database, which is what
215
- * happened before this existed: a typo reached the INSERT and came back as
216
- * a Postgres error about a column, or — where a column really does exist
217
- * that the config never declared, populated by a trigger or a default —
218
- * quietly worked. The second case is the reason for the escape hatch.
214
+ * Set to `false` where a column really does exist that the config never
215
+ * declared — populated by a trigger, or introspected rather than declared —
216
+ * and callers need to write it. The column still has to exist: the driver
217
+ * checks the key against the table's own columns whatever this is set to,
218
+ * because a key with no column behind it is not passed to the database and
219
+ * refused, it is dropped from the statement and answered 201.
220
+ *
221
+ * It does not let a typo through to Postgres for Postgres to judge. That is
222
+ * what this flag was documented as doing, and no such judgment ever
223
+ * happened.
219
224
  */
220
225
  strictWrites?: boolean;
221
226
 
@@ -245,6 +245,22 @@ export const ALL_WHERE_FILTER_OPS: readonly WhereFilterOp[] = [
245
245
  /** All canonical operator strings for runtime validation. */
246
246
  const CANONICAL_OPS: ReadonlySet<string> = new Set<WhereFilterOp>(ALL_WHERE_FILTER_OPS);
247
247
 
248
+ /**
249
+ * The REST table as a `Map`, because the key `toCanonicalOp` is handed comes
250
+ * off the wire.
251
+ *
252
+ * Indexed as a plain object, every `Object.prototype` member answered:
253
+ * `toCanonicalOp("valueOf")` returned the inherited *function* as though it
254
+ * were a `WhereFilterOp`, and every caller here treats a defined result as
255
+ * "known operator". Same defect the REST codec's own lookup tables were
256
+ * converted away from in `filter-dialect.ts`; this is the copy that survived
257
+ * one package over, and it now sits under the operator validation the REST
258
+ * parser does, which would otherwise have admitted `["constructor", x]`.
259
+ */
260
+ const REST_OP_LOOKUP: ReadonlyMap<string, WhereFilterOp> = new Map<string, WhereFilterOp>(
261
+ Object.entries(REST_TO_CANONICAL) as [string, WhereFilterOp][]
262
+ );
263
+
248
264
  /**
249
265
  * Resolve any operator string (canonical or REST short-code) to its
250
266
  * canonical `WhereFilterOp` form. Returns `undefined` for unknown operators.
@@ -257,5 +273,5 @@ const CANONICAL_OPS: ReadonlySet<string> = new Set<WhereFilterOp>(ALL_WHERE_FILT
257
273
  */
258
274
  export function toCanonicalOp(op: string): WhereFilterOp | undefined {
259
275
  if (CANONICAL_OPS.has(op)) return op as WhereFilterOp;
260
- return (REST_TO_CANONICAL as Record<string, WhereFilterOp | undefined>)[op];
276
+ return REST_OP_LOOKUP.get(op);
261
277
  }
@@ -218,12 +218,19 @@ export interface BaseProperty<CustomProps = unknown> {
218
218
  validation?: PropertyValidationSchema;
219
219
 
220
220
  /**
221
- * Never include this column in an API response.
221
+ * Never mention this column on the API surface, in either direction.
222
222
  *
223
223
  * For secrets the server must store and read but no client should ever
224
224
  * receive — password hashes, verification tokens. The value is still
225
225
  * written and queryable server-side; it is stripped from every row the API
226
- * serves, for every caller, including admins and service keys.
226
+ * serves, for every caller, including admins and service keys, and it is
227
+ * absent from every generated description of the surface: the SDK's `Row`,
228
+ * `Insert` and `Update` types, and the OpenAPI schemas, filters and
229
+ * parameters.
230
+ *
231
+ * The generated types are a *description*, not a second enforcement point:
232
+ * the server still accepts such a field on a write, because that is how the
233
+ * value gets written in the first place. Nothing generated offers it.
227
234
  *
228
235
  * This is a server-side guarantee, unlike `admin.hideFromCollection`, which
229
236
  * only stops the admin panel from *rendering* a field and leaves it in the