@zeno-lib/schema 0.4.0 → 0.4.1

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.
package/dist/index.d.mts CHANGED
@@ -10,9 +10,9 @@ type TableColumns<TTable extends Table> = TTable["_"]["columns"];
10
10
  declare const COLUMN_RULES_KEY = "~zeno";
11
11
  /**
12
12
  * What a column marker from `@zeno-lib/db/schema` records. `writer` says who
13
- * writes the column when a client doesn't: `"server"` code (`serverOwned`), or
14
- * only the `"database"`, through a default and a trigger (the audit columns
15
- * `timestamps()` and `authorship()` emit). `refine` runs on it in insert and
13
+ * writes the column when a client doesn't: `"server"` code (`serverManaged`),
14
+ * or only the `"database"` (`databaseManaged`, which the audit columns of
15
+ * `timestamps()` and `authorship()` carry). `refine` runs on it in insert and
16
16
  * update, and `hint` goes to the form field that edits it.
17
17
  */
18
18
  type ColumnRule = {
@@ -73,8 +73,9 @@ declare function defineTableSchema<TTable extends ZenoTable>(table: TTable): Def
73
73
  declare function defineTableSchema<TTable extends ZenoTable, TCoerce extends CoerceOptions = undefined, TOptions extends DefineTableSchemaOptions<TTable, TCoerce> = DefineTableSchemaOptions<TTable, TCoerce>>(table: TTable, options: TOptions): DefineTableSchemaResult<TTable, TCoerce, TOptions>;
74
74
  /**
75
75
  * `defineTableSchema` for code that runs only on the server, such as a sync
76
- * job, which writes the columns `serverOwned()` keeps from clients. Identity
77
- * and audit columns stay out, as the database writes them. Never parse what a
76
+ * job, which writes the columns `serverManaged()` keeps from clients.
77
+ * Identity, audit and `databaseManaged()` columns stay out, as the database
78
+ * writes them. Never parse what a
78
79
  * client sends with it: a server action's input is a client's.
79
80
  */
80
81
  declare function defineServerTableSchema<TTable extends ZenoTable>(table: TTable): DefineTableSchemaResult<TTable, undefined, NoTableSchemaOptions, ServerExcludes>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeno-lib/schema",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "repository": {
5
5
  "url": "https://github.com/zeno-lib/zeno.git",
6
6
  "directory": "packages/schema"
package/src/index.ts CHANGED
@@ -39,9 +39,9 @@ const COLUMN_RULES_KEY = "~zeno"
39
39
 
40
40
  /**
41
41
  * What a column marker from `@zeno-lib/db/schema` records. `writer` says who
42
- * writes the column when a client doesn't: `"server"` code (`serverOwned`), or
43
- * only the `"database"`, through a default and a trigger (the audit columns
44
- * `timestamps()` and `authorship()` emit). `refine` runs on it in insert and
42
+ * writes the column when a client doesn't: `"server"` code (`serverManaged`),
43
+ * or only the `"database"` (`databaseManaged`, which the audit columns of
44
+ * `timestamps()` and `authorship()` carry). `refine` runs on it in insert and
45
45
  * update, and `hint` goes to the form field that edits it.
46
46
  */
47
47
  type ColumnRule = {
@@ -447,8 +447,8 @@ const withChecks = (
447
447
  return composeRefinements(refinements, generated)
448
448
  }
449
449
 
450
- // Zod rejects an omit key the shape lacks, which a generated or server-owned
451
- // column would be.
450
+ // Zod rejects an omit key the shape lacks, which a generated or managed column
451
+ // would be.
452
452
  const omitPresent = <TSchema extends z.ZodObject>(
453
453
  schema: TSchema,
454
454
  keys: readonly string[]
@@ -540,8 +540,9 @@ function defineTableSchema(
540
540
 
541
541
  /**
542
542
  * `defineTableSchema` for code that runs only on the server, such as a sync
543
- * job, which writes the columns `serverOwned()` keeps from clients. Identity
544
- * and audit columns stay out, as the database writes them. Never parse what a
543
+ * job, which writes the columns `serverManaged()` keeps from clients.
544
+ * Identity, audit and `databaseManaged()` columns stay out, as the database
545
+ * writes them. Never parse what a
545
546
  * client sends with it: a server action's input is a client's.
546
547
  */
547
548
  function defineServerTableSchema<TTable extends ZenoTable>(