@stonecrop/schema 0.16.6 → 0.18.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.
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import { readFileSync as c, existsSync as v, mkdirSync as O, writeFileSync as k
3
3
  import { resolve as d, join as C } from "node:path";
4
4
  import { parseArgs as P } from "node:util";
5
5
  import { getIntrospectionQuery as j } from "graphql";
6
- import { c as E, m as J, f as L, v as R } from "./validation-CToUOy0a.js";
6
+ import { c as E, m as J, f as L, v as R } from "./validation-C25HJXWs.js";
7
7
  async function q(e, f) {
8
8
  const o = await fetch(e, {
9
9
  method: "POST",
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as d, D as A, F as p, G as u, I as y, a as T, T as m, b as S, d as D, V as I, W as L, e as N, g as C, h as f, i as F, j as O, k as b, c as k, l as E, n as x, f as P, o as _, p as g, q as h, m as R, r as M, s as v, t as w, u as W, w as G, x as K, y as j, z as Q, v as V, B as q } from "./validation-CToUOy0a.js";
1
+ import { A as d, D as A, F as p, G as u, I as y, a as T, T as m, b as S, d as I, V as C, W as D, e as L, g as N, h as F, i as f, j as O, k as b, c as k, l as E, n as x, f as g, o as P, p as R, q as _, r as h, m as M, s as v, t as w, u as W, w as G, x as K, y as j, z as Q, B as V, v as q, C as z } from "./validation-C25HJXWs.js";
2
2
  const a = {
3
3
  ATextInput: "text",
4
4
  ATextboxInput: "text",
@@ -46,13 +46,13 @@ export {
46
46
  T as INTROSPECTED_IDENTITY_PROPS,
47
47
  m as TableFieldSchema,
48
48
  S as TableViewConfig,
49
- D as TriggerDefinition,
50
- I as ValueFieldSchema,
51
- L as WELL_KNOWN_SCALARS,
52
- N as WorkflowLayout,
53
- C as WorkflowMeta,
54
- f as buildScalarMap,
55
- F as camelToLabel,
49
+ I as TriggerDefinition,
50
+ C as ValueFieldSchema,
51
+ D as WELL_KNOWN_SCALARS,
52
+ L as WorkflowLayout,
53
+ N as WorkflowMeta,
54
+ F as buildScalarMap,
55
+ f as camelToLabel,
56
56
  O as camelToSnake,
57
57
  b as classifyFieldType,
58
58
  o as componentCategory,
@@ -60,21 +60,22 @@ export {
60
60
  k as convertGraphQLSchema,
61
61
  E as defaultIsEntityField,
62
62
  x as defaultIsEntityType,
63
- P as formatDoctypeDrift,
64
- _ as getPrimaryKeyField,
65
- g as getRecordIdentity,
63
+ g as formatDoctypeDrift,
64
+ P as getPrimaryKeyField,
65
+ R as getRecordIdField,
66
+ _ as getRecordIdentity,
66
67
  h as isActionAllowedInState,
67
- R as mergeIntrospectedDoctype,
68
- M as normalizeFieldKind,
69
- v as parseDoctype,
70
- w as parseField,
71
- W as pascalToSnake,
68
+ M as mergeIntrospectedDoctype,
69
+ v as normalizeFieldKind,
70
+ w as parseDoctype,
71
+ W as parseField,
72
+ G as pascalToSnake,
72
73
  s as resolveLinkRenderMode,
73
- G as snakeToCamel,
74
- K as snakeToLabel,
75
- j as toPascalCase,
76
- Q as toSlug,
77
- V as validateDoctype,
78
- q as validateField
74
+ K as snakeToCamel,
75
+ j as snakeToLabel,
76
+ Q as toPascalCase,
77
+ V as toSlug,
78
+ q as validateDoctype,
79
+ z as validateField
79
80
  };
80
81
  //# sourceMappingURL=index.js.map
package/dist/schema.d.ts CHANGED
@@ -408,12 +408,12 @@ export declare interface DataClient<T extends DoctypeRef = DoctypeRef, M = Docty
408
408
  */
409
409
  getRecord(doctype: T, recordId: string, options?: GetRecordOptions): Promise<GetRecordResult>;
410
410
  /**
411
- * Fetch multiple records
411
+ * Fetch a page of records
412
412
  * @param doctype - Doctype reference (name and optional slug)
413
413
  * @param options - Query options
414
- * @returns Array of record data
414
+ * @returns The page, plus whether more exist and (on request) the total
415
415
  */
416
- getRecords(doctype: T, options?: GetRecordsOptions): Promise<Record<string, unknown>[]>;
416
+ getRecords(doctype: T, options?: GetRecordsOptions): Promise<GetRecordsResult>;
417
417
  /**
418
418
  * Execute a doctype action (e.g., SUBMIT, APPROVE, save).
419
419
  * All state changes flow through this single mutation endpoint.
@@ -736,9 +736,10 @@ export declare function formatDoctypeDrift(drift: DoctypeDrift): string[];
736
736
  * Two deliberate limits, both matching the shape `primaryKey` actually has:
737
737
  * - Only **top-level** fields are scanned. `primaryKey` is a `ValueField` flag and a fieldset's
738
738
  * children are not identity columns, so a nested match would be an authoring error, not a PK.
739
- * - The **first** match wins. Nothing in the schema enforces exactly one `primaryKey: true`, and
740
- * there is no composite-key representation — a doctype with several is already malformed, and
741
- * picking the first is what the middleware has always done.
739
+ * - The **first** match wins. Identity is single-valued by design — a doctype describes the API
740
+ * surface, and mapping a composite database key onto one identity there is the adapter's job —
741
+ * so a doctype declaring several is malformed rather than composite. `DoctypeMeta` rejects that
742
+ * at the load gate; this stays total for callers holding fields that never went through it.
742
743
  *
743
744
  * @param fields - the doctype's top-level fields
744
745
  * @returns the primary-key field, or `undefined` for a PK-less doctype
@@ -761,6 +762,29 @@ export declare function getPrimaryKeyField(fields: readonly DoctypeField[]): Val
761
762
  */
762
763
  export declare function getRecordIdentity(fields: readonly DoctypeField[], record: Record<string, unknown>): string | undefined;
763
764
 
765
+ /**
766
+ * The name of the field a record is identified by: the declared `primaryKey`, or `id` when the
767
+ * doctype declares none.
768
+ *
769
+ * The `id` fallback is load-bearing, not defensive — a surrogate-key doctype carries an `id`
770
+ * column and marks no primary key, so "nothing declared" means `id`, not "no identity".
771
+ *
772
+ * This exists because that one-line rule had been restated at four sites — the client's
773
+ * `Doctype.recordIdField`, both nuxt hosts' `recordLookupField`, and the Postgres adapter — and
774
+ * the fourth had omitted the fallback, so a doctype the client keyed by `id` was one the adapter
775
+ * could not look up at all. Call this; a fifth restatement is how they diverge again.
776
+ *
777
+ * The returned name is not guaranteed to be a declared field: a doctype that declares no
778
+ * `primaryKey` and no `id` yields `'id'` regardless. An adapter that must build a SQL predicate
779
+ * from it has to confirm the field exists and say so when it does not, because selecting a column
780
+ * the doctype never declared returns nothing rather than failing.
781
+ *
782
+ * @param fields - the doctype's top-level fields
783
+ * @returns the identifying fieldname
784
+ * @public
785
+ */
786
+ export declare function getRecordIdField(fields: readonly DoctypeField[]): string;
787
+
764
788
  /**
765
789
  * Options for fetching a single record
766
790
  * @public
@@ -802,6 +826,36 @@ export declare interface GetRecordsOptions {
802
826
  limit?: number;
803
827
  /** Number of records to skip */
804
828
  offset?: number;
829
+ /**
830
+ * Ask the backend for the total matching the filters as well as the page.
831
+ *
832
+ * Off by default because it costs a second query — a full scan on Postgres — and knowing
833
+ * *whether* more exist (`hasMore`) is what a list view actually needs. Turn it on for a
834
+ * "showing 20 of 4,312" style display.
835
+ */
836
+ includeTotal?: boolean;
837
+ }
838
+
839
+ /**
840
+ * Result from getRecords — a page of records, and enough to tell that it is one.
841
+ *
842
+ * A bare array used to be returned here, which claimed to be the whole collection. It is not:
843
+ * a limit always applies, so a caller could not distinguish a complete list from a truncated
844
+ * one. That is the entire reason this type exists.
845
+ *
846
+ * @public
847
+ */
848
+ export declare interface GetRecordsResult {
849
+ /** The records in this page */
850
+ data: Record<string, unknown>[];
851
+ /** Whether the backend holds further records beyond this page */
852
+ hasMore: boolean;
853
+ /**
854
+ * Total records matching the filters, ignoring limit/offset. Present only when the caller
855
+ * asked for it via {@link GetRecordsOptions.includeTotal} — counting is a full scan on most
856
+ * backends, so it is never computed speculatively.
857
+ */
858
+ count?: number;
805
859
  }
806
860
 
807
861
  /**
@@ -368,6 +368,14 @@ export interface GetRecordsOptions {
368
368
  limit?: number;
369
369
  /** Number of records to skip */
370
370
  offset?: number;
371
+ /**
372
+ * Ask the backend for the total matching the filters as well as the page.
373
+ *
374
+ * Off by default because it costs a second query — a full scan on Postgres — and knowing
375
+ * *whether* more exist (`hasMore`) is what a list view actually needs. Turn it on for a
376
+ * "showing 20 of 4,312" style display.
377
+ */
378
+ includeTotal?: boolean;
371
379
  }
372
380
  /**
373
381
  * Result from getRecord - includes the record data
@@ -377,6 +385,27 @@ export interface GetRecordResult {
377
385
  /** The record data, or null if not found */
378
386
  record: Record<string, unknown> | null;
379
387
  }
388
+ /**
389
+ * Result from getRecords — a page of records, and enough to tell that it is one.
390
+ *
391
+ * A bare array used to be returned here, which claimed to be the whole collection. It is not:
392
+ * a limit always applies, so a caller could not distinguish a complete list from a truncated
393
+ * one. That is the entire reason this type exists.
394
+ *
395
+ * @public
396
+ */
397
+ export interface GetRecordsResult {
398
+ /** The records in this page */
399
+ data: Record<string, unknown>[];
400
+ /** Whether the backend holds further records beyond this page */
401
+ hasMore: boolean;
402
+ /**
403
+ * Total records matching the filters, ignoring limit/offset. Present only when the caller
404
+ * asked for it via {@link GetRecordsOptions.includeTotal} — counting is a full scan on most
405
+ * backends, so it is never computed speculatively.
406
+ */
407
+ count?: number;
408
+ }
380
409
  /**
381
410
  * Interface for data clients that fetch doctype metadata and records.
382
411
  * Implemented by \@stonecrop/graphql-client's StonecropClient.
@@ -406,12 +435,12 @@ export interface DataClient<T extends DoctypeRef = DoctypeRef, M = DoctypeMeta>
406
435
  */
407
436
  getRecord(doctype: T, recordId: string, options?: GetRecordOptions): Promise<GetRecordResult>;
408
437
  /**
409
- * Fetch multiple records
438
+ * Fetch a page of records
410
439
  * @param doctype - Doctype reference (name and optional slug)
411
440
  * @param options - Query options
412
- * @returns Array of record data
441
+ * @returns The page, plus whether more exist and (on request) the total
413
442
  */
414
- getRecords(doctype: T, options?: GetRecordsOptions): Promise<Record<string, unknown>[]>;
443
+ getRecords(doctype: T, options?: GetRecordsOptions): Promise<GetRecordsResult>;
415
444
  /**
416
445
  * Execute a doctype action (e.g., SUBMIT, APPROVE, save).
417
446
  * All state changes flow through this single mutation endpoint.
@@ -1 +1 @@
1
- {"version":3,"file":"doctype.d.ts","sourceRoot":"","sources":["../../src/doctype.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;EAGtB,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG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AE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAE9E;;;;;;;;OAQG;IACH,SAAS,CACR,OAAO,EAAE,CAAC,EACV,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,OAAO,EAAE,GACd,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;CACrE"}
@@ -220,4 +220,29 @@ export const DoctypeMeta = z
220
220
  .meta({
221
221
  title: 'DoctypeMeta',
222
222
  description: 'Doctype metadata - complete definition of a doctype',
223
+ })
224
+ .superRefine((doctype, ctx) => {
225
+ // A record is identified by exactly one field here, and that is the design rather than a
226
+ // limitation awaiting composite support. A doctype describes the **API surface** a client
227
+ // interacts with, not the table behind it; how a composite database key maps onto a single
228
+ // identity on that surface is the server's business, and the client neither sees nor
229
+ // encodes the parts. So there is nothing for a doctype-level composite key to express.
230
+ //
231
+ // Declaring several is therefore malformed, and silently so: `getPrimaryKeyField` takes the
232
+ // first match and the rest are ignored, leaving an adapter to key records on a column that
233
+ // need not be unique — `stonecropRecord`'s row map then keeps whichever row comes last.
234
+ // Refusing at the gate is what makes it say so.
235
+ //
236
+ // Zero keys stays legal and is not an omission: a surrogate-key doctype declares none and
237
+ // resolves through `getRecordIdField`'s documented `id` fallback.
238
+ const declared = doctype.fields.filter(f => f.kind === 'field' && f.primaryKey);
239
+ if (declared.length > 1) {
240
+ ctx.addIssue({
241
+ code: 'custom',
242
+ path: ['fields'],
243
+ message: `Doctype declares ${declared.length} primaryKey fields (${declared
244
+ .map(f => (f.kind === 'field' ? f.fieldname : ''))
245
+ .join(', ')}); a record is identified by exactly one field. A composite database key is mapped to a single identity by the adapter, so a doctype never declares its parts`,
246
+ });
247
+ }
223
248
  });
@@ -195,15 +195,38 @@ export declare const INTROSPECTED_IDENTITY_PROPS: readonly ["fieldname", "primar
195
195
  * Two deliberate limits, both matching the shape `primaryKey` actually has:
196
196
  * - Only **top-level** fields are scanned. `primaryKey` is a `ValueField` flag and a fieldset's
197
197
  * children are not identity columns, so a nested match would be an authoring error, not a PK.
198
- * - The **first** match wins. Nothing in the schema enforces exactly one `primaryKey: true`, and
199
- * there is no composite-key representation — a doctype with several is already malformed, and
200
- * picking the first is what the middleware has always done.
198
+ * - The **first** match wins. Identity is single-valued by design — a doctype describes the API
199
+ * surface, and mapping a composite database key onto one identity there is the adapter's job —
200
+ * so a doctype declaring several is malformed rather than composite. `DoctypeMeta` rejects that
201
+ * at the load gate; this stays total for callers holding fields that never went through it.
201
202
  *
202
203
  * @param fields - the doctype's top-level fields
203
204
  * @returns the primary-key field, or `undefined` for a PK-less doctype
204
205
  * @public
205
206
  */
206
207
  export declare function getPrimaryKeyField(fields: readonly DoctypeField[]): ValueField | undefined;
208
+ /**
209
+ * The name of the field a record is identified by: the declared `primaryKey`, or `id` when the
210
+ * doctype declares none.
211
+ *
212
+ * The `id` fallback is load-bearing, not defensive — a surrogate-key doctype carries an `id`
213
+ * column and marks no primary key, so "nothing declared" means `id`, not "no identity".
214
+ *
215
+ * This exists because that one-line rule had been restated at four sites — the client's
216
+ * `Doctype.recordIdField`, both nuxt hosts' `recordLookupField`, and the Postgres adapter — and
217
+ * the fourth had omitted the fallback, so a doctype the client keyed by `id` was one the adapter
218
+ * could not look up at all. Call this; a fifth restatement is how they diverge again.
219
+ *
220
+ * The returned name is not guaranteed to be a declared field: a doctype that declares no
221
+ * `primaryKey` and no `id` yields `'id'` regardless. An adapter that must build a SQL predicate
222
+ * from it has to confirm the field exists and say so when it does not, because selecting a column
223
+ * the doctype never declared returns nothing rather than failing.
224
+ *
225
+ * @param fields - the doctype's top-level fields
226
+ * @returns the identifying fieldname
227
+ * @public
228
+ */
229
+ export declare function getRecordIdField(fields: readonly DoctypeField[]): string;
207
230
  /**
208
231
  * Resolve a record's identity value using the doctype's declared primary key.
209
232
  *
@@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;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAS1D;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,uFAO9B,CAAA;AAEV;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,UAAU,GAAG,SAAS,CAE1F;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAExE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,GAAG,SAAS,CAUpB;AA6ED;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA2B,CAAA;AAExD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;iBAA8B,CAAA;AAE9D;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA2B,CAAA;AAExD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,mFAA6B,CAAA"}
package/dist/src/field.js CHANGED
@@ -127,9 +127,10 @@ export const INTROSPECTED_IDENTITY_PROPS = [
127
127
  * Two deliberate limits, both matching the shape `primaryKey` actually has:
128
128
  * - Only **top-level** fields are scanned. `primaryKey` is a `ValueField` flag and a fieldset's
129
129
  * children are not identity columns, so a nested match would be an authoring error, not a PK.
130
- * - The **first** match wins. Nothing in the schema enforces exactly one `primaryKey: true`, and
131
- * there is no composite-key representation — a doctype with several is already malformed, and
132
- * picking the first is what the middleware has always done.
130
+ * - The **first** match wins. Identity is single-valued by design — a doctype describes the API
131
+ * surface, and mapping a composite database key onto one identity there is the adapter's job —
132
+ * so a doctype declaring several is malformed rather than composite. `DoctypeMeta` rejects that
133
+ * at the load gate; this stays total for callers holding fields that never went through it.
133
134
  *
134
135
  * @param fields - the doctype's top-level fields
135
136
  * @returns the primary-key field, or `undefined` for a PK-less doctype
@@ -138,6 +139,30 @@ export const INTROSPECTED_IDENTITY_PROPS = [
138
139
  export function getPrimaryKeyField(fields) {
139
140
  return fields.find((f) => f.kind === 'field' && Boolean(f.primaryKey));
140
141
  }
142
+ /**
143
+ * The name of the field a record is identified by: the declared `primaryKey`, or `id` when the
144
+ * doctype declares none.
145
+ *
146
+ * The `id` fallback is load-bearing, not defensive — a surrogate-key doctype carries an `id`
147
+ * column and marks no primary key, so "nothing declared" means `id`, not "no identity".
148
+ *
149
+ * This exists because that one-line rule had been restated at four sites — the client's
150
+ * `Doctype.recordIdField`, both nuxt hosts' `recordLookupField`, and the Postgres adapter — and
151
+ * the fourth had omitted the fallback, so a doctype the client keyed by `id` was one the adapter
152
+ * could not look up at all. Call this; a fifth restatement is how they diverge again.
153
+ *
154
+ * The returned name is not guaranteed to be a declared field: a doctype that declares no
155
+ * `primaryKey` and no `id` yields `'id'` regardless. An adapter that must build a SQL predicate
156
+ * from it has to confirm the field exists and say so when it does not, because selecting a column
157
+ * the doctype never declared returns nothing rather than failing.
158
+ *
159
+ * @param fields - the doctype's top-level fields
160
+ * @returns the identifying fieldname
161
+ * @public
162
+ */
163
+ export function getRecordIdField(fields) {
164
+ return getPrimaryKeyField(fields)?.fieldname ?? 'id';
165
+ }
141
166
  /**
142
167
  * Resolve a record's identity value using the doctype's declared primary key.
143
168
  *
@@ -2,9 +2,9 @@ export type { InteractionMode } from './mode';
2
2
  export { TableViewConfig } from './table';
3
3
  export { CANONICAL_COMPONENTS, COMPONENT_CATEGORY, COMPONENT_LINK_EXPANSION, componentCategory, componentLinkExpansion, resolveLinkRenderMode, type ComponentCategory, type LinkExpansion, type LinkRenderMode, } from './component-meta';
4
4
  export type { DoctypeField, FieldOptions, FieldValidation, FieldsetField, TableField, ValueField } from './field';
5
- export { DoctypeFieldSchema, FieldsetFieldSchema, getPrimaryKeyField, getRecordIdentity, INTROSPECTED_IDENTITY_PROPS, normalizeFieldKind, TableFieldSchema, ValueFieldSchema, } from './field';
5
+ export { DoctypeFieldSchema, FieldsetFieldSchema, getPrimaryKeyField, getRecordIdentity, getRecordIdField, INTROSPECTED_IDENTITY_PROPS, normalizeFieldKind, TableFieldSchema, ValueFieldSchema, } from './field';
6
6
  export { ActionDefinition, TriggerDefinition, WorkflowLayout, WorkflowMeta, isActionAllowedInState } from './doctype';
7
- export type { Cardinality, CustomFetch, DataClient, DoctypeContext, DoctypeMeta, DoctypeRef, FetchStrategy, GetRecordOptions, GetRecordResult, GetRecordsOptions, LazyFetch, LinkDeclaration, SerializedFunction, SyncFetch, } from './doctype';
7
+ export type { Cardinality, CustomFetch, DataClient, DoctypeContext, DoctypeMeta, DoctypeRef, FetchStrategy, GetRecordOptions, GetRecordResult, GetRecordsOptions, GetRecordsResult, LazyFetch, LinkDeclaration, SerializedFunction, SyncFetch, } from './doctype';
8
8
  export { parseDoctype, parseField, validateDoctype, validateField, type ValidationError, type ValidationResult, } from './validation';
9
9
  export { buildScalarMap, classifyFieldType, convertGraphQLSchema, defaultIsEntityField, defaultIsEntityType, formatDoctypeDrift, GQL_SCALAR_MAP, INTERNAL_SCALARS, mergeIntrospectedDoctype, WELL_KNOWN_SCALARS, type AuthoredDoctype, type ConvertedGraphQLDoctype, type DoctypeDrift, type GraphQLConversionFieldMeta, type GraphQLConversionOptions, type IntrospectionSource, type MergeResult, } from './converter';
10
10
  export { toSlug, toPascalCase, pascalToSnake, snakeToCamel, camelToSnake, snakeToLabel, camelToLabel } from './naming';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAG7C,OAAO,EAAE,eAAe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BAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,WAAW,GAChB,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGtH,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA"}
package/dist/src/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  export { TableViewConfig } from './table';
3
3
  // Component → semantic category — the single source of "what kind of value does this component render"
4
4
  export { CANONICAL_COMPONENTS, COMPONENT_CATEGORY, COMPONENT_LINK_EXPANSION, componentCategory, componentLinkExpansion, resolveLinkRenderMode, } from './component-meta';
5
- export { DoctypeFieldSchema, FieldsetFieldSchema, getPrimaryKeyField, getRecordIdentity, INTROSPECTED_IDENTITY_PROPS, normalizeFieldKind, TableFieldSchema, ValueFieldSchema, } from './field';
5
+ export { DoctypeFieldSchema, FieldsetFieldSchema, getPrimaryKeyField, getRecordIdentity, getRecordIdField, INTROSPECTED_IDENTITY_PROPS, normalizeFieldKind, TableFieldSchema, ValueFieldSchema, } from './field';
6
6
  // Doctype schema
7
7
  // ActionDefinition and WorkflowMeta are exported as values (Zod schemas) so consumers can use
8
8
  // .safeParse(), .shape, etc. at runtime. TypeScript types are inferred from the same exports.