@byline/core 2.2.0 → 2.2.2

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.
@@ -7,6 +7,25 @@
7
7
  */
8
8
  import type { ArrayField, BlocksField, Field, FieldSet, GroupField, LocalizedField, OptionalField, SelectField } from './field-types.js';
9
9
  import type { Prettify, ValueUnion } from './type-utils.js';
10
+ /**
11
+ * Structural type for any JSON-serializable value. Used as the type for
12
+ * `json` and `richText` field data — these columns are stored as JSON,
13
+ * and the underlying shape is plugin-defined (e.g. Lexical's
14
+ * `SerializedEditorState` for richText). Consumers narrow this at the
15
+ * read site to their plugin's specific state type.
16
+ *
17
+ * Typed as `JsonValue` rather than `unknown` so that values flow cleanly
18
+ * through framework serialization validators (e.g. TanStack Start's
19
+ * `createServerFn`) without being branded as un-serializable.
20
+ */
21
+ export type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
22
+ /**
23
+ * A JSON object — the narrower form used by the `object` field type,
24
+ * whose definition constrains values to `Record<string, any>`.
25
+ */
26
+ export type JsonObject = {
27
+ [k: string]: JsonValue;
28
+ };
10
29
  type BaseFieldDataTypes = {
11
30
  array: never;
12
31
  blocks: never;
@@ -19,9 +38,9 @@ type BaseFieldDataTypes = {
19
38
  group: never;
20
39
  integer: number;
21
40
  counter: number;
22
- json: unknown;
23
- object: unknown;
24
- richText: unknown;
41
+ json: JsonValue;
42
+ object: JsonObject;
43
+ richText: JsonValue;
25
44
  select: never;
26
45
  textArea: string;
27
46
  text: string;
@@ -199,7 +199,7 @@ export async function createDocument(ctx, params) {
199
199
  action: 'create',
200
200
  documentData: data,
201
201
  path: resolvedPath,
202
- status: params.status ?? data.status,
202
+ status: params.status ?? data.status ?? getDefaultStatus(definition),
203
203
  locale: params.locale ?? defaultLocale,
204
204
  orderKey,
205
205
  })
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@byline/core",
3
3
  "private": false,
4
4
  "license": "MPL-2.0",
5
- "version": "2.2.0",
5
+ "version": "2.2.2",
6
6
  "engines": {
7
7
  "node": ">=20.9.0"
8
8
  },
@@ -79,7 +79,7 @@
79
79
  "sharp": "^0.34.5",
80
80
  "uuid": "^14.0.0",
81
81
  "zod": "^4.4.3",
82
- "@byline/auth": "2.2.0"
82
+ "@byline/auth": "2.2.2"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@biomejs/biome": "2.4.15",