@vielzeug/codex 2.1.4 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/errors.js +0 -3
- package/dist/errors.js.map +1 -1
- package/dist/snapshot.js.map +1 -1
- package/dist/tools/packages.js +2 -3
- package/dist/tools/packages.js.map +1 -1
- package/dist/tools/refine.js +2 -2
- package/dist/tools/refine.js.map +1 -1
- package/dist/tools/schema.js +2 -0
- package/dist/tools/schema.js.map +1 -1
- package/package.json +6 -1
- package/data/catalog.json +0 -1689
- package/data/llms-full.txt +0 -25771
- package/data/llms.txt +0 -40
- package/data/manifest.json +0 -8
- package/data/packages/arsenal.json +0 -210
- package/data/packages/assay.json +0 -40
- package/data/packages/clockwork.json +0 -67
- package/data/packages/codex.json +0 -43
- package/data/packages/coins.json +0 -103
- package/data/packages/conduit.json +0 -60
- package/data/packages/courier.json +0 -58
- package/data/packages/dnd.json +0 -77
- package/data/packages/familiar.json +0 -40
- package/data/packages/flux.json +0 -93
- package/data/packages/forge.json +0 -84
- package/data/packages/herald.json +0 -108
- package/data/packages/keymap.json +0 -59
- package/data/packages/ledger.json +0 -57
- package/data/packages/lingua.json +0 -68
- package/data/packages/necromancer.json +0 -50
- package/data/packages/orbit.json +0 -107
- package/data/packages/ore.json +0 -73
- package/data/packages/prism.json +0 -67
- package/data/packages/pulse.json +0 -60
- package/data/packages/refine.json +0 -12
- package/data/packages/ripple.json +0 -83
- package/data/packages/rune.json +0 -80
- package/data/packages/sandbox.json +0 -40
- package/data/packages/scout.json +0 -60
- package/data/packages/scroll.json +0 -114
- package/data/packages/sourcerer.json +0 -74
- package/data/packages/spell.json +0 -134
- package/data/packages/tempo.json +0 -81
- package/data/packages/vault.json +0 -87
- package/data/packages/ward.json +0 -113
- package/data/packages/wayfinder.json +0 -113
- package/data/refine.json +0 -11926
- package/data/search.json +0 -1436
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"apiSource": "export { createCursorSource } from './cursorSource';\nexport { createInfiniteSource } from './infiniteSource';\nexport { createLocalSource } from './localSource';\nexport { createPageSource } from './pageSource';\nexport type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';\n",
|
|
3
|
-
"docs": {
|
|
4
|
-
"index": "---\ntitle: Sourcerer — Reactive Query Sources\ndescription: Framework-agnostic collection sources for local, page, cursor, and infinite pagination.\npackage: sourcerer\ncategory: data\nkeywords: [pagination, data-source, cursor, infinite-scroll, search]\nrelated: [courier, ripple, scout, wayfinder]\nexports:\n [\n createCursorSource,\n createInfiniteSource,\n createLocalSource,\n createPageSource,\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n ]\nenvironments: [browser, node, ssr, deno]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"sourcerer\" />\n\n## Why Sourcerer?\n\nLists often combine pagination, search, request cancellation, and render state. Sourcerer gives local arrays and remote loaders one snapshot contract while leaving caching, retries, and transport policy to your application.\n\n```ts\nimport { createPageSource } from '@vielzeug/sourcerer';\n\ntype User = { id: number; name: string };\n\n// Before: query changes can mix old items with new loading and page state.\nlet items: User[] = [];\nlet page = 1;\nlet isLoading = false;\n\n// After: one source publishes internally consistent loaded state.\nconst source = createPageSource<User>({\n autoStart: false,\n load: async () => ({ data: [{ id: 1, name: 'Ada' }], total: 1 }),\n});\nsource.subscribe((snapshot) => console.log(snapshot.data));\nsource.dispose();\n```\n\n| Feature | Sourcerer | Manual list state | Courier query cache |\n| --- | --- | --- | --- |\n| Bundle size | <PackageInfo package=\"sourcerer\" type=\"size\" /> | Application-defined | <PackageInfo package=\"courier\" type=\"size\" /> |\n| Zero runtime dependencies | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> |\n| Local and remote collections | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Application-defined | <ore-icon name=\"triangle-alert\" size=\"16\"></ore-icon> |\n| Cursor and infinite pagination | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Application-defined | <ore-icon name=\"triangle-alert\" size=\"16\"></ore-icon> |\n| Latest-request cancellation | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Application-defined | Transport-level |\n\n<div class=\"decision-callout\">\n\n**Use Sourcerer when** one UI collection needs local or remote pagination with an explicit, framework-independent snapshot contract.\n\n**Consider Courier alone when** you only need cached HTTP queries and pagination state belongs elsewhere.\n\n</div>\n\n## Installation\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/sourcerer\n```\n\n```sh [npm]\nnpm install @vielzeug/sourcerer\n```\n\n```sh [yarn]\nyarn add @vielzeug/sourcerer\n```\n\n:::\n\n## Quick Start\n\nCreate a page source, load it, then dispose it with its owner.\n\n```ts\nimport { createPageSource } from '@vielzeug/sourcerer';\n\ntype User = { id: number; name: string };\n\nconst source = createPageSource<User>({\n autoStart: false,\n load: async ({ query }) => {\n const users = [\n { id: 1, name: 'Ada' },\n { id: 2, name: 'Grace' },\n { id: 3, name: 'Linus' },\n ];\n const start = (query.page - 1) * query.pageSize;\n\n return { data: users.slice(start, start + query.pageSize), total: users.length };\n },\n});\n\ntry {\n await source.reload();\n console.log(source.snapshot.data);\n} catch (error) {\n console.error(error);\n} finally {\n source.dispose();\n}\n```\n\n## Features\n\n<div class=\"features-grid\">\n\n- `createLocalSource()` — synchronous search and numbered pagination over an array\n- `createPageSource()` — numbered remote pages with latest-request cancellation\n- `createCursorSource()` — sequential opaque-cursor navigation\n- `createInfiniteSource()` — append-only page loading\n- `SourceSnapshot` — loaded `query`, `data`, and `pagination` plus optional `pendingQuery`\n- `debugSource()` — opt-in `console.debug` observer from `/devtools`\n\n</div>\n\n## Documentation\n\n<div class=\"doc-links\">\n\n- [Usage Guide](./usage.md)\n- [API Reference](./api.md)\n- [Examples](./examples.md)\n- [Migration Guide](./migration.md)\n\n</div>\n\n## See Also\n\n<div class=\"see-also\">\n\n- [Courier](/courier/) — use as transport, caching, and retry policy inside a page loader\n- [Scout](/scout/) — adapt an indexed search matcher for local sources\n- [Ripple](/ripple/) — project source snapshots into reactive application state\n- [Wayfinder](/wayfinder/) — validate and synchronize page query fields with route state\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
|
|
5
|
-
"api": "---\ntitle: Sourcerer — API Reference\ndescription: Public API for @vielzeug/sourcerer.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution | Common gotcha |\n| --- | --- | --- | --- |\n| `createLocalSource()` | In-memory search and pagination | Sync | Prepare filtering and ranking before `setData()` |\n| `createPageSource()` | Numbered async pages | Async | `query` remains loaded state while `pendingQuery` is active |\n| `createCursorSource()` | Cursor-based async pages | Async | `after` and `before` cannot coexist |\n| `createInfiniteSource()` | Appended async pages | Async | `loadMore()` does nothing while fetching or exhausted |\n| `SourceSnapshot` | Atomic loaded state plus pending request | Type | Read `pendingQuery` for newer in-flight state |\n| `debugSource()` | Console debug observer | Sync | Import from `/devtools` |\n\n## Package Entry Point\n\n| Import | Purpose |\n| --- | --- |\n| `@vielzeug/sourcerer` | Factories and public types |\n| `@vielzeug/sourcerer/devtools` | `debugSource()` observer |\n\n## Factories\n\n### `createLocalSource()`\n\n```ts\nfunction createLocalSource<T>(data: readonly T[], config?: LocalSourceConfig<T>): LocalSource<T>\n```\n\nCreates a synchronous source over an in-memory collection.\n\n| Option | Type | Description |\n| --- | --- | --- |\n| `initialQuery` | `LocalQueryPatch` | Initial page, page size, or search value |\n| `match` | `(item, search) => boolean` | Explicit search predicate |\n\n**Returns:** `LocalSource<T>`.\n\n```ts\nimport { createLocalSource } from '@vielzeug/sourcerer';\n\nconst users = createLocalSource(\n [{ id: 1, name: 'Ada' }],\n {\n initialQuery: { pageSize: 20 },\n match: (user, search) => user.name.toLowerCase().includes(search.toLowerCase()),\n },\n);\n\nusers.setQuery({ search: 'ada' });\n```\n\n---\n\n### `createPageSource()`\n\n```ts\nfunction createPageSource<T, TFilter = unknown, TSort = unknown>(\n config: PageSourceConfig<T, TFilter, TSort>,\n): PageSource<T, TFilter, TSort>\n```\n\nCreates a numbered source. New queries abort older work. Loaded state stays in `snapshot`; newer work appears in `snapshot.pendingQuery`.\n\n| Option | Type | Description |\n| --- | --- | --- |\n| `autoStart` | `boolean` | Start initial request; default `true` |\n| `initialQuery` | `PageQueryPatch<TFilter, TSort>` | Initial query values |\n| `load` | `(context) => Promise<PageResult<T>>` | Transport callback |\n\n**Returns:** `PageSource<T, TFilter, TSort>`.\n\n```ts\nimport { createPageSource } from '@vielzeug/sourcerer';\n\nconst users = createPageSource({\n autoStart: false,\n load: async () => ({ data: [{ id: 1, name: 'Ada' }], total: 1 }),\n});\n\nawait users.setQuery({ page: 1 });\nusers.dispose();\n```\n\n---\n\n### `createCursorSource()`\n\n```ts\nfunction createCursorSource<T, TCursor = string>(\n config: CursorSourceConfig<T, TCursor>,\n): CursorSource<T, TCursor>\n```\n\nCreates a sequential cursor source. Search and page-size changes reset cursors.\n\n**Returns:** `CursorSource<T, TCursor>`.\n\n```ts\nimport { createCursorSource } from '@vielzeug/sourcerer';\n\nconst orders = createCursorSource({\n autoStart: false,\n load: async () => ({ data: ['order-1'] }),\n});\n\nawait orders.reload();\nawait orders.page.next();\norders.dispose();\n```\n\n---\n\n### `createInfiniteSource()`\n\n```ts\nfunction createInfiniteSource<T>(config: InfiniteSourceConfig<T>): InfiniteSource<T>\n```\n\nCreates an append-only source. Query changes replace loaded collection after successful first-page load.\n\n**Returns:** `InfiniteSource<T>`.\n\n```ts\nimport { createInfiniteSource } from '@vielzeug/sourcerer';\n\nconst feed = createInfiniteSource({\n autoStart: false,\n load: async () => ({ data: ['post-1'], total: 1 }),\n});\n\nawait feed.loadMore();\nfeed.dispose();\n```\n\n## Types\n\n### Source primitives\n\n```ts\ntype Disposable = {\n [Symbol.dispose](): void;\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n};\n\ntype SourceSnapshot<T, TQuery, TPagination extends AnyPagination = AnyPagination> = Readonly<{\n data: readonly T[];\n error: Error | null;\n isFetching: boolean;\n pagination: TPagination;\n pendingQuery?: TQuery;\n query: TQuery;\n}>;\n\ntype Source<T, TQuery, TPagination extends AnyPagination = AnyPagination> = Disposable & {\n readonly snapshot: SourceSnapshot<T, TQuery, TPagination>;\n subscribe(listener: (snapshot: SourceSnapshot<T, TQuery, TPagination>) => void): () => void;\n};\n```\n\n### Numbered pages\n\n```ts\ntype PagePagination = Readonly<{\n count: number;\n hasNext: boolean;\n hasPrevious: boolean;\n index: number;\n kind: 'page';\n size: number;\n total: number;\n}>;\n\ntype PageQuery<TFilter = unknown, TSort = unknown> = Readonly<{\n filter?: TFilter;\n page: number;\n pageSize: number;\n search: string;\n sort?: TSort;\n}>;\n\ntype PageQueryPatch<TFilter = unknown, TSort = unknown> = Readonly<{\n filter?: TFilter | undefined;\n page?: number;\n pageSize?: number;\n search?: string;\n sort?: TSort | undefined;\n}>;\n\ntype PageResult<T> = Readonly<{ data: readonly T[]; total: number }>;\ntype PageLoadContext<TQuery> = Readonly<{ query: TQuery; signal: AbortSignal }>;\n\ntype PageSourceConfig<T, TFilter = unknown, TSort = unknown> = Readonly<{\n autoStart?: boolean;\n initialQuery?: PageQueryPatch<TFilter, TSort>;\n load(context: PageLoadContext<PageQuery<TFilter, TSort>>): Promise<PageResult<T>>;\n}>;\n\ntype PageSource<T, TFilter = unknown, TSort = unknown> = Source<T, PageQuery<TFilter, TSort>, PagePagination> & {\n readonly page: Readonly<{\n go(index: number): Promise<void>;\n last(): Promise<void>;\n next(): Promise<void>;\n previous(): Promise<void>;\n }>;\n reload(): Promise<void>;\n setQuery(changes: PageQueryPatch<TFilter, TSort>): Promise<void>;\n};\n```\n\n### Local sources\n\n```ts\ntype LocalQuery = Readonly<{ page: number; pageSize: number; search: string }>;\ntype LocalQueryPatch = Readonly<{ page?: number; pageSize?: number; search?: string }>;\ntype LocalSourceConfig<T> = Readonly<{\n initialQuery?: LocalQueryPatch;\n match?: (item: T, search: string) => boolean;\n}>;\n\ntype LocalSource<T> = Source<T, LocalQuery, PagePagination> & {\n readonly page: Readonly<{\n go(index: number): boolean;\n last(): boolean;\n next(): boolean;\n previous(): boolean;\n }>;\n setData(data: readonly T[]): boolean;\n setQuery(changes: LocalQueryPatch): boolean;\n};\n```\n\n### Cursor and infinite sources\n\n```ts\ntype CursorPagination<TCursor = string> = Readonly<{\n hasNext: boolean;\n hasPrevious: boolean;\n kind: 'cursor';\n nextCursor?: TCursor;\n previousCursor?: TCursor;\n total?: number;\n}>;\n\ntype CursorQuery<TCursor = string> = Readonly<{\n after?: TCursor;\n before?: TCursor;\n pageSize: number;\n search: string;\n}>;\n\ntype CursorQueryPatch<TCursor = string> = Readonly<{\n after?: TCursor | undefined;\n before?: TCursor | undefined;\n pageSize?: number;\n search?: string;\n}>;\n\ntype CursorResult<T, TCursor = string> = Readonly<{\n data: readonly T[];\n nextCursor?: TCursor;\n previousCursor?: TCursor;\n total?: number;\n}>;\n\ntype CursorSourceConfig<T, TCursor = string> = Readonly<{\n autoStart?: boolean;\n initialQuery?: CursorQueryPatch<TCursor>;\n load(context: PageLoadContext<CursorQuery<TCursor>>): Promise<CursorResult<T, TCursor>>;\n}>;\n\ntype CursorSource<T, TCursor = string> = Source<T, CursorQuery<TCursor>, CursorPagination<TCursor>> & {\n readonly page: Readonly<{ next(): Promise<void>; previous(): Promise<void> }>;\n reload(): Promise<void>;\n setQuery(changes: CursorQueryPatch<TCursor>): Promise<void>;\n};\n\ntype InfinitePagination = Readonly<{\n hasMore: boolean;\n isLoadingMore: boolean;\n kind: 'infinite';\n loaded: number;\n total: number;\n}>;\n\ntype InfiniteQuery = Readonly<{ pageSize: number; search: string }>;\ntype InfiniteQueryPatch = Readonly<{ pageSize?: number; search?: string }>;\n\ntype InfiniteSourceConfig<T> = Readonly<{\n autoStart?: boolean;\n initialQuery?: InfiniteQueryPatch;\n load(context: PageLoadContext<PageQuery>): Promise<PageResult<T>>;\n}>;\n\ntype InfiniteSource<T> = Source<T, InfiniteQuery, InfinitePagination> & {\n loadMore(): Promise<void>;\n reload(): Promise<void>;\n setQuery(changes: InfiniteQueryPatch): Promise<void>;\n};\n```\n\n### Shared helpers\n\n```ts\ntype AnyPagination = CursorPagination<unknown> | InfinitePagination | PagePagination;\ntype Predicate<T> = (value: T, index: number, values: readonly T[]) => boolean;\ntype Sorter<T> = (left: T, right: T) => number;\n```\n\n## Devtools\n\n```ts\nimport { debugSource } from '@vielzeug/sourcerer/devtools';\n\nconst stopDebugging = debugSource(source, { label: 'users' });\nstopDebugging();\n```\n",
|
|
6
|
-
"usage": "---\ntitle: Sourcerer — Usage Guide\ndescription: Build local, page, cursor, and infinite collection sources.\n---\n\n[[toc]]\n\n## Basic Usage\n\nUse a local source when data already exists in memory.\n\n```ts\nimport { createLocalSource } from '@vielzeug/sourcerer';\n\nconst source = createLocalSource(\n [\n { id: 1, name: 'Ada' },\n { id: 2, name: 'Grace' },\n { id: 3, name: 'Linus' },\n ],\n {\n initialQuery: { pageSize: 2 },\n match: (user, search) => user.name.toLowerCase().includes(search.toLowerCase()),\n },\n);\n\nsource.setQuery({ search: 'a' });\nconsole.log(source.snapshot.data);\nsource.dispose();\n```\n\nRead `snapshot.query`, `snapshot.data`, and `snapshot.pagination` together. They always describe one loaded result.\n\n## Handle Pending Remote Queries\n\nUse `pendingQuery` to distinguish loaded data from newer work.\n\n```ts\nimport { createPageSource } from '@vielzeug/sourcerer';\n\nconst source = createPageSource<string>({\n autoStart: false,\n load: async ({ query }) => {\n const data = ['Ada', 'Grace', 'Linus'];\n const start = (query.page - 1) * query.pageSize;\n\n return { data: data.slice(start, start + query.pageSize), total: data.length };\n },\n});\n\nsource.subscribe((snapshot) => {\n if (snapshot.pendingQuery) console.log('Loading:', snapshot.pendingQuery);\n console.log('Loaded:', snapshot.query, snapshot.data);\n});\n\nawait source.setQuery({ page: 2 });\nsource.dispose();\n```\n\nNew `setQuery()` calls abort older requests. A failed current request preserves prior loaded data, records `snapshot.error`, and rejects the returned promise.\n\n## Use Cursor Pagination\n\nUse cursors when an API cannot provide stable page numbers.\n\n```ts\nimport { createCursorSource } from '@vielzeug/sourcerer';\n\nconst rows = ['A', 'B', 'C', 'D'];\nconst source = createCursorSource<string, number>({\n autoStart: false,\n initialQuery: { pageSize: 2 },\n load: async ({ query }) => {\n const start = query.after ?? 0;\n const data = rows.slice(start, start + query.pageSize);\n const nextCursor = start + data.length;\n\n return {\n data,\n nextCursor: nextCursor < rows.length ? nextCursor : undefined,\n previousCursor: start > 0 ? Math.max(0, start - query.pageSize) : undefined,\n };\n },\n});\n\nawait source.reload();\nawait source.page.next();\nconsole.log(source.snapshot.data);\nsource.dispose();\n```\n\n`after` and `before` cannot coexist. Search or page-size changes reset cursor state.\n\n## Build an Infinite Feed\n\nUse an infinite source when each page should append.\n\n```ts\nimport { createInfiniteSource } from '@vielzeug/sourcerer';\n\nconst source = createInfiniteSource<number>({\n autoStart: false,\n initialQuery: { pageSize: 2 },\n load: async ({ query }) => {\n const values = [1, 2, 3, 4, 5];\n const start = (query.page - 1) * query.pageSize;\n\n return { data: values.slice(start, start + query.pageSize), total: values.length };\n },\n});\n\nawait source.loadMore();\nawait source.loadMore();\nconsole.log(source.snapshot.data);\nsource.dispose();\n```\n\n`loadMore()` is a no-op while fetching or after `pagination.hasMore` becomes false.\n\n## Testing and Debugging\n\nInject deterministic loaders in unit tests. Await source commands before reading final state.\n\n```ts\nimport { expect, it } from 'vitest';\nimport { createPageSource } from '@vielzeug/sourcerer';\n\nit('loads first page', async () => {\n const source = createPageSource({\n autoStart: false,\n load: async () => ({ data: ['Ada'], total: 1 }),\n });\n\n await source.reload();\n expect(source.snapshot.data).toEqual(['Ada']);\n source.dispose();\n});\n```\n\nUse `debugSource()` only while investigating state transitions.\n\n```ts\nimport { debugSource } from '@vielzeug/sourcerer/devtools';\nimport { createLocalSource } from '@vielzeug/sourcerer';\n\nconst source = createLocalSource(['Ada']);\nconst stopDebugging = debugSource(source, { label: 'users' });\nstopDebugging();\nsource.dispose();\n```\n\n## Framework Integration\n\nSubscribe through each framework’s lifecycle. Keep source creation stable across renders.\n\n::: code-group\n\n```tsx [React]\nimport { createPageSource } from '@vielzeug/sourcerer';\nimport { useEffect, useMemo, useSyncExternalStore } from 'react';\n\nexport function Users() {\n const source = useMemo(\n () => createPageSource({ load: async () => ({ data: [{ id: 1, name: 'Ada' }], total: 1 }) }),\n [],\n );\n const snapshot = useSyncExternalStore(source.subscribe, () => source.snapshot);\n\n useEffect(() => () => source.dispose(), [source]);\n\n return <p>{snapshot.isFetching ? 'Loading' : snapshot.data.length}</p>;\n}\n```\n\n```ts [Vue 3]\nimport { onUnmounted, shallowRef } from 'vue';\nimport { createPageSource } from '@vielzeug/sourcerer';\n\nconst source = createPageSource({ load: async () => ({ data: [{ id: 1, name: 'Ada' }], total: 1 }) });\nconst snapshot = shallowRef(source.snapshot);\nconst stop = source.subscribe((next) => (snapshot.value = next));\n\nonUnmounted(() => {\n stop();\n source.dispose();\n});\n```\n\n```svelte [Svelte]\n<script lang=\"ts\">\n import { onDestroy } from 'svelte';\n import { createPageSource } from '@vielzeug/sourcerer';\n\n const source = createPageSource({ load: async () => ({ data: [{ id: 1, name: 'Ada' }], total: 1 }) });\n let snapshot = source.snapshot;\n const stop = source.subscribe((next) => (snapshot = next));\n\n onDestroy(() => {\n stop();\n source.dispose();\n });\n</script>\n\n{#if snapshot.isFetching}Loading{/if}\n{#each snapshot.data as user}{user.name}{/each}\n```\n\n:::\n\n## Working with Other Vielzeug Libraries\n\nUse Courier for transport policy. Sourcerer owns request succession; Courier owns HTTP behavior.\n\n```ts\nimport { createCourier } from '@vielzeug/courier';\nimport { createPageSource } from '@vielzeug/sourcerer';\n\nconst courier = createCourier({ baseUrl: '/api' });\nconst source = createPageSource({\n load: ({ query, signal }) => courier.get('/users', { query, signal }),\n});\n```\n\nUse Scout’s matcher when local search needs an index.\n\n```ts\nimport { createIndex, toSearchMatcher } from '@vielzeug/scout';\nimport { createLocalSource } from '@vielzeug/sourcerer';\n\nconst users = [{ name: 'Ada' }, { name: 'Grace' }];\nconst index = createIndex(users, { fields: ['name'] });\nconst source = createLocalSource(users, { match: toSearchMatcher(index) });\n```\n\n## Best Practices\n\n- Dispose each source with its owning view, request, or scope.\n- Read one snapshot object per render instead of mixing source fields across updates.\n- Inspect `pendingQuery` before rendering controls for in-flight work.\n- Validate URL query values before passing them to `setQuery()`.\n- Keep caching, retries, polling, and optimistic writes in your transport layer.\n- Use `setData()` with prepared local collections; keep ranking and filtering explicit.\n- Debounce text inputs before updating remote source queries.\n",
|
|
7
|
-
"examples": "---\ntitle: Sourcerer — Examples\ndescription: Recipes for local, page, cursor, infinite, and framework source usage.\n---\n\n## Examples\n\n- [Local Pagination and Search](./examples/local-pagination-and-filtering.md)\n- [Page Query with URL State](./examples/remote-search-with-url-state.md)\n- [Cursor-Based Pagination](./examples/cursor-based-pagination.md)\n- [Infinite Scroll](./examples/infinite-scroll.md)\n- [Framework Integration](./examples/framework-integration.md)\n- [Remote Data with Courier](./examples/sourcerer-with-courier.md)\n- [Reactive Controls with Ripple](./examples/sourcerer-with-ripple.md)\n- [URL-Synced List with Wayfinder](./examples/sourcerer-with-wayfinder.md)\n"
|
|
8
|
-
},
|
|
9
|
-
"examples": [
|
|
10
|
-
{
|
|
11
|
-
"id": "cursor-source",
|
|
12
|
-
"code": "import { createCursorSource } from '@vielzeug/sourcerer'\n\nconst items = Array.from({ length: 30 }, (_, index) => ({ id: index + 1, label: `Item ${index + 1}` }))\n\nconst source = createCursorSource({\n initialQuery: { pageSize: 10 },\n load: async ({ query }) => {\n const start = query.after ? Number(query.after) : 0\n const data = items.slice(start, start + query.pageSize)\n const next = start + data.length\n return { data, nextCursor: next < items.length ? String(next) : undefined, previousCursor: start ? String(Math.max(0, start - query.pageSize)) : undefined }\n },\n})\n\nawait source.reload()\nawait source.page.next()\nconsole.log(source.snapshot.data.map((item) => item.label))\nconsole.log(source.snapshot.pagination)\n\nsource.dispose()",
|
|
13
|
-
"name": "Cursor Source"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"id": "error-handling",
|
|
17
|
-
"code": "import { createPageSource } from '@vielzeug/sourcerer'\n\nconst source = createPageSource({\n autoStart: false,\n load: async () => { throw new Error('network down') },\n})\n\ntry {\n await source.reload()\n} catch (error) {\n console.log((error as Error).message)\n}\n\nconsole.log(source.snapshot.error?.message)\nconsole.log(source.snapshot.error?.message)\nsource.dispose()",
|
|
18
|
-
"name": "Error Handling"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"id": "infinite-source",
|
|
22
|
-
"code": "import { createInfiniteSource } from '@vielzeug/sourcerer'\n\nconst posts = Array.from({ length: 25 }, (_, index) => ({ id: index + 1, title: `Post ${index + 1}` }))\n\nconst source = createInfiniteSource({\n initialQuery: { pageSize: 8 },\n load: async ({ query }) => {\n const start = (query.page - 1) * query.pageSize\n return { data: posts.slice(start, start + query.pageSize), total: posts.length }\n },\n})\n\nawait source.reload()\nawait source.loadMore()\nconsole.log(source.snapshot.data.length)\nconsole.log(source.snapshot.pagination)\n\nsource.dispose()",
|
|
23
|
-
"name": "Infinite Source"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"id": "lifecycle",
|
|
27
|
-
"code": "import { createPageSource } from '@vielzeug/sourcerer'\n\nconst source = createPageSource({\n autoStart: false,\n load: async () => ({ data: ['item'], total: 1 }),\n})\n\nconsole.log(source.disposed)\nsource.disposalSignal.addEventListener('abort', () => console.log('disposed'))\nawait source.reload()\nconsole.log(source.snapshot.data)\nsource.dispose()\nconsole.log(source.disposalSignal.aborted)",
|
|
28
|
-
"name": "Source Lifecycle"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"id": "local-source",
|
|
32
|
-
"code": "import { createLocalSource } from '@vielzeug/sourcerer'\n\nconst users = [\n { id: 1, name: 'Ada', role: 'admin' },\n { id: 2, name: 'Grace', role: 'admin' },\n { id: 3, name: 'Linus', role: 'user' },\n]\n\nconst source = createLocalSource(users, {\n initialQuery: { pageSize: 2 },\n match: (user, search) => user.name.toLowerCase().includes(search.toLowerCase()),\n})\n\nsource.setQuery({ search: 'a' })\nconsole.log(source.snapshot.data)\nconsole.log(source.snapshot.pagination)\n\nsource.dispose()",
|
|
33
|
-
"name": "Local Source"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"id": "page-source",
|
|
37
|
-
"code": "import { createPageSource } from '@vielzeug/sourcerer'\n\nconst allItems = Array.from({ length: 47 }, (_, index) => ({ id: index + 1, name: `Item ${index + 1}` }))\n\nconst source = createPageSource({\n initialQuery: { pageSize: 10 },\n load: async ({ query }) => {\n const filtered = query.search ? allItems.filter((item) => item.name.includes(query.search)) : allItems\n const start = (query.page - 1) * query.pageSize\n return { data: filtered.slice(start, start + query.pageSize), total: filtered.length }\n },\n})\n\nawait source.reload()\nawait source.setQuery({ search: 'Item 4' })\nconsole.log(source.snapshot.data.map((item) => item.name))\nconsole.log(source.snapshot.pagination)\n\nsource.dispose()",
|
|
38
|
-
"name": "Page Source"
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
"typeSignatures": {
|
|
42
|
-
"createCursorSource": "export { createCursorSource } from './cursorSource';",
|
|
43
|
-
"createInfiniteSource": "export { createInfiniteSource } from './infiniteSource';",
|
|
44
|
-
"createLocalSource": "export { createLocalSource } from './localSource';",
|
|
45
|
-
"createPageSource": "export { createPageSource } from './pageSource';",
|
|
46
|
-
"AnyPagination": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
47
|
-
"CursorPagination": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
48
|
-
"CursorQuery": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
49
|
-
"CursorQueryPatch": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
50
|
-
"CursorResult": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
51
|
-
"CursorSource": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
52
|
-
"CursorSourceConfig": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
53
|
-
"InfinitePagination": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
54
|
-
"InfiniteQuery": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
55
|
-
"InfiniteQueryPatch": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
56
|
-
"InfiniteSource": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
57
|
-
"InfiniteSourceConfig": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
58
|
-
"LocalQuery": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
59
|
-
"LocalQueryPatch": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
60
|
-
"LocalSource": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
61
|
-
"LocalSourceConfig": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
62
|
-
"PageLoadContext": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
63
|
-
"PagePagination": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
64
|
-
"PageQuery": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
65
|
-
"PageQueryPatch": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
66
|
-
"PageResult": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
67
|
-
"PageSource": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
68
|
-
"PageSourceConfig": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
69
|
-
"Predicate": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
70
|
-
"Sorter": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
71
|
-
"Source": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';",
|
|
72
|
-
"SourceSnapshot": "export type {\n AnyPagination,\n CursorPagination,\n CursorQuery,\n CursorQueryPatch,\n CursorResult,\n CursorSource,\n CursorSourceConfig,\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PageLoadContext,\n PagePagination,\n PageQuery,\n PageQueryPatch,\n PageResult,\n PageSource,\n PageSourceConfig,\n Predicate,\n Sorter,\n Source,\n SourceSnapshot,\n} from './types';"
|
|
73
|
-
}
|
|
74
|
-
}
|
package/data/packages/spell.json
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"apiSource": "import { fail, prependIssuePath } from './errors';\nimport { createParseContext } from './messages';\n\nexport type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';\nexport {\n ErrorCode,\n PipeSchema,\n Schema,\n SpellDefinitionError,\n SpellError,\n SpellValidationError,\n schemaMode,\n} from './core';\nexport type { DeepPartial } from './messages';\nexport { s } from './s';\n\n/** Error helpers and immutable parse-context creation are secondary operations. */\nexport const diagnostics = {\n createParseContext,\n fail,\n prependIssuePath,\n};\n",
|
|
3
|
-
"docs": {
|
|
4
|
-
"index": "---\ntitle: Spell — Schema validation for TypeScript\ndescription: Schema validation with explicit sync/async checks, portable definitions, JSON Schema export, and tree-shakeable entry points.\npackage: spell\ncategory: validation\nkeywords: [schema, validation, parsing, json-schema, locale, typescript, descriptors]\nrelated: [forge, courier, vault]\nexports:\n [s, Schema, PipeSchema, SpellValidationError, SpellDefinitionError, ErrorCode, diagnostics, './json', './predicates']\nenvironments: [browser, node, ssr, deno]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"spell\" />\n\n## Why Spell?\n\nSpell keeps runtime validation, static inference, and portable definitions in one API. Use `s` for schema construction; import JSON conversion and predicates from dedicated subpaths.\n\nThis example shows the difference between manual branching and a single reusable schema.\n\n```ts\n// Before\nfunction parseUserBefore(value: unknown) {\n if (typeof value !== 'object' || value === null) throw new Error('Expected object');\n\n const candidate = value as Record<string, unknown>;\n\n if (typeof candidate.email !== 'string' || !candidate.email.includes('@')) {\n throw new Error('Expected valid email');\n }\n\n if (typeof candidate.role !== 'string' || !['admin', 'editor', 'viewer'].includes(candidate.role)) {\n throw new Error('Expected valid role');\n }\n\n return {\n email: candidate.email,\n role: candidate.role,\n };\n}\n\n// After\nimport { s } from '@vielzeug/spell';\n\nconst User = s.object({\n email: s.string().email(),\n role: s.enum(['admin', 'editor', 'viewer'] as const),\n});\n\nconst user = User.parse({ email: 'ada@example.com', role: 'admin' });\n```\n\n| Feature | Spell | Zod | Yup |\n| ----------------- | --------------------------------------------------------------------------- | -------------------------------------------- | -------------------------------------------- |\n| Bundle size | <PackageInfo package=\"spell\" type=\"size\" /> | ~62 kB | ~14 kB |\n| Type inference | <ore-icon name=\"check\" size=\"16\"></ore-icon> `Infer<T>` | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Partial |\n| Coercion API | <ore-icon name=\"check\" size=\"16\"></ore-icon> `s.coerce.*` | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"check\" size=\"16\"></ore-icon> |\n| Async validation | <ore-icon name=\"check\" size=\"16\"></ore-icon> `.checkAsync()` | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"check\" size=\"16\"></ore-icon> |\n| Error flattening | <ore-icon name=\"check\" size=\"16\"></ore-icon> `flatten()` + `flattenFirst()` | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Partial |\n| Zero dependencies | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"x\" size=\"16\"></ore-icon> |\n\n<div class=\"decision-callout\">\n\n**Use Spell when** you want a fluent schema API with strong TypeScript inference, structured errors, and no third-party runtime dependencies.\n\n**Consider alternatives when** you are already standardized on another validator ecosystem and migration cost outweighs the API benefits.\n\n</div>\n\n## Installation\n\nUse your workspace package manager to add Spell.\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/spell\n```\n\n```sh [npm]\nnpm install @vielzeug/spell\n```\n\n```sh [yarn]\nyarn add @vielzeug/spell\n```\n\n:::\n\n## Quick Start\n\nStart with a schema, then parse unknown input and use the inferred output type everywhere else.\n\n```ts\nimport { s, type Infer } from '@vielzeug/spell';\n\nconst User = s\n .object({\n email: s.string().email(),\n name: s.string().min(1),\n role: s.enum(['admin', 'editor', 'viewer'] as const),\n })\n .relaxed(); // allow extra keys — omit for strict-mode (default)\n\ntype User = Infer<typeof User>;\n\nconst payload: unknown = {\n email: 'ada@example.com',\n name: 'Ada',\n role: 'admin',\n team: 'platform',\n};\n\nconst result = User.safeParse(payload);\n\nif (!result.success) throw result.error;\nconst user = result.data;\n```\n\n## Features\n\n<div class=\"features-grid\">\n\n- Namespace and tree-shakeable schema builders.\n- Sync and async parsing with `parse()`, `safeParse()`, `parseAsync()`, and `safeParseAsync()`.\n- Explicit `check()` and `checkAsync()` rules; sync parsing never skips an async check.\n- Wrapper modes for `optional`, `nullable`, `nullish`, `default`, `catch`, and `required`.\n- Frozen declarative definitions through `definition()` and JSON Schema export via `fromDefinition()` from `@vielzeug/spell/json`.\n- Grouped `diagnostics` and `predicates` utilities keep schema construction focused.\n- Ordered union parsing produces the same selected branch in sync and async modes.\n- Structured errors with direct path lookup, flattened views, and best-match union diagnostics.\n- Object parsing is hardened against prototype-pollution-style keys.\n\n</div>\n\n## Documentation\n\n<div class=\"doc-links\">\n\n- [Usage Guide](./usage.md)\n- [API Reference](./api.md)\n- [Examples](./examples.md)\n- [Migration Guide](./migration.md)\n\n</div>\n\n## See Also\n\n<div class=\"see-also\">\n\n- [Forge](/forge/) — typed form state that uses Spell schemas as its validation layer\n- [Courier](/courier/) — HTTP client for validating request and response payloads at service boundaries\n- [Vault](/vault/) — unified storage API that accepts Spell schemas to type-gate persisted data\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
|
|
5
|
-
"api": "---\ntitle: Spell — API Reference\ndescription: Reference for Spell schema builders, parsing, diagnostics, and tooling exports.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution mode | Common gotcha |\n| ----------------------- | ------------------------------- | ---------------------------------- | ---------------------------------------------------- |\n| `s` | Creates schemas | Sync or async, depending on checks | `checkAsync()` requires async parsing |\n| `Schema` / `PipeSchema` | Base schema abstractions | Sync or async | Use `Infer` rather than assuming input equals output |\n| `diagnostics` | Parse-context and error helpers | Sync | Context is per parse/request, not global |\n| `SpellValidationError` | Validation failure details | Sync/async parse failures | Use `safeParse()` to handle it as a result |\n\n## Package Entry Point\n\n| Import | Purpose |\n| ---------------------------- | ----------------------------------------------- |\n| `@vielzeug/spell` | Schema builders, errors, types, and diagnostics |\n| `@vielzeug/spell/json` | Convert portable definitions to JSON Schema |\n| `@vielzeug/spell/predicates` | Standalone format and type predicates |\n\n```ts\nimport { diagnostics, s, type Infer } from '@vielzeug/spell';\nimport { fromDefinition } from '@vielzeug/spell/json';\nimport { isEmail } from '@vielzeug/spell/predicates';\n```\n\n## `s`\n\nAll builders live under `s`.\n\n| Builder | Purpose |\n| ----------------------------------------------------------------- | -------------------------- |\n| `string`, `number`, `boolean`, `bigint`, `date` | Primitive values |\n| `literal`, `enum`, `null`, `undefined`, `unknown`, `any`, `never` | Exact and universal values |\n| `array`, `tuple`, `set`, `map`, `record`, `object` | Collections |\n| `union`, `intersect`, `discriminatedUnion`, `lazy` | Composition |\n| `coerce.*` | Coercing primitive schemas |\n\n```ts\nconst User = s.object({\n email: s.string().email(),\n id: s.string().uuid(),\n role: s.enum(['admin', 'member'] as const),\n});\n\ntype User = Infer<typeof User>;\n```\n\nObject schemas reject unknown keys. Use `.relaxed()` to retain extras.\n\n## Parsing\n\nEvery schema provides:\n\n```ts\nschema.parse(value, context?); // Output or SpellValidationError\nschema.safeParse(value, context?); // ParseResult<Output>\nschema.parseAsync(value, context?); // Promise<Output>\nschema.safeParseAsync(value, context?); // Promise<ParseResult<Output>>\nschema.is(value); // value is Output\nschema.assert(value, label?); // assertion\n```\n\n`parse()` and `safeParse()` are available on synchronous schemas. Calling `checkAsync()` returns an async-only schema, where TypeScript exposes only `parseAsync()` and `safeParseAsync()`. That async-only mode propagates through compositional schemas when a child is asynchronous.\n\n## Custom Checks\n\n`check()` is synchronous. `checkAsync()` is asynchronous. Do not return a Promise from `check()`.\n\n```ts\nconst Signup = s.object({ confirm: s.string(), password: s.string() }).check((value, context) => {\n if (value.password !== value.confirm) {\n context.addIssue({ code: 'custom', message: 'Passwords must match', path: ['confirm'] });\n }\n});\n\nconst AvailableEmail = s\n .string()\n .email()\n .checkAsync(async (value) => {\n return (await emailAvailable(value)) || 'Email is already registered';\n });\n```\n\n`CheckContext.addIssue()` takes `{ code, message, params?, path? }`. Paths are relative to current schema.\n\n## Modifiers and Transforms\n\n```ts\ns.string().optional();\ns.string().nullable();\ns.string().nullish();\ns.string().required();\ns.string().default('guest');\ns.string().catch('guest');\ns.string()\n .trim()\n .transform((value) => value.toLowerCase());\ns.string().pipe(s.string().slug());\ns.string().label('User name');\n```\n\n`default()`, `catch()`, preprocessors, transforms, and checks are runtime behavior. They cannot become portable definitions.\n\n## Definitions and JSON Schema\n\n`definition()` is only for schemas containing declarative structure. It returns frozen data and throws `SpellDefinitionError` when runtime behavior is present.\n\n```ts\nimport { s } from '@vielzeug/spell';\nimport { fromDefinition } from '@vielzeug/spell/json';\n\nconst Product = s.object({\n id: s.string().uuid(),\n name: s.string().min(1),\n});\n\nconst definition = Product.definition();\nconst jsonSchema = fromDefinition(definition);\n```\n\nNo implicit schema-to-JSON conversion exists. Make definition boundary explicit.\n\n## Diagnostics\n\n`diagnostics` contains pure helpers and immutable parse-context creation.\n\n```ts\nimport { diagnostics, s } from '@vielzeug/spell';\n\nconst context = diagnostics.createParseContext({\n object: { invalidKeys: () => 'Unsupported field' },\n});\n\nconst result = s.object({ email: s.string().email() }).safeParse({ email: 'ada@example.com', extra: true }, context);\n\nif (!result.success) {\n const messages = result.error.messagesAt('email');\n console.log(messages);\n}\n```\n\n`diagnostics.fail(code, message, params?)` and `diagnostics.prependIssuePath(issues, segment)` support custom parser implementations.\n\n## Errors\n\n- `SpellError` — base class. Use `SpellError.is(error)` for cross-boundary narrowing.\n- `SpellValidationError` — validation failure with `issues`, `bestMatch()`, `messagesAt()`, `flatten()`, and `flattenFirst()`.\n- `SpellDefinitionError` — schema cannot create portable definition.\n\n```ts\nconst result = s.object({ email: s.string().email() }).safeParse({ email: 'invalid' });\n\nif (!result.success) {\n const { fieldErrors, formErrors } = result.error.flatten();\n console.log(fieldErrors, formErrors);\n}\n```\n\n## Types\n\n| Type | Purpose |\n| --------------------------------- | ----------------------------------------------------------------- |\n| `Infer<T>` / `InferOutput<T>` | Parsed output type |\n| `InferInput<T>` | Accepted input type, including async schemas |\n| `InferSchemaMode<T>` | `'sync'` or `'async'` parsing capability |\n| `SchemaMode` | Mode union: `'sync' | 'async'` |\n| `AnySchema` | Structural schema surface for composition and custom integrations |\n| `schemaMode` | Public symbol marking a schema's parsing capability |\n| `MergeSchemaModes<T>` | Produces `'async'` when any constituent mode is async |\n| `ParseResult<T>` | Tagged safe-parse result |\n| `Issue` | Validation issue union |\n| `CheckContext` / `ValidateResult` | Custom check callback contracts |\n| `SchemaDefinition` | Frozen portable schema definition |\n| `JsonSchema` | JSON Schema object shape |\n| `Messages` / `DeepPartial<T>` | Parse-context message overrides |\n| `SchemaWalker<R>` | Schema traversal visitor |\n",
|
|
6
|
-
"usage": "---\ntitle: Spell — Usage Guide\ndescription: Learn how to build schemas, compose wrappers, customize locales, and integrate spell with other Vielzeug packages.\n---\n\n[[toc]]\n\n## Basic Usage\n\nStart with `safeParse()` when you want explicit success and failure branches.\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst Signup = s.object({\n email: s.string().email(),\n password: s.string().min(12),\n referralCode: s.string().optional(),\n});\n\nconst result = Signup.safeParse({\n email: 'ada@example.com',\n password: 'horse-battery-staple',\n});\n\nif (!result.success) {\n console.error(result.error.issues);\n} else {\n console.log(result.data.email);\n}\n```\n\nUse `parse()` when invalid input should throw immediately. Use `safeParse()` when invalid input is part of normal control flow.\n\n## Building Schemas\n\nUse the namespace form when readability matters more than bundle trimming.\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst Article = s.object({\n id: s.string().uuid(),\n title: s.string().trim().min(1).max(120),\n slug: s.string().slug(),\n tags: s.array(s.string().min(1)).default(() => []),\n meta: s\n .object({\n published: s.boolean(),\n publishedAt: s.date().nullable(),\n })\n .relaxed(),\n});\n```\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst Todo = s.object({\n done: s.boolean(),\n tags: s.array(s.string().min(1)).default(() => []),\n title: s.string().min(1),\n});\n```\n\nObject schemas reject unknown keys by default. Call `.relaxed()` when you need to preserve extra properties.\n\nCall `.defaults()` to get a fully default-filled object without providing any input. Every required field must have a `.default()` set, or a `SpellValidationError` is thrown. Call `.partialDefaults()` when only some fields have defaults — fields without a default are silently omitted instead of throwing.\n\n```ts\nconst Config = s.object({\n host: s.string().default('localhost'),\n port: s.number().default(3000),\n});\n\nConfig.defaults(); // { host: 'localhost', port: 3000 }\n\nconst Form = s.object({ name: s.string(), role: s.string().default('viewer') });\nForm.partialDefaults(); // { role: 'viewer' }\n```\n\n## Wrapper Modes, Defaults, and Fallbacks\n\nChain wrappers to describe missing values and recovery rules without losing schema metadata.\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst DisplayName = s.string().trim().min(2).label('Display name').optional().default('Guest').nullable();\n\nDisplayName.parse(undefined); // 'Guest'\nDisplayName.parse(null); // null\nDisplayName.description; // 'Display name'\n```\n\nCall `.required()` to remove `undefined` without removing `null`.\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst NullableButRequired = s.string().optional().nullable().required();\n\nNullableButRequired.parse('Ada');\nNullableButRequired.parse(null);\n// NullableButRequired.parse(undefined); // throws\n```\n\nUse `.catch()` when you want a fallback output after validation fails.\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst Port = s.number().int().min(1).max(65535).catch(3000);\n\nPort.parse('not-a-number'); // 3000\n```\n\n## Custom Validation\n\nUse `check()` for synchronous domain rules and `checkAsync()` for asynchronous rules. Sync parsing rejects schemas with asynchronous checks.\n\n```ts\nimport { s } from '@vielzeug/spell';\n\n// Boolean shorthand: return false to fail with default message\nconst EvenNumber = s.number().check((n) => n % 2 === 0);\n\n// String shorthand: return the message as a string\nconst Username = s\n .string()\n .min(3)\n .check((v) => !v.startsWith('_') || 'Cannot start with underscore');\n\n// Multiple issues via ctx.addIssue()\nconst Signup = s.object({ confirm: s.string(), password: s.string() }).check((v, ctx) => {\n if (v.password !== v.confirm) {\n ctx.addIssue({ code: 'custom', message: 'Passwords must match', path: ['confirm'] });\n }\n});\n```\n\n`checkAsync()` returns an async-only schema: TypeScript exposes `parseAsync()` and `safeParseAsync()` but not `parse()` or `safeParse()`. This mode survives fluent modifiers and propagates through nested arrays, objects, unions, intersections, tuples, maps, records, sets, lazy schemas, pipelines, and `s.discriminatedUnion(...)` branches. Sync parsing also fails at runtime instead of accepting an unchecked value.\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst takenEmails = new Set(['ada@example.com']);\n\nconst AccountEmail = s\n .string()\n .email()\n .checkAsync(async (value, ctx) => {\n if (takenEmails.has(value)) {\n ctx.addIssue({ code: 'custom', message: 'Email is already taken', path: [] });\n }\n });\n\n// Async checks require parseAsync\nawait AccountEmail.parseAsync('grace@example.com');\n```\n\nUse `check()` for predicate-only rules too. Return `true` on success or message on failure.\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst PositivePrice = s.number().check((value) => value > 0 || 'Must be positive');\nPositivePrice.parse(9.99);\n```\n\n## Strings, Numbers, and Safe Regex Usage\n\nUse schema helpers for common string and number constraints instead of hand-written predicates.\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst Password = s.string().min(12).regex(/[A-Z]/).regex(/[0-9]/);\nconst Price = s.number().nonNegative().multipleOf(0.01);\nconst LaunchWindow = s.date().min(new Date('2025-01-01T00:00:00.000Z'));\n```\n\nSpell strips stateful `/g` and `/y` flags from `regex()` patterns before validation. Repeated parses stay deterministic even when the original regular expression is reused.\n\n## Coercion and Transforms\n\nUse coercion when input arrives as strings, query parameters, or form values.\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst Query = s.object({\n draft: s.coerce.boolean().default(false),\n limit: s.coerce.number().int().positive().default(20),\n publishedAt: s.coerce.date().nullable(),\n search: s.coerce.string().trim().min(1).optional(),\n});\n\nconst parsed = Query.parse({\n draft: 'true',\n limit: '50',\n publishedAt: '2025-04-01T12:00:00.000Z',\n search: ' vielzeug ',\n});\n```\n\nUse `transform()` or `pipe()` after validation when downstream code needs a different output shape.\n\n```ts\nimport { s } from '@vielzeug/spell';\n\nconst TrimmedTags = s.array(s.string().trim().min(1)).transform((tags) => tags.map((tag) => tag.toLowerCase()));\nconst Slug = s.string().trim().min(1).pipe(s.string().slug());\n```\n\n## Introspection, Round-Trips, and JSON Schema\n\nUse declarative definitions when schemas need to cross process boundaries or feed tooling.\n\n```ts\nimport { s } from '@vielzeug/spell';\nimport { fromDefinition } from '@vielzeug/spell/json';\n\nconst Product = s\n .object({\n id: s.string().uuid(),\n name: s.string().min(1),\n price: s.number().positive().multipleOf(0.01),\n })\n .label('Product');\n\nconst definition = Product.definition();\nconst jsonSchema = fromDefinition(definition);\n\nProduct.parse({ id: '550e8400-e29b-41d4-a716-446655440000', name: 'Keyboard', price: 129.99 });\nconsole.log(jsonSchema.title);\n```\n\nDefinitions are frozen serializable snapshots of declarative schema structure. Use `definition()` and `fromDefinition()` for external tooling. Schemas with runtime checks, transforms, defaults, catches, or preprocessors intentionally have no definition.\n\n## Messages\n\nSpell has no mutable process-wide configuration. Build one parse context per request, locale, or form, then pass it explicitly.\n\n```ts\nimport { diagnostics, s } from '@vielzeug/spell';\n\nconst User = s.object({ email: s.string().email() });\nconst german = diagnostics.createParseContext({\n object: { invalidKeys: () => 'Keine unbekannten Felder erlaubt' },\n});\n\nUser.safeParse({ email: 'ada@example.com', extra: true }, german);\n```\n\nInternal development warnings always use `console.warn` in development builds. Route application diagnostics in application code instead of mutating library-wide logger state.\n\n## Working with Validation Errors\n\nUse `SpellValidationError` helpers when you need UI-ready error structures.\n\n```ts\nimport { s, SpellValidationError } from '@vielzeug/spell';\n\nconst User = s.object({\n email: s.string().email(),\n profile: s.object({\n name: s.string().min(2),\n }),\n});\n\nconst result = User.safeParse({ email: 'nope', profile: { name: '' } });\n\nif (!result.success && result.error instanceof SpellValidationError) {\n const profileErrors = result.error.messagesAt('profile', 'name');\n console.log(profileErrors);\n}\n```\n\nUse `bestMatch()` on a union failure when you want the branch that came closest to succeeding. Pass a specific `invalid_union` issue when one validation produced multiple union failures.\n\n## Schema Traversal with walk()\n\nUse `walk()` to inspect or transform a schema tree without importing internal implementation classes.\n\n```ts\nimport { s, type SchemaWalker } from '@vielzeug/spell';\n\nconst fields: string[] = [];\n\nconst collectFields: SchemaWalker<void> = {\n object(schema) {\n for (const [key, child] of Object.entries(schema.shape)) {\n fields.push(key);\n child.walk(collectFields);\n }\n },\n unknown() {},\n};\n\nconst User = s.object({\n email: s.string().email(),\n profile: s.object({ name: s.string() }),\n});\n\nUser.walk(collectFields);\nconsole.log(fields); // ['email', 'profile', 'name']\n```\n\n`walk()` dispatches by `schema.kind`. If no handler matches and no `unknown` fallback is provided, `walk()` returns `null`. Add an `unknown` handler to capture any kind not explicitly listed in your visitor.\n\n## Framework Integration\n\nSpell works anywhere you can call a function before state enters your app.\n\n::: code-group\n\n```tsx [React]\nimport { s } from '@vielzeug/spell';\n\nconst SearchParams = s\n .object({\n page: s.coerce.number().int().positive().default(1),\n q: s.string().trim().optional(),\n })\n .relaxed();\n\nexport function SearchPage({ rawParams }: { rawParams: unknown }) {\n const params = SearchParams.parse(rawParams);\n\n return (\n <div>\n {params.q ?? 'All results'} — page {params.page}\n </div>\n );\n}\n```\n\n```ts [Vue]\nimport { computed, ref } from 'vue';\nimport { s } from '@vielzeug/spell';\n\nconst Settings = s.object({\n locale: s.string().min(2),\n compact: s.coerce.boolean().default(false),\n});\n\nconst raw = ref<unknown>({ locale: 'en', compact: 'true' });\nconst settings = computed(() => Settings.parse(raw.value));\n```\n\n:::\n\nUse `safeParse()` at event boundaries and `parse()` inside trusted data flows.\n\n## Working with Other Vielzeug Libraries\n\nUse Spell as the validation layer and let other packages focus on transport, forms, or storage.\n\n```ts\nimport { createForm } from '@vielzeug/forge';\nimport { customValidator } from '@vielzeug/forge/spell';\nimport { createCourier } from '@vielzeug/courier';\nimport { s } from '@vielzeug/spell';\n\nconst Profile = s.object({\n displayName: s.string().min(2),\n newsletter: s.boolean(),\n});\n\nconst form = createForm({\n initialValues: {\n displayName: '',\n newsletter: false,\n },\n validate: customValidator(Profile),\n});\n\nconst courier = createCourier({ baseUrl: '/api' });\nconst profile = Profile.parse(await courier.get('/profile'));\n```\n\nUse Spell definitions with `@vielzeug/codex` or other tooling when you need generated docs or external schema consumers.\n\n## Best Practices\n\n- Keep schemas close to the boundary where unknown data enters your app.\n- Use `s` consistently for construction; use explicit `/json` and `/predicates` subpaths for tooling.\n- Use `.default(() => value)` for mutable defaults such as arrays, objects, `Map`, and `Set`.\n- Call `.required()` when you want to remove `undefined` but keep `null` semantics intact.\n- Use `check()` with a `ctx` argument when you need `ctx.addIssue()`; return a message for simple predicate failures.\n- Use `checkAsync()` and `parseAsync()` for every asynchronous domain rule.\n- Build a parse context per request or test; never rely on mutable process-wide configuration.\n- Use `definition()` with `fromDefinition()` from `@vielzeug/spell/json` for external tooling.\n",
|
|
7
|
-
"examples": "---\ntitle: Spell — Examples\ndescription: Practical examples and recipes for spell.\n---\n\n## Examples\n\n- [Validating API Payloads](./examples/api.md)\n- [Form-Safe Parsing](./examples/forms.md)\n- [Async Business Rules](./examples/async.md)\n- [Schema Introspection and Round-Trips](./examples/introspection.md)\n- [Unions, Intersections, and Variants](./examples/unions.md)\n- [Schema Traversal with walk()](./examples/walk.md)\n"
|
|
8
|
-
},
|
|
9
|
-
"examples": [
|
|
10
|
-
{
|
|
11
|
-
"id": "array-validation",
|
|
12
|
-
"code": "// Validate a product tag list before it hits search filters.\nimport { s } from '@vielzeug/spell'\n\nconst ProductTags = s.array(s.string().trim().min(2)).min(1).max(4).unique()\n\nconsole.log('Valid tags:', ProductTags.safeParse(['ui', 'forms', 'docs']).success)\n\nconst invalid = ProductTags.safeParse(['ui', 'ui', 'x', 'search', 'extra'])\nconsole.log('Invalid tags:', invalid.success)\n\nif (!invalid.success) {\n console.log('Issues:', invalid.error.issues.map((issue) => issue.message))\n}",
|
|
13
|
-
"name": "Array Validation"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"id": "async-validate",
|
|
17
|
-
"code": "// checkAsync() declares asynchronous domain rules.\n// Use safeParseAsync() or parseAsync() for schemas containing async checks.\nimport { s } from '@vielzeug/spell'\n\n// Simulated async check (e.g. database lookup)\nfunction isUsernameAvailable(name) {\n return new Promise(resolve => setTimeout(() => resolve(name !== 'taken'), 50))\n}\n\nconst UsernameSchema = s.string()\n .min(3)\n .checkAsync(async (name) => {\n const available = await isUsernameAvailable(name)\n return available || 'Username is already taken'\n })\n\n// Async checks require safeParseAsync() or parseAsync()\nconst ok = await UsernameSchema.safeParseAsync('alice')\nconsole.log('alice:', ok.success ? 'available' : ok.error.issues[0].message)\n\nconst fail = await UsernameSchema.safeParseAsync('taken')\nconsole.log('taken:', fail.success ? 'available' : fail.error.issues[0].message)\n\nconst tooShort = await UsernameSchema.safeParseAsync('ab')\nconsole.log('ab:', tooShort.success ? 'available' : tooShort.error.issues[0].message)",
|
|
18
|
-
"name": "Async Validation"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"id": "basic-parsing",
|
|
22
|
-
"code": "// Schema definition, type inference, and safe parsing\nimport { s } from '@vielzeug/spell'\n\nconst Product = s.object({\n id: s.string().uuid(),\n name: s.string().min(1).max(120),\n price: s.number().positive().multipleOf(0.01),\n tags: s.array(s.string().min(1)).default(() => []),\n})\n\n// Infer the TypeScript type directly from the schema\n// type Product = { id: string; name: string; price: number; tags: string[] }\n\n// parse() throws on failure — use when invalid input is a programmer error\nconst product = Product.parse({\n id: '550e8400-e29b-41d4-a716-446655440000',\n name: 'Mechanical Keyboard',\n price: 129.99,\n})\nconsole.log('Parsed:', product.name, '— tags:', product.tags)\n\n// safeParse() returns a tagged result union — use at untrusted boundaries\nconst bad = Product.safeParse({ id: 'not-a-uuid', name: '', price: -5 })\nif (!bad.success) {\n const paths = bad.error.issues.map(i => i.path.join('.') || 'root')\n console.log('Validation failed at:', paths.join(', '))\n}",
|
|
23
|
-
"name": "Basic Parsing"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"id": "basic-schema",
|
|
27
|
-
"code": "// Validate a signup payload before it enters application state.\nimport { s } from '@vielzeug/spell'\n\nconst Signup = s.object({\n email: s.string().email(),\n password: s.string().min(12),\n referralCode: s.string().optional(),\n})\n\nconsole.log('Accepted:', Signup.parse({\n email: 'ada@example.com',\n password: 'horse-battery-staple',\n}))\n\nconst invalid = Signup.safeParse({\n email: 'not-an-email',\n password: 'short',\n})\n\nif (!invalid.success) {\n console.log('Email errors:', invalid.error.messagesAt('email'))\n console.log('Password errors:', invalid.error.messagesAt('password'))\n}",
|
|
28
|
-
"name": "Basic Schema Validation"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"id": "coercion",
|
|
32
|
-
"code": "// Coerce query params into typed search options with safe defaults.\nimport { s } from '@vielzeug/spell'\n\nconst SearchQuery = s.object({\n draft: s.coerce.boolean().default(false),\n limit: s.coerce.number().int().positive().default(20),\n page: s.coerce.number().int().positive().default(1),\n q: s.coerce.string().trim().min(1).optional(),\n})\n\nconst parsed = SearchQuery.parse({\n draft: 'true',\n limit: '50',\n page: '2',\n q: ' vielzeug ',\n})\n\nconsole.log(parsed)\nconsole.log('limit type:', typeof parsed.limit)",
|
|
33
|
-
"name": "Type Coercion"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"id": "descriptor-roundtrip",
|
|
37
|
-
"code": "import { s } from '@vielzeug/spell'\nimport { fromDefinition } from '@vielzeug/spell/json'\n\nconst Product = s.object({\n id: s.string().uuid(),\n name: s.string().min(1),\n price: s.number().positive(),\n})\n\nconst definition = Product.definition()\nconst jsonSchema = fromDefinition(definition)\n\nconsole.log(definition.kind)\nconsole.log(jsonSchema)",
|
|
38
|
-
"name": "Declarative Definition Export"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"id": "discriminated-union",
|
|
42
|
-
"code": "// s.discriminatedUnion() validates a discriminated union — objects sharing a common tag field.\n// Spell automatically injects the discriminator literal into each branch.\nimport { s } from '@vielzeug/spell'\n\nconst Event = s.discriminatedUnion('type', {\n click: s.object({ x: s.number(), y: s.number() }),\n keydown: s.object({ key: s.string(), repeat: s.boolean() }),\n resize: s.object({ width: s.number(), height: s.number() }),\n})\n\nconst click = Event.parse({ type: 'click', x: 100, y: 200 })\nconsole.log('click:', click)\n\nconst key = Event.parse({ type: 'keydown', key: 'Enter', repeat: false })\nconsole.log('keydown:', key)\n\n// Wrong discriminator value\nconst bad = Event.safeParse({ type: 'unknown', x: 0 })\nconsole.log('unknown type:', bad.success ? 'ok' : bad.error.issues[0].message)\n\n// Missing required field in matched branch\nconst missingField = Event.safeParse({ type: 'resize', width: 800 })\nconsole.log('missing height:', missingField.success ? 'ok' : missingField.error.issues[0].message)",
|
|
43
|
-
"name": "Discriminated Union"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"id": "format-validators",
|
|
47
|
-
"code": "import { s } from '@vielzeug/spell'\nimport { isEmail, isUuid } from '@vielzeug/spell/predicates'\n\nconsole.log(isEmail('ada@example.com'))\nconsole.log(isEmail('not-an-email'))\nconsole.log(isUuid('550e8400-e29b-41d4-a716-446655440000'))\nconsole.log(isUuid('short'))\n\nconst UserId = s.string().uuid()\nconsole.log(UserId.safeParse('550e8400-e29b-41d4-a716-446655440000').success)",
|
|
48
|
-
"name": "Format Predicates"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"id": "messages-override",
|
|
52
|
-
"code": "import { diagnostics, s } from '@vielzeug/spell'\n\nconst context = diagnostics.createParseContext({\n object: { invalidKeys: () => 'Use only supported fields' },\n})\n\nconsole.log(s.object({ email: s.string().email() }).safeParse({ email: 'ada@example.com', extra: true }, context).success)",
|
|
53
|
-
"name": "Request-local messages"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"id": "nested-objects",
|
|
57
|
-
"code": "// Model an API response with a discriminator instead of a loose union.\nimport { s } from '@vielzeug/spell'\n\nconst SearchResponse = s.discriminatedUnion('status', {\n error: s.object({\n message: s.string().min(1),\n status: s.literal('error'),\n }),\n success: s.object({\n results: s.array(s.object({ id: s.string().uuid(), title: s.string().min(1) })).default(() => []),\n status: s.literal('success'),\n }),\n})\n\nconsole.log('Success branch:', SearchResponse.parse({\n status: 'success',\n results: [{ id: '550e8400-e29b-41d4-a716-446655440000', title: 'Spell docs' }],\n}))\n\nconst invalid = SearchResponse.safeParse({ status: 'success', message: 'no results here' })\nconsole.log('Invalid branch accepted:', invalid.success)",
|
|
58
|
-
"name": "Variant Responses"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"id": "number-validation",
|
|
62
|
-
"code": "// Enforce money-like numeric constraints for a checkout amount.\nimport { s } from '@vielzeug/spell'\n\nconst CheckoutTotal = s.number().nonNegative().multipleOf(0.01).max(9999)\n\nfor (const value of [129.99, -4, 19.999, 15000]) {\n const result = CheckoutTotal.safeParse(value)\n console.log(value, '=>', result.success ? 'accepted' : result.error.issues[0].message)\n}",
|
|
63
|
-
"name": "Number Validation"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"id": "object-defaults",
|
|
67
|
-
"code": "import { s } from '@vielzeug/spell';\n\n// Schema where all fields have defaults\nconst ServerConfig = s.object({\n host: s.string().default('localhost'),\n port: s.number().int().positive().default(3000),\n tls: s.boolean().default(false),\n});\n\n// Get a fully filled config without providing any input\nconst config = ServerConfig.defaults();\nconsole.log(config);\n// { host: 'localhost', port: 3000, tls: false }\n\n// Works with nested schemas too\nconst AppConfig = s.object({\n server: ServerConfig,\n debug: s.boolean().default(false),\n});\n\n// Parse with partial input — missing fields use their defaults\nconst parsed = AppConfig.parse({ server: { host: 'prod.example.com', port: 443, tls: true }, debug: true });\nconsole.log(parsed.server.host); // 'prod.example.com'\n\n// Schema with required field (no default) — throws if .defaults() called\nconst Strict = s.object({ name: s.string() });\nconst result = Strict.safeParse({});\nconsole.log(result.success); // false — name is required\n",
|
|
68
|
-
"name": "Object Defaults"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"id": "object-merge",
|
|
72
|
-
"code": "import { s } from '@vielzeug/spell';\n\n// merge() combines two object schemas (right-hand fields win on conflict)\nconst Base = s.object({\n id: s.string().uuid(),\n createdAt: s.date(),\n});\n\nconst WithMeta = s.object({\n description: s.string().optional(),\n tags: s.array(s.string()).default(() => []),\n});\n\nconst Resource = Base.merge(WithMeta);\n\nconst result = Resource.parse({\n createdAt: new Date('2025-01-01'),\n id: '550e8400-e29b-41d4-a716-446655440000',\n tags: ['api', 'v2'],\n});\nconsole.log(result.tags); // ['api', 'v2']\nconsole.log(result.id); // '550e8400-...'\n\n// merge() inherits the right-hand schema's strict/relaxed mode\nconst Strict = s.object({ a: s.string() });\nconst Relaxed = s.object({ b: s.number() }).relaxed();\n\nconst Merged = Strict.merge(Relaxed);\n// Extra keys are allowed because Relaxed is the right-hand schema\nconsole.log(Merged.safeParse({ a: 'hi', b: 1, extra: true }).success); // true\n\nconst IdOrSlug = s.union(s.string().uuid(), s.string().slug());\nconsole.log(IdOrSlug.safeParse('550e8400-e29b-41d4-a716-446655440000').success); // true\nconsole.log(IdOrSlug.safeParse('my-slug').success); // true\nconsole.log(IdOrSlug.safeParse(42).success); // false\n\nconst NonEmptyString = s.intersect(s.string(), s.string().min(1));\nconsole.log(NonEmptyString.parse('hello')); // 'hello'\n",
|
|
73
|
-
"name": "Object Merge & Aliases"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"id": "optional-nullable",
|
|
77
|
-
"code": "// Preserve defaults and validators while tightening undefined away with required().\nimport { s } from '@vielzeug/spell'\n\nconst DisplayName = s.string().trim().min(2).optional().default('Guest').nullable()\nconst RequiredDisplayName = DisplayName.required()\n\nconsole.log('default for undefined:', DisplayName.parse(undefined))\nconsole.log('null stays null:', DisplayName.parse(null))\n\nconst short = RequiredDisplayName.safeParse('A')\nconsole.log('short name accepted:', short.success)\n\nconst missing = RequiredDisplayName.safeParse(undefined)\nconsole.log('undefined accepted after required():', missing.success)\n\nconsole.log('null accepted after required():', RequiredDisplayName.parse(null))",
|
|
78
|
-
"name": "Optional and Nullable Fields"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"id": "refinements",
|
|
82
|
-
"code": "// check() and checkAsync() — explicit custom domain rules\nimport { s } from '@vielzeug/spell'\n\nconst reserved = new Set(['admin', 'root'])\n\n// check() is synchronous; return a string to fail with that message\nconst Username = s.string().min(3).check((value) =>\n !reserved.has(value) || value + ' is reserved'\n)\n\n// check() receives context for multiple issues or custom error codes\nconst Signup = s.object({ password: s.string().min(8), confirm: s.string() })\n .check((v, ctx) => {\n if (v.password !== v.confirm)\n ctx.addIssue({ code: 'custom', message: 'Passwords must match', path: ['confirm'] })\n })\n\n// check() also covers predicate-only domain rules\nconst EvenPort = s.number().int().min(1).max(65535)\n .check((n) => n % 2 === 0 || 'Port must be even')\n\nfor (const name of ['ad', 'admin', 'grace']) {\n const r = Username.safeParse(name)\n console.log(name, '->', r.success ? 'ok' : r.error.issues[0].message)\n}\n\nconst signupResult = Signup.safeParse({ password: 'secure123', confirm: 'different' })\nconsole.log('signup:', signupResult.success ? 'ok' : signupResult.error.issues[0].message)\n\nfor (const port of [8080, 3001, 443]) {\n const r = EvenPort.safeParse(port)\n console.log('port', port, '->', r.success ? 'ok' : r.error.issues[0].message)\n}",
|
|
83
|
-
"name": "Custom Validation"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"id": "schema-walk",
|
|
87
|
-
"code": "// Traverse a schema tree with walk() to extract field metadata.\nimport { s } from '@vielzeug/spell'\n\nconst Order = s.object({\n id: s.string().uuid(),\n amount: s.number().positive(),\n customer: s.object({\n email: s.string().email(),\n name: s.string().min(1),\n }),\n tags: s.array(s.string()).optional(),\n})\n\n// Collect every field name and whether it is optional.\nconst fields: { name: string; required: boolean }[] = []\n\nOrder.walk({\n object(node) {\n for (const [key, child] of Object.entries(node.shape)) {\n fields.push({ name: key, required: !child.isOptional })\n child.walk(this)\n }\n },\n // unknown() catches any kind without a handler; omitting it returns null instead of throwing\n unknown() {},\n})\n\nconsole.log('Fields:')\nfields.forEach(f => console.log(' ', f.name, f.required ? '(required)' : '(optional)'))\nconsole.log('Total:', fields.length)",
|
|
88
|
-
"name": "Schema Traversal"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"id": "string-validation",
|
|
92
|
-
"code": "// Reuse one stateful regex safely across repeated parses in the browser REPL.\nimport { s } from '@vielzeug/spell'\n\nconst HexColor = s.string().regex(/#[0-9a-f]{6}/gy)\n\nfor (const value of ['#ff8800', '#ff8800', 'oops']) {\n const result = HexColor.safeParse(value)\n console.log(value, '=>', result.success)\n}",
|
|
93
|
-
"name": "String Validation"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"id": "wrappers-and-defaults",
|
|
97
|
-
"code": "// optional(), nullable(), default(), catch() — missing-value semantics\nimport { s } from '@vielzeug/spell'\n\n// optional: accepts undefined, passes through validation otherwise\nconst Nickname = s.string().min(2).optional().default('Guest')\n\nconsole.log(Nickname.parse(undefined)) // 'Guest'\nconsole.log(Nickname.parse('Ada')) // 'Ada'\n\n// nullable: accepts null explicitly\nconst Bio = s.string().max(200).nullable()\n\nconsole.log(Bio.parse(null)) // null\nconsole.log(Bio.parse('Loves types')) // 'Loves types'\n\n// nullish: accepts both null and undefined\nconst Avatar = s.string().url().nullish()\n\nconsole.log(Avatar.parse(null)) // null\nconsole.log(Avatar.parse(undefined)) // undefined\n\n// required(): strips undefined without removing null\nconst NullableButRequired = s.string().optional().nullable().required()\nconsole.log(NullableButRequired.parse(null)) // null\nconsole.log(NullableButRequired.safeParse(undefined).success) // false\n\n// catch(): returns a fallback when validation fails — never throws\nconst Port = s.number().int().min(1).max(65535).catch(3000)\nconsole.log(Port.parse(8080)) // 8080\nconsole.log(Port.parse('not-a-port')) // 3000",
|
|
98
|
-
"name": "Wrappers & Defaults"
|
|
99
|
-
}
|
|
100
|
-
],
|
|
101
|
-
"typeSignatures": {
|
|
102
|
-
"AnySchema": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
103
|
-
"CheckContext": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
104
|
-
"FlatError": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
105
|
-
"FlatErrorFirst": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
106
|
-
"Infer": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
107
|
-
"InferInput": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
108
|
-
"InferOutput": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
109
|
-
"InferSchemaMode": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
110
|
-
"Issue": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
111
|
-
"JsonSchema": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
112
|
-
"MergeSchemaModes": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
113
|
-
"MessageFn": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
114
|
-
"Messages": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
115
|
-
"ParseContext": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
116
|
-
"ParseResult": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
117
|
-
"SchemaDefinition": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
118
|
-
"SchemaDescriptor": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
119
|
-
"SchemaMode": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
120
|
-
"SchemaWalker": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
121
|
-
"ValidateFn": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
122
|
-
"ValidateResult": "export type {\n AnySchema,\n CheckContext,\n FlatError,\n FlatErrorFirst,\n Infer,\n InferInput,\n InferOutput,\n InferSchemaMode,\n Issue,\n JsonSchema,\n MergeSchemaModes,\n MessageFn,\n Messages,\n ParseContext,\n ParseResult,\n SchemaDefinition,\n SchemaDescriptor,\n SchemaMode,\n SchemaWalker,\n ValidateFn,\n ValidateResult,\n} from './core';",
|
|
123
|
-
"ErrorCode": "export {\n ErrorCode,\n PipeSchema,\n Schema,\n SpellDefinitionError,\n SpellError,\n SpellValidationError,\n schemaMode,\n} from './core';",
|
|
124
|
-
"PipeSchema": "export {\n ErrorCode,\n PipeSchema,\n Schema,\n SpellDefinitionError,\n SpellError,\n SpellValidationError,\n schemaMode,\n} from './core';",
|
|
125
|
-
"Schema": "export {\n ErrorCode,\n PipeSchema,\n Schema,\n SpellDefinitionError,\n SpellError,\n SpellValidationError,\n schemaMode,\n} from './core';",
|
|
126
|
-
"SpellDefinitionError": "export {\n ErrorCode,\n PipeSchema,\n Schema,\n SpellDefinitionError,\n SpellError,\n SpellValidationError,\n schemaMode,\n} from './core';",
|
|
127
|
-
"SpellError": "export {\n ErrorCode,\n PipeSchema,\n Schema,\n SpellDefinitionError,\n SpellError,\n SpellValidationError,\n schemaMode,\n} from './core';",
|
|
128
|
-
"SpellValidationError": "export {\n ErrorCode,\n PipeSchema,\n Schema,\n SpellDefinitionError,\n SpellError,\n SpellValidationError,\n schemaMode,\n} from './core';",
|
|
129
|
-
"schemaMode": "export {\n ErrorCode,\n PipeSchema,\n Schema,\n SpellDefinitionError,\n SpellError,\n SpellValidationError,\n schemaMode,\n} from './core';",
|
|
130
|
-
"DeepPartial": "export type { DeepPartial } from './messages';",
|
|
131
|
-
"s": "export { s } from './s';",
|
|
132
|
-
"diagnostics": "export const diagnostics = {\n createParseContext,\n fail,\n prependIssuePath,\n};"
|
|
133
|
-
}
|
|
134
|
-
}
|
package/data/packages/tempo.json
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"apiSource": "// Tempo keeps this re-export so all consumers share one Temporal implementation and version.\nexport { Temporal } from '@js-temporal/polyfill';\nexport { inTimeZone, toInstant } from './_convert';\nexport { endOf, startOf } from './boundary';\nexport { classifyExpiry, timeDiff } from './classify';\nexport { clamp, contains, isAfter, isBefore, isSame } from './compare';\nexport { difference, isValid, now, nowInstant, parse, shift } from './core';\nexport {\n TempoError,\n TempoInvalidInputError,\n TempoInvalidTzError,\n TempoMissingTzError,\n TempoUnsupportedInputError,\n} from './errors';\nexport {\n format,\n formatDuration,\n formatInstant,\n formatParts,\n formatRange,\n formatRangeParts,\n formatRelative,\n formatZoned,\n humanize,\n parseDuration,\n} from './format';\nexport { dateRange, recurrence } from './range';\nexport type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';\n",
|
|
3
|
-
"docs": {
|
|
4
|
-
"index": "---\ntitle: Tempo — Temporal date and time utilities\ndescription: Explicit Temporal parsing, timezone-safe arithmetic, and localized date/time formatting for TypeScript.\npackage: tempo\ncategory: time\nkeywords: [temporal, date-time, timezone, formatting, arithmetic, dst, intl]\nrelated: [rune, vault]\nexports: [Temporal, parse, now, nowInstant, isValid, toInstant, inTimeZone, shift, difference, contains, clamp, isBefore, isAfter, isSame, startOf, endOf, format, formatParts, formatRange, formatRangeParts, formatInstant, formatZoned, formatRelative, parseDuration, formatDuration, classifyExpiry, timeDiff, humanize, dateRange, recurrence, TempoError, TempoInvalidInputError, TempoInvalidTzError, TempoMissingTzError, TempoUnsupportedInputError]\nenvironments: [browser, node, ssr, deno]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"tempo\" />\n\n## Why Tempo?\n\nDate/time bugs come from treating an instant and a wall-clock value as interchangeable. Tempo requires an explicit parse target and requires `timeZone` whenever a wall-clock value becomes an instant.\n\n```ts\n// Before\nconst reminder = new Date(meeting.getTime() - 15 * 60_000);\n\n// After\nimport { parse, shift, toInstant } from '@vielzeug/tempo';\n\nconst localMeeting = parse('2026-03-21T10:30:00', { as: 'plainDateTime' });\nconst meeting = toInstant(localMeeting, { timeZone: 'America/New_York' });\nconst reminder = shift(meeting, { minutes: -15 }, { timeZone: 'America/New_York' });\n```\n\n| Feature | Tempo | date-fns | Native Date |\n| --- | --- | --- | --- |\n| Bundle size | <PackageInfo package=\"tempo\" type=\"size\" /> | ~10 kB | 0 kB |\n| Zero dependencies | <ore-icon name=\"x\" size=\"16\"></ore-icon> `@js-temporal/polyfill` | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"check\" size=\"16\"></ore-icon> |\n| Explicit wall-time conversion | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Manual | <ore-icon name=\"x\" size=\"16\"></ore-icon> |\n| DST-safe arithmetic | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Manual | Manual |\n| Localized formatting | <ore-icon name=\"check\" size=\"16\"></ore-icon> `Intl` | <ore-icon name=\"check\" size=\"16\"></ore-icon> | <ore-icon name=\"check\" size=\"16\"></ore-icon> |\n\n<div class=\"decision-callout\">\n\n**Use Tempo when** you need Temporal values, explicit timezone rules, and DST-safe operations.\n\n**Consider native `Date` when** your data is only elapsed milliseconds and you do not need calendar or timezone behavior.\n\n</div>\n\n## Installation\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/tempo\n```\n\n```sh [npm]\nnpm install @vielzeug/tempo\n```\n\n```sh [yarn]\nyarn add @vielzeug/tempo\n```\n\n:::\n\n## Quick Start\n\nParse a wall-clock input explicitly, attach its timezone, then format it for a user.\n\n```ts\nimport { format, inTimeZone, parse, shift, toInstant } from '@vielzeug/tempo';\n\nconst localMeeting = parse('2026-03-21T10:30:00', { as: 'plainDateTime' });\nconst meeting = toInstant(localMeeting, { timeZone: 'America/New_York' });\nconst reminder = shift(meeting, { minutes: -15 }, { timeZone: 'America/New_York' });\nconst text = format(inTimeZone(reminder, 'America/New_York'), {\n locale: 'en-US',\n pattern: 'short',\n});\n```\n\n## Features\n\n<div class=\"features-grid\">\n\n- `parse()` — Requires an explicit ISO target: instant, zoned date-time, plain date-time, or plain date.\n- `toInstant()` / `inTimeZone()` — Convert wall-clock and absolute values with explicit timezone semantics.\n- `shift()` / `difference()` — Perform DST-safe arithmetic and duration calculation.\n- `contains()` / `clamp()` — Use named range fields instead of ambiguous positional inputs.\n- `classifyExpiry()` — Classify fixed elapsed-time thresholds in milliseconds or larger units without month or year approximation.\n- `format()` / `formatRelative()` / `formatDuration()` — Render UI, relative, and duration values through `Intl`.\n- `dateRange()` / `recurrence()` — Lazily generate zoned calendar sequences.\n\n</div>\n\n## Documentation\n\n<div class=\"doc-links\">\n\n- [Usage Guide](./usage.md)\n- [API Reference](./api.md)\n- [Examples](./examples.md)\n- [Migration Guide](./migration.md)\n\n</div>\n\n## See Also\n\n<div class=\"see-also\">\n\n- [Rune](/rune/) — format stable Temporal timestamps before writing structured log records.\n- [Vault](/vault/) — derive explicit expiry moments before storing records with TTL policies.\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
|
|
5
|
-
"api": "---\ntitle: Tempo — API Reference\ndescription: Reference for Tempo Temporal parsing, conversion, arithmetic, formatting, and classification APIs.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution mode | Common gotcha |\n| --- | --- | --- | --- |\n| `parse()` | Parse ISO text to an explicit Temporal kind | Sync | `as` is required |\n| `isValid()` | Narrow an unknown runtime value to `TimeInput` | Sync | Does not parse strings |\n| `toInstant()` | Resolve a value as an absolute instant | Sync | Plain values require `timeZone` |\n| `inTimeZone()` | Project a value to a zone | Sync | Preserves instant, changes wall-clock fields |\n| `shift()` / `difference()` | DST-safe arithmetic | Sync | Calendar work needs a timezone |\n| `contains()` / `clamp()` | Named range operations | Sync | Bounds normalize automatically |\n| `classifyExpiry()` | Classify fixed elapsed-time thresholds | Sync | Use milliseconds or larger units; months and years are rejected |\n| `format()` family | Localized and machine formatting | Sync | Use `timeZone`, not `tz` |\n| `dateRange()` / `recurrence()` | Lazy zoned sequences | Sync | Plain inputs need `timeZone` |\n\n## Package Entry Point\n\n| Import | Purpose |\n| --- | --- |\n| `@vielzeug/tempo` | Tempo utilities, errors, types, and shared `Temporal` namespace |\n\n## Core Functions\n\n### `parse(input, { as })`\n\n```ts\nparse(input: string, options: { as: 'instant' }): Temporal.Instant;\nparse(input: string, options: { as: 'zonedDateTime' }): Temporal.ZonedDateTime;\nparse(input: string, options: { as: 'plainDateTime' }): Temporal.PlainDateTime;\nparse(input: string, options: { as: 'plainDate' }): Temporal.PlainDate;\n```\n\nParses an ISO 8601 string as the requested temporal kind.\n\n**Parameters**\n\n| Parameter | Type | Description |\n| --- | --- | --- |\n| `input` | `string` | ISO 8601 input |\n| `options.as` | `ParseAs` | Required result kind |\n\n**Returns:** Requested Temporal value.\n\n**Example:**\n\n```ts\nimport { parse } from '@vielzeug/tempo';\n\nconst instant = parse('2026-03-21T10:15:30Z', { as: 'instant' });\n```\n\n---\n\n### `isValid(value)`\n\n```ts\nisValid(value: unknown): value is TimeInput;\n```\n\nReturns whether `value` is a Tempo-supported Temporal value. It does not parse ISO strings.\n\n**Example:**\n\n```ts\nimport { isValid, parse } from '@vielzeug/tempo';\n\nconst value: unknown = parse('2026-03-21T10:15:30Z', { as: 'instant' });\nconst valid = isValid(value); // true\n```\n\n---\n\n### `now({ timeZone })` / `nowInstant()`\n\n```ts\nnow(options: { timeZone: string }): Temporal.ZonedDateTime;\nnowInstant(): Temporal.Instant;\n```\n\nReturns current zoned or absolute time.\n\n**Example:**\n\n```ts\nimport { now, nowInstant } from '@vielzeug/tempo';\n\nnow({ timeZone: 'Europe/Berlin' });\nnowInstant();\n```\n\n---\n\n### `toInstant(input, options?)` / `inTimeZone(input, timeZone)`\n\n```ts\ntoInstant(input: AbsoluteTime): Temporal.Instant;\ntoInstant(input: WallTime, options: { timeZone: string; disambiguation?: Disambiguation }): Temporal.Instant;\ninTimeZone(input: TimeInput, timeZone: string): Temporal.ZonedDateTime;\n```\n\n`toInstant()` resolves wall-clock values. `inTimeZone()` projects a value into a requested timezone.\n\n**Example:**\n\n```ts\nimport { inTimeZone, parse, toInstant } from '@vielzeug/tempo';\n\nconst local = parse('2026-11-01T01:30:00', { as: 'plainDateTime' });\nconst instant = toInstant(local, { disambiguation: 'later', timeZone: 'America/New_York' });\ninTimeZone(instant, 'Europe/Berlin');\n```\n\n---\n\n### `shift(input, duration, options?)`\n\n```ts\nshift(input: TimeInput, duration: Temporal.DurationLike, options?: ShiftOptions): Temporal.ZonedDateTime;\n```\n\nAdds a duration through Temporal calendar rules and returns a zoned value.\n\n**Returns:** `Temporal.ZonedDateTime`.\n\n**Example:**\n\n```ts\nimport { parse, shift } from '@vielzeug/tempo';\n\nconst before = parse('2026-03-08T01:30:00-05:00[America/New_York]', { as: 'zonedDateTime' });\nshift(before, { hours: 1 });\n```\n\n---\n\n### `difference({ start, end, ...options })`\n\n```ts\ndifference(input: DifferenceInput): Temporal.Duration;\n```\n\nReturns duration from `start` to `end`.\n\n**Example:**\n\n```ts\nimport { difference, parse } from '@vielzeug/tempo';\n\nconst start = parse('2026-03-21T10:00:00Z', { as: 'instant' });\nconst end = parse('2026-03-21T12:00:00Z', { as: 'instant' });\ndifference({ end, largestUnit: 'hour', start });\n```\n\n## Range and Comparison\n\n### `contains({ value, start, end, ...options })`\n\n```ts\ncontains(input: ContainsInput): boolean;\n```\n\nReturns whether `value` lies in inclusive normalized bounds.\n\n### `clamp({ value, start, end, ...options })`\n\n```ts\nclamp(input: ClampInput): Temporal.Instant | Temporal.ZonedDateTime;\n```\n\nReturns the nearest bound when `value` falls outside the range.\n\n### `isBefore(a, b, options?)` / `isAfter(a, b, options?)` / `isSame(a, b, options?)`\n\n```ts\nisBefore(a: TimeInput, b: TimeInput, options?: CompareOptions): boolean;\nisAfter(a: TimeInput, b: TimeInput, options?: CompareOptions): boolean;\nisSame(a: TimeInput, b: TimeInput, options?: CompareOptions): boolean;\n```\n\nCompare absolute values or calendar boundaries when `unit` is supplied.\n\n### `startOf(input, unit, options?)` / `endOf(input, unit, options?)`\n\n```ts\nstartOf(input: TimeInput, unit: BoundaryUnit, options?: BoundaryOptions): Temporal.ZonedDateTime;\nendOf(input: TimeInput, unit: BoundaryUnit, options?: BoundaryOptions): Temporal.ZonedDateTime;\n```\n\nReturns the first or last nanosecond of the requested boundary unit.\n\n## Formatting\n\n### `format(input, options?)`\n\n```ts\nformat(input: TimeInput, options?: FormatOptions): string;\n```\n\nFormats a value through `Intl.DateTimeFormat`.\n\n**Example:**\n\n```ts\nimport { format, parse } from '@vielzeug/tempo';\n\nformat(parse('2026-03-21T10:15:30Z', { as: 'instant' }), {\n locale: 'en-GB',\n pattern: 'short',\n timeZone: 'UTC',\n});\n```\n\n### `formatInstant()` / `formatZoned()` / `formatRelative()` / `formatDuration()`\n\n```ts\nformatInstant(input: TimeInput, options?: TimeZoneOptions): string;\nformatZoned(input: TimeInput, options?: TimeZoneOptions): string;\nformatRelative(input: RelativeTimeInput, options?: RelativeFormatOptions): string;\nformatDuration(input: string | Temporal.DurationLike, options?: DurationFormatOptions): string;\n```\n\n`formatInstant()` produces UTC transport text. `formatZoned()` produces zoned ISO text. `formatDuration()` falls back to English when `Intl.DurationFormat` is unavailable.\n\n### `formatParts()` / `formatRange()` / `formatRangeParts()`\n\n```ts\nformatParts(input: TimeInput, options?: FormatOptions): Intl.DateTimeFormatPart[];\nformatRange(start: TimeInput, end: TimeInput, options?: FormatOptions): string;\nformatRangeParts(\n start: TimeInput,\n end: TimeInput,\n options?: FormatOptions,\n): ReturnType<Intl.DateTimeFormat['formatRangeToParts']>;\n```\n\nReturn `Intl` parts or localized range strings using `FormatOptions`.\n\n### `parseDuration()` / `humanize()`\n\n```ts\nparseDuration(input: string | Temporal.DurationLike): Temporal.Duration;\nhumanize(diff: TimeDiffResult, options?: { locale?: Intl.LocalesArgument }): string;\n```\n\n`humanize()` localizes numbers only. Unit names remain English.\n\n## Classification and Sequences\n\n### `classifyExpiry({ value, thresholds, relativeTo?, timeZone? })`\n\n```ts\nclassifyExpiry<K extends string>(input: ClassifyExpiryInput<K>): K | null;\n```\n\nClassifies an expiry against fixed elapsed-time thresholds in milliseconds or larger units. Months and years throw `TempoInvalidInputError`.\n\n### `timeDiff(a, b?, options?)`\n\n```ts\ntimeDiff(a: TimeInput, b?: TimeInput, options?: TimeZoneOptions): TimeDiffResult;\n```\n\nReturns absolute calendar difference in its largest meaningful unit.\n\n### `dateRange()` / `recurrence()`\n\n```ts\ndateRange(start: TimeInput, end: TimeInput, step: Temporal.DurationLike, options?: TimeZoneOptions): Generator<Temporal.ZonedDateTime>;\nrecurrence(start: TimeInput, rule: RecurrenceRule, options?: TimeZoneOptions): Generator<Temporal.ZonedDateTime>;\n```\n\nReturns lazy `ZonedDateTime` sequences.\n\n## Types\n\n```ts\ntype AbsoluteTime = Temporal.Instant | Temporal.ZonedDateTime;\ntype WallTime = Temporal.PlainDate | Temporal.PlainDateTime;\ntype TimeInput = AbsoluteTime | WallTime;\ntype RelativeTimeInput = AbsoluteTime;\ntype ParseAs = 'instant' | 'plainDate' | 'plainDateTime' | 'zonedDateTime';\ntype Disambiguation = 'compatible' | 'earlier' | 'later' | 'reject';\ntype FormatPattern = 'date-only' | 'long' | 'medium' | 'short' | 'time-only';\ntype TempoUnit = 'day' | 'hour' | 'microsecond' | 'millisecond' | 'minute' | 'month' | 'nanosecond' | 'second' | 'week' | 'year';\ntype CalendarUnit = Extract<TempoUnit, 'day' | 'month' | 'week' | 'year'>;\ntype BoundaryUnit = Exclude<TempoUnit, 'microsecond' | 'millisecond' | 'nanosecond' | 'second'>;\ntype WeekStartDay = 1 | 2 | 3 | 4 | 5 | 6 | 7;\ntype FixedDuration = Pick<Temporal.DurationLike, 'days' | 'hours' | 'microseconds' | 'milliseconds' | 'minutes' | 'nanoseconds' | 'seconds' | 'weeks'>;\ntype ExpiryThresholds<K extends string> = Record<K, FixedDuration>;\ntype TimeDiffUnit = Exclude<TempoUnit, 'microsecond' | 'nanosecond'>;\ntype TimeDiffResult = { unit: TimeDiffUnit; value: number };\ntype RecurrenceRule =\n | { frequency: 'daily' | 'monthly' | 'weekly' | 'yearly'; interval?: number; count: number; until?: TimeInput }\n | { frequency: 'daily' | 'monthly' | 'weekly' | 'yearly'; interval?: number; count?: number; until: TimeInput };\n\ninterface TimeZoneOptions { timeZone?: string }\ninterface DisambiguationOptions { disambiguation?: Disambiguation }\ninterface ShiftOptions extends DisambiguationOptions, TimeZoneOptions {}\ninterface DifferenceInput extends DisambiguationOptions, TimeZoneOptions {\n start: TimeInput;\n end: TimeInput;\n largestUnit?: Temporal.DateTimeUnit;\n smallestUnit?: Temporal.DateTimeUnit;\n roundingIncrement?: number;\n roundingMode?: Temporal.RoundingMode;\n}\ntype FormatOptions =\n | { intl: Intl.DateTimeFormatOptions; locale?: Intl.LocalesArgument; pattern?: never; timeZone?: string }\n | { intl?: never; locale?: Intl.LocalesArgument; pattern?: FormatPattern; timeZone?: string };\ninterface RelativeFormatOptions {\n base?: RelativeTimeInput;\n locale?: Intl.LocalesArgument;\n numeric?: Intl.RelativeTimeFormatNumeric;\n style?: Intl.RelativeTimeFormatStyle;\n}\ninterface DurationFormatOptions {\n locale?: Intl.LocalesArgument;\n style?: 'digital' | 'long' | 'narrow' | 'short';\n}\ninterface BoundaryOptions extends TimeZoneOptions { weekStartsOn?: WeekStartDay }\ninterface CompareOptions extends TimeZoneOptions { unit?: BoundaryUnit; weekStartsOn?: WeekStartDay }\ninterface ContainsInput extends CompareOptions { value: TimeInput; start: TimeInput; end: TimeInput }\ninterface ClampInput extends CompareOptions { value: TimeInput; start: TimeInput; end: TimeInput }\ninterface ClassifyExpiryInput<K extends string> extends TimeZoneOptions {\n value: TimeInput;\n thresholds: ExpiryThresholds<K>;\n relativeTo?: Temporal.Instant;\n}\n```\n\n## Errors\n\n| Error | Trigger | Notable properties |\n| --- | --- | --- |\n| `TempoError` | Base Tempo error | `TempoError.is(value)` narrows every subtype |\n| `TempoInvalidInputError` | Invalid parse, duration, or fixed-threshold input | Extends `TempoError` |\n| `TempoInvalidTzError` | Invalid IANA zone or offset | Extends `TempoError` |\n| `TempoMissingTzError` | Wall time without required `timeZone` | Extends `TempoError` |\n| `TempoUnsupportedInputError` | Non-Temporal input passed to conversion | Extends `TempoError` |\n",
|
|
6
|
-
"usage": "---\ntitle: Tempo — Usage Guide\ndescription: Parse explicit Temporal values, resolve wall-clock time, compare ranges, and format dates with Tempo.\n---\n\n[[toc]]\n\n## Basic Usage\n\nParse ISO input with a declared target. Convert plain values with `timeZone` before treating them as an instant.\n\n```ts\nimport { format, inTimeZone, parse, shift, toInstant } from '@vielzeug/tempo';\n\nconst local = parse('2026-03-21T10:15:30', { as: 'plainDateTime' });\nconst instant = toInstant(local, { timeZone: 'America/New_York' });\nconst reminder = shift(instant, { minutes: -15 }, { timeZone: 'America/New_York' });\n\nformat(inTimeZone(reminder, 'America/New_York'), { locale: 'en-US', pattern: 'short' });\n```\n\n## Parse ISO Values\n\nChoose the value your boundary actually represents. Tempo does not auto-detect ISO strings.\n\n```ts\nimport { parse } from '@vielzeug/tempo';\n\nconst occurredAt = parse('2026-03-21T10:15:30Z', { as: 'instant' });\nconst meeting = parse('2026-03-21T10:15:30+01:00[Europe/Berlin]', { as: 'zonedDateTime' });\nconst localStart = parse('2026-03-21T10:15:30', { as: 'plainDateTime' });\nconst birthday = parse('2026-03-21', { as: 'plainDate' });\n```\n\n## Convert Timezones\n\nUse `inTimeZone()` to project an absolute value. Use `toInstant()` only when resolving a wall-clock value.\n\n```ts\nimport { inTimeZone, parse, toInstant } from '@vielzeug/tempo';\n\nconst local = parse('2026-11-01T01:30:00', { as: 'plainDateTime' });\nconst firstOccurrence = toInstant(local, {\n disambiguation: 'earlier',\n timeZone: 'America/New_York',\n});\n\nconst berlin = inTimeZone(firstOccurrence, 'Europe/Berlin');\n```\n\n## Calculate and Compare\n\nUse object inputs for operations with multiple time values.\n\n```ts\nimport { clamp, contains, difference, parse } from '@vielzeug/tempo';\n\nconst start = parse('2026-03-21T10:00:00Z', { as: 'instant' });\nconst end = parse('2026-03-21T12:00:00Z', { as: 'instant' });\nconst value = parse('2026-03-21T13:00:00Z', { as: 'instant' });\n\nconst duration = difference({ end, largestUnit: 'hour', start });\nconst isScheduled = contains({ end, start, value });\nconst bounded = clamp({ end, start, value });\n```\n\n## Classify Expiry\n\nUse fixed elapsed-time thresholds in milliseconds or larger units. Handle `null` as the unclassified state instead of adding a far-future catch-all.\n\n```ts\nimport { classifyExpiry, parse } from '@vielzeug/tempo';\n\nconst status = classifyExpiry({\n relativeTo: parse('2026-06-01T00:00:00Z', { as: 'instant' }),\n thresholds: {\n expired: { days: 0 },\n critical: { days: 3 },\n warning: { days: 14 },\n },\n value: parse('2026-06-04T00:00:00Z', { as: 'instant' }),\n});\n\nconst label = status ?? 'safe';\n```\n\n## Format Values\n\nUse `format()` for UI, `formatInstant()` for transport, and `formatZoned()` for a zoned ISO string.\n\n```ts\nimport { format, formatInstant, formatRelative, formatZoned, parse } from '@vielzeug/tempo';\n\nconst instant = parse('2026-03-21T10:15:30Z', { as: 'instant' });\n\nformat(instant, { locale: 'en-GB', pattern: 'short', timeZone: 'UTC' });\nformatInstant(instant);\nformatZoned(instant, { timeZone: 'Europe/Berlin' });\nformatRelative(instant, { base: parse('2026-03-21T09:15:30Z', { as: 'instant' }) });\n```\n\n## Generate Calendar Sequences\n\nUse zoned inputs for date sequences so the timezone is inferred.\n\n```ts\nimport { dateRange, parse, recurrence } from '@vielzeug/tempo';\n\nconst start = parse('2026-03-01T00:00:00[UTC]', { as: 'zonedDateTime' });\nconst end = parse('2026-03-31T00:00:00[UTC]', { as: 'zonedDateTime' });\n\nconst days = [...dateRange(start, end, { days: 1 })];\nconst meetings = [...recurrence(start, { count: 4, frequency: 'weekly' })];\n```\n\n## Testing\n\nPin the reference instant for deterministic expiry tests.\n\n```ts\nimport { classifyExpiry, parse } from '@vielzeug/tempo';\n\nconst relativeTo = parse('2026-06-01T00:00:00Z', { as: 'instant' });\nconst value = parse('2026-05-31T00:00:00Z', { as: 'instant' });\n\nclassifyExpiry({ relativeTo, thresholds: { expired: { days: 0 } }, value });\n```\n\n## Framework Integration\n\nPass ISO strings through component props. Parse and format at the rendering boundary.\n\n::: code-group\n\n```tsx [React]\nimport { format, parse } from '@vielzeug/tempo';\n\nconst label = format(parse(iso, { as: 'instant' }), { locale: 'en-US', pattern: 'medium', timeZone: 'UTC' });\n```\n\n```vue [Vue 3]\n<script setup lang=\"ts\">\nimport { format, parse } from '@vielzeug/tempo';\n\nconst props = defineProps<{ iso: string }>();\nconst label = format(parse(props.iso, { as: 'instant' }), { locale: 'en-US', pattern: 'medium', timeZone: 'UTC' });\n</script>\n```\n\n```svelte [Svelte]\n<script lang=\"ts\">\n import { format, parse } from '@vielzeug/tempo';\n export let iso: string;\n $: label = format(parse(iso, { as: 'instant' }), { locale: 'en-US', pattern: 'medium', timeZone: 'UTC' });\n</script>\n```\n\n:::\n\n## Working with Other Vielzeug Libraries\n\n### With Rune\n\nWrite stable UTC timestamps to structured logs.\n\n```ts\nimport { formatInstant, nowInstant } from '@vielzeug/tempo';\n\nlogger.info({ timestamp: formatInstant(nowInstant()) }, 'server started');\n```\n\n### With Vault\n\nCalculate an explicit instant before storing an expiring record.\n\n```ts\nimport { now, shift } from '@vielzeug/tempo';\n\nconst expiresAt = shift(now({ timeZone: 'UTC' }), { minutes: 30 }).toInstant();\n```\n\n## Best Practices\n\n- Parse each string with its actual temporal meaning.\n- Pass `timeZone` when converting a plain date or plain date-time.\n- Use `disambiguation` for DST overlap and gap handling.\n- Pass named fields to `difference()`, `contains()`, `clamp()`, and `classifyExpiry()`.\n- Use fixed duration units for expiry thresholds.\n- Store instants for transport and database values.\n- Use `formatInstant()` for machine output and `format()` for user-facing text.\n",
|
|
7
|
-
"examples": "---\ntitle: Tempo — Examples\ndescription: Practical examples and recipes for tempo.\n---\n\n## Examples\n\n- [DST-Safe Arithmetic](./examples/dst-safe-arithmetic.md)\n- [Locale Formatting](./examples/locale-formatting.md)\n- [Timezone Conversion](./examples/timezone-conversion.md)\n- [Expiry Classification](./examples/expiry-classification.md)\n- [Date Ranges and Recurrence](./examples/date-ranges-and-recurrence.md)\n"
|
|
8
|
-
},
|
|
9
|
-
"examples": [
|
|
10
|
-
{
|
|
11
|
-
"id": "meeting-duration",
|
|
12
|
-
"code": "import { classifyExpiry, contains, difference, format, inTimeZone, parse, shift, toInstant } from '@vielzeug/tempo'\n\nconst local = parse('2026-03-21T10:00:00', { as: 'plainDateTime' })\nconst start = toInstant(local, { timeZone: 'America/New_York' })\nconst end = shift(start, { hours: 2 }, { timeZone: 'America/New_York' }).toInstant()\nconst check = parse('2026-03-21T11:00:00Z', { as: 'instant' })\n\nconsole.log('Duration:', difference({ end, largestUnit: 'hour', start }).toString())\nconsole.log('Contains check:', contains({ end, start, value: check }))\nconsole.log('New York:', format(inTimeZone(start, 'America/New_York'), { locale: 'en-US', pattern: 'short' }))\nconsole.log('Expiry:', classifyExpiry({ thresholds: { soon: { days: 3 } }, value: end }))",
|
|
13
|
-
"name": "Explicit Parsing and Timezone Arithmetic"
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"typeSignatures": {
|
|
17
|
-
"Temporal": "export { Temporal } from '@js-temporal/polyfill';",
|
|
18
|
-
"inTimeZone": "export { inTimeZone, toInstant } from './_convert';",
|
|
19
|
-
"toInstant": "export { inTimeZone, toInstant } from './_convert';",
|
|
20
|
-
"endOf": "export { endOf, startOf } from './boundary';",
|
|
21
|
-
"startOf": "export { endOf, startOf } from './boundary';",
|
|
22
|
-
"classifyExpiry": "export { classifyExpiry, timeDiff } from './classify';",
|
|
23
|
-
"timeDiff": "export { classifyExpiry, timeDiff } from './classify';",
|
|
24
|
-
"clamp": "export { clamp, contains, isAfter, isBefore, isSame } from './compare';",
|
|
25
|
-
"contains": "export { clamp, contains, isAfter, isBefore, isSame } from './compare';",
|
|
26
|
-
"isAfter": "export { clamp, contains, isAfter, isBefore, isSame } from './compare';",
|
|
27
|
-
"isBefore": "export { clamp, contains, isAfter, isBefore, isSame } from './compare';",
|
|
28
|
-
"isSame": "export { clamp, contains, isAfter, isBefore, isSame } from './compare';",
|
|
29
|
-
"difference": "export { difference, isValid, now, nowInstant, parse, shift } from './core';",
|
|
30
|
-
"isValid": "export { difference, isValid, now, nowInstant, parse, shift } from './core';",
|
|
31
|
-
"now": "export { difference, isValid, now, nowInstant, parse, shift } from './core';",
|
|
32
|
-
"nowInstant": "export { difference, isValid, now, nowInstant, parse, shift } from './core';",
|
|
33
|
-
"parse": "export { difference, isValid, now, nowInstant, parse, shift } from './core';",
|
|
34
|
-
"shift": "export { difference, isValid, now, nowInstant, parse, shift } from './core';",
|
|
35
|
-
"TempoError": "export {\n TempoError,\n TempoInvalidInputError,\n TempoInvalidTzError,\n TempoMissingTzError,\n TempoUnsupportedInputError,\n} from './errors';",
|
|
36
|
-
"TempoInvalidInputError": "export {\n TempoError,\n TempoInvalidInputError,\n TempoInvalidTzError,\n TempoMissingTzError,\n TempoUnsupportedInputError,\n} from './errors';",
|
|
37
|
-
"TempoInvalidTzError": "export {\n TempoError,\n TempoInvalidInputError,\n TempoInvalidTzError,\n TempoMissingTzError,\n TempoUnsupportedInputError,\n} from './errors';",
|
|
38
|
-
"TempoMissingTzError": "export {\n TempoError,\n TempoInvalidInputError,\n TempoInvalidTzError,\n TempoMissingTzError,\n TempoUnsupportedInputError,\n} from './errors';",
|
|
39
|
-
"TempoUnsupportedInputError": "export {\n TempoError,\n TempoInvalidInputError,\n TempoInvalidTzError,\n TempoMissingTzError,\n TempoUnsupportedInputError,\n} from './errors';",
|
|
40
|
-
"format": "export {\n format,\n formatDuration,\n formatInstant,\n formatParts,\n formatRange,\n formatRangeParts,\n formatRelative,\n formatZoned,\n humanize,\n parseDuration,\n} from './format';",
|
|
41
|
-
"formatDuration": "export {\n format,\n formatDuration,\n formatInstant,\n formatParts,\n formatRange,\n formatRangeParts,\n formatRelative,\n formatZoned,\n humanize,\n parseDuration,\n} from './format';",
|
|
42
|
-
"formatInstant": "export {\n format,\n formatDuration,\n formatInstant,\n formatParts,\n formatRange,\n formatRangeParts,\n formatRelative,\n formatZoned,\n humanize,\n parseDuration,\n} from './format';",
|
|
43
|
-
"formatParts": "export {\n format,\n formatDuration,\n formatInstant,\n formatParts,\n formatRange,\n formatRangeParts,\n formatRelative,\n formatZoned,\n humanize,\n parseDuration,\n} from './format';",
|
|
44
|
-
"formatRange": "export {\n format,\n formatDuration,\n formatInstant,\n formatParts,\n formatRange,\n formatRangeParts,\n formatRelative,\n formatZoned,\n humanize,\n parseDuration,\n} from './format';",
|
|
45
|
-
"formatRangeParts": "export {\n format,\n formatDuration,\n formatInstant,\n formatParts,\n formatRange,\n formatRangeParts,\n formatRelative,\n formatZoned,\n humanize,\n parseDuration,\n} from './format';",
|
|
46
|
-
"formatRelative": "export {\n format,\n formatDuration,\n formatInstant,\n formatParts,\n formatRange,\n formatRangeParts,\n formatRelative,\n formatZoned,\n humanize,\n parseDuration,\n} from './format';",
|
|
47
|
-
"formatZoned": "export {\n format,\n formatDuration,\n formatInstant,\n formatParts,\n formatRange,\n formatRangeParts,\n formatRelative,\n formatZoned,\n humanize,\n parseDuration,\n} from './format';",
|
|
48
|
-
"humanize": "export {\n format,\n formatDuration,\n formatInstant,\n formatParts,\n formatRange,\n formatRangeParts,\n formatRelative,\n formatZoned,\n humanize,\n parseDuration,\n} from './format';",
|
|
49
|
-
"parseDuration": "export {\n format,\n formatDuration,\n formatInstant,\n formatParts,\n formatRange,\n formatRangeParts,\n formatRelative,\n formatZoned,\n humanize,\n parseDuration,\n} from './format';",
|
|
50
|
-
"dateRange": "export { dateRange, recurrence } from './range';",
|
|
51
|
-
"recurrence": "export { dateRange, recurrence } from './range';",
|
|
52
|
-
"AbsoluteTime": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
53
|
-
"BoundaryOptions": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
54
|
-
"BoundaryUnit": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
55
|
-
"CalendarUnit": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
56
|
-
"ClampInput": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
57
|
-
"ClassifyExpiryInput": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
58
|
-
"CompareOptions": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
59
|
-
"ContainsInput": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
60
|
-
"DifferenceInput": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
61
|
-
"Disambiguation": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
62
|
-
"DisambiguationOptions": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
63
|
-
"DurationFormatOptions": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
64
|
-
"ExpiryThresholds": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
65
|
-
"FixedDuration": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
66
|
-
"FormatOptions": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
67
|
-
"FormatPattern": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
68
|
-
"ParseAs": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
69
|
-
"RecurrenceRule": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
70
|
-
"RelativeFormatOptions": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
71
|
-
"RelativeTimeInput": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
72
|
-
"ShiftOptions": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
73
|
-
"TempoUnit": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
74
|
-
"TimeDiffResult": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
75
|
-
"TimeDiffUnit": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
76
|
-
"TimeInput": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
77
|
-
"TimeZoneOptions": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
78
|
-
"WallTime": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';",
|
|
79
|
-
"WeekStartDay": "export type {\n AbsoluteTime,\n BoundaryOptions,\n BoundaryUnit,\n CalendarUnit,\n ClampInput,\n ClassifyExpiryInput,\n CompareOptions,\n ContainsInput,\n DifferenceInput,\n Disambiguation,\n DisambiguationOptions,\n DurationFormatOptions,\n ExpiryThresholds,\n FixedDuration,\n FormatOptions,\n FormatPattern,\n ParseAs,\n RecurrenceRule,\n RelativeFormatOptions,\n RelativeTimeInput,\n ShiftOptions,\n TempoUnit,\n TimeDiffResult,\n TimeDiffUnit,\n TimeInput,\n TimeZoneOptions,\n WallTime,\n WeekStartDay,\n} from './types';"
|
|
80
|
-
}
|
|
81
|
-
}
|