@oakbun/ws 2.0.0 → 3.0.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +12 -1
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -41,6 +41,8 @@ interface ColumnDef {
41
41
  unique: boolean;
42
42
  defaultValue?: unknown;
43
43
  defaultFn?: () => unknown;
44
+ /** Explicit SQL column name — overrides the JS key when set. */
45
+ columnName?: string;
44
46
  }
45
47
  declare class Column<T> {
46
48
  readonly def: Readonly<ColumnDef>;
@@ -51,6 +53,15 @@ declare class Column<T> {
51
53
  unique(): Column<T>;
52
54
  default(value: NonNullable<T>): Column<T>;
53
55
  defaultFn(fn: () => NonNullable<T>): Column<T>;
56
+ /**
57
+ * Set an explicit SQL column name, independent of the JS property key.
58
+ * Use this to map camelCase TypeScript keys to snake_case SQL columns.
59
+ *
60
+ * @example
61
+ * passwordHash: column.text().name('password_hash')
62
+ * // INSERT uses "password_hash", SELECT returns { passwordHash: ... }
63
+ */
64
+ name(columnName: string): Column<T>;
54
65
  }
55
66
 
56
67
  type SchemaMap = Record<string, Column<any>>;
@@ -725,7 +736,7 @@ declare class InsertBuilder<T, S extends SchemaMap> {
725
736
  * ])
726
737
  */
727
738
  insertMany(data: InferInsert<S>[]): Promise<T[]>;
728
- /** Serialize values for storage. Date → ISO string. Drops undefined values. */
739
+ /** Serialize values for storage. Maps JS keys → SQL column names. Date → ISO string. Drops undefined. */
729
740
  private _serializeForInsert;
730
741
  }
731
742
  declare class JoinBuilder {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oakbun/ws",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "WebSocket plugin for the OakBun framework.",
5
5
  "author": "René (SchildW3rk)",
6
6
  "license": "MIT",
@@ -41,7 +41,7 @@
41
41
  "prepublishOnly": "bun run build"
42
42
  },
43
43
  "peerDependencies": {
44
- "oakbun": ">=0.3.0",
44
+ "oakbun": ">=0.4.0",
45
45
  "zod": "^3.0.0 || ^4.0.0"
46
46
  },
47
47
  "devDependencies": {