@datakable/core 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/catalog/codes.cjs +12 -8
- package/dist/catalog/codes.cjs.map +1 -1
- package/dist/catalog/codes.js +12 -8
- package/dist/catalog/codes.js.map +1 -1
- package/dist/catalog/slots.cjs +10 -6
- package/dist/catalog/slots.cjs.map +1 -1
- package/dist/catalog/slots.js +10 -6
- package/dist/catalog/slots.js.map +1 -1
- package/dist/{codes-OsjAR3Wz.d.cts → codes-B9bCK73-.d.cts} +30 -4
- package/dist/{codes-OsjAR3Wz.d.ts → codes-B9bCK73-.d.ts} +30 -4
- package/dist/column/column-def.cjs.map +1 -1
- package/dist/column/get-value.cjs +6 -1
- package/dist/column/get-value.cjs.map +1 -1
- package/dist/column/get-value.js +6 -1
- package/dist/column/get-value.js.map +1 -1
- package/dist/column-filters.d.cts +2 -2
- package/dist/column-filters.d.ts +2 -2
- package/dist/diagnostics/build.cjs +4 -1
- package/dist/diagnostics/build.cjs.map +1 -1
- package/dist/diagnostics/build.js +4 -1
- package/dist/diagnostics/build.js.map +1 -1
- package/dist/diagnostics/catalog.cjs +11 -5
- package/dist/diagnostics/catalog.cjs.map +1 -1
- package/dist/diagnostics/catalog.js +10 -5
- package/dist/diagnostics/catalog.js.map +1 -1
- package/dist/diagnostics/codes.cjs +12 -8
- package/dist/diagnostics/codes.cjs.map +1 -1
- package/dist/diagnostics/codes.js +12 -8
- package/dist/diagnostics/codes.js.map +1 -1
- package/dist/diagnostics/console.cjs +13 -6
- package/dist/diagnostics/console.cjs.map +1 -1
- package/dist/diagnostics/console.js +13 -6
- package/dist/diagnostics/console.js.map +1 -1
- package/dist/diagnostics/env.cjs +1 -0
- package/dist/diagnostics/env.cjs.map +1 -1
- package/dist/diagnostics/env.js +1 -0
- package/dist/diagnostics/env.js.map +1 -1
- package/dist/diagnostics/explain-text.cjs +2 -1
- package/dist/diagnostics/explain-text.cjs.map +1 -1
- package/dist/diagnostics/explain-text.js +2 -1
- package/dist/diagnostics/explain-text.js.map +1 -1
- package/dist/diagnostics/explain.cjs +3 -2
- package/dist/diagnostics/explain.cjs.map +1 -1
- package/dist/diagnostics/explain.js +3 -2
- package/dist/diagnostics/explain.js.map +1 -1
- package/dist/diagnostics/hub.cjs +5 -4
- package/dist/diagnostics/hub.cjs.map +1 -1
- package/dist/diagnostics/hub.js +5 -4
- package/dist/diagnostics/hub.js.map +1 -1
- package/dist/diagnostics/process-guard.cjs +26 -0
- package/dist/diagnostics/process-guard.cjs.map +1 -0
- package/dist/diagnostics/process-guard.js +9 -0
- package/dist/diagnostics/process-guard.js.map +1 -0
- package/dist/diagnostics/prose.cjs +120 -0
- package/dist/diagnostics/prose.cjs.map +1 -0
- package/dist/diagnostics/prose.js +93 -0
- package/dist/diagnostics/prose.js.map +1 -0
- package/dist/diagnostics/redact.cjs +7 -4
- package/dist/diagnostics/redact.cjs.map +1 -1
- package/dist/diagnostics/redact.js +6 -4
- package/dist/diagnostics/redact.js.map +1 -1
- package/dist/diagnostics/trace-store.cjs +6 -0
- package/dist/diagnostics/trace-store.cjs.map +1 -1
- package/dist/diagnostics/trace-store.js +4 -0
- package/dist/diagnostics/trace-store.js.map +1 -1
- package/dist/diagnostics/tracer.cjs +74 -13
- package/dist/diagnostics/tracer.cjs.map +1 -1
- package/dist/diagnostics/tracer.js +75 -14
- package/dist/diagnostics/tracer.js.map +1 -1
- package/dist/diagnostics/types.cjs.map +1 -1
- package/dist/{explain-vkD2cewE.d.cts → explain-Q8Cg0cZy.d.cts} +13 -4
- package/dist/{explain-Dn99IQt0.d.ts → explain-i0OATi_W.d.ts} +13 -4
- package/dist/feature/codes.cjs +1 -0
- package/dist/feature/codes.cjs.map +1 -1
- package/dist/feature/codes.js +1 -0
- package/dist/feature/codes.js.map +1 -1
- package/dist/feature/install.cjs +4 -3
- package/dist/feature/install.cjs.map +1 -1
- package/dist/feature/install.js +4 -3
- package/dist/feature/install.js.map +1 -1
- package/dist/features/column-filters/codes.cjs +1 -0
- package/dist/features/column-filters/codes.cjs.map +1 -1
- package/dist/features/column-filters/codes.js +1 -0
- package/dist/features/column-filters/codes.js.map +1 -1
- package/dist/features/column-filters/column-filters.cjs +4 -2
- package/dist/features/column-filters/column-filters.cjs.map +1 -1
- package/dist/features/column-filters/column-filters.js +4 -2
- package/dist/features/column-filters/column-filters.js.map +1 -1
- package/dist/features/column-filters/match.cjs +5 -5
- package/dist/features/column-filters/match.cjs.map +1 -1
- package/dist/features/column-filters/match.js +5 -5
- package/dist/features/column-filters/match.js.map +1 -1
- package/dist/features/pagination/codes.cjs +1 -0
- package/dist/features/pagination/codes.cjs.map +1 -1
- package/dist/features/pagination/codes.js +1 -0
- package/dist/features/pagination/codes.js.map +1 -1
- package/dist/features/pagination/pagination.cjs +16 -13
- package/dist/features/pagination/pagination.cjs.map +1 -1
- package/dist/features/pagination/pagination.js +16 -13
- package/dist/features/pagination/pagination.js.map +1 -1
- package/dist/features/search/codes.cjs +1 -0
- package/dist/features/search/codes.cjs.map +1 -1
- package/dist/features/search/codes.js +1 -0
- package/dist/features/search/codes.js.map +1 -1
- package/dist/features/search/search-index.cjs +68 -15
- package/dist/features/search/search-index.cjs.map +1 -1
- package/dist/features/search/search-index.js +68 -15
- package/dist/features/search/search-index.js.map +1 -1
- package/dist/features/search/search.cjs +41 -9
- package/dist/features/search/search.cjs.map +1 -1
- package/dist/features/search/search.js +41 -9
- package/dist/features/search/search.js.map +1 -1
- package/dist/features/search/skipped-codes.cjs +45 -0
- package/dist/features/search/skipped-codes.cjs.map +1 -0
- package/dist/features/search/skipped-codes.js +20 -0
- package/dist/features/search/skipped-codes.js.map +1 -0
- package/dist/features/sorting/codes.cjs +1 -0
- package/dist/features/sorting/codes.cjs.map +1 -1
- package/dist/features/sorting/codes.js +1 -0
- package/dist/features/sorting/codes.js.map +1 -1
- package/dist/features/sorting/sorting.cjs +16 -20
- package/dist/features/sorting/sorting.cjs.map +1 -1
- package/dist/features/sorting/sorting.js +16 -20
- package/dist/features/sorting/sorting.js.map +1 -1
- package/dist/features/sorting/strategy.cjs +4 -4
- package/dist/features/sorting/strategy.cjs.map +1 -1
- package/dist/features/sorting/strategy.js +4 -4
- package/dist/features/sorting/strategy.js.map +1 -1
- package/dist/features/validity/codes.cjs +1 -0
- package/dist/features/validity/codes.cjs.map +1 -1
- package/dist/features/validity/codes.js +1 -0
- package/dist/features/validity/codes.js.map +1 -1
- package/dist/features/validity/validity.cjs +3 -3
- package/dist/features/validity/validity.cjs.map +1 -1
- package/dist/features/validity/validity.js +3 -3
- package/dist/features/validity/validity.js.map +1 -1
- package/dist/index.d.cts +13 -10
- package/dist/index.d.ts +13 -10
- package/dist/ingest/data-check-codes.cjs +4 -2
- package/dist/ingest/data-check-codes.cjs.map +1 -1
- package/dist/ingest/data-check-codes.js +4 -2
- package/dist/ingest/data-check-codes.js.map +1 -1
- package/dist/ingest/data-checks.cjs +1 -1
- package/dist/ingest/data-checks.cjs.map +1 -1
- package/dist/ingest/data-checks.js +1 -1
- package/dist/ingest/data-checks.js.map +1 -1
- package/dist/ingest/row-key-codes.cjs +1 -0
- package/dist/ingest/row-key-codes.cjs.map +1 -1
- package/dist/ingest/row-key-codes.js +1 -0
- package/dist/ingest/row-key-codes.js.map +1 -1
- package/dist/ingest/row-key.cjs +23 -20
- package/dist/ingest/row-key.cjs.map +1 -1
- package/dist/ingest/row-key.js +23 -20
- package/dist/ingest/row-key.js.map +1 -1
- package/dist/ingest/schema-codes.cjs +1 -0
- package/dist/ingest/schema-codes.cjs.map +1 -1
- package/dist/ingest/schema-codes.js +1 -0
- package/dist/ingest/schema-codes.js.map +1 -1
- package/dist/ingest/unique-fields.cjs +2 -2
- package/dist/ingest/unique-fields.cjs.map +1 -1
- package/dist/ingest/unique-fields.js +2 -2
- package/dist/ingest/unique-fields.js.map +1 -1
- package/dist/intercept/boundary.cjs +4 -2
- package/dist/intercept/boundary.cjs.map +1 -1
- package/dist/intercept/boundary.js +4 -2
- package/dist/intercept/boundary.js.map +1 -1
- package/dist/intercept/cell-batch.cjs +4 -4
- package/dist/intercept/cell-batch.cjs.map +1 -1
- package/dist/intercept/cell-batch.js +4 -4
- package/dist/intercept/cell-batch.js.map +1 -1
- package/dist/intercept/codes.cjs +1 -0
- package/dist/intercept/codes.cjs.map +1 -1
- package/dist/intercept/codes.js +1 -0
- package/dist/intercept/codes.js.map +1 -1
- package/dist/intercept/fallbacks.cjs +12 -20
- package/dist/intercept/fallbacks.cjs.map +1 -1
- package/dist/intercept/fallbacks.js +12 -20
- package/dist/intercept/fallbacks.js.map +1 -1
- package/dist/intercept/runtime.cjs +7 -9
- package/dist/intercept/runtime.cjs.map +1 -1
- package/dist/intercept/runtime.js +7 -9
- package/dist/intercept/runtime.js.map +1 -1
- package/dist/messages/index.cjs +4 -1
- package/dist/messages/index.cjs.map +1 -1
- package/dist/messages/index.js +4 -1
- package/dist/messages/index.js.map +1 -1
- package/dist/pagination.d.cts +2 -2
- package/dist/pagination.d.ts +2 -2
- package/dist/pipeline/codes.cjs +1 -0
- package/dist/pipeline/codes.cjs.map +1 -1
- package/dist/pipeline/codes.js +1 -0
- package/dist/pipeline/codes.js.map +1 -1
- package/dist/pipeline/column-cache.cjs +94 -76
- package/dist/pipeline/column-cache.cjs.map +1 -1
- package/dist/pipeline/column-cache.js +92 -75
- package/dist/pipeline/column-cache.js.map +1 -1
- package/dist/pipeline/dev-checks.cjs +1 -0
- package/dist/pipeline/dev-checks.cjs.map +1 -1
- package/dist/pipeline/dev-checks.js +1 -0
- package/dist/pipeline/dev-checks.js.map +1 -1
- package/dist/pipeline/env-codes.cjs +3 -2
- package/dist/pipeline/env-codes.cjs.map +1 -1
- package/dist/pipeline/env-codes.js +3 -2
- package/dist/pipeline/env-codes.js.map +1 -1
- package/dist/pipeline/perf-codes.cjs +1 -0
- package/dist/pipeline/perf-codes.cjs.map +1 -1
- package/dist/pipeline/perf-codes.js +1 -0
- package/dist/pipeline/perf-codes.js.map +1 -1
- package/dist/pipeline/runner.cjs +17 -9
- package/dist/pipeline/runner.cjs.map +1 -1
- package/dist/pipeline/runner.js +17 -9
- package/dist/pipeline/runner.js.map +1 -1
- package/dist/pipeline/slice.cjs +3 -1
- package/dist/pipeline/slice.cjs.map +1 -1
- package/dist/pipeline/slice.js +3 -1
- package/dist/pipeline/slice.js.map +1 -1
- package/dist/schema.d.cts +2 -2
- package/dist/schema.d.ts +2 -2
- package/dist/{search-async-entry-v5JdEk5Y.d.cts → search-async-entry-CuLYPfY_.d.cts} +2 -2
- package/dist/{search-async-entry-DGSw2pDL.d.ts → search-async-entry-Cx7xpuVZ.d.ts} +2 -2
- package/dist/search-async.d.cts +3 -3
- package/dist/search-async.d.ts +3 -3
- package/dist/search.d.cts +8 -6
- package/dist/search.d.ts +8 -6
- package/dist/server.d.cts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/sorting.d.cts +2 -2
- package/dist/sorting.d.ts +2 -2
- package/dist/source/codes.cjs +1 -0
- package/dist/source/codes.cjs.map +1 -1
- package/dist/source/codes.js +1 -0
- package/dist/source/codes.js.map +1 -1
- package/dist/source/fetch-codes.cjs +1 -0
- package/dist/source/fetch-codes.cjs.map +1 -1
- package/dist/source/fetch-codes.js +1 -0
- package/dist/source/fetch-codes.js.map +1 -1
- package/dist/table/codes.cjs +1 -0
- package/dist/table/codes.cjs.map +1 -1
- package/dist/table/codes.js +1 -0
- package/dist/table/codes.js.map +1 -1
- package/dist/table/create-table.cjs +39 -9
- package/dist/table/create-table.cjs.map +1 -1
- package/dist/table/create-table.js +39 -9
- package/dist/table/create-table.js.map +1 -1
- package/dist/table/data-mutation.cjs +1 -0
- package/dist/table/data-mutation.cjs.map +1 -1
- package/dist/table/data-mutation.js +1 -0
- package/dist/table/data-mutation.js.map +1 -1
- package/dist/table/internals.cjs.map +1 -1
- package/dist/table/internals.js.map +1 -1
- package/dist/table/ssr-codes.cjs +1 -0
- package/dist/table/ssr-codes.cjs.map +1 -1
- package/dist/table/ssr-codes.js +1 -0
- package/dist/table/ssr-codes.js.map +1 -1
- package/dist/table/ssr.cjs +4 -1
- package/dist/table/ssr.cjs.map +1 -1
- package/dist/table/ssr.js +4 -1
- package/dist/table/ssr.js.map +1 -1
- package/dist/table/state-feedback.cjs +19 -0
- package/dist/table/state-feedback.cjs.map +1 -1
- package/dist/table/state-feedback.js +19 -0
- package/dist/table/state-feedback.js.map +1 -1
- package/dist/table/types.cjs.map +1 -1
- package/dist/table/types.js.map +1 -1
- package/dist/validity.d.cts +2 -2
- package/dist/validity.d.ts +2 -2
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/versioning/codes.cjs +18 -0
- package/dist/versioning/codes.cjs.map +1 -1
- package/dist/versioning/codes.js +18 -0
- package/dist/versioning/codes.js.map +1 -1
- package/dist/versioning/registry.cjs +4 -2
- package/dist/versioning/registry.cjs.map +1 -1
- package/dist/versioning/registry.js +4 -2
- package/dist/versioning/registry.js.map +1 -1
- package/package.json +39 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/versioning/registry.ts"],"sourcesContent":["import { throwConfigError } from '../diagnostics/build'\nimport { keepDiagnostics } from '../diagnostics/catalog'\nimport type { Emit } from '../diagnostics/types'\nimport type { AnyFeature } from '../feature/types'\nimport { VERSION } from '../version'\nimport { FIXED_GROUP, versioningDiagnostics } from './codes'\nimport { satisfies } from './semver'\n\nkeepDiagnostics(versioningDiagnostics)\n\n/** `globalThis[Symbol.for('datakable')]`: shared by every copy of core in the process (§8.5). */\nexport const REGISTRY_KEY: unique symbol = Symbol.for('datakable') as never\n\ninterface CoreEntry {\n readonly version: string\n}\n\n/** Version 1 of the registry shape. Later cores must keep these fields readable. */\nexport interface VersionRegistry {\n v: number\n /** One entry per core copy that created a table, in registration order. */\n cores: CoreEntry[]\n /** Fixed-group package → version (`registerPackage`). */\n packages: Record<string, string>\n /** Once-per-session keys (deprecations, dependency capabilities). */\n reported: Set<string>\n}\n\n/** This copy of core; its identity tells copies apart even when their versions are equal. */\nconst self: CoreEntry = { version: VERSION }\n/** `package@version` pairs this copy already reported as mismatched. */\nconst mismatched = new Set<string>()\nlet local: VersionRegistry | undefined\n\nconst isObject = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object'\n\n/**\n * The global registry, created on first use. Fields are read defensively: a registry left by\n * another core version (or anything else under the symbol) is repaired, never trusted to throw.\n */\nexport function getVersionRegistry(): VersionRegistry {\n const g = globalThis as unknown as Record<symbol, unknown>\n try {\n let r = g[REGISTRY_KEY]\n if (!isObject(r)) {\n r = {}\n g[REGISTRY_KEY] = r\n }\n const reg = r as Partial<VersionRegistry>\n if (typeof reg.v !== 'number') reg.v = 1\n if (!Array.isArray(reg.cores)) reg.cores = []\n if (!isObject(reg.packages)) reg.packages = {}\n if (!(reg.reported instanceof Set)) reg.reported = new Set()\n return reg as VersionRegistry\n } catch {\n // Frozen / non-writable global: fall back to a per-copy registry (no cross-copy detection).\n local ??= { v: 1, cores: [], packages: {}, reported: new Set() }\n return local\n }\n}\n\n/**\n * Records a fixed-group package's version (`@datakable/react`, `datakable`) so `createTable` can\n * report `DK_VERSION_MISMATCH`. Called once by each binding when it is first used.\n */\nexport function registerPackage(name: string, version: string): void {\n getVersionRegistry().packages[name] = version\n}\n\n/** `true` the first time `key` is seen in this session (across core copies). */\nexport function firstInSession(key: string): boolean {\n const reported = getVersionRegistry().reported\n if (reported.has(key)) return false\n reported.add(key)\n return true\n}\n\n/**\n * Version checks of one `createTable` (§8.5), cold path:\n * - feature `requires.core` against this core → `DatakableConfigError` `DK_FEATURE_INCOMPATIBLE`;\n * - registers this copy on its first table; a copy finding another
|
|
1
|
+
{"version":3,"sources":["../../src/versioning/registry.ts"],"sourcesContent":["import { throwConfigError } from '../diagnostics/build'\nimport { keepDiagnostics } from '../diagnostics/catalog'\nimport type { Emit } from '../diagnostics/types'\nimport type { AnyFeature } from '../feature/types'\nimport { VERSION } from '../version'\nimport { FIXED_GROUP, versioningDiagnostics } from './codes'\nimport { satisfies } from './semver'\n\nkeepDiagnostics(versioningDiagnostics)\n\n/** `globalThis[Symbol.for('datakable')]`: shared by every copy of core in the process (§8.5). */\nexport const REGISTRY_KEY: unique symbol = Symbol.for('datakable') as never\n\ninterface CoreEntry {\n readonly version: string\n}\n\n/** Version 1 of the registry shape. Later cores must keep these fields readable. */\nexport interface VersionRegistry {\n v: number\n /** One entry per core copy that created a table, in registration order. */\n cores: CoreEntry[]\n /** Fixed-group package → version (`registerPackage`). */\n packages: Record<string, string>\n /** Once-per-session keys (deprecations, dependency capabilities). */\n reported: Set<string>\n}\n\n/** This copy of core; its identity tells copies apart even when their versions are equal. */\nconst self: CoreEntry = { version: VERSION }\n/** `package@version` pairs this copy already reported as mismatched. */\nconst mismatched = new Set<string>()\nlet local: VersionRegistry | undefined\n\nconst isObject = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object'\n\n/**\n * The global registry, created on first use. Fields are read defensively: a registry left by\n * another core version (or anything else under the symbol) is repaired, never trusted to throw.\n */\nexport function getVersionRegistry(): VersionRegistry {\n const g = globalThis as unknown as Record<symbol, unknown>\n try {\n let r = g[REGISTRY_KEY]\n if (!isObject(r)) {\n r = {}\n g[REGISTRY_KEY] = r\n }\n const reg = r as Partial<VersionRegistry>\n if (typeof reg.v !== 'number') reg.v = 1\n if (!Array.isArray(reg.cores)) reg.cores = []\n if (!isObject(reg.packages)) reg.packages = {}\n if (!(reg.reported instanceof Set)) reg.reported = new Set()\n return reg as VersionRegistry\n } catch {\n // Frozen / non-writable global: fall back to a per-copy registry (no cross-copy detection).\n local ??= { v: 1, cores: [], packages: {}, reported: new Set() }\n return local\n }\n}\n\n/**\n * Records a fixed-group package's version (`@datakable/react`, `datakable`) so `createTable` can\n * report `DK_VERSION_MISMATCH`. Called once by each binding when it is first used.\n */\nexport function registerPackage(name: string, version: string): void {\n getVersionRegistry().packages[name] = version\n}\n\n/** `true` the first time `key` is seen in this session (across core copies). */\nexport function firstInSession(key: string): boolean {\n const reported = getVersionRegistry().reported\n if (reported.has(key)) return false\n reported.add(key)\n return true\n}\n\n/**\n * Version checks of one `createTable` (§8.5), cold path:\n * - feature `requires.core` against this core → `DatakableConfigError` `DK_FEATURE_INCOMPATIBLE`;\n * - registers this copy on its first table; a copy finding one of another version →\n * `DK_DUPLICATE_CORE` (once per copy), only copies of its own version →\n * `DK_DUPLICATE_CORE_SAME_VERSION` (info, once per session);\n * - fixed-group packages with another version → `DK_VERSION_MISMATCH` (once per package version).\n */\nexport function checkVersions(features: readonly AnyFeature[], emit: Emit, table: string): void {\n for (const f of features) {\n const required = f.requires?.core\n if (required === undefined) continue\n const ok = typeof required === 'string' ? satisfies(VERSION, required) : undefined\n if (ok === true) continue\n throwConfigError(\n 'DK_FEATURE_INCOMPATIBLE',\n { feature: f.name, required: String(required), core: VERSION, invalid: ok === undefined },\n { table },\n )\n }\n const reg = getVersionRegistry()\n if (!reg.cores.includes(self)) {\n reg.cores.push(self)\n const versions = reg.cores.map((c) => String(c?.version))\n // One version evaluated again (ESM + CJS builds, bundler layers, HMR) is not a second install\n // (#14): an info, once per session, that strict never throws.\n if (versions.some((v) => v !== VERSION)) emit('DK_DUPLICATE_CORE', { versions })\n else if (versions.length > 1 && firstInSession('DK_DUPLICATE_CORE_SAME_VERSION')) {\n emit('DK_DUPLICATE_CORE_SAME_VERSION', { version: VERSION, copies: versions.length })\n }\n }\n for (const name of FIXED_GROUP) {\n const version = reg.packages[name]\n if (typeof version !== 'string' || version === VERSION) continue\n const key = `${name}@${version}`\n if (mismatched.has(key)) continue\n mismatched.add(key)\n emit('DK_VERSION_MISMATCH', { package: name, version, core: VERSION })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,qBAAgC;AAGhC,qBAAwB;AACxB,mBA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AAO,KAAM;AACjB;AAAA,MACE;AAAA,MACA,EAAE,SAAS,EAAE,MAAM,UAAU,OAAO,QAAQ,GAAG,MAAM,wBAAS,SAAS,OAAO,OAAU;AAAA,MACxF,EAAE,MAAM;AAAA,IACV;AAAA,EACF;AACA,QAAM,MAAM,mBAAmB;AAC/B,MAAI,CAAC,IAAI,MAAM,SAAS,IAAI,GAAG;AAC7B,QAAI,MAAM,KAAK,IAAI;AACnB,UAAM,WAAW,IAAI,MAAM,IAAI,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAGxD,QAAI,SAAS,KAAK,CAAC,MAAM,MAAM,sBAAO,EAAG,MAAK,qBAAqB,EAAE,SAAS,CAAC;AAAA,aACtE,SAAS,SAAS,KAAK,eAAe,gCAAgC,GAAG;AAChF,WAAK,kCAAkC,EAAE,SAAS,wBAAS,QAAQ,SAAS,OAAO,CAAC;AAAA,IACtF;AAAA,EACF;AACA,aAAW,QAAQ,0BAAa;AAC9B,UAAM,UAAU,IAAI,SAAS,IAAI;AACjC,QAAI,OAAO,YAAY,YAAY,YAAY,uBAAS;AACxD,UAAM,MAAM,GAAG,IAAI,IAAI,OAAO;AAC9B,QAAI,WAAW,IAAI,GAAG,EAAG;AACzB,eAAW,IAAI,GAAG;AAClB,SAAK,uBAAuB,EAAE,SAAS,MAAM,SAAS,MAAM,uBAAQ,CAAC;AAAA,EACvE;AACF;","names":[]}
|
|
@@ -53,8 +53,10 @@ function checkVersions(features, emit, table) {
|
|
|
53
53
|
const reg = getVersionRegistry();
|
|
54
54
|
if (!reg.cores.includes(self)) {
|
|
55
55
|
reg.cores.push(self);
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const versions = reg.cores.map((c) => String(c?.version));
|
|
57
|
+
if (versions.some((v) => v !== VERSION)) emit("DK_DUPLICATE_CORE", { versions });
|
|
58
|
+
else if (versions.length > 1 && firstInSession("DK_DUPLICATE_CORE_SAME_VERSION")) {
|
|
59
|
+
emit("DK_DUPLICATE_CORE_SAME_VERSION", { version: VERSION, copies: versions.length });
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
for (const name of FIXED_GROUP) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/versioning/registry.ts"],"sourcesContent":["import { throwConfigError } from '../diagnostics/build'\nimport { keepDiagnostics } from '../diagnostics/catalog'\nimport type { Emit } from '../diagnostics/types'\nimport type { AnyFeature } from '../feature/types'\nimport { VERSION } from '../version'\nimport { FIXED_GROUP, versioningDiagnostics } from './codes'\nimport { satisfies } from './semver'\n\nkeepDiagnostics(versioningDiagnostics)\n\n/** `globalThis[Symbol.for('datakable')]`: shared by every copy of core in the process (§8.5). */\nexport const REGISTRY_KEY: unique symbol = Symbol.for('datakable') as never\n\ninterface CoreEntry {\n readonly version: string\n}\n\n/** Version 1 of the registry shape. Later cores must keep these fields readable. */\nexport interface VersionRegistry {\n v: number\n /** One entry per core copy that created a table, in registration order. */\n cores: CoreEntry[]\n /** Fixed-group package → version (`registerPackage`). */\n packages: Record<string, string>\n /** Once-per-session keys (deprecations, dependency capabilities). */\n reported: Set<string>\n}\n\n/** This copy of core; its identity tells copies apart even when their versions are equal. */\nconst self: CoreEntry = { version: VERSION }\n/** `package@version` pairs this copy already reported as mismatched. */\nconst mismatched = new Set<string>()\nlet local: VersionRegistry | undefined\n\nconst isObject = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object'\n\n/**\n * The global registry, created on first use. Fields are read defensively: a registry left by\n * another core version (or anything else under the symbol) is repaired, never trusted to throw.\n */\nexport function getVersionRegistry(): VersionRegistry {\n const g = globalThis as unknown as Record<symbol, unknown>\n try {\n let r = g[REGISTRY_KEY]\n if (!isObject(r)) {\n r = {}\n g[REGISTRY_KEY] = r\n }\n const reg = r as Partial<VersionRegistry>\n if (typeof reg.v !== 'number') reg.v = 1\n if (!Array.isArray(reg.cores)) reg.cores = []\n if (!isObject(reg.packages)) reg.packages = {}\n if (!(reg.reported instanceof Set)) reg.reported = new Set()\n return reg as VersionRegistry\n } catch {\n // Frozen / non-writable global: fall back to a per-copy registry (no cross-copy detection).\n local ??= { v: 1, cores: [], packages: {}, reported: new Set() }\n return local\n }\n}\n\n/**\n * Records a fixed-group package's version (`@datakable/react`, `datakable`) so `createTable` can\n * report `DK_VERSION_MISMATCH`. Called once by each binding when it is first used.\n */\nexport function registerPackage(name: string, version: string): void {\n getVersionRegistry().packages[name] = version\n}\n\n/** `true` the first time `key` is seen in this session (across core copies). */\nexport function firstInSession(key: string): boolean {\n const reported = getVersionRegistry().reported\n if (reported.has(key)) return false\n reported.add(key)\n return true\n}\n\n/**\n * Version checks of one `createTable` (§8.5), cold path:\n * - feature `requires.core` against this core → `DatakableConfigError` `DK_FEATURE_INCOMPATIBLE`;\n * - registers this copy on its first table; a copy finding another
|
|
1
|
+
{"version":3,"sources":["../../src/versioning/registry.ts"],"sourcesContent":["import { throwConfigError } from '../diagnostics/build'\nimport { keepDiagnostics } from '../diagnostics/catalog'\nimport type { Emit } from '../diagnostics/types'\nimport type { AnyFeature } from '../feature/types'\nimport { VERSION } from '../version'\nimport { FIXED_GROUP, versioningDiagnostics } from './codes'\nimport { satisfies } from './semver'\n\nkeepDiagnostics(versioningDiagnostics)\n\n/** `globalThis[Symbol.for('datakable')]`: shared by every copy of core in the process (§8.5). */\nexport const REGISTRY_KEY: unique symbol = Symbol.for('datakable') as never\n\ninterface CoreEntry {\n readonly version: string\n}\n\n/** Version 1 of the registry shape. Later cores must keep these fields readable. */\nexport interface VersionRegistry {\n v: number\n /** One entry per core copy that created a table, in registration order. */\n cores: CoreEntry[]\n /** Fixed-group package → version (`registerPackage`). */\n packages: Record<string, string>\n /** Once-per-session keys (deprecations, dependency capabilities). */\n reported: Set<string>\n}\n\n/** This copy of core; its identity tells copies apart even when their versions are equal. */\nconst self: CoreEntry = { version: VERSION }\n/** `package@version` pairs this copy already reported as mismatched. */\nconst mismatched = new Set<string>()\nlet local: VersionRegistry | undefined\n\nconst isObject = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object'\n\n/**\n * The global registry, created on first use. Fields are read defensively: a registry left by\n * another core version (or anything else under the symbol) is repaired, never trusted to throw.\n */\nexport function getVersionRegistry(): VersionRegistry {\n const g = globalThis as unknown as Record<symbol, unknown>\n try {\n let r = g[REGISTRY_KEY]\n if (!isObject(r)) {\n r = {}\n g[REGISTRY_KEY] = r\n }\n const reg = r as Partial<VersionRegistry>\n if (typeof reg.v !== 'number') reg.v = 1\n if (!Array.isArray(reg.cores)) reg.cores = []\n if (!isObject(reg.packages)) reg.packages = {}\n if (!(reg.reported instanceof Set)) reg.reported = new Set()\n return reg as VersionRegistry\n } catch {\n // Frozen / non-writable global: fall back to a per-copy registry (no cross-copy detection).\n local ??= { v: 1, cores: [], packages: {}, reported: new Set() }\n return local\n }\n}\n\n/**\n * Records a fixed-group package's version (`@datakable/react`, `datakable`) so `createTable` can\n * report `DK_VERSION_MISMATCH`. Called once by each binding when it is first used.\n */\nexport function registerPackage(name: string, version: string): void {\n getVersionRegistry().packages[name] = version\n}\n\n/** `true` the first time `key` is seen in this session (across core copies). */\nexport function firstInSession(key: string): boolean {\n const reported = getVersionRegistry().reported\n if (reported.has(key)) return false\n reported.add(key)\n return true\n}\n\n/**\n * Version checks of one `createTable` (§8.5), cold path:\n * - feature `requires.core` against this core → `DatakableConfigError` `DK_FEATURE_INCOMPATIBLE`;\n * - registers this copy on its first table; a copy finding one of another version →\n * `DK_DUPLICATE_CORE` (once per copy), only copies of its own version →\n * `DK_DUPLICATE_CORE_SAME_VERSION` (info, once per session);\n * - fixed-group packages with another version → `DK_VERSION_MISMATCH` (once per package version).\n */\nexport function checkVersions(features: readonly AnyFeature[], emit: Emit, table: string): void {\n for (const f of features) {\n const required = f.requires?.core\n if (required === undefined) continue\n const ok = typeof required === 'string' ? satisfies(VERSION, required) : undefined\n if (ok === true) continue\n throwConfigError(\n 'DK_FEATURE_INCOMPATIBLE',\n { feature: f.name, required: String(required), core: VERSION, invalid: ok === undefined },\n { table },\n )\n }\n const reg = getVersionRegistry()\n if (!reg.cores.includes(self)) {\n reg.cores.push(self)\n const versions = reg.cores.map((c) => String(c?.version))\n // One version evaluated again (ESM + CJS builds, bundler layers, HMR) is not a second install\n // (#14): an info, once per session, that strict never throws.\n if (versions.some((v) => v !== VERSION)) emit('DK_DUPLICATE_CORE', { versions })\n else if (versions.length > 1 && firstInSession('DK_DUPLICATE_CORE_SAME_VERSION')) {\n emit('DK_DUPLICATE_CORE_SAME_VERSION', { version: VERSION, copies: versions.length })\n }\n }\n for (const name of FIXED_GROUP) {\n const version = reg.packages[name]\n if (typeof version !== 'string' || version === VERSION) continue\n const key = `${name}@${version}`\n if (mismatched.has(key)) continue\n mismatched.add(key)\n emit('DK_VERSION_MISMATCH', { package: name, version, core: VERSION })\n }\n}\n"],"mappings":";AAAA,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAGhC,SAAS,eAAe;AACxB,SAAS,aAAa,6BAA6B;AACnD,SAAS,iBAAiB;AAE1B,gBAAgB,qBAAqB;AAG9B,IAAM,eAA8B,uBAAO,IAAI,WAAW;AAkBjE,IAAM,OAAkB,EAAE,SAAS,QAAQ;AAE3C,IAAM,aAAa,oBAAI,IAAY;AACnC,IAAI;AAEJ,IAAM,WAAW,CAAC,MAA6C,MAAM,QAAQ,OAAO,MAAM;AAMnF,SAAS,qBAAsC;AACpD,QAAM,IAAI;AACV,MAAI;AACF,QAAI,IAAI,EAAE,YAAY;AACtB,QAAI,CAAC,SAAS,CAAC,GAAG;AAChB,UAAI,CAAC;AACL,QAAE,YAAY,IAAI;AAAA,IACpB;AACA,UAAM,MAAM;AACZ,QAAI,OAAO,IAAI,MAAM,SAAU,KAAI,IAAI;AACvC,QAAI,CAAC,MAAM,QAAQ,IAAI,KAAK,EAAG,KAAI,QAAQ,CAAC;AAC5C,QAAI,CAAC,SAAS,IAAI,QAAQ,EAAG,KAAI,WAAW,CAAC;AAC7C,QAAI,EAAE,IAAI,oBAAoB,KAAM,KAA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O,YAAY,YAAY,YAAY,QAAS;AACxD,UAAM,MAAM,GAAG,IAAI,IAAI,OAAO;AAC9B,QAAI,WAAW,IAAI,GAAG,EAAG;AACzB,eAAW,IAAI,GAAG;AAClB,SAAK,uBAAuB,EAAE,SAAS,MAAM,SAAS,MAAM,QAAQ,CAAC;AAAA,EACvE;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datakable/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Headless, framework-agnostic core of DataKable — table state, sorting, filtering and types.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Supakit Kitjanabumrungsak",
|
|
@@ -23,11 +23,47 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"sideEffects": [
|
|
25
25
|
"./dist/messages/index.js",
|
|
26
|
-
"./dist/messages/index.cjs"
|
|
26
|
+
"./dist/messages/index.cjs",
|
|
27
|
+
"./dist/diagnostics/process-guard.js",
|
|
28
|
+
"./dist/diagnostics/process-guard.cjs"
|
|
27
29
|
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.18.0"
|
|
32
|
+
},
|
|
28
33
|
"main": "./dist/index.cjs",
|
|
29
34
|
"module": "./dist/index.js",
|
|
30
35
|
"types": "./dist/index.d.ts",
|
|
36
|
+
"typesVersions": {
|
|
37
|
+
"*": {
|
|
38
|
+
"column-filters": [
|
|
39
|
+
"./dist/column-filters.d.ts"
|
|
40
|
+
],
|
|
41
|
+
"validity": [
|
|
42
|
+
"./dist/validity.d.ts"
|
|
43
|
+
],
|
|
44
|
+
"search": [
|
|
45
|
+
"./dist/search.d.ts"
|
|
46
|
+
],
|
|
47
|
+
"sorting": [
|
|
48
|
+
"./dist/sorting.d.ts"
|
|
49
|
+
],
|
|
50
|
+
"pagination": [
|
|
51
|
+
"./dist/pagination.d.ts"
|
|
52
|
+
],
|
|
53
|
+
"messages": [
|
|
54
|
+
"./dist/messages.d.ts"
|
|
55
|
+
],
|
|
56
|
+
"schema": [
|
|
57
|
+
"./dist/schema.d.ts"
|
|
58
|
+
],
|
|
59
|
+
"search-async": [
|
|
60
|
+
"./dist/search-async.d.ts"
|
|
61
|
+
],
|
|
62
|
+
"server": [
|
|
63
|
+
"./dist/server.d.ts"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
31
67
|
"exports": {
|
|
32
68
|
".": {
|
|
33
69
|
"import": {
|
|
@@ -146,7 +182,7 @@
|
|
|
146
182
|
"build": "tsup && node scripts/postbuild.mjs",
|
|
147
183
|
"dev": "tsup --watch",
|
|
148
184
|
"typecheck": "tsc -p tsconfig.json",
|
|
149
|
-
"check:pkg": "publint --strict && attw --pack .
|
|
185
|
+
"check:pkg": "publint --strict && attw --pack . && node scripts/check-catalog.mjs",
|
|
150
186
|
"check:catalog": "node scripts/check-catalog.mjs"
|
|
151
187
|
}
|
|
152
188
|
}
|