@datakable/core 2.0.1 → 2.0.3

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 (125) hide show
  1. package/README.md +3 -2
  2. package/dist/{codes-B9bCK73-.d.cts → codes-4sYQv_7J.d.cts} +42 -12
  3. package/dist/{codes-B9bCK73-.d.ts → codes-4sYQv_7J.d.ts} +42 -12
  4. package/dist/column-filters.d.cts +2 -2
  5. package/dist/column-filters.d.ts +2 -2
  6. package/dist/diagnostics/build.cjs +1 -1
  7. package/dist/diagnostics/build.cjs.map +1 -1
  8. package/dist/diagnostics/build.js +2 -2
  9. package/dist/diagnostics/build.js.map +1 -1
  10. package/dist/diagnostics/console.cjs +15 -4
  11. package/dist/diagnostics/console.cjs.map +1 -1
  12. package/dist/diagnostics/console.js +15 -4
  13. package/dist/diagnostics/console.js.map +1 -1
  14. package/dist/diagnostics/explain.cjs.map +1 -1
  15. package/dist/diagnostics/explain.js.map +1 -1
  16. package/dist/diagnostics/hub.cjs +7 -1
  17. package/dist/diagnostics/hub.cjs.map +1 -1
  18. package/dist/diagnostics/hub.js +7 -1
  19. package/dist/diagnostics/hub.js.map +1 -1
  20. package/dist/diagnostics/prose.cjs +10 -1
  21. package/dist/diagnostics/prose.cjs.map +1 -1
  22. package/dist/diagnostics/prose.js +9 -1
  23. package/dist/diagnostics/prose.js.map +1 -1
  24. package/dist/diagnostics/redact.cjs +1 -1
  25. package/dist/diagnostics/redact.cjs.map +1 -1
  26. package/dist/diagnostics/redact.js +1 -1
  27. package/dist/diagnostics/redact.js.map +1 -1
  28. package/dist/diagnostics/types.cjs.map +1 -1
  29. package/dist/{explain-i0OATi_W.d.ts → explain-DmwN_RG9.d.cts} +13 -6
  30. package/dist/{explain-Q8Cg0cZy.d.cts → explain-Dr3SmMNY.d.ts} +13 -6
  31. package/dist/feature/install.cjs +2 -1
  32. package/dist/feature/install.cjs.map +1 -1
  33. package/dist/feature/install.js +2 -1
  34. package/dist/feature/install.js.map +1 -1
  35. package/dist/feature/slice-guard.cjs +76 -0
  36. package/dist/feature/slice-guard.cjs.map +1 -0
  37. package/dist/feature/slice-guard.js +50 -0
  38. package/dist/feature/slice-guard.js.map +1 -0
  39. package/dist/features/column-filters/codes.cjs +2 -19
  40. package/dist/features/column-filters/codes.cjs.map +1 -1
  41. package/dist/features/column-filters/codes.js +2 -19
  42. package/dist/features/column-filters/codes.js.map +1 -1
  43. package/dist/features/column-filters/column-filters.cjs +37 -22
  44. package/dist/features/column-filters/column-filters.cjs.map +1 -1
  45. package/dist/features/column-filters/column-filters.js +37 -22
  46. package/dist/features/column-filters/column-filters.js.map +1 -1
  47. package/dist/features/column-filters/match.cjs +6 -2
  48. package/dist/features/column-filters/match.cjs.map +1 -1
  49. package/dist/features/column-filters/match.js +6 -2
  50. package/dist/features/column-filters/match.js.map +1 -1
  51. package/dist/features/pagination/pagination.cjs +2 -2
  52. package/dist/features/pagination/pagination.cjs.map +1 -1
  53. package/dist/features/pagination/pagination.js +2 -2
  54. package/dist/features/pagination/pagination.js.map +1 -1
  55. package/dist/features/search/codes.cjs +18 -2
  56. package/dist/features/search/codes.cjs.map +1 -1
  57. package/dist/features/search/codes.js +16 -1
  58. package/dist/features/search/codes.js.map +1 -1
  59. package/dist/features/search/search-engine.cjs +24 -5
  60. package/dist/features/search/search-engine.cjs.map +1 -1
  61. package/dist/features/search/search-engine.js +25 -6
  62. package/dist/features/search/search-engine.js.map +1 -1
  63. package/dist/features/sorting/sorting.cjs +55 -24
  64. package/dist/features/sorting/sorting.cjs.map +1 -1
  65. package/dist/features/sorting/sorting.js +55 -24
  66. package/dist/features/sorting/sorting.js.map +1 -1
  67. package/dist/index.d.cts +26 -17
  68. package/dist/index.d.ts +26 -17
  69. package/dist/intercept/runtime.cjs +3 -2
  70. package/dist/intercept/runtime.cjs.map +1 -1
  71. package/dist/intercept/runtime.js +3 -2
  72. package/dist/intercept/runtime.js.map +1 -1
  73. package/dist/messages/index.cjs +2 -0
  74. package/dist/messages/index.cjs.map +1 -1
  75. package/dist/messages/index.js +2 -0
  76. package/dist/messages/index.js.map +1 -1
  77. package/dist/pagination.d.cts +2 -2
  78. package/dist/pagination.d.ts +2 -2
  79. package/dist/schema.d.cts +2 -2
  80. package/dist/schema.d.ts +2 -2
  81. package/dist/{search-async-entry-CuLYPfY_.d.cts → search-async-entry-BiemO3JT.d.cts} +2 -2
  82. package/dist/{search-async-entry-Cx7xpuVZ.d.ts → search-async-entry-GRj0E06n.d.ts} +2 -2
  83. package/dist/search-async.d.cts +3 -3
  84. package/dist/search-async.d.ts +3 -3
  85. package/dist/search.d.cts +4 -4
  86. package/dist/search.d.ts +4 -4
  87. package/dist/server.d.cts +3 -3
  88. package/dist/server.d.ts +3 -3
  89. package/dist/sorting.d.cts +2 -2
  90. package/dist/sorting.d.ts +2 -2
  91. package/dist/source/async-control.cjs +2 -1
  92. package/dist/source/async-control.cjs.map +1 -1
  93. package/dist/source/async-control.js +2 -1
  94. package/dist/source/async-control.js.map +1 -1
  95. package/dist/source/fetcher.cjs.map +1 -1
  96. package/dist/source/fetcher.js.map +1 -1
  97. package/dist/source/server.cjs +58 -5
  98. package/dist/source/server.cjs.map +1 -1
  99. package/dist/source/server.js +58 -5
  100. package/dist/source/server.js.map +1 -1
  101. package/dist/table/create-table.cjs +30 -20
  102. package/dist/table/create-table.cjs.map +1 -1
  103. package/dist/table/create-table.js +30 -20
  104. package/dist/table/create-table.js.map +1 -1
  105. package/dist/table/index.cjs +3 -0
  106. package/dist/table/index.cjs.map +1 -1
  107. package/dist/table/index.js +5 -1
  108. package/dist/table/index.js.map +1 -1
  109. package/dist/table/state-codes.cjs +72 -0
  110. package/dist/table/state-codes.cjs.map +1 -0
  111. package/dist/table/state-codes.js +45 -0
  112. package/dist/table/state-codes.js.map +1 -0
  113. package/dist/table/types.cjs.map +1 -1
  114. package/dist/table/types.js.map +1 -1
  115. package/dist/validity.d.cts +2 -2
  116. package/dist/validity.d.ts +2 -2
  117. package/dist/version.cjs +1 -1
  118. package/dist/version.cjs.map +1 -1
  119. package/dist/version.js +1 -1
  120. package/dist/version.js.map +1 -1
  121. package/package.json +1 -1
  122. package/dist/ingest/test-schemas.cjs +0 -73
  123. package/dist/ingest/test-schemas.cjs.map +0 -1
  124. package/dist/ingest/test-schemas.js +0 -46
  125. package/dist/ingest/test-schemas.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/table/types.ts"],"sourcesContent":["import type { ColumnDef, LooseRow, Path } from '../column'\nimport type { RowExplanation, TableExplanation } from '../diagnostics/explain'\nimport type { RedactFn, RedactLevel } from '../diagnostics/redact'\nimport type { Diagnostic } from '../diagnostics/types'\nimport type { AnyFeature } from '../feature/types'\nimport type { InvalidRow } from '../ingest/schema'\nimport type { TableSchema } from '../ingest/schema-brand'\nimport type { InvalidRowsMode } from '../ingest/schema-codes'\nimport type { Interceptor } from '../intercept/define'\nimport type { OpName } from '../intercept/operations'\nimport type { RowKey } from '../pipeline/row'\nimport type { RowModel } from '../pipeline/types'\nimport type { FetchOutcome } from '../source/fetcher'\nimport type { ServerFetcher } from '../source/server-brand'\n\n/** Table state: one entry per slice (feature state is typed by `StateOf`, T08). */\nexport type TableState = Record<string, unknown>\n\n/** A partial state merged per slice, or a function of the current state returning one. */\nexport type Updater<S> = Partial<S> | ((prev: S) => Partial<S>)\n\n/** `options.state`: a slice given as `undefined` counts as not passed (owned by the store). */\nexport type ControlledState<S> = { [K in keyof S]?: S[K] | undefined }\n\n/** Called after each committed change with the new and the previously notified snapshot. */\nexport type Listener<S> = (state: S, prev: S) => void\n\n/**\n * Max consecutive re-entrant notification rounds (a listener updating state, whose listeners\n * update state, …). The update that would start the next round is dropped (`DK_UPDATE_LOOP`).\n */\nexport const UPDATE_DEPTH_LIMIT = 50\n\nexport interface TableDiagnosticsOptions {\n /**\n * Redaction (§8.2): a level, or a custom `redact(path, value)` on top of the default level\n * (`'keys'` in development, `'safe'` in production). Columns with `sensitive: true` are never\n * logged; a `rowKey` path into a sensitive column is hashed at every level.\n */\n redact?: RedactLevel | RedactFn\n}\n\nexport interface TableOptions<T, S extends TableState = TableState> {\n /** Names the table in diagnostics; default `table#n`. */\n name?: string\n data?: readonly T[]\n columns?: readonly ColumnDef<T>[]\n /**\n * A Standard Schema v1 (zod, valibot, arktype, …) every row is validated with (§5.1), opted in\n * with `withSchema(UserSchema)` from `@datakable/core/schema`; the row type is its output. An\n * async schema sets `status: 'validating'` while it runs. Read once, at creation.\n */\n schema?: TableSchema<unknown, T>\n /**\n * What happens to rows that fail `schema` (§5.1): `'drop'` (default) removes them, `'flag'` keeps\n * them with `row.valid === false`, `'throw'` throws `DatakableSchemaError`. All three list them in\n * `getInvalidRows()`. Read once, at creation; no effect without `schema`.\n */\n invalidRows?: InvalidRowsMode\n /** Row identity (§5.2). Read by redaction here; key handling is the ingest's. */\n rowKey?: Path<LooseRow<T>> | ((row: T) => string | number)\n /**\n * Installed features (§3.3), in any order: the pipeline runs them by `stage`. Each adds its state\n * slice and merges its API onto the table. Read once, at creation (`setOptions` ignores it).\n */\n features?: readonly AnyFeature[]\n /** Starting values of owned slices; a feature slice given here replaces its `initialState()`. */\n initialState?: Partial<S>\n /**\n * Controlled slices (§3.2): every key with a defined value is owned by the caller, who feeds\n * changes back through `setOptions({ state })`. Slices not passed are owned by the store.\n */\n state?: ControlledState<S>\n /**\n * Receives changes to controlled slices as an updater that merges only the changed slices into\n * the caller's state: `onStateChange: (u) => setControlled(u)`. Not called for owned slices.\n */\n onStateChange?: (updater: (prev: Partial<S>) => Partial<S>) => void\n /** User / feature interceptors (§3.4). The errorBoundary is always installed outermost. */\n interceptors?: readonly Interceptor<OpName>[]\n /** User sink for every diagnostic (e.g. Sentry). */\n onDiagnostic?: (d: Diagnostic) => void\n /**\n * ms before an async request (`fetcher`, `searchFn`) is aborted with `DK_ASYNC_TIMEOUT`.\n * Default 30 000; `Infinity` disables it. Read once, at creation.\n */\n timeout?: number\n /**\n * Server source (§7.1): `fetcher({ query, filters, sort, pageIndex, pageSize, signal })` →\n * `{ rows, rowCount }`. It receives only the state of the server-mode features and runs at\n * creation and whenever that state changes (`status: 'fetching'`), through `async:request`\n * (latest wins, abort, `timeout`). Needs at least one feature with `mode: 'server'`\n * (`DK_FETCHER_WITHOUT_SERVER_MODE`). The returned rows go through `schema` and the data checks.\n * Opt in with `withFetcher(fetchUsers)` from `@datakable/core/server`: a table without a fetcher\n * does not bundle the server source (changed 2026-10-13 for §9.3).\n */\n fetcher?: ServerFetcher<T>\n /**\n * Server mode without a fetcher (§7.1): the total number of rows on the server, while `data` is\n * only the current page. Server-mode pagination counts pages from it (`DK_ROW_COUNT_MISSING`\n * when missing).\n */\n rowCount?: number\n /**\n * SSR (§7.2): the rows the server already produced for the initial state (e.g. its fetcher\n * result). Ingested at creation like `data` when `data` is not given, and counts as the result of\n * the initial async work: the fetcher's first request is skipped (a later server-state change\n * fetches), a `searchFn` is not called for the initial query, and hydration does not re-fetch.\n * With server pagination, `rowCount` gives its total. Read once, at creation.\n */\n initialData?: readonly T[]\n /** Rethrow error-level diagnostics as `DatakableError`. */\n strict?: boolean\n diagnostics?: TableDiagnosticsOptions\n}\n\nexport interface Table<\n T,\n S extends TableState = TableState,\n M extends InvalidRowsMode = 'drop',\n /** The element type `setOptions({ data })` accepts: `unknown` (raw input) with a schema. */\n In = T,\n> {\n /** The current immutable snapshot; the same reference until a slice changes. */\n getState(): S\n setState(updater: Updater<S>): void\n /** Returns the unsubscribe function. One throwing listener never stops the others. */\n subscribe(listener: Listener<S>): () => void\n /** Merges `options` into the current ones (`table:setOptions`). */\n setOptions(\n options: Partial<Omit<TableOptions<T, S>, 'features' | 'data'>> & { data?: readonly In[] },\n ): void\n getOptions(): Readonly<TableOptions<T, S>>\n /** The ingested data (the previous data while an async ingest is pending or failed). */\n getData(): readonly T[]\n /**\n * The row model (§6.6): the visible rows (`Row` objects for the current page only), the counts\n * and the status. The same object until data, state or columns change the result.\n */\n getRowModel(): RowModel<T, M>\n /**\n * The rows that failed `schema` in the current data (§5.1), in every `invalidRows` mode:\n * `{ index, raw, issues }` with `index` into `options.data`. Empty without a schema.\n */\n getInvalidRows(): readonly InvalidRow[]\n /** Oldest first, at most 100 entries. */\n getDiagnostics(): Diagnostic[]\n /**\n * The last pipeline run (§8.4): rows per step, schema drops, the page, open diagnostics, and\n * timings when traced (the tracer runs in development). `String(table.explain())` is a one-line\n * summary. Read-only.\n */\n explain(): TableExplanation\n /**\n * Replays the row with key `key` through the schema and every step (§8.4): which step kept it\n * where, and the step that removed it, with a fix. Values are redacted like diagnostics (§8.2).\n * `String(table.explainRow(key))` is the console report. Read-only.\n */\n explainRow(key: RowKey): RowExplanation\n /**\n * Runs `options.fetcher` again with the current params (§7.1), e.g. a Retry button after\n * `DK_FETCH_FAILED`. Never rejects. Without a fetcher: `{ status: 'applied' }` at once.\n */\n refetch(): Promise<FetchOutcome>\n /** Releases listeners. Later mutating calls are no-ops that report `DK_TABLE_DESTROYED`. */\n destroy(): void\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BO,IAAM,qBAAqB;","names":[]}
1
+ {"version":3,"sources":["../../src/table/types.ts"],"sourcesContent":["import type { ColumnDef, LooseRow, Path } from '../column'\nimport type { RowExplanation, TableExplanation } from '../diagnostics/explain'\nimport type { RedactFn, RedactLevel } from '../diagnostics/redact'\nimport type { Diagnostic } from '../diagnostics/types'\nimport type { AnyFeature } from '../feature/types'\nimport type { InvalidRow } from '../ingest/schema'\nimport type { TableSchema } from '../ingest/schema-brand'\nimport type { InvalidRowsMode } from '../ingest/schema-codes'\nimport type { Interceptor } from '../intercept/define'\nimport type { OpName } from '../intercept/operations'\nimport type { RowKey } from '../pipeline/row'\nimport type { RowModel } from '../pipeline/types'\nimport type { FetchOutcome } from '../source/fetcher'\nimport type { ServerFetcher } from '../source/server-brand'\n\n/** Table state: one entry per slice (feature state is typed by `StateOf`, T08). */\nexport type TableState = Record<string, unknown>\n\n/** A partial state merged per slice, or a function of the current state returning one. */\nexport type Updater<S> = Partial<S> | ((prev: S) => Partial<S>)\n\n/** `options.state`: a slice given as `undefined` counts as not passed (owned by the store). */\nexport type ControlledState<S> = { [K in keyof S]?: S[K] | undefined }\n\n/** Called after each committed change with the new and the previously notified snapshot. */\nexport type Listener<S> = (state: S, prev: S) => void\n\n/**\n * Max consecutive re-entrant notification rounds (a listener updating state, whose listeners\n * update state, …). The update that would start the next round is dropped (`DK_UPDATE_LOOP`).\n */\nexport const UPDATE_DEPTH_LIMIT = 50\n\nexport interface TableDiagnosticsOptions {\n /**\n * Redaction (§8.2): a level, or a custom `redact(path, value)` on top of the default level\n * (`'keys'` in development, `'safe'` in production). Columns with `sensitive: true` are never\n * logged; a `rowKey` path into a sensitive column is logged as `[sensitive]` (no hash) at every level.\n */\n redact?: RedactLevel | RedactFn\n}\n\nexport interface TableOptions<T, S extends TableState = TableState> {\n /** Names the table in diagnostics; default `table#n`. */\n name?: string\n data?: readonly T[]\n columns?: readonly ColumnDef<T>[]\n /**\n * A Standard Schema v1 (zod, valibot, arktype, …) every row is validated with (§5.1), opted in\n * with `withSchema(UserSchema)` from `@datakable/core/schema`; the row type is its output. An\n * async schema sets `status: 'validating'` while it runs. Read once, at creation.\n */\n schema?: TableSchema<unknown, T>\n /**\n * What happens to rows that fail `schema` (§5.1): `'drop'` (default) removes them, `'flag'` keeps\n * them with `row.valid === false`, `'throw'` throws `DatakableSchemaError`. All three list them in\n * `getInvalidRows()`. Read once, at creation; no effect without `schema`.\n */\n invalidRows?: InvalidRowsMode\n /** Row identity (§5.2). Read by redaction here; key handling is the ingest's. */\n rowKey?: Path<LooseRow<T>> | ((row: T) => string | number)\n /**\n * Installed features (§3.3), in any order: the pipeline runs them by `stage`. Each adds its state\n * slice and merges its API onto the table. Read once, at creation (`setOptions` ignores it).\n */\n features?: readonly AnyFeature[]\n /** Starting values of owned slices; a feature slice given here replaces its `initialState()`. */\n initialState?: Partial<S>\n /**\n * Controlled slices (§3.2): every key with a defined value is owned by the caller, who feeds\n * changes back through `setOptions({ state })`. Slices not passed are owned by the store.\n */\n state?: ControlledState<S>\n /**\n * Receives changes to controlled slices as an updater that merges only the changed slices into\n * the caller's state: `onStateChange: (u) => setControlled(u)`. Not called for owned slices.\n */\n onStateChange?: (updater: (prev: Partial<S>) => Partial<S>) => void\n /** User / feature interceptors (§3.4). The errorBoundary is always installed outermost. */\n interceptors?: readonly Interceptor<OpName>[]\n /** User sink for every diagnostic (e.g. Sentry). */\n onDiagnostic?: (d: Diagnostic) => void\n /**\n * ms before an async request (`fetcher`, `searchFn`) is aborted with `DK_ASYNC_TIMEOUT`.\n * Default 30 000; `Infinity` disables it. Read once, at creation.\n */\n timeout?: number\n /**\n * Server source (§7.1): `fetcher({ query, filters, sort, pageIndex, pageSize, signal })` →\n * `{ rows, rowCount }`. It receives only the state of the server-mode features and runs at\n * creation and whenever that state changes (`status: 'fetching'`), through `async:request`\n * (latest wins, abort, `timeout`). Needs at least one feature with `mode: 'server'`\n * (`DK_FETCHER_WITHOUT_SERVER_MODE`). The returned rows go through `schema` and the data checks.\n * Opt in with `withFetcher(fetchUsers)` from `@datakable/core/server`: a table without a fetcher\n * does not bundle the server source (changed 2026-10-13 for §9.3).\n */\n fetcher?: ServerFetcher<T>\n /**\n * Server mode without a fetcher (§7.1): the total number of rows on the server, while `data` is\n * only the current page. Server-mode pagination counts pages from it (`DK_ROW_COUNT_MISSING`\n * when missing).\n */\n rowCount?: number\n /**\n * SSR (§7.2): the rows the server already produced for the initial state (e.g. its fetcher\n * result). Ingested at creation like `data` when `data` is not given, and counts as the result of\n * the initial async work: the fetcher's first request is skipped (a later server-state change\n * fetches), a `searchFn` is not called for the initial query, and hydration does not re-fetch.\n * With server pagination, `rowCount` gives its total. Read once, at creation.\n */\n initialData?: readonly T[]\n /** Rethrow error-level diagnostics as `DatakableError`. */\n strict?: boolean\n diagnostics?: TableDiagnosticsOptions\n}\n\nexport interface Table<\n T,\n S extends TableState = TableState,\n M extends InvalidRowsMode = 'drop',\n /** The element type `setOptions({ data })` accepts: `unknown` (raw input) with a schema. */\n In = T,\n> {\n /** The current immutable snapshot; the same reference until a slice changes. */\n getState(): S\n setState(updater: Updater<S>): void\n /** Returns the unsubscribe function. One throwing listener never stops the others. */\n subscribe(listener: Listener<S>): () => void\n /** Merges `options` into the current ones (`table:setOptions`). */\n setOptions(\n options: Partial<Omit<TableOptions<T, S>, 'features' | 'data'>> & { data?: readonly In[] },\n ): void\n getOptions(): Readonly<TableOptions<T, S>>\n /** The ingested data (the previous data while an async ingest is pending or failed). */\n getData(): readonly T[]\n /**\n * The row model (§6.6): the visible rows (`Row` objects for the current page only), the counts\n * and the status. The same object until data, state or columns change the result.\n */\n getRowModel(): RowModel<T, M>\n /**\n * The rows that failed `schema` in the current data (§5.1), in every `invalidRows` mode:\n * `{ index, raw, issues }` with `index` into `options.data`. Empty without a schema.\n */\n getInvalidRows(): readonly InvalidRow[]\n /** Oldest first, at most 100 entries. */\n getDiagnostics(): Diagnostic[]\n /**\n * The last pipeline run (§8.4): rows per step, schema drops, the page, open diagnostics, and\n * timings when traced (the tracer runs in development). `String(table.explain())` is a one-line\n * summary. Read-only.\n */\n explain(): TableExplanation\n /**\n * Replays the row with key `key` through the schema and every step (§8.4): which step kept it\n * where, and the step that removed it, with a fix. Values are redacted like diagnostics (§8.2).\n * `String(table.explainRow(key))` is the console report. Read-only.\n */\n explainRow(key: RowKey): RowExplanation\n /**\n * Runs `options.fetcher` again with the current params (§7.1), e.g. a Retry button after\n * `DK_FETCH_FAILED`. Never rejects. Without a fetcher: `{ status: 'applied' }` at once. On a\n * `createDeferred` table it settles with the request that runs after `startTable`\n * (`'superseded'` when the table is destroyed first, #90).\n */\n refetch(): Promise<FetchOutcome>\n /** Releases listeners. Later mutating calls are no-ops that report `DK_TABLE_DESTROYED`. */\n destroy(): void\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BO,IAAM,qBAAqB;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/table/types.ts"],"sourcesContent":["import type { ColumnDef, LooseRow, Path } from '../column'\nimport type { RowExplanation, TableExplanation } from '../diagnostics/explain'\nimport type { RedactFn, RedactLevel } from '../diagnostics/redact'\nimport type { Diagnostic } from '../diagnostics/types'\nimport type { AnyFeature } from '../feature/types'\nimport type { InvalidRow } from '../ingest/schema'\nimport type { TableSchema } from '../ingest/schema-brand'\nimport type { InvalidRowsMode } from '../ingest/schema-codes'\nimport type { Interceptor } from '../intercept/define'\nimport type { OpName } from '../intercept/operations'\nimport type { RowKey } from '../pipeline/row'\nimport type { RowModel } from '../pipeline/types'\nimport type { FetchOutcome } from '../source/fetcher'\nimport type { ServerFetcher } from '../source/server-brand'\n\n/** Table state: one entry per slice (feature state is typed by `StateOf`, T08). */\nexport type TableState = Record<string, unknown>\n\n/** A partial state merged per slice, or a function of the current state returning one. */\nexport type Updater<S> = Partial<S> | ((prev: S) => Partial<S>)\n\n/** `options.state`: a slice given as `undefined` counts as not passed (owned by the store). */\nexport type ControlledState<S> = { [K in keyof S]?: S[K] | undefined }\n\n/** Called after each committed change with the new and the previously notified snapshot. */\nexport type Listener<S> = (state: S, prev: S) => void\n\n/**\n * Max consecutive re-entrant notification rounds (a listener updating state, whose listeners\n * update state, …). The update that would start the next round is dropped (`DK_UPDATE_LOOP`).\n */\nexport const UPDATE_DEPTH_LIMIT = 50\n\nexport interface TableDiagnosticsOptions {\n /**\n * Redaction (§8.2): a level, or a custom `redact(path, value)` on top of the default level\n * (`'keys'` in development, `'safe'` in production). Columns with `sensitive: true` are never\n * logged; a `rowKey` path into a sensitive column is hashed at every level.\n */\n redact?: RedactLevel | RedactFn\n}\n\nexport interface TableOptions<T, S extends TableState = TableState> {\n /** Names the table in diagnostics; default `table#n`. */\n name?: string\n data?: readonly T[]\n columns?: readonly ColumnDef<T>[]\n /**\n * A Standard Schema v1 (zod, valibot, arktype, …) every row is validated with (§5.1), opted in\n * with `withSchema(UserSchema)` from `@datakable/core/schema`; the row type is its output. An\n * async schema sets `status: 'validating'` while it runs. Read once, at creation.\n */\n schema?: TableSchema<unknown, T>\n /**\n * What happens to rows that fail `schema` (§5.1): `'drop'` (default) removes them, `'flag'` keeps\n * them with `row.valid === false`, `'throw'` throws `DatakableSchemaError`. All three list them in\n * `getInvalidRows()`. Read once, at creation; no effect without `schema`.\n */\n invalidRows?: InvalidRowsMode\n /** Row identity (§5.2). Read by redaction here; key handling is the ingest's. */\n rowKey?: Path<LooseRow<T>> | ((row: T) => string | number)\n /**\n * Installed features (§3.3), in any order: the pipeline runs them by `stage`. Each adds its state\n * slice and merges its API onto the table. Read once, at creation (`setOptions` ignores it).\n */\n features?: readonly AnyFeature[]\n /** Starting values of owned slices; a feature slice given here replaces its `initialState()`. */\n initialState?: Partial<S>\n /**\n * Controlled slices (§3.2): every key with a defined value is owned by the caller, who feeds\n * changes back through `setOptions({ state })`. Slices not passed are owned by the store.\n */\n state?: ControlledState<S>\n /**\n * Receives changes to controlled slices as an updater that merges only the changed slices into\n * the caller's state: `onStateChange: (u) => setControlled(u)`. Not called for owned slices.\n */\n onStateChange?: (updater: (prev: Partial<S>) => Partial<S>) => void\n /** User / feature interceptors (§3.4). The errorBoundary is always installed outermost. */\n interceptors?: readonly Interceptor<OpName>[]\n /** User sink for every diagnostic (e.g. Sentry). */\n onDiagnostic?: (d: Diagnostic) => void\n /**\n * ms before an async request (`fetcher`, `searchFn`) is aborted with `DK_ASYNC_TIMEOUT`.\n * Default 30 000; `Infinity` disables it. Read once, at creation.\n */\n timeout?: number\n /**\n * Server source (§7.1): `fetcher({ query, filters, sort, pageIndex, pageSize, signal })` →\n * `{ rows, rowCount }`. It receives only the state of the server-mode features and runs at\n * creation and whenever that state changes (`status: 'fetching'`), through `async:request`\n * (latest wins, abort, `timeout`). Needs at least one feature with `mode: 'server'`\n * (`DK_FETCHER_WITHOUT_SERVER_MODE`). The returned rows go through `schema` and the data checks.\n * Opt in with `withFetcher(fetchUsers)` from `@datakable/core/server`: a table without a fetcher\n * does not bundle the server source (changed 2026-10-13 for §9.3).\n */\n fetcher?: ServerFetcher<T>\n /**\n * Server mode without a fetcher (§7.1): the total number of rows on the server, while `data` is\n * only the current page. Server-mode pagination counts pages from it (`DK_ROW_COUNT_MISSING`\n * when missing).\n */\n rowCount?: number\n /**\n * SSR (§7.2): the rows the server already produced for the initial state (e.g. its fetcher\n * result). Ingested at creation like `data` when `data` is not given, and counts as the result of\n * the initial async work: the fetcher's first request is skipped (a later server-state change\n * fetches), a `searchFn` is not called for the initial query, and hydration does not re-fetch.\n * With server pagination, `rowCount` gives its total. Read once, at creation.\n */\n initialData?: readonly T[]\n /** Rethrow error-level diagnostics as `DatakableError`. */\n strict?: boolean\n diagnostics?: TableDiagnosticsOptions\n}\n\nexport interface Table<\n T,\n S extends TableState = TableState,\n M extends InvalidRowsMode = 'drop',\n /** The element type `setOptions({ data })` accepts: `unknown` (raw input) with a schema. */\n In = T,\n> {\n /** The current immutable snapshot; the same reference until a slice changes. */\n getState(): S\n setState(updater: Updater<S>): void\n /** Returns the unsubscribe function. One throwing listener never stops the others. */\n subscribe(listener: Listener<S>): () => void\n /** Merges `options` into the current ones (`table:setOptions`). */\n setOptions(\n options: Partial<Omit<TableOptions<T, S>, 'features' | 'data'>> & { data?: readonly In[] },\n ): void\n getOptions(): Readonly<TableOptions<T, S>>\n /** The ingested data (the previous data while an async ingest is pending or failed). */\n getData(): readonly T[]\n /**\n * The row model (§6.6): the visible rows (`Row` objects for the current page only), the counts\n * and the status. The same object until data, state or columns change the result.\n */\n getRowModel(): RowModel<T, M>\n /**\n * The rows that failed `schema` in the current data (§5.1), in every `invalidRows` mode:\n * `{ index, raw, issues }` with `index` into `options.data`. Empty without a schema.\n */\n getInvalidRows(): readonly InvalidRow[]\n /** Oldest first, at most 100 entries. */\n getDiagnostics(): Diagnostic[]\n /**\n * The last pipeline run (§8.4): rows per step, schema drops, the page, open diagnostics, and\n * timings when traced (the tracer runs in development). `String(table.explain())` is a one-line\n * summary. Read-only.\n */\n explain(): TableExplanation\n /**\n * Replays the row with key `key` through the schema and every step (§8.4): which step kept it\n * where, and the step that removed it, with a fix. Values are redacted like diagnostics (§8.2).\n * `String(table.explainRow(key))` is the console report. Read-only.\n */\n explainRow(key: RowKey): RowExplanation\n /**\n * Runs `options.fetcher` again with the current params (§7.1), e.g. a Retry button after\n * `DK_FETCH_FAILED`. Never rejects. Without a fetcher: `{ status: 'applied' }` at once.\n */\n refetch(): Promise<FetchOutcome>\n /** Releases listeners. Later mutating calls are no-ops that report `DK_TABLE_DESTROYED`. */\n destroy(): void\n}\n"],"mappings":";AA+BO,IAAM,qBAAqB;","names":[]}
1
+ {"version":3,"sources":["../../src/table/types.ts"],"sourcesContent":["import type { ColumnDef, LooseRow, Path } from '../column'\nimport type { RowExplanation, TableExplanation } from '../diagnostics/explain'\nimport type { RedactFn, RedactLevel } from '../diagnostics/redact'\nimport type { Diagnostic } from '../diagnostics/types'\nimport type { AnyFeature } from '../feature/types'\nimport type { InvalidRow } from '../ingest/schema'\nimport type { TableSchema } from '../ingest/schema-brand'\nimport type { InvalidRowsMode } from '../ingest/schema-codes'\nimport type { Interceptor } from '../intercept/define'\nimport type { OpName } from '../intercept/operations'\nimport type { RowKey } from '../pipeline/row'\nimport type { RowModel } from '../pipeline/types'\nimport type { FetchOutcome } from '../source/fetcher'\nimport type { ServerFetcher } from '../source/server-brand'\n\n/** Table state: one entry per slice (feature state is typed by `StateOf`, T08). */\nexport type TableState = Record<string, unknown>\n\n/** A partial state merged per slice, or a function of the current state returning one. */\nexport type Updater<S> = Partial<S> | ((prev: S) => Partial<S>)\n\n/** `options.state`: a slice given as `undefined` counts as not passed (owned by the store). */\nexport type ControlledState<S> = { [K in keyof S]?: S[K] | undefined }\n\n/** Called after each committed change with the new and the previously notified snapshot. */\nexport type Listener<S> = (state: S, prev: S) => void\n\n/**\n * Max consecutive re-entrant notification rounds (a listener updating state, whose listeners\n * update state, …). The update that would start the next round is dropped (`DK_UPDATE_LOOP`).\n */\nexport const UPDATE_DEPTH_LIMIT = 50\n\nexport interface TableDiagnosticsOptions {\n /**\n * Redaction (§8.2): a level, or a custom `redact(path, value)` on top of the default level\n * (`'keys'` in development, `'safe'` in production). Columns with `sensitive: true` are never\n * logged; a `rowKey` path into a sensitive column is logged as `[sensitive]` (no hash) at every level.\n */\n redact?: RedactLevel | RedactFn\n}\n\nexport interface TableOptions<T, S extends TableState = TableState> {\n /** Names the table in diagnostics; default `table#n`. */\n name?: string\n data?: readonly T[]\n columns?: readonly ColumnDef<T>[]\n /**\n * A Standard Schema v1 (zod, valibot, arktype, …) every row is validated with (§5.1), opted in\n * with `withSchema(UserSchema)` from `@datakable/core/schema`; the row type is its output. An\n * async schema sets `status: 'validating'` while it runs. Read once, at creation.\n */\n schema?: TableSchema<unknown, T>\n /**\n * What happens to rows that fail `schema` (§5.1): `'drop'` (default) removes them, `'flag'` keeps\n * them with `row.valid === false`, `'throw'` throws `DatakableSchemaError`. All three list them in\n * `getInvalidRows()`. Read once, at creation; no effect without `schema`.\n */\n invalidRows?: InvalidRowsMode\n /** Row identity (§5.2). Read by redaction here; key handling is the ingest's. */\n rowKey?: Path<LooseRow<T>> | ((row: T) => string | number)\n /**\n * Installed features (§3.3), in any order: the pipeline runs them by `stage`. Each adds its state\n * slice and merges its API onto the table. Read once, at creation (`setOptions` ignores it).\n */\n features?: readonly AnyFeature[]\n /** Starting values of owned slices; a feature slice given here replaces its `initialState()`. */\n initialState?: Partial<S>\n /**\n * Controlled slices (§3.2): every key with a defined value is owned by the caller, who feeds\n * changes back through `setOptions({ state })`. Slices not passed are owned by the store.\n */\n state?: ControlledState<S>\n /**\n * Receives changes to controlled slices as an updater that merges only the changed slices into\n * the caller's state: `onStateChange: (u) => setControlled(u)`. Not called for owned slices.\n */\n onStateChange?: (updater: (prev: Partial<S>) => Partial<S>) => void\n /** User / feature interceptors (§3.4). The errorBoundary is always installed outermost. */\n interceptors?: readonly Interceptor<OpName>[]\n /** User sink for every diagnostic (e.g. Sentry). */\n onDiagnostic?: (d: Diagnostic) => void\n /**\n * ms before an async request (`fetcher`, `searchFn`) is aborted with `DK_ASYNC_TIMEOUT`.\n * Default 30 000; `Infinity` disables it. Read once, at creation.\n */\n timeout?: number\n /**\n * Server source (§7.1): `fetcher({ query, filters, sort, pageIndex, pageSize, signal })` →\n * `{ rows, rowCount }`. It receives only the state of the server-mode features and runs at\n * creation and whenever that state changes (`status: 'fetching'`), through `async:request`\n * (latest wins, abort, `timeout`). Needs at least one feature with `mode: 'server'`\n * (`DK_FETCHER_WITHOUT_SERVER_MODE`). The returned rows go through `schema` and the data checks.\n * Opt in with `withFetcher(fetchUsers)` from `@datakable/core/server`: a table without a fetcher\n * does not bundle the server source (changed 2026-10-13 for §9.3).\n */\n fetcher?: ServerFetcher<T>\n /**\n * Server mode without a fetcher (§7.1): the total number of rows on the server, while `data` is\n * only the current page. Server-mode pagination counts pages from it (`DK_ROW_COUNT_MISSING`\n * when missing).\n */\n rowCount?: number\n /**\n * SSR (§7.2): the rows the server already produced for the initial state (e.g. its fetcher\n * result). Ingested at creation like `data` when `data` is not given, and counts as the result of\n * the initial async work: the fetcher's first request is skipped (a later server-state change\n * fetches), a `searchFn` is not called for the initial query, and hydration does not re-fetch.\n * With server pagination, `rowCount` gives its total. Read once, at creation.\n */\n initialData?: readonly T[]\n /** Rethrow error-level diagnostics as `DatakableError`. */\n strict?: boolean\n diagnostics?: TableDiagnosticsOptions\n}\n\nexport interface Table<\n T,\n S extends TableState = TableState,\n M extends InvalidRowsMode = 'drop',\n /** The element type `setOptions({ data })` accepts: `unknown` (raw input) with a schema. */\n In = T,\n> {\n /** The current immutable snapshot; the same reference until a slice changes. */\n getState(): S\n setState(updater: Updater<S>): void\n /** Returns the unsubscribe function. One throwing listener never stops the others. */\n subscribe(listener: Listener<S>): () => void\n /** Merges `options` into the current ones (`table:setOptions`). */\n setOptions(\n options: Partial<Omit<TableOptions<T, S>, 'features' | 'data'>> & { data?: readonly In[] },\n ): void\n getOptions(): Readonly<TableOptions<T, S>>\n /** The ingested data (the previous data while an async ingest is pending or failed). */\n getData(): readonly T[]\n /**\n * The row model (§6.6): the visible rows (`Row` objects for the current page only), the counts\n * and the status. The same object until data, state or columns change the result.\n */\n getRowModel(): RowModel<T, M>\n /**\n * The rows that failed `schema` in the current data (§5.1), in every `invalidRows` mode:\n * `{ index, raw, issues }` with `index` into `options.data`. Empty without a schema.\n */\n getInvalidRows(): readonly InvalidRow[]\n /** Oldest first, at most 100 entries. */\n getDiagnostics(): Diagnostic[]\n /**\n * The last pipeline run (§8.4): rows per step, schema drops, the page, open diagnostics, and\n * timings when traced (the tracer runs in development). `String(table.explain())` is a one-line\n * summary. Read-only.\n */\n explain(): TableExplanation\n /**\n * Replays the row with key `key` through the schema and every step (§8.4): which step kept it\n * where, and the step that removed it, with a fix. Values are redacted like diagnostics (§8.2).\n * `String(table.explainRow(key))` is the console report. Read-only.\n */\n explainRow(key: RowKey): RowExplanation\n /**\n * Runs `options.fetcher` again with the current params (§7.1), e.g. a Retry button after\n * `DK_FETCH_FAILED`. Never rejects. Without a fetcher: `{ status: 'applied' }` at once. On a\n * `createDeferred` table it settles with the request that runs after `startTable`\n * (`'superseded'` when the table is destroyed first, #90).\n */\n refetch(): Promise<FetchOutcome>\n /** Releases listeners. Later mutating calls are no-ops that report `DK_TABLE_DESTROYED`. */\n destroy(): void\n}\n"],"mappings":";AA+BO,IAAM,qBAAqB;","names":[]}
@@ -1,5 +1,5 @@
1
- export { aw as validityDiagnostics } from './codes-B9bCK73-.cjs';
2
- import { F as Feature, b as FixedTypes } from './explain-Q8Cg0cZy.cjs';
1
+ export { ax as validityDiagnostics } from './codes-4sYQv_7J.cjs';
2
+ import { F as Feature, b as FixedTypes } from './explain-DmwN_RG9.cjs';
3
3
 
4
4
  /** Which rows the `validity` step keeps (§6.2). */
5
5
  type ValidityState = 'all' | 'valid' | 'invalid';
@@ -1,5 +1,5 @@
1
- export { aw as validityDiagnostics } from './codes-B9bCK73-.js';
2
- import { F as Feature, b as FixedTypes } from './explain-i0OATi_W.js';
1
+ export { ax as validityDiagnostics } from './codes-4sYQv_7J.js';
2
+ import { F as Feature, b as FixedTypes } from './explain-Dr3SmMNY.js';
3
3
 
4
4
  /** Which rows the `validity` step keeps (§6.2). */
5
5
  type ValidityState = 'all' | 'valid' | 'invalid';
package/dist/version.cjs CHANGED
@@ -25,7 +25,7 @@ __export(version_exports, {
25
25
  module.exports = __toCommonJS(version_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.0.1";
28
+ var version = "2.0.3";
29
29
 
30
30
  // src/version.ts
31
31
  var VERSION = version;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/version.ts","../package.json"],"sourcesContent":["// Read from package.json at build time (the bundler inlines the one field), so a release never\n// ships a stale hard-coded version.\nimport { version } from '../package.json'\n\n/** The `@datakable/core` version (`context.package`, docs URLs, the global version registry). */\nexport const VERSION: string = version\n","{\n \"name\": \"@datakable/core\",\n \"version\": \"2.0.1\",\n \"description\": \"Headless, framework-agnostic core of DataKable — table state, sorting, filtering and types.\",\n \"license\": \"MIT\",\n \"author\": \"Supakit Kitjanabumrungsak\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Ink01101011/datakable.git\",\n \"directory\": \"packages/core\"\n },\n \"homepage\": \"https://github.com/Ink01101011/datakable#readme\",\n \"bugs\": \"https://github.com/Ink01101011/datakable/issues\",\n \"keywords\": [\n \"react\",\n \"react-table\",\n \"datatable\",\n \"data-table\",\n \"data-grid\",\n \"datagrid\",\n \"table\",\n \"typescript\",\n \"type-safe\",\n \"headless\",\n \"headless-ui\",\n \"zero-config\",\n \"sorting\",\n \"filtering\",\n \"search\",\n \"pagination\",\n \"framework-agnostic\",\n \"vanilla-js\",\n \"table-state\"\n ],\n \"type\": \"module\",\n \"sideEffects\": [\n \"./dist/messages/index.js\",\n \"./dist/messages/index.cjs\",\n \"./dist/diagnostics/process-guard.js\",\n \"./dist/diagnostics/process-guard.cjs\"\n ],\n \"engines\": {\n \"node\": \">=18.18.0\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"column-filters\": [\n \"./dist/column-filters.d.ts\"\n ],\n \"validity\": [\n \"./dist/validity.d.ts\"\n ],\n \"search\": [\n \"./dist/search.d.ts\"\n ],\n \"sorting\": [\n \"./dist/sorting.d.ts\"\n ],\n \"pagination\": [\n \"./dist/pagination.d.ts\"\n ],\n \"messages\": [\n \"./dist/messages.d.ts\"\n ],\n \"schema\": [\n \"./dist/schema.d.ts\"\n ],\n \"search-async\": [\n \"./dist/search-async.d.ts\"\n ],\n \"server\": [\n \"./dist/server.d.ts\"\n ]\n }\n },\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./column-filters\": {\n \"import\": {\n \"types\": \"./dist/column-filters.d.ts\",\n \"default\": \"./dist/features/column-filters/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/column-filters.d.cts\",\n \"default\": \"./dist/features/column-filters/index.cjs\"\n }\n },\n \"./validity\": {\n \"import\": {\n \"types\": \"./dist/validity.d.ts\",\n \"default\": \"./dist/features/validity/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/validity.d.cts\",\n \"default\": \"./dist/features/validity/index.cjs\"\n }\n },\n \"./search\": {\n \"import\": {\n \"types\": \"./dist/search.d.ts\",\n \"default\": \"./dist/features/search/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/search.d.cts\",\n \"default\": \"./dist/features/search/index.cjs\"\n }\n },\n \"./sorting\": {\n \"import\": {\n \"types\": \"./dist/sorting.d.ts\",\n \"default\": \"./dist/features/sorting/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/sorting.d.cts\",\n \"default\": \"./dist/features/sorting/index.cjs\"\n }\n },\n \"./pagination\": {\n \"import\": {\n \"types\": \"./dist/pagination.d.ts\",\n \"default\": \"./dist/features/pagination/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/pagination.d.cts\",\n \"default\": \"./dist/features/pagination/index.cjs\"\n }\n },\n \"./messages\": {\n \"import\": {\n \"types\": \"./dist/messages.d.ts\",\n \"default\": \"./dist/messages/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/messages.d.cts\",\n \"default\": \"./dist/messages/index.cjs\"\n }\n },\n \"./schema\": {\n \"import\": {\n \"types\": \"./dist/schema.d.ts\",\n \"default\": \"./dist/ingest/schema-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/schema.d.cts\",\n \"default\": \"./dist/ingest/schema-entry.cjs\"\n }\n },\n \"./search-async\": {\n \"import\": {\n \"types\": \"./dist/search-async.d.ts\",\n \"default\": \"./dist/features/search/search-async-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/search-async.d.cts\",\n \"default\": \"./dist/features/search/search-async-entry.cjs\"\n }\n },\n \"./server\": {\n \"import\": {\n \"types\": \"./dist/server.d.ts\",\n \"default\": \"./dist/source/server-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/server.d.cts\",\n \"default\": \"./dist/source/server-entry.cjs\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup && node scripts/postbuild.mjs\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc -p tsconfig.json\",\n \"check:pkg\": \"publint --strict && attw --pack . && node scripts/check-catalog.mjs\",\n \"check:catalog\": \"node scripts/check-catalog.mjs\"\n },\n \"dependencies\": {\n \"ex-search\": \"1.1.1\",\n \"exsorted\": \"1.2.3\",\n \"kk-debounce\": \"1.1.0\"\n },\n \"devDependencies\": {\n \"esbuild\": \"0.27.7\"\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEE,cAAW;;;ADGN,IAAM,UAAkB;","names":[]}
1
+ {"version":3,"sources":["../src/version.ts","../package.json"],"sourcesContent":["// Read from package.json at build time (the bundler inlines the one field), so a release never\n// ships a stale hard-coded version.\nimport { version } from '../package.json'\n\n/** The `@datakable/core` version (`context.package`, docs URLs, the global version registry). */\nexport const VERSION: string = version\n","{\n \"name\": \"@datakable/core\",\n \"version\": \"2.0.3\",\n \"description\": \"Headless, framework-agnostic core of DataKable — table state, sorting, filtering and types.\",\n \"license\": \"MIT\",\n \"author\": \"Supakit Kitjanabumrungsak\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Ink01101011/datakable.git\",\n \"directory\": \"packages/core\"\n },\n \"homepage\": \"https://github.com/Ink01101011/datakable#readme\",\n \"bugs\": \"https://github.com/Ink01101011/datakable/issues\",\n \"keywords\": [\n \"react\",\n \"react-table\",\n \"datatable\",\n \"data-table\",\n \"data-grid\",\n \"datagrid\",\n \"table\",\n \"typescript\",\n \"type-safe\",\n \"headless\",\n \"headless-ui\",\n \"zero-config\",\n \"sorting\",\n \"filtering\",\n \"search\",\n \"pagination\",\n \"framework-agnostic\",\n \"vanilla-js\",\n \"table-state\"\n ],\n \"type\": \"module\",\n \"sideEffects\": [\n \"./dist/messages/index.js\",\n \"./dist/messages/index.cjs\",\n \"./dist/diagnostics/process-guard.js\",\n \"./dist/diagnostics/process-guard.cjs\"\n ],\n \"engines\": {\n \"node\": \">=18.18.0\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"column-filters\": [\n \"./dist/column-filters.d.ts\"\n ],\n \"validity\": [\n \"./dist/validity.d.ts\"\n ],\n \"search\": [\n \"./dist/search.d.ts\"\n ],\n \"sorting\": [\n \"./dist/sorting.d.ts\"\n ],\n \"pagination\": [\n \"./dist/pagination.d.ts\"\n ],\n \"messages\": [\n \"./dist/messages.d.ts\"\n ],\n \"schema\": [\n \"./dist/schema.d.ts\"\n ],\n \"search-async\": [\n \"./dist/search-async.d.ts\"\n ],\n \"server\": [\n \"./dist/server.d.ts\"\n ]\n }\n },\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./column-filters\": {\n \"import\": {\n \"types\": \"./dist/column-filters.d.ts\",\n \"default\": \"./dist/features/column-filters/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/column-filters.d.cts\",\n \"default\": \"./dist/features/column-filters/index.cjs\"\n }\n },\n \"./validity\": {\n \"import\": {\n \"types\": \"./dist/validity.d.ts\",\n \"default\": \"./dist/features/validity/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/validity.d.cts\",\n \"default\": \"./dist/features/validity/index.cjs\"\n }\n },\n \"./search\": {\n \"import\": {\n \"types\": \"./dist/search.d.ts\",\n \"default\": \"./dist/features/search/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/search.d.cts\",\n \"default\": \"./dist/features/search/index.cjs\"\n }\n },\n \"./sorting\": {\n \"import\": {\n \"types\": \"./dist/sorting.d.ts\",\n \"default\": \"./dist/features/sorting/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/sorting.d.cts\",\n \"default\": \"./dist/features/sorting/index.cjs\"\n }\n },\n \"./pagination\": {\n \"import\": {\n \"types\": \"./dist/pagination.d.ts\",\n \"default\": \"./dist/features/pagination/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/pagination.d.cts\",\n \"default\": \"./dist/features/pagination/index.cjs\"\n }\n },\n \"./messages\": {\n \"import\": {\n \"types\": \"./dist/messages.d.ts\",\n \"default\": \"./dist/messages/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/messages.d.cts\",\n \"default\": \"./dist/messages/index.cjs\"\n }\n },\n \"./schema\": {\n \"import\": {\n \"types\": \"./dist/schema.d.ts\",\n \"default\": \"./dist/ingest/schema-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/schema.d.cts\",\n \"default\": \"./dist/ingest/schema-entry.cjs\"\n }\n },\n \"./search-async\": {\n \"import\": {\n \"types\": \"./dist/search-async.d.ts\",\n \"default\": \"./dist/features/search/search-async-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/search-async.d.cts\",\n \"default\": \"./dist/features/search/search-async-entry.cjs\"\n }\n },\n \"./server\": {\n \"import\": {\n \"types\": \"./dist/server.d.ts\",\n \"default\": \"./dist/source/server-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/server.d.cts\",\n \"default\": \"./dist/source/server-entry.cjs\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup && node scripts/postbuild.mjs\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc -p tsconfig.json\",\n \"check:pkg\": \"publint --strict && attw --pack . && node scripts/check-catalog.mjs\",\n \"check:catalog\": \"node scripts/check-catalog.mjs\"\n },\n \"dependencies\": {\n \"ex-search\": \"1.1.1\",\n \"exsorted\": \"1.2.3\",\n \"kk-debounce\": \"1.1.0\"\n },\n \"devDependencies\": {\n \"esbuild\": \"0.27.7\"\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEE,cAAW;;;ADGN,IAAM,UAAkB;","names":[]}
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.0.1";
2
+ var version = "2.0.3";
3
3
 
4
4
  // src/version.ts
5
5
  var VERSION = version;
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json","../src/version.ts"],"sourcesContent":["{\n \"name\": \"@datakable/core\",\n \"version\": \"2.0.1\",\n \"description\": \"Headless, framework-agnostic core of DataKable — table state, sorting, filtering and types.\",\n \"license\": \"MIT\",\n \"author\": \"Supakit Kitjanabumrungsak\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Ink01101011/datakable.git\",\n \"directory\": \"packages/core\"\n },\n \"homepage\": \"https://github.com/Ink01101011/datakable#readme\",\n \"bugs\": \"https://github.com/Ink01101011/datakable/issues\",\n \"keywords\": [\n \"react\",\n \"react-table\",\n \"datatable\",\n \"data-table\",\n \"data-grid\",\n \"datagrid\",\n \"table\",\n \"typescript\",\n \"type-safe\",\n \"headless\",\n \"headless-ui\",\n \"zero-config\",\n \"sorting\",\n \"filtering\",\n \"search\",\n \"pagination\",\n \"framework-agnostic\",\n \"vanilla-js\",\n \"table-state\"\n ],\n \"type\": \"module\",\n \"sideEffects\": [\n \"./dist/messages/index.js\",\n \"./dist/messages/index.cjs\",\n \"./dist/diagnostics/process-guard.js\",\n \"./dist/diagnostics/process-guard.cjs\"\n ],\n \"engines\": {\n \"node\": \">=18.18.0\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"column-filters\": [\n \"./dist/column-filters.d.ts\"\n ],\n \"validity\": [\n \"./dist/validity.d.ts\"\n ],\n \"search\": [\n \"./dist/search.d.ts\"\n ],\n \"sorting\": [\n \"./dist/sorting.d.ts\"\n ],\n \"pagination\": [\n \"./dist/pagination.d.ts\"\n ],\n \"messages\": [\n \"./dist/messages.d.ts\"\n ],\n \"schema\": [\n \"./dist/schema.d.ts\"\n ],\n \"search-async\": [\n \"./dist/search-async.d.ts\"\n ],\n \"server\": [\n \"./dist/server.d.ts\"\n ]\n }\n },\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./column-filters\": {\n \"import\": {\n \"types\": \"./dist/column-filters.d.ts\",\n \"default\": \"./dist/features/column-filters/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/column-filters.d.cts\",\n \"default\": \"./dist/features/column-filters/index.cjs\"\n }\n },\n \"./validity\": {\n \"import\": {\n \"types\": \"./dist/validity.d.ts\",\n \"default\": \"./dist/features/validity/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/validity.d.cts\",\n \"default\": \"./dist/features/validity/index.cjs\"\n }\n },\n \"./search\": {\n \"import\": {\n \"types\": \"./dist/search.d.ts\",\n \"default\": \"./dist/features/search/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/search.d.cts\",\n \"default\": \"./dist/features/search/index.cjs\"\n }\n },\n \"./sorting\": {\n \"import\": {\n \"types\": \"./dist/sorting.d.ts\",\n \"default\": \"./dist/features/sorting/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/sorting.d.cts\",\n \"default\": \"./dist/features/sorting/index.cjs\"\n }\n },\n \"./pagination\": {\n \"import\": {\n \"types\": \"./dist/pagination.d.ts\",\n \"default\": \"./dist/features/pagination/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/pagination.d.cts\",\n \"default\": \"./dist/features/pagination/index.cjs\"\n }\n },\n \"./messages\": {\n \"import\": {\n \"types\": \"./dist/messages.d.ts\",\n \"default\": \"./dist/messages/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/messages.d.cts\",\n \"default\": \"./dist/messages/index.cjs\"\n }\n },\n \"./schema\": {\n \"import\": {\n \"types\": \"./dist/schema.d.ts\",\n \"default\": \"./dist/ingest/schema-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/schema.d.cts\",\n \"default\": \"./dist/ingest/schema-entry.cjs\"\n }\n },\n \"./search-async\": {\n \"import\": {\n \"types\": \"./dist/search-async.d.ts\",\n \"default\": \"./dist/features/search/search-async-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/search-async.d.cts\",\n \"default\": \"./dist/features/search/search-async-entry.cjs\"\n }\n },\n \"./server\": {\n \"import\": {\n \"types\": \"./dist/server.d.ts\",\n \"default\": \"./dist/source/server-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/server.d.cts\",\n \"default\": \"./dist/source/server-entry.cjs\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup && node scripts/postbuild.mjs\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc -p tsconfig.json\",\n \"check:pkg\": \"publint --strict && attw --pack . && node scripts/check-catalog.mjs\",\n \"check:catalog\": \"node scripts/check-catalog.mjs\"\n },\n \"dependencies\": {\n \"ex-search\": \"1.1.1\",\n \"exsorted\": \"1.2.3\",\n \"kk-debounce\": \"1.1.0\"\n },\n \"devDependencies\": {\n \"esbuild\": \"0.27.7\"\n }\n}\n","// Read from package.json at build time (the bundler inlines the one field), so a release never\n// ships a stale hard-coded version.\nimport { version } from '../package.json'\n\n/** The `@datakable/core` version (`context.package`, docs URLs, the global version registry). */\nexport const VERSION: string = version\n"],"mappings":";AAEE,cAAW;;;ACGN,IAAM,UAAkB;","names":[]}
1
+ {"version":3,"sources":["../package.json","../src/version.ts"],"sourcesContent":["{\n \"name\": \"@datakable/core\",\n \"version\": \"2.0.3\",\n \"description\": \"Headless, framework-agnostic core of DataKable — table state, sorting, filtering and types.\",\n \"license\": \"MIT\",\n \"author\": \"Supakit Kitjanabumrungsak\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Ink01101011/datakable.git\",\n \"directory\": \"packages/core\"\n },\n \"homepage\": \"https://github.com/Ink01101011/datakable#readme\",\n \"bugs\": \"https://github.com/Ink01101011/datakable/issues\",\n \"keywords\": [\n \"react\",\n \"react-table\",\n \"datatable\",\n \"data-table\",\n \"data-grid\",\n \"datagrid\",\n \"table\",\n \"typescript\",\n \"type-safe\",\n \"headless\",\n \"headless-ui\",\n \"zero-config\",\n \"sorting\",\n \"filtering\",\n \"search\",\n \"pagination\",\n \"framework-agnostic\",\n \"vanilla-js\",\n \"table-state\"\n ],\n \"type\": \"module\",\n \"sideEffects\": [\n \"./dist/messages/index.js\",\n \"./dist/messages/index.cjs\",\n \"./dist/diagnostics/process-guard.js\",\n \"./dist/diagnostics/process-guard.cjs\"\n ],\n \"engines\": {\n \"node\": \">=18.18.0\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"column-filters\": [\n \"./dist/column-filters.d.ts\"\n ],\n \"validity\": [\n \"./dist/validity.d.ts\"\n ],\n \"search\": [\n \"./dist/search.d.ts\"\n ],\n \"sorting\": [\n \"./dist/sorting.d.ts\"\n ],\n \"pagination\": [\n \"./dist/pagination.d.ts\"\n ],\n \"messages\": [\n \"./dist/messages.d.ts\"\n ],\n \"schema\": [\n \"./dist/schema.d.ts\"\n ],\n \"search-async\": [\n \"./dist/search-async.d.ts\"\n ],\n \"server\": [\n \"./dist/server.d.ts\"\n ]\n }\n },\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./column-filters\": {\n \"import\": {\n \"types\": \"./dist/column-filters.d.ts\",\n \"default\": \"./dist/features/column-filters/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/column-filters.d.cts\",\n \"default\": \"./dist/features/column-filters/index.cjs\"\n }\n },\n \"./validity\": {\n \"import\": {\n \"types\": \"./dist/validity.d.ts\",\n \"default\": \"./dist/features/validity/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/validity.d.cts\",\n \"default\": \"./dist/features/validity/index.cjs\"\n }\n },\n \"./search\": {\n \"import\": {\n \"types\": \"./dist/search.d.ts\",\n \"default\": \"./dist/features/search/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/search.d.cts\",\n \"default\": \"./dist/features/search/index.cjs\"\n }\n },\n \"./sorting\": {\n \"import\": {\n \"types\": \"./dist/sorting.d.ts\",\n \"default\": \"./dist/features/sorting/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/sorting.d.cts\",\n \"default\": \"./dist/features/sorting/index.cjs\"\n }\n },\n \"./pagination\": {\n \"import\": {\n \"types\": \"./dist/pagination.d.ts\",\n \"default\": \"./dist/features/pagination/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/pagination.d.cts\",\n \"default\": \"./dist/features/pagination/index.cjs\"\n }\n },\n \"./messages\": {\n \"import\": {\n \"types\": \"./dist/messages.d.ts\",\n \"default\": \"./dist/messages/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/messages.d.cts\",\n \"default\": \"./dist/messages/index.cjs\"\n }\n },\n \"./schema\": {\n \"import\": {\n \"types\": \"./dist/schema.d.ts\",\n \"default\": \"./dist/ingest/schema-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/schema.d.cts\",\n \"default\": \"./dist/ingest/schema-entry.cjs\"\n }\n },\n \"./search-async\": {\n \"import\": {\n \"types\": \"./dist/search-async.d.ts\",\n \"default\": \"./dist/features/search/search-async-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/search-async.d.cts\",\n \"default\": \"./dist/features/search/search-async-entry.cjs\"\n }\n },\n \"./server\": {\n \"import\": {\n \"types\": \"./dist/server.d.ts\",\n \"default\": \"./dist/source/server-entry.js\"\n },\n \"require\": {\n \"types\": \"./dist/server.d.cts\",\n \"default\": \"./dist/source/server-entry.cjs\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup && node scripts/postbuild.mjs\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc -p tsconfig.json\",\n \"check:pkg\": \"publint --strict && attw --pack . && node scripts/check-catalog.mjs\",\n \"check:catalog\": \"node scripts/check-catalog.mjs\"\n },\n \"dependencies\": {\n \"ex-search\": \"1.1.1\",\n \"exsorted\": \"1.2.3\",\n \"kk-debounce\": \"1.1.0\"\n },\n \"devDependencies\": {\n \"esbuild\": \"0.27.7\"\n }\n}\n","// Read from package.json at build time (the bundler inlines the one field), so a release never\n// ships a stale hard-coded version.\nimport { version } from '../package.json'\n\n/** The `@datakable/core` version (`context.package`, docs URLs, the global version registry). */\nexport const VERSION: string = version\n"],"mappings":";AAEE,cAAW;;;ACGN,IAAM,UAAkB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datakable/core",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Headless, framework-agnostic core of DataKable — table state, sorting, filtering and types.",
5
5
  "license": "MIT",
6
6
  "author": "Supakit Kitjanabumrungsak",
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/ingest/test-schemas.ts
21
- var test_schemas_exports = {};
22
- __export(test_schemas_exports, {
23
- makeSchema: () => makeSchema,
24
- userCheck: () => userCheck,
25
- userSchema: () => userSchema
26
- });
27
- module.exports = __toCommonJS(test_schemas_exports);
28
- function makeSchema(check, opts = {}) {
29
- const delay = opts.async;
30
- return {
31
- "~standard": {
32
- version: 1,
33
- vendor: opts.vendor ?? "test",
34
- validate: (value) => {
35
- if (!delay) return check(value);
36
- const wait = typeof delay === "function" ? delay() : Promise.resolve();
37
- return wait.then(() => check(value));
38
- }
39
- }
40
- };
41
- }
42
- function userCheck(value) {
43
- if (typeof value !== "object" || value === null) {
44
- return { issues: [{ message: `Expected object, received ${JSON.stringify(value)}` }] };
45
- }
46
- const v = value;
47
- const issues = [];
48
- if (typeof v.id !== "number") {
49
- issues.push({ message: `Expected number, received ${JSON.stringify(v.id)}`, path: ["id"] });
50
- }
51
- if (typeof v.name !== "string") {
52
- issues.push({ message: `Expected string, received ${JSON.stringify(v.name)}`, path: ["name"] });
53
- }
54
- const age = typeof v.age === "string" && /^\d+$/.test(v.age) ? Number(v.age) : v.age;
55
- if (typeof age !== "number") {
56
- issues.push({
57
- message: `Expected number, received ${JSON.stringify(v.age)}`,
58
- path: [{ key: "age" }]
59
- });
60
- }
61
- if (issues.length > 0) return { issues };
62
- return { value: { id: v.id, name: v.name, age } };
63
- }
64
- var userSchema = makeSchema(
65
- userCheck
66
- );
67
- // Annotate the CommonJS export names for ESM import in node:
68
- 0 && (module.exports = {
69
- makeSchema,
70
- userCheck,
71
- userSchema
72
- });
73
- //# sourceMappingURL=test-schemas.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ingest/test-schemas.ts"],"sourcesContent":["import type { StandardSchemaV1 } from './standard-schema'\n\n/** Test-only Standard Schema implementations (no schema library is a dependency, §5.1). */\n\ntype Check<Out> = (value: unknown) => StandardSchemaV1.Result<Out>\n\n/** A conforming schema from a check; `async` makes `validate` return a promise. */\nexport function makeSchema<Out, In = unknown>(\n check: Check<Out>,\n opts: { async?: boolean | (() => Promise<void>); vendor?: string } = {},\n): StandardSchemaV1<In, Out> {\n const delay = opts.async\n return {\n '~standard': {\n version: 1,\n vendor: opts.vendor ?? 'test',\n validate: (value) => {\n if (!delay) return check(value)\n const wait = typeof delay === 'function' ? delay() : Promise.resolve()\n return wait.then(() => check(value))\n },\n },\n }\n}\n\nexport type User = { id: number; name: string; age: number }\n\n/**\n * `{ id: number, name: string, age: number | numeric string }`; `age` is coerced to a number.\n * Messages embed the received value, like real validators do (redaction must scrub them).\n */\nexport function userCheck(value: unknown): StandardSchemaV1.Result<User> {\n if (typeof value !== 'object' || value === null) {\n return { issues: [{ message: `Expected object, received ${JSON.stringify(value)}` }] }\n }\n const v = value as Record<string, unknown>\n const issues: StandardSchemaV1.Issue[] = []\n if (typeof v.id !== 'number') {\n issues.push({ message: `Expected number, received ${JSON.stringify(v.id)}`, path: ['id'] })\n }\n if (typeof v.name !== 'string') {\n issues.push({ message: `Expected string, received ${JSON.stringify(v.name)}`, path: ['name'] })\n }\n const age = typeof v.age === 'string' && /^\\d+$/.test(v.age) ? Number(v.age) : v.age\n if (typeof age !== 'number') {\n issues.push({\n message: `Expected number, received ${JSON.stringify(v.age)}`,\n path: [{ key: 'age' }],\n })\n }\n if (issues.length > 0) return { issues }\n return { value: { id: v.id as number, name: v.name as string, age: age as number } }\n}\n\nexport const userSchema = makeSchema<User, { id: number; name: string; age: number | string }>(\n userCheck,\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,WACd,OACA,OAAqE,CAAC,GAC3C;AAC3B,QAAM,QAAQ,KAAK;AACnB,SAAO;AAAA,IACL,aAAa;AAAA,MACX,SAAS;AAAA,MACT,QAAQ,KAAK,UAAU;AAAA,MACvB,UAAU,CAAC,UAAU;AACnB,YAAI,CAAC,MAAO,QAAO,MAAM,KAAK;AAC9B,cAAM,OAAO,OAAO,UAAU,aAAa,MAAM,IAAI,QAAQ,QAAQ;AACrE,eAAO,KAAK,KAAK,MAAM,MAAM,KAAK,CAAC;AAAA,MACrC;AAAA,IACF;AAAA,EACF;AACF;AAQO,SAAS,UAAU,OAA+C;AACvE,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,WAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,6BAA6B,KAAK,UAAU,KAAK,CAAC,GAAG,CAAC,EAAE;AAAA,EACvF;AACA,QAAM,IAAI;AACV,QAAM,SAAmC,CAAC;AAC1C,MAAI,OAAO,EAAE,OAAO,UAAU;AAC5B,WAAO,KAAK,EAAE,SAAS,6BAA6B,KAAK,UAAU,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;AAAA,EAC5F;AACA,MAAI,OAAO,EAAE,SAAS,UAAU;AAC9B,WAAO,KAAK,EAAE,SAAS,6BAA6B,KAAK,UAAU,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;AAAA,EAChG;AACA,QAAM,MAAM,OAAO,EAAE,QAAQ,YAAY,QAAQ,KAAK,EAAE,GAAG,IAAI,OAAO,EAAE,GAAG,IAAI,EAAE;AACjF,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO,KAAK;AAAA,MACV,SAAS,6BAA6B,KAAK,UAAU,EAAE,GAAG,CAAC;AAAA,MAC3D,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC;AAAA,IACvB,CAAC;AAAA,EACH;AACA,MAAI,OAAO,SAAS,EAAG,QAAO,EAAE,OAAO;AACvC,SAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAc,MAAM,EAAE,MAAgB,IAAmB,EAAE;AACrF;AAEO,IAAM,aAAa;AAAA,EACxB;AACF;","names":[]}
@@ -1,46 +0,0 @@
1
- // src/ingest/test-schemas.ts
2
- function makeSchema(check, opts = {}) {
3
- const delay = opts.async;
4
- return {
5
- "~standard": {
6
- version: 1,
7
- vendor: opts.vendor ?? "test",
8
- validate: (value) => {
9
- if (!delay) return check(value);
10
- const wait = typeof delay === "function" ? delay() : Promise.resolve();
11
- return wait.then(() => check(value));
12
- }
13
- }
14
- };
15
- }
16
- function userCheck(value) {
17
- if (typeof value !== "object" || value === null) {
18
- return { issues: [{ message: `Expected object, received ${JSON.stringify(value)}` }] };
19
- }
20
- const v = value;
21
- const issues = [];
22
- if (typeof v.id !== "number") {
23
- issues.push({ message: `Expected number, received ${JSON.stringify(v.id)}`, path: ["id"] });
24
- }
25
- if (typeof v.name !== "string") {
26
- issues.push({ message: `Expected string, received ${JSON.stringify(v.name)}`, path: ["name"] });
27
- }
28
- const age = typeof v.age === "string" && /^\d+$/.test(v.age) ? Number(v.age) : v.age;
29
- if (typeof age !== "number") {
30
- issues.push({
31
- message: `Expected number, received ${JSON.stringify(v.age)}`,
32
- path: [{ key: "age" }]
33
- });
34
- }
35
- if (issues.length > 0) return { issues };
36
- return { value: { id: v.id, name: v.name, age } };
37
- }
38
- var userSchema = makeSchema(
39
- userCheck
40
- );
41
- export {
42
- makeSchema,
43
- userCheck,
44
- userSchema
45
- };
46
- //# sourceMappingURL=test-schemas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/ingest/test-schemas.ts"],"sourcesContent":["import type { StandardSchemaV1 } from './standard-schema'\n\n/** Test-only Standard Schema implementations (no schema library is a dependency, §5.1). */\n\ntype Check<Out> = (value: unknown) => StandardSchemaV1.Result<Out>\n\n/** A conforming schema from a check; `async` makes `validate` return a promise. */\nexport function makeSchema<Out, In = unknown>(\n check: Check<Out>,\n opts: { async?: boolean | (() => Promise<void>); vendor?: string } = {},\n): StandardSchemaV1<In, Out> {\n const delay = opts.async\n return {\n '~standard': {\n version: 1,\n vendor: opts.vendor ?? 'test',\n validate: (value) => {\n if (!delay) return check(value)\n const wait = typeof delay === 'function' ? delay() : Promise.resolve()\n return wait.then(() => check(value))\n },\n },\n }\n}\n\nexport type User = { id: number; name: string; age: number }\n\n/**\n * `{ id: number, name: string, age: number | numeric string }`; `age` is coerced to a number.\n * Messages embed the received value, like real validators do (redaction must scrub them).\n */\nexport function userCheck(value: unknown): StandardSchemaV1.Result<User> {\n if (typeof value !== 'object' || value === null) {\n return { issues: [{ message: `Expected object, received ${JSON.stringify(value)}` }] }\n }\n const v = value as Record<string, unknown>\n const issues: StandardSchemaV1.Issue[] = []\n if (typeof v.id !== 'number') {\n issues.push({ message: `Expected number, received ${JSON.stringify(v.id)}`, path: ['id'] })\n }\n if (typeof v.name !== 'string') {\n issues.push({ message: `Expected string, received ${JSON.stringify(v.name)}`, path: ['name'] })\n }\n const age = typeof v.age === 'string' && /^\\d+$/.test(v.age) ? Number(v.age) : v.age\n if (typeof age !== 'number') {\n issues.push({\n message: `Expected number, received ${JSON.stringify(v.age)}`,\n path: [{ key: 'age' }],\n })\n }\n if (issues.length > 0) return { issues }\n return { value: { id: v.id as number, name: v.name as string, age: age as number } }\n}\n\nexport const userSchema = makeSchema<User, { id: number; name: string; age: number | string }>(\n userCheck,\n)\n"],"mappings":";AAOO,SAAS,WACd,OACA,OAAqE,CAAC,GAC3C;AAC3B,QAAM,QAAQ,KAAK;AACnB,SAAO;AAAA,IACL,aAAa;AAAA,MACX,SAAS;AAAA,MACT,QAAQ,KAAK,UAAU;AAAA,MACvB,UAAU,CAAC,UAAU;AACnB,YAAI,CAAC,MAAO,QAAO,MAAM,KAAK;AAC9B,cAAM,OAAO,OAAO,UAAU,aAAa,MAAM,IAAI,QAAQ,QAAQ;AACrE,eAAO,KAAK,KAAK,MAAM,MAAM,KAAK,CAAC;AAAA,MACrC;AAAA,IACF;AAAA,EACF;AACF;AAQO,SAAS,UAAU,OAA+C;AACvE,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,WAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,6BAA6B,KAAK,UAAU,KAAK,CAAC,GAAG,CAAC,EAAE;AAAA,EACvF;AACA,QAAM,IAAI;AACV,QAAM,SAAmC,CAAC;AAC1C,MAAI,OAAO,EAAE,OAAO,UAAU;AAC5B,WAAO,KAAK,EAAE,SAAS,6BAA6B,KAAK,UAAU,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;AAAA,EAC5F;AACA,MAAI,OAAO,EAAE,SAAS,UAAU;AAC9B,WAAO,KAAK,EAAE,SAAS,6BAA6B,KAAK,UAAU,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;AAAA,EAChG;AACA,QAAM,MAAM,OAAO,EAAE,QAAQ,YAAY,QAAQ,KAAK,EAAE,GAAG,IAAI,OAAO,EAAE,GAAG,IAAI,EAAE;AACjF,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO,KAAK;AAAA,MACV,SAAS,6BAA6B,KAAK,UAAU,EAAE,GAAG,CAAC;AAAA,MAC3D,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC;AAAA,IACvB,CAAC;AAAA,EACH;AACA,MAAI,OAAO,SAAS,EAAG,QAAO,EAAE,OAAO;AACvC,SAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAc,MAAM,EAAE,MAAgB,IAAmB,EAAE;AACrF;AAEO,IAAM,aAAa;AAAA,EACxB;AACF;","names":[]}