@vielzeug/sourcerer 2.2.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -18
- package/dist/asyncSource.cjs +1 -1
- package/dist/asyncSource.cjs.map +1 -1
- package/dist/asyncSource.d.ts +13 -12
- package/dist/asyncSource.d.ts.map +1 -1
- package/dist/asyncSource.js +46 -23
- package/dist/asyncSource.js.map +1 -1
- package/dist/cursorSource.cjs +1 -1
- package/dist/cursorSource.cjs.map +1 -1
- package/dist/cursorSource.d.ts +2 -2
- package/dist/cursorSource.d.ts.map +1 -1
- package/dist/cursorSource.js +82 -59
- package/dist/cursorSource.js.map +1 -1
- package/dist/errors.cjs +2 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +18 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/infiniteSource.cjs +1 -1
- package/dist/infiniteSource.cjs.map +1 -1
- package/dist/infiniteSource.d.ts +2 -2
- package/dist/infiniteSource.d.ts.map +1 -1
- package/dist/infiniteSource.js +76 -53
- package/dist/infiniteSource.js.map +1 -1
- package/dist/localSource.cjs +1 -1
- package/dist/localSource.cjs.map +1 -1
- package/dist/localSource.d.ts +3 -2
- package/dist/localSource.d.ts.map +1 -1
- package/dist/localSource.js +54 -57
- package/dist/localSource.js.map +1 -1
- package/dist/pageSource.cjs +1 -1
- package/dist/pageSource.cjs.map +1 -1
- package/dist/pageSource.d.ts +2 -2
- package/dist/pageSource.d.ts.map +1 -1
- package/dist/pageSource.js +84 -63
- package/dist/pageSource.js.map +1 -1
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.cjs.map +1 -1
- package/dist/pagination.d.ts +1 -2
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +16 -19
- package/dist/pagination.js.map +1 -1
- package/dist/sourceStore.cjs.map +1 -1
- package/dist/sourceStore.d.ts +5 -2
- package/dist/sourceStore.d.ts.map +1 -1
- package/dist/sourceStore.js.map +1 -1
- package/dist/sourcerer.cjs +1 -1
- package/dist/sourcerer.cjs.map +1 -1
- package/dist/sourcerer.iife.js +1 -1
- package/dist/sourcerer.iife.js.map +1 -1
- package/dist/sourcerer.js +1 -1
- package/dist/sourcerer.js.map +1 -1
- package/dist/types.d.ts +130 -117
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -7
- package/dist/_dev.cjs +0 -2
- package/dist/_dev.cjs.map +0 -1
- package/dist/_dev.d.ts +0 -2
- package/dist/_dev.d.ts.map +0 -1
- package/dist/_dev.js +0 -6
- package/dist/_dev.js.map +0 -1
package/dist/sourcerer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourcerer.js","names":[],"sources":["../src/_dev.ts","../src/requestController.ts","../src/sourceStore.ts","../src/asyncSource.ts","../src/pagination.ts","../src/cursorSource.ts","../src/infiniteSource.ts","../src/localSource.ts","../src/pageSource.ts"],"sourcesContent":["const isDev = !(globalThis as { __SOURCERER_PROD__?: boolean }).__SOURCERER_PROD__;\n\n/** @internal */\nexport function warn(msg: string): void {\n if (isDev) console.warn(`[@vielzeug/sourcerer] ${msg}`);\n}\n","export type RequestHandle = Readonly<{\n finish(): void;\n isCurrent(): boolean;\n signal: AbortSignal;\n}>;\n\nexport type RequestController = Readonly<{\n begin(): RequestHandle;\n dispose(): void;\n}>;\n\n/** A source owns one active request: newer query state always supersedes older work. */\nexport function createRequestController(): RequestController {\n let active: AbortController | undefined;\n let sequence = 0;\n\n return {\n begin() {\n active?.abort();\n\n const controller = new AbortController();\n const requestSequence = ++sequence;\n\n active = controller;\n\n return {\n finish() {\n if (requestSequence === sequence) active = undefined;\n },\n\n isCurrent() {\n return requestSequence === sequence;\n },\n\n signal: controller.signal,\n };\n },\n\n dispose() {\n active?.abort();\n active = undefined;\n sequence++;\n },\n };\n}\n\nexport function toError(reason: unknown): Error {\n if (reason instanceof Error) return reason;\n\n const message = typeof reason === 'string' && reason.length > 0 ? reason : 'Source request failed';\n\n return new Error(message, { cause: reason });\n}\n","import type { Disposable } from './types';\n\ntype SourceStore<T> = Disposable & {\n set(value: T): void;\n subscribe(listener: (value: T) => void): () => void;\n readonly value: T;\n};\n\n/** Store commits source state before notifying; observer failures cannot rewrite committed state. */\nexport function createSourceStore<T>(initialValue: T): SourceStore<T> {\n const controller = new AbortController();\n const listeners = new Set<(value: T) => void>();\n let disposed = false;\n let value = initialValue;\n\n const dispose = (): void => {\n if (disposed) return;\n\n disposed = true;\n listeners.clear();\n controller.abort();\n };\n\n return {\n get disposalSignal() {\n return controller.signal;\n },\n\n dispose,\n\n get disposed() {\n return disposed;\n },\n\n set(nextValue) {\n if (disposed) return;\n\n value = nextValue;\n\n for (const listener of listeners) {\n try {\n listener(value);\n } catch (error) {\n queueMicrotask(() => {\n throw error;\n });\n }\n }\n },\n\n subscribe(listener) {\n if (disposed) return () => {};\n\n listeners.add(listener);\n\n return () => listeners.delete(listener);\n },\n\n [Symbol.dispose]: dispose,\n\n get value() {\n return value;\n },\n };\n}\n","import { createRequestController, toError } from './requestController';\nimport { createSourceStore } from './sourceStore';\nimport type { AnyPagination, SourceSnapshot } from './types';\n\ntype AsyncSource<T, TQuery, TPagination extends AnyPagination> = Readonly<{\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n fetch<TResult>(options: {\n failure(previous: SourceSnapshot<T, TQuery, TPagination>, error: Error): SourceSnapshot<T, TQuery, TPagination>;\n load(signal: AbortSignal): Promise<TResult>;\n pending(previous: SourceSnapshot<T, TQuery, TPagination>): SourceSnapshot<T, TQuery, TPagination>;\n success(result: TResult): SourceSnapshot<T, TQuery, TPagination>;\n }): Promise<void>;\n readonly snapshot: SourceSnapshot<T, TQuery, TPagination>;\n subscribe(listener: (snapshot: SourceSnapshot<T, TQuery, TPagination>) => void): () => void;\n}>;\n\n/** Request failures and observer failures stay separate so observers cannot corrupt source state. */\nexport function createAsyncSource<T, TQuery, TPagination extends AnyPagination>(\n initial: SourceSnapshot<T, TQuery, TPagination>,\n): AsyncSource<T, TQuery, TPagination> {\n const store = createSourceStore(initial);\n const requests = createRequestController();\n\n return {\n get disposalSignal() {\n return store.disposalSignal;\n },\n\n dispose() {\n requests.dispose();\n store.dispose();\n },\n\n get disposed() {\n return store.disposed;\n },\n\n async fetch(options) {\n if (store.disposed) return;\n\n const request = requests.begin();\n const previous = store.value;\n\n store.set(options.pending(previous));\n\n let next: SourceSnapshot<T, TQuery, TPagination>;\n\n try {\n next = options.success(await options.load(request.signal));\n } catch (reason: unknown) {\n if (!request.isCurrent() || store.disposed) return;\n\n const error = toError(reason);\n\n store.set(options.failure(previous, error));\n throw error;\n } finally {\n request.finish();\n }\n\n if (!request.isCurrent() || store.disposed) return;\n\n store.set(next);\n },\n\n get snapshot() {\n return store.value;\n },\n\n subscribe: store.subscribe,\n };\n}\n","import type { PagePagination } from './types';\n\nexport function positiveInteger(value: number, name: string): number {\n if (!Number.isInteger(value) || value < 1) throw new RangeError(`${name} must be a positive integer`);\n\n return value;\n}\n\nexport function totalItems(value: number): number {\n if (!Number.isInteger(value) || value < 0) throw new RangeError('Source loader total must be a non-negative integer');\n\n return value;\n}\n\nexport function createPagePagination(index: number, size: number, total: number): PagePagination {\n const count = Math.max(1, Math.ceil(total / size));\n const safeIndex = Math.min(index, count);\n\n return {\n count,\n hasNext: safeIndex < count,\n hasPrevious: safeIndex > 1,\n index: safeIndex,\n kind: 'page',\n size,\n total,\n };\n}\n\nexport function sameQuery<T extends Record<string, unknown>>(left: T, right: T): boolean {\n const keys = new Set([...Object.keys(left), ...Object.keys(right)]);\n\n return [...keys].every((key) => Object.is(left[key], right[key]));\n}\n","import { warn } from './_dev';\nimport { createAsyncSource } from './asyncSource';\nimport { positiveInteger, sameQuery, totalItems } from './pagination';\nimport type { CursorPagination, CursorQuery, CursorQueryPatch, CursorSource, CursorSourceConfig } from './types';\n\nconst createPagination = <TCursor>(result?: {\n nextCursor?: TCursor;\n previousCursor?: TCursor;\n total?: number;\n}): CursorPagination<TCursor> => ({\n hasNext: result?.nextCursor !== undefined,\n hasPrevious: result?.previousCursor !== undefined,\n kind: 'cursor',\n ...(result?.nextCursor !== undefined && { nextCursor: result.nextCursor }),\n ...(result?.previousCursor !== undefined && { previousCursor: result.previousCursor }),\n ...(result?.total !== undefined && { total: totalItems(result.total) }),\n});\n\nconst normalizeQuery = <TCursor>(\n current: CursorQuery<TCursor>,\n patch: CursorQueryPatch<TCursor> = {},\n): CursorQuery<TCursor> => {\n if (patch.after !== undefined && patch.before !== undefined) {\n throw new RangeError('Cursor query cannot include both after and before');\n }\n\n const resetsCursor = patch.pageSize !== undefined || patch.search !== undefined;\n const after = resetsCursor || 'before' in patch ? undefined : 'after' in patch ? patch.after : current.after;\n const before = resetsCursor || 'after' in patch ? undefined : 'before' in patch ? patch.before : current.before;\n\n return {\n ...(after !== undefined && { after }),\n ...(before !== undefined && { before }),\n pageSize: positiveInteger(patch.pageSize ?? current.pageSize, 'pageSize'),\n search: patch.search ?? current.search,\n };\n};\n\n/** Cursor sources retain loaded cursors while pendingQuery records newer navigation. */\nexport function createCursorSource<T, TCursor = string>(\n config: CursorSourceConfig<T, TCursor>,\n): CursorSource<T, TCursor> {\n const initialQuery: CursorQuery<TCursor> = { pageSize: 20, search: '' };\n let requestedQuery = normalizeQuery(initialQuery, config.initialQuery);\n const asyncSource = createAsyncSource<T, CursorQuery<TCursor>, CursorPagination<TCursor>>({\n data: [],\n error: null,\n isFetching: false,\n pagination: createPagination(),\n query: requestedQuery,\n });\n\n const fetch = (query: CursorQuery<TCursor>): Promise<void> =>\n asyncSource.fetch({\n failure: (previous, error) => ({ ...previous, error, isFetching: false, pendingQuery: undefined }),\n load: (signal) => config.load({ query, signal }),\n pending: (previous) => ({ ...previous, error: null, isFetching: true, pendingQuery: query }),\n success: (result) => ({\n data: result.data,\n error: null,\n isFetching: false,\n pagination: createPagination(result),\n query,\n }),\n });\n\n const reload = (): Promise<void> => fetch(requestedQuery);\n\n const setQuery = async (patch: CursorQueryPatch<TCursor>): Promise<void> => {\n const current = asyncSource.snapshot.pendingQuery ?? asyncSource.snapshot.query;\n const next = normalizeQuery(current, patch);\n\n if (sameQuery(next, requestedQuery)) return;\n\n requestedQuery = next;\n await fetch(next);\n };\n\n const source: CursorSource<T, TCursor> = {\n get disposalSignal() {\n return asyncSource.disposalSignal;\n },\n\n dispose: asyncSource.dispose,\n\n get disposed() {\n return asyncSource.disposed;\n },\n\n page: {\n next() {\n const cursor = asyncSource.snapshot.pagination.nextCursor;\n\n return asyncSource.snapshot.isFetching || cursor === undefined\n ? Promise.resolve()\n : setQuery({ after: cursor });\n },\n\n previous() {\n const cursor = asyncSource.snapshot.pagination.previousCursor;\n\n return asyncSource.snapshot.isFetching || cursor === undefined\n ? Promise.resolve()\n : setQuery({ before: cursor });\n },\n },\n\n reload,\n setQuery,\n\n get snapshot() {\n return asyncSource.snapshot;\n },\n\n subscribe: asyncSource.subscribe,\n\n [Symbol.dispose]() {\n source.dispose();\n },\n };\n\n if (config.autoStart !== false)\n void reload().catch(() => warn('Initial load failed. Inspect source.snapshot.error.'));\n\n return source;\n}\n","import { warn } from './_dev';\nimport { createAsyncSource } from './asyncSource';\nimport { positiveInteger, sameQuery, totalItems } from './pagination';\nimport type {\n InfinitePagination,\n InfiniteQuery,\n InfiniteQueryPatch,\n InfiniteSource,\n InfiniteSourceConfig,\n} from './types';\n\nconst createPagination = (loaded: number, total: number): InfinitePagination => ({\n hasMore: loaded < total,\n kind: 'infinite',\n loaded,\n total,\n});\n\nconst normalizeQuery = (current: InfiniteQuery, patch: InfiniteQueryPatch = {}): InfiniteQuery => ({\n pageSize: positiveInteger(patch.pageSize ?? current.pageSize, 'pageSize'),\n search: patch.search ?? current.search,\n});\n\n/** Infinite sources preserve loaded collection state while a pending query replaces it. */\nexport function createInfiniteSource<T>(config: InfiniteSourceConfig<T>): InfiniteSource<T> {\n const initialQuery: InfiniteQuery = { pageSize: 20, search: '' };\n let requestedQuery = normalizeQuery(initialQuery, config.initialQuery);\n let nextPage = 1;\n const asyncSource = createAsyncSource<T, InfiniteQuery, InfinitePagination>({\n data: [],\n error: null,\n isFetching: false,\n pagination: createPagination(0, 0),\n query: requestedQuery,\n });\n\n const fetch = (query: InfiniteQuery, page: number, append: boolean): Promise<void> => {\n const loadedData = asyncSource.snapshot.data;\n\n return asyncSource.fetch({\n failure: (previous, error) => ({ ...previous, error, isFetching: false, pendingQuery: undefined }),\n load: (signal) => config.load({ query: { page, pageSize: query.pageSize, search: query.search }, signal }),\n pending: (previous) => ({\n ...previous,\n error: null,\n isFetching: true,\n pagination: createPagination(previous.data.length, previous.pagination.total),\n ...(append ? {} : { pendingQuery: query }),\n }),\n success: (result) => {\n const total = totalItems(result.total);\n const data = append ? [...loadedData, ...result.data] : result.data;\n\n nextPage = page + 1;\n\n return {\n data,\n error: null,\n isFetching: false,\n pagination: createPagination(data.length, total),\n query,\n };\n },\n });\n };\n\n const reload = (): Promise<void> => {\n nextPage = 1;\n\n return fetch(requestedQuery, 1, false);\n };\n\n const setQuery = async (patch: InfiniteQueryPatch): Promise<void> => {\n const current = asyncSource.snapshot.pendingQuery ?? asyncSource.snapshot.query;\n const next = normalizeQuery(current, patch);\n\n if (sameQuery(next, requestedQuery)) return;\n\n requestedQuery = next;\n nextPage = 1;\n await fetch(next, 1, false);\n };\n\n const source: InfiniteSource<T> = {\n get disposalSignal() {\n return asyncSource.disposalSignal;\n },\n\n dispose: asyncSource.dispose,\n\n get disposed() {\n return asyncSource.disposed;\n },\n\n loadMore() {\n const { isFetching, pagination } = asyncSource.snapshot;\n\n return isFetching || (asyncSource.snapshot.data.length > 0 && !pagination.hasMore)\n ? Promise.resolve()\n : fetch(requestedQuery, nextPage, true);\n },\n\n reload,\n setQuery,\n\n get snapshot() {\n return asyncSource.snapshot;\n },\n\n subscribe: asyncSource.subscribe,\n\n [Symbol.dispose]() {\n source.dispose();\n },\n };\n\n if (config.autoStart !== false)\n void reload().catch(() => warn('Initial load failed. Inspect source.snapshot.error.'));\n\n return source;\n}\n","import { createPagePagination, positiveInteger, sameQuery, totalItems } from './pagination';\nimport { createSourceStore } from './sourceStore';\nimport type {\n LocalQuery,\n LocalQueryPatch,\n LocalSource,\n LocalSourceConfig,\n PagePagination,\n SourceSnapshot,\n} from './types';\n\nconst normalizeQuery = (current: LocalQuery, patch: LocalQueryPatch = {}, maxPage?: number): LocalQuery => {\n const page = patch.page ?? current.page;\n const pageSize = patch.pageSize ?? current.pageSize;\n const search = patch.search ?? current.search;\n const resetsPage = patch.pageSize !== undefined || patch.search !== undefined;\n\n const requestedPage = patch.page ?? (resetsPage ? 1 : page);\n\n return {\n page:\n maxPage === undefined\n ? positiveInteger(requestedPage, 'page')\n : Math.min(positiveInteger(requestedPage, 'page'), maxPage),\n pageSize: positiveInteger(pageSize, 'pageSize'),\n search,\n };\n};\n\n/** Local sources own only search and pagination; callers prepare filtering and ranking. */\nexport function createLocalSource<T>(data: readonly T[], config: LocalSourceConfig<T> = {}): LocalSource<T> {\n let allData = data;\n let query = normalizeQuery({ page: 1, pageSize: 20, search: '' }, config.initialQuery);\n\n const buildSnapshot = (): SourceSnapshot<T, LocalQuery, PagePagination> => {\n const matched =\n query.search.length > 0 && config.match ? allData.filter((item) => config.match?.(item, query.search)) : allData;\n const total = totalItems(matched.length);\n const pagination = createPagePagination(query.page, query.pageSize, total);\n const start = (pagination.index - 1) * pagination.size;\n\n query = { ...query, page: pagination.index };\n\n return {\n data: matched.slice(start, start + pagination.size),\n error: null,\n isFetching: false,\n pagination,\n query,\n };\n };\n\n const store = createSourceStore(buildSnapshot());\n\n const commit = (): boolean => {\n const next = buildSnapshot();\n\n if (\n sameQuery(next.query, store.value.query) &&\n next.data === store.value.data &&\n next.pagination === store.value.pagination\n ) {\n return false;\n }\n\n store.set(next);\n\n return true;\n };\n\n const setQuery = (patch: LocalQueryPatch): void => {\n const next = normalizeQuery(query, patch, store.value.pagination.count);\n\n if (sameQuery(next, query)) return;\n\n query = next;\n\n commit();\n };\n\n const source: LocalSource<T> = {\n get disposalSignal() {\n return store.disposalSignal;\n },\n\n dispose: store.dispose,\n\n get disposed() {\n return store.disposed;\n },\n\n page: {\n go(index) {\n setQuery({ page: index });\n },\n\n last() {\n setQuery({ page: store.value.pagination.count });\n },\n\n next() {\n if (store.value.pagination.hasNext) setQuery({ page: store.value.pagination.index + 1 });\n },\n\n previous() {\n if (store.value.pagination.hasPrevious) setQuery({ page: store.value.pagination.index - 1 });\n },\n },\n\n setData(nextData) {\n if (nextData === allData) return;\n\n allData = nextData;\n\n commit();\n },\n\n setQuery,\n\n get snapshot() {\n return store.value;\n },\n\n subscribe: store.subscribe,\n\n [Symbol.dispose]() {\n source.dispose();\n },\n };\n\n return source;\n}\n","import { warn } from './_dev';\nimport { createAsyncSource } from './asyncSource';\nimport { createPagePagination, positiveInteger, sameQuery, totalItems } from './pagination';\nimport type { PagePagination, PageQuery, PageQueryPatch, PageSource, PageSourceConfig } from './types';\n\nconst normalizeQuery = <TFilter, TSort>(\n current: PageQuery<TFilter, TSort>,\n patch: PageQueryPatch<TFilter, TSort> = {},\n maxPage?: number,\n): PageQuery<TFilter, TSort> => {\n const page = patch.page ?? current.page;\n const pageSize = patch.pageSize ?? current.pageSize;\n const search = patch.search ?? current.search;\n const resetsPage = 'filter' in patch || patch.pageSize !== undefined || patch.search !== undefined || 'sort' in patch;\n\n const requestedPage = patch.page ?? (resetsPage ? 1 : page);\n\n return {\n ...('filter' in patch\n ? patch.filter !== undefined && { filter: patch.filter }\n : current.filter !== undefined && { filter: current.filter }),\n ...('sort' in patch\n ? patch.sort !== undefined && { sort: patch.sort }\n : current.sort !== undefined && { sort: current.sort }),\n page:\n maxPage === undefined\n ? positiveInteger(requestedPage, 'page')\n : Math.min(positiveInteger(requestedPage, 'page'), maxPage),\n pageSize: positiveInteger(pageSize, 'pageSize'),\n search,\n };\n};\n\n/** Page sources retain loaded state while pendingQuery records newer work. */\nexport function createPageSource<T, TFilter = unknown, TSort = unknown>(\n config: PageSourceConfig<T, TFilter, TSort>,\n): PageSource<T, TFilter, TSort> {\n const initialQuery: PageQuery<TFilter, TSort> = {\n page: 1,\n pageSize: 20,\n search: '',\n };\n let requestedQuery = normalizeQuery(initialQuery, config.initialQuery);\n const asyncSource = createAsyncSource<T, PageQuery<TFilter, TSort>, PagePagination>({\n data: [],\n error: null,\n isFetching: false,\n pagination: createPagePagination(requestedQuery.page, requestedQuery.pageSize, 0),\n query: requestedQuery,\n });\n\n const fetch = (query: PageQuery<TFilter, TSort>): Promise<void> =>\n asyncSource.fetch({\n failure: (previous, error) => ({ ...previous, error, isFetching: false, pendingQuery: undefined }),\n load: (signal) => config.load({ query, signal }),\n pending: (previous) => ({ ...previous, error: null, isFetching: true, pendingQuery: query }),\n success: (result) => {\n const total = totalItems(result.total);\n const pagination = createPagePagination(query.page, query.pageSize, total);\n const loadedQuery = { ...query, page: pagination.index };\n\n requestedQuery = loadedQuery;\n\n return {\n data: result.data,\n error: null,\n isFetching: false,\n pagination,\n query: loadedQuery,\n };\n },\n });\n\n const reload = (): Promise<void> => fetch(requestedQuery);\n\n const setQuery = async (patch: PageQueryPatch<TFilter, TSort>): Promise<void> => {\n const current = asyncSource.snapshot.pendingQuery ?? asyncSource.snapshot.query;\n const next = normalizeQuery(\n current,\n patch,\n asyncSource.snapshot.pagination.total > 0 ? asyncSource.snapshot.pagination.count : undefined,\n );\n\n if (sameQuery(next, requestedQuery)) return;\n\n requestedQuery = next;\n await fetch(next);\n };\n\n const source: PageSource<T, TFilter, TSort> = {\n get disposalSignal() {\n return asyncSource.disposalSignal;\n },\n\n dispose: asyncSource.dispose,\n\n get disposed() {\n return asyncSource.disposed;\n },\n\n page: {\n go(index) {\n return asyncSource.snapshot.isFetching ? Promise.resolve() : setQuery({ page: index });\n },\n\n last() {\n return asyncSource.snapshot.isFetching\n ? Promise.resolve()\n : setQuery({ page: asyncSource.snapshot.pagination.count });\n },\n\n next() {\n return asyncSource.snapshot.isFetching || !asyncSource.snapshot.pagination.hasNext\n ? Promise.resolve()\n : setQuery({ page: asyncSource.snapshot.pagination.index + 1 });\n },\n\n previous() {\n return asyncSource.snapshot.isFetching || !asyncSource.snapshot.pagination.hasPrevious\n ? Promise.resolve()\n : setQuery({ page: asyncSource.snapshot.pagination.index - 1 });\n },\n },\n\n reload,\n setQuery,\n\n get snapshot() {\n return asyncSource.snapshot;\n },\n\n subscribe: asyncSource.subscribe,\n\n [Symbol.dispose]() {\n source.dispose();\n },\n };\n\n if (config.autoStart !== false)\n void reload().catch(() => warn('Initial load failed. Inspect source.snapshot.error.'));\n\n return source;\n}\n"],"mappings":"ACYA,SAAgB,GAA6C,CAC3D,IAAI,EACA,EAAW,EAEf,MAAO,CACL,OAAQ,CACN,GAAQ,MAAM,EAEd,IAAM,EAAa,IAAI,gBACjB,EAAkB,EAAE,EAI1B,MAFA,GAAS,EAEF,CACL,QAAS,CACH,IAAoB,IAAU,EAAS,IAAA,GAC7C,EAEA,WAAY,CACV,OAAO,IAAoB,CAC7B,EAEA,OAAQ,EAAW,MACrB,CACF,EAEA,SAAU,CACR,GAAQ,MAAM,EACd,EAAS,IAAA,GACT,GACF,CACF,CACF,CAEA,SAAgB,EAAQ,EAAwB,CAC9C,GAAI,aAAkB,MAAO,OAAO,EAEpC,IAAM,EAAU,OAAO,GAAW,UAAY,EAAO,OAAS,EAAI,EAAS,wBAE3E,OAAW,MAAM,EAAS,CAAE,MAAO,CAAO,CAAC,CAC7C,CC3CA,SAAgB,EAAqB,EAAiC,CACpE,IAAM,EAAa,IAAI,gBACjB,EAAY,IAAI,IAClB,EAAW,GACX,EAAQ,EAEN,MAAsB,CACtB,IAEJ,EAAW,GACX,EAAU,MAAM,EAChB,EAAW,MAAM,EACnB,EAEA,MAAO,CACL,IAAI,gBAAiB,CACnB,OAAO,EAAW,MACpB,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AAS,WACxB,QAAQ,QAAQ,EAChB,EAAS,CAAE,KAAM,EAAY,SAAS,WAAW,KAAM,CAAC,CAC9D,EAEA,MAAO,CACL,OAAO,EAAY,SAAS,YAAc,CAAC,EAAY,SAAS,WAAW,QACvE,QAAQ,QAAQ,EAChB,EAAS,CAAE,KAAM,EAAY,SAAS,WAAW,MAAQ,CAAE,CAAC,CAClE,EAEA,UAAW,CACT,OAAO,EAAY,SAAS,YAAc,CAAC,EAAY,SAAS,WAAW,YACvE,QAAQ,QAAQ,EAChB,EAAS,CAAE,KAAM,EAAY,SAAS,WAAW,MAAQ,CAAE,CAAC,CAClE,CACF,EAEA,SACA,WAEA,IAAI,UAAW,CACb,OAAO,EAAY,QACrB,EAEA,UAAW,EAAY,UAEvB,CAAC,OAAO,UAAW,CACjB,EAAO,QAAQ,CACjB,CACF,EAKA,OAHI,EAAO,YAAc,IACvB,EAAY,CAAC,CAAC,UAAY,MAA2D,EAEhF,CACT"}
|
|
1
|
+
{"version":3,"file":"sourcerer.js","names":[],"sources":["../src/errors.ts","../src/requestController.ts","../src/sourceStore.ts","../src/asyncSource.ts","../src/pagination.ts","../src/cursorSource.ts","../src/infiniteSource.ts","../src/localSource.ts","../src/pageSource.ts"],"sourcesContent":["/** Base class for all sourcerer errors. Use `instanceof SourcererError` to catch any sourcerer-originated error. */\nexport class SourcererError extends Error {\n protected static readonly errorName: string = 'SourcererError';\n\n constructor(message: string, opts?: ErrorOptions) {\n super(message, opts);\n this.name = (new.target as typeof SourcererError).errorName;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when a source is configured or queried with invalid arguments. */\nexport class SourcererConfigurationError extends SourcererError {\n protected static override readonly errorName = 'SourcererConfigurationError';\n}\n\nexport class SourcererDisposedError extends SourcererError {\n protected static override readonly errorName = 'SourcererDisposedError';\n\n constructor(message = 'Sourcerer source disposed') {\n super(message);\n }\n}\n","export type RequestHandle = Readonly<{\n finish(): void;\n isCurrent(): boolean;\n signal: AbortSignal;\n}>;\n\nexport type RequestController = Readonly<{\n begin(): RequestHandle;\n dispose(): void;\n}>;\n\n/** A source owns one active request: newer query state always supersedes older work. */\nexport function createRequestController(): RequestController {\n let active: AbortController | undefined;\n let sequence = 0;\n\n return {\n begin() {\n active?.abort();\n\n const controller = new AbortController();\n const requestSequence = ++sequence;\n\n active = controller;\n\n return {\n finish() {\n if (requestSequence === sequence) active = undefined;\n },\n\n isCurrent() {\n return requestSequence === sequence;\n },\n\n signal: controller.signal,\n };\n },\n\n dispose() {\n active?.abort();\n active = undefined;\n sequence++;\n },\n };\n}\n\nexport function toError(reason: unknown): Error {\n if (reason instanceof Error) return reason;\n\n const message = typeof reason === 'string' && reason.length > 0 ? reason : 'Source request failed';\n\n return new Error(message, { cause: reason });\n}\n","type SourceStore<T> = {\n [Symbol.dispose](): void;\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n set(value: T): void;\n subscribe(listener: (value: T) => void): () => void;\n readonly value: T;\n};\n\n/** Store commits source state before notifying; observer failures cannot rewrite committed state. */\nexport function createSourceStore<T>(initialValue: T): SourceStore<T> {\n const controller = new AbortController();\n const listeners = new Set<(value: T) => void>();\n let disposed = false;\n let value = initialValue;\n\n const dispose = (): void => {\n if (disposed) return;\n\n disposed = true;\n listeners.clear();\n controller.abort();\n };\n\n return {\n get disposalSignal() {\n return controller.signal;\n },\n\n dispose,\n\n get disposed() {\n return disposed;\n },\n\n set(nextValue) {\n if (disposed) return;\n\n value = nextValue;\n\n for (const listener of listeners) {\n try {\n listener(value);\n } catch (error) {\n queueMicrotask(() => {\n throw error;\n });\n }\n }\n },\n\n subscribe(listener) {\n if (disposed) return () => {};\n\n listeners.add(listener);\n\n return () => listeners.delete(listener);\n },\n\n [Symbol.dispose]: dispose,\n\n get value() {\n return value;\n },\n };\n}\n","import { abortError } from '@vielzeug/arsenal';\n\nimport { SourcererDisposedError } from './errors';\nimport { createRequestController, toError } from './requestController';\nimport { createSourceStore } from './sourceStore';\n\nconst loadWithSignal = <T>(load: (signal: AbortSignal) => Promise<T>, signal: AbortSignal): Promise<T> =>\n new Promise((resolve, reject) => {\n const abort = (): void => reject(abortError(signal, 'The operation was aborted.'));\n if (signal.aborted) {\n abort();\n return;\n }\n\n signal.addEventListener('abort', abort, { once: true });\n let result: Promise<T>;\n try {\n result = load(signal);\n } catch (error) {\n signal.removeEventListener('abort', abort);\n reject(error);\n return;\n }\n\n result.then(\n (value) => {\n signal.removeEventListener('abort', abort);\n resolve(value);\n },\n (error: unknown) => {\n signal.removeEventListener('abort', abort);\n reject(error);\n },\n );\n });\n\ntype FetchOptions<TState, TResult> = {\n load(signal: AbortSignal): Promise<TResult>;\n success(result: TResult): TState;\n commit?(state: TState, result: TResult): void;\n pending(previous: TState): TState;\n failure(previous: TState, error: Error): TState;\n};\n\ntype AsyncSource<TState> = Readonly<{\n readonly disposalSignal: AbortSignal;\n dispose(): void;\n readonly disposed: boolean;\n fetch<TResult>(options: FetchOptions<TState, TResult>): Promise<void>;\n readonly state: TState;\n subscribe(listener: (state: TState) => void): () => void;\n}>;\n\n/** Only the current request may commit; superseded work settles without changing source state. */\nexport function createAsyncSource<TState>(initial: TState): AsyncSource<TState> {\n const store = createSourceStore(initial);\n const requests = createRequestController();\n\n return {\n get disposalSignal() {\n return store.disposalSignal;\n },\n\n dispose() {\n requests.dispose();\n store.dispose();\n },\n\n get disposed() {\n return store.disposed;\n },\n\n async fetch(options) {\n if (store.disposed) throw new SourcererDisposedError();\n\n const request = requests.begin();\n const previous = store.value;\n store.set(options.pending(previous));\n\n try {\n const result = await loadWithSignal(options.load, request.signal);\n if (!request.isCurrent() || store.disposed) return;\n\n const state = options.success(result);\n options.commit?.(state, result);\n store.set(state);\n } catch (reason: unknown) {\n if (!request.isCurrent() || store.disposed) return;\n\n const error = toError(reason);\n store.set(options.failure(previous, error));\n throw error;\n } finally {\n request.finish();\n }\n },\n\n get state() {\n return store.value;\n },\n\n subscribe: store.subscribe,\n };\n}\n","import { SourcererConfigurationError } from './errors';\nimport type { PagePagination } from './types';\n\nexport function positiveInteger(value: number, name: string): number {\n if (!Number.isInteger(value) || value < 1)\n throw new SourcererConfigurationError(`${name} must be a positive integer`);\n\n return value;\n}\n\nexport function totalItems(value: number): number {\n if (!Number.isInteger(value) || value < 0)\n throw new SourcererConfigurationError('totalItems must be a non-negative integer');\n\n return value;\n}\n\nexport function createPagePagination(page: number, pageSize: number, total: number): PagePagination {\n const pageCount = Math.max(1, Math.ceil(total / pageSize));\n\n return {\n hasNext: page < pageCount,\n hasPrevious: page > 1,\n page,\n pageCount,\n pageSize,\n totalItems: total,\n };\n}\n","import { createAsyncSource } from './asyncSource';\nimport { SourcererConfigurationError, SourcererDisposedError } from './errors';\nimport { positiveInteger, totalItems } from './pagination';\nimport type { CursorPagination, CursorResult, CursorSource, CursorSourceConfig, CursorSourceState } from './types';\n\ntype Request<TParams, TCursor> = Readonly<{\n after?: TCursor;\n before?: TCursor;\n pageSize: number;\n params: TParams;\n}>;\n\nconst createPagination = <TCursor>(\n pageSize: number,\n result?: CursorResult<unknown, TCursor>,\n): CursorPagination<TCursor> => ({\n ...(result?.nextCursor !== undefined && { nextCursor: result.nextCursor }),\n pageSize,\n ...(result?.previousCursor !== undefined && { previousCursor: result.previousCursor }),\n ...(result?.totalItems !== undefined && { totalItems: totalItems(result.totalItems) }),\n});\n\n/** Cursor sources retain committed items and cursors while replacement work is pending. */\nexport function createCursorSource<T, TParams = undefined, TCursor = string>(\n config: CursorSourceConfig<T, TParams, TCursor>,\n): CursorSource<T, TParams, TCursor> {\n if (config.after !== undefined && config.before !== undefined) {\n throw new SourcererConfigurationError('Cursor source cannot start with both after and before');\n }\n\n let requested: Request<TParams, TCursor> = {\n ...(config.after !== undefined && { after: config.after }),\n ...(config.before !== undefined && { before: config.before }),\n pageSize: positiveInteger(config.pageSize ?? 20, 'pageSize'),\n params: config.params as TParams,\n };\n const asyncSource = createAsyncSource<CursorSourceState<T, TParams, TCursor>>({\n error: null,\n items: [],\n loading: false,\n pagination: createPagination(requested.pageSize),\n params: requested.params,\n });\n const assertLive = (): void => {\n if (asyncSource.disposed) throw new SourcererDisposedError();\n };\n\n const fetch = (request: Request<TParams, TCursor>): Promise<void> =>\n asyncSource.fetch({\n failure: (previous, error) => ({ ...previous, error, loading: false, pendingParams: undefined }),\n load: (signal) => config.load({ ...request, signal }),\n pending: (previous) => ({\n ...previous,\n error: null,\n loading: true,\n ...(Object.is(request.params, previous.params) ? {} : { pendingParams: request.params }),\n }),\n success: (result) => ({\n error: null,\n items: [...result.items],\n loading: false,\n pagination: createPagination(request.pageSize, result),\n params: request.params,\n }),\n });\n\n const source: CursorSource<T, TParams, TCursor> = {\n get disposalSignal() {\n return asyncSource.disposalSignal;\n },\n\n dispose: asyncSource.dispose,\n\n get disposed() {\n return asyncSource.disposed;\n },\n\n async next() {\n assertLive();\n const cursor = asyncSource.state.pagination.nextCursor;\n if (asyncSource.state.loading || cursor === undefined) return;\n requested = { after: cursor, pageSize: requested.pageSize, params: requested.params };\n await fetch(requested);\n },\n\n async previous() {\n assertLive();\n const cursor = asyncSource.state.pagination.previousCursor;\n if (asyncSource.state.loading || cursor === undefined) return;\n requested = { before: cursor, pageSize: requested.pageSize, params: requested.params };\n await fetch(requested);\n },\n\n reload() {\n return fetch(requested);\n },\n\n async setPageSize(pageSize) {\n assertLive();\n const normalized = positiveInteger(pageSize, 'pageSize');\n if (normalized === requested.pageSize && requested.after === undefined && requested.before === undefined) {\n if (\n asyncSource.state.loading ||\n (asyncSource.state.pagination.pageSize === normalized &&\n Object.is(asyncSource.state.params, requested.params))\n )\n return;\n await fetch(requested);\n return;\n }\n requested = { pageSize: normalized, params: requested.params };\n await fetch(requested);\n },\n\n async setParams(params) {\n assertLive();\n if (Object.is(params, requested.params)) {\n if (!asyncSource.state.loading && !Object.is(params, asyncSource.state.params)) await fetch(requested);\n return;\n }\n requested = { pageSize: requested.pageSize, params };\n await fetch(requested);\n },\n\n get state() {\n return asyncSource.state;\n },\n\n subscribe: asyncSource.subscribe,\n\n [Symbol.dispose]() {\n source.dispose();\n },\n };\n\n return source;\n}\n","import { createAsyncSource } from './asyncSource';\nimport { SourcererDisposedError } from './errors';\nimport { positiveInteger, totalItems } from './pagination';\nimport type { InfinitePagination, InfiniteSource, InfiniteSourceConfig, InfiniteSourceState } from './types';\n\ntype Request<TParams> = Readonly<{ pageSize: number; params: TParams }>;\n\nconst createPagination = (loadedItems: number, pageSize: number, total: number): InfinitePagination => ({\n hasMore: loadedItems < total,\n loadedItems,\n pageSize,\n totalItems: total,\n});\n\n/** Infinite sources retain committed items while replacement work is pending. */\nexport function createInfiniteSource<T, TParams = undefined>(\n config: InfiniteSourceConfig<T, TParams>,\n): InfiniteSource<T, TParams> {\n let requested: Request<TParams> = {\n pageSize: positiveInteger(config.pageSize ?? 20, 'pageSize'),\n params: config.params as TParams,\n };\n let nextPage = 1;\n let hasLoaded = false;\n const asyncSource = createAsyncSource<InfiniteSourceState<T, TParams>>({\n error: null,\n items: [],\n loading: false,\n pagination: createPagination(0, requested.pageSize, 0),\n params: requested.params,\n });\n const assertLive = (): void => {\n if (asyncSource.disposed) throw new SourcererDisposedError();\n };\n\n const fetch = (request: Request<TParams>, page: number, append: boolean): Promise<void> => {\n const loadedItems = asyncSource.state.items;\n\n return asyncSource.fetch({\n commit: () => {\n hasLoaded = true;\n nextPage = page + 1;\n requested = request;\n },\n failure: (previous, error) => ({ ...previous, error, loading: false, pendingParams: undefined }),\n load: (signal) => config.load({ page, pageSize: request.pageSize, params: request.params, signal }),\n pending: (previous) => ({\n ...previous,\n error: null,\n loading: true,\n ...(append || Object.is(request.params, previous.params) ? {} : { pendingParams: request.params }),\n }),\n success: (result) => {\n const items = append ? [...loadedItems, ...result.items] : [...result.items];\n return {\n error: null,\n items,\n loading: false,\n pagination: createPagination(items.length, request.pageSize, totalItems(result.totalItems)),\n params: request.params,\n };\n },\n });\n };\n\n const reload = (): Promise<void> => fetch(requested, 1, false);\n\n const source: InfiniteSource<T, TParams> = {\n get disposalSignal() {\n return asyncSource.disposalSignal;\n },\n\n dispose: asyncSource.dispose,\n\n get disposed() {\n return asyncSource.disposed;\n },\n\n async loadMore() {\n assertLive();\n if (asyncSource.state.loading) return;\n if (!hasLoaded || !Object.is(requested.params, asyncSource.state.params)) {\n await reload();\n return;\n }\n if (asyncSource.state.pagination.hasMore) await fetch(requested, nextPage, true);\n },\n\n reload,\n\n async setPageSize(pageSize) {\n assertLive();\n const normalized = positiveInteger(pageSize, 'pageSize');\n if (normalized === requested.pageSize) {\n if (asyncSource.state.loading || asyncSource.state.pagination.pageSize === normalized) return;\n await reload();\n return;\n }\n requested = { ...requested, pageSize: normalized };\n nextPage = 1;\n await reload();\n },\n\n async setParams(params) {\n assertLive();\n if (Object.is(params, requested.params)) {\n if (!asyncSource.state.loading && !Object.is(params, asyncSource.state.params)) await reload();\n return;\n }\n requested = { ...requested, params };\n nextPage = 1;\n await reload();\n },\n\n get state() {\n return asyncSource.state;\n },\n\n subscribe: asyncSource.subscribe,\n\n [Symbol.dispose]() {\n source.dispose();\n },\n };\n\n return source;\n}\n","import { SourcererDisposedError } from './errors';\nimport { createPagePagination, positiveInteger } from './pagination';\nimport { createSourceStore } from './sourceStore';\nimport type { LocalSource, LocalSourceConfig, LocalSourceState, PagePagination } from './types';\n\n/** Local sources filter and paginate an in-memory collection synchronously. */\nexport function createLocalSource<T>(items: readonly T[]): LocalSource<T>;\nexport function createLocalSource<T, TParams = undefined>(\n items: readonly T[],\n config: LocalSourceConfig<T, TParams>,\n): LocalSource<T, TParams>;\nexport function createLocalSource<T, TParams = undefined>(\n items: readonly T[],\n config: LocalSourceConfig<T, TParams> = {} as LocalSourceConfig<T, TParams>,\n): LocalSource<T, TParams> {\n let allItems = items;\n let page = 1;\n let pageSize = positiveInteger(config.pageSize ?? 20, 'pageSize');\n let params = config.params as TParams;\n\n const buildState = (): LocalSourceState<T, TParams> => {\n const filtered = config.filter ? allItems.filter((item) => config.filter?.(item, params)) : allItems;\n const pagination = createPagePagination(page, pageSize, filtered.length);\n if (page > pagination.pageCount) {\n page = pagination.pageCount;\n return buildState();\n }\n const start = (page - 1) * pageSize;\n\n return {\n error: null,\n items: filtered.slice(start, start + pageSize),\n loading: false,\n pagination,\n params,\n };\n };\n\n const store = createSourceStore(buildState());\n const assertLive = (): void => {\n if (store.disposed) throw new SourcererDisposedError();\n };\n const samePagination = (left: PagePagination, right: PagePagination): boolean =>\n Object.keys(left).every((key) => left[key as keyof PagePagination] === right[key as keyof PagePagination]);\n const commit = (): void => {\n const next = buildState();\n const current = store.value;\n const sameItems =\n next.items.length === current.items.length &&\n next.items.every((item, index) => Object.is(item, current.items[index]));\n\n if (Object.is(next.params, current.params) && sameItems && samePagination(next.pagination, current.pagination))\n return;\n store.set(next);\n };\n const goTo = (nextPage: number): void => {\n assertLive();\n const normalized = Math.min(positiveInteger(nextPage, 'page'), store.value.pagination.pageCount);\n if (normalized === page) return;\n page = normalized;\n commit();\n };\n\n const source: LocalSource<T, TParams> = {\n get disposalSignal() {\n return store.disposalSignal;\n },\n\n dispose: store.dispose,\n\n get disposed() {\n return store.disposed;\n },\n\n first() {\n goTo(1);\n },\n\n goTo,\n\n last() {\n goTo(store.value.pagination.pageCount);\n },\n\n next() {\n if (store.value.pagination.hasNext) goTo(page + 1);\n else assertLive();\n },\n\n previous() {\n if (store.value.pagination.hasPrevious) goTo(page - 1);\n else assertLive();\n },\n\n setItems(nextItems) {\n assertLive();\n if (nextItems === allItems) return;\n allItems = nextItems;\n commit();\n },\n\n setPageSize(nextPageSize) {\n assertLive();\n const normalized = positiveInteger(nextPageSize, 'pageSize');\n if (normalized === pageSize) return;\n page = 1;\n pageSize = normalized;\n commit();\n },\n\n setParams(nextParams) {\n assertLive();\n if (Object.is(nextParams, params)) return;\n page = 1;\n params = nextParams;\n commit();\n },\n\n get state() {\n return store.value;\n },\n\n subscribe: store.subscribe,\n\n [Symbol.dispose]() {\n source.dispose();\n },\n };\n\n return source;\n}\n","import { createAsyncSource } from './asyncSource';\nimport { SourcererDisposedError } from './errors';\nimport { createPagePagination, positiveInteger, totalItems } from './pagination';\nimport type { PageSource, PageSourceConfig, PageSourceState } from './types';\n\ntype Request<TParams> = Readonly<{ page: number; pageSize: number; params: TParams }>;\n\n/** Page sources retain committed items while replacement work is pending. */\nexport function createPageSource<T, TParams = undefined>(config: PageSourceConfig<T, TParams>): PageSource<T, TParams> {\n let requested: Request<TParams> = {\n page: 1,\n pageSize: positiveInteger(config.pageSize ?? 20, 'pageSize'),\n params: config.params as TParams,\n };\n let hasLoaded = false;\n const asyncSource = createAsyncSource<PageSourceState<T, TParams>>({\n error: null,\n items: [],\n loading: false,\n pagination: createPagePagination(requested.page, requested.pageSize, 0),\n params: requested.params,\n });\n const assertLive = (): void => {\n if (asyncSource.disposed) throw new SourcererDisposedError();\n };\n const isCommitted = (request: Request<TParams>): boolean =>\n asyncSource.state.pagination.page === request.page &&\n asyncSource.state.pagination.pageSize === request.pageSize &&\n Object.is(asyncSource.state.params, request.params);\n\n const fetch = (request: Request<TParams>): Promise<void> =>\n asyncSource.fetch({\n commit: () => {\n hasLoaded = true;\n requested = request;\n },\n failure: (previous, error) => ({ ...previous, error, loading: false, pendingParams: undefined }),\n load: (signal) => config.load({ ...request, signal }),\n pending: (previous) => ({\n ...previous,\n error: null,\n loading: true,\n ...(Object.is(request.params, previous.params) ? {} : { pendingParams: request.params }),\n }),\n success: (result) => ({\n error: null,\n items: [...result.items],\n loading: false,\n pagination: createPagePagination(request.page, request.pageSize, totalItems(result.totalItems)),\n params: request.params,\n }),\n });\n\n const goTo = async (page: number): Promise<void> => {\n assertLive();\n const normalized = hasLoaded\n ? Math.min(positiveInteger(page, 'page'), asyncSource.state.pagination.pageCount)\n : positiveInteger(page, 'page');\n if (normalized === requested.page) {\n if (!asyncSource.state.loading && (!hasLoaded || !isCommitted(requested))) await fetch(requested);\n return;\n }\n requested = { ...requested, page: normalized };\n await fetch(requested);\n };\n\n const source: PageSource<T, TParams> = {\n get disposalSignal() {\n return asyncSource.disposalSignal;\n },\n\n dispose: asyncSource.dispose,\n\n get disposed() {\n return asyncSource.disposed;\n },\n\n first() {\n return goTo(1);\n },\n\n goTo,\n\n last() {\n return goTo(asyncSource.state.pagination.pageCount);\n },\n\n async next() {\n assertLive();\n if (!hasLoaded || requested.page < asyncSource.state.pagination.pageCount) await goTo(requested.page + 1);\n },\n\n async previous() {\n assertLive();\n if (requested.page > 1) await goTo(requested.page - 1);\n },\n\n reload() {\n return fetch(requested);\n },\n\n async setPageSize(pageSize) {\n assertLive();\n const normalized = positiveInteger(pageSize, 'pageSize');\n if (normalized === requested.pageSize && requested.page === 1) {\n if (!asyncSource.state.loading && !isCommitted(requested)) await fetch(requested);\n return;\n }\n requested = { ...requested, page: 1, pageSize: normalized };\n await fetch(requested);\n },\n\n async setParams(params) {\n assertLive();\n if (Object.is(params, requested.params)) {\n if (!asyncSource.state.loading && !isCommitted(requested)) await fetch(requested);\n return;\n }\n requested = { ...requested, page: 1, params };\n await fetch(requested);\n },\n\n get state() {\n return asyncSource.state;\n },\n\n subscribe: asyncSource.subscribe,\n\n [Symbol.dispose]() {\n source.dispose();\n },\n };\n\n return source;\n}\n"],"mappings":"+CACA,IAAa,EAAb,cAAoC,KAAM,CACxC,OAA0B,UAAoB,iBAE9C,YAAY,EAAiB,EAAqB,CAChD,MAAM,EAAS,CAAI,EACnB,KAAK,KAAQ,WAAqC,UAClD,OAAO,eAAe,KAAM,WAAW,SAAS,CAClD,CACF,EAGa,EAAb,cAAiD,CAAe,CAC9D,OAAmC,UAAY,6BACjD,EAEa,EAAb,cAA4C,CAAe,CACzD,OAAmC,UAAY,yBAE/C,YAAY,EAAU,4BAA6B,CACjD,MAAM,CAAO,CACf,CACF,ECVA,SAAgB,GAA6C,CAC3D,IAAI,EACA,EAAW,EAEf,MAAO,CACL,OAAQ,CACN,GAAQ,MAAM,EAEd,IAAM,EAAa,IAAI,gBACjB,EAAkB,EAAE,EAI1B,MAFA,GAAS,EAEF,C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AAO,CAAC,CAC1G,EAEA,MAAM,UAAW,CACf,EAAW,EACP,EAAU,KAAO,GAAG,MAAM,EAAK,EAAU,KAAO,CAAC,CACvD,EAEA,QAAS,CACP,OAAO,EAAM,CAAS,CACxB,EAEA,MAAM,YAAY,EAAU,CAC1B,EAAW,EACX,IAAM,EAAa,EAAgB,EAAU,UAAU,EACvD,GAAI,IAAe,EAAU,UAAY,EAAU,OAAS,EAAG,CACzD,CAAC,EAAY,MAAM,SAAW,CAAC,EAAY,CAAS,GAAG,MAAM,EAAM,CAAS,EAChF,MACF,CACA,EAAY,CAAE,GAAG,EAAW,KAAM,EAAG,SAAU,CAAW,EAC1D,MAAM,EAAM,CAAS,CACvB,EAEA,MAAM,UAAU,EAAQ,CAEtB,GADA,EAAW,EACP,OAAO,GAAG,EAAQ,EAAU,MAAM,EAAG,CACnC,CAAC,EAAY,MAAM,SAAW,CAAC,EAAY,CAAS,GAAG,MAAM,EAAM,CAAS,EAChF,MACF,CACA,EAAY,CAAE,GAAG,EAAW,KAAM,EAAG,QAAO,EAC5C,MAAM,EAAM,CAAS,CACvB,EAEA,IAAI,OAAQ,CACV,OAAO,EAAY,KACrB,EAEA,UAAW,EAAY,UAEvB,CAAC,OAAO,UAAW,CACjB,EAAO,QAAQ,CACjB,CACF,EAEA,OAAO,CACT"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,159 +1,172 @@
|
|
|
1
|
-
export type Disposable = {
|
|
2
|
-
[Symbol.dispose](): void;
|
|
3
|
-
readonly disposalSignal: AbortSignal;
|
|
4
|
-
dispose(): void;
|
|
5
|
-
readonly disposed: boolean;
|
|
6
|
-
};
|
|
7
1
|
export type PagePagination = Readonly<{
|
|
8
|
-
count: number;
|
|
9
2
|
hasNext: boolean;
|
|
10
3
|
hasPrevious: boolean;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
page: number;
|
|
5
|
+
pageCount: number;
|
|
6
|
+
pageSize: number;
|
|
7
|
+
totalItems: number;
|
|
15
8
|
}>;
|
|
16
9
|
export type CursorPagination<TCursor = string> = Readonly<{
|
|
17
|
-
hasNext: boolean;
|
|
18
|
-
hasPrevious: boolean;
|
|
19
|
-
kind: 'cursor';
|
|
20
10
|
nextCursor?: TCursor;
|
|
11
|
+
pageSize: number;
|
|
21
12
|
previousCursor?: TCursor;
|
|
22
|
-
|
|
13
|
+
totalItems?: number;
|
|
23
14
|
}>;
|
|
24
15
|
export type InfinitePagination = Readonly<{
|
|
25
16
|
hasMore: boolean;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
loadedItems: number;
|
|
18
|
+
pageSize: number;
|
|
19
|
+
totalItems: number;
|
|
29
20
|
}>;
|
|
30
|
-
export type
|
|
31
|
-
/** Loaded state remains internally consistent while pendingQuery describes newer work. */
|
|
32
|
-
export type SourceSnapshot<T, TQuery, TPagination extends AnyPagination = AnyPagination> = Readonly<{
|
|
33
|
-
data: readonly T[];
|
|
21
|
+
export type PageSourceState<T, TParams = undefined> = Readonly<{
|
|
34
22
|
error: Error | null;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
items: readonly T[];
|
|
24
|
+
loading: boolean;
|
|
25
|
+
pagination: PagePagination;
|
|
26
|
+
params: TParams;
|
|
27
|
+
pendingParams?: TParams;
|
|
39
28
|
}>;
|
|
40
|
-
export type
|
|
41
|
-
readonly snapshot: SourceSnapshot<T, TQuery, TPagination>;
|
|
42
|
-
subscribe(listener: (snapshot: SourceSnapshot<T, TQuery, TPagination>) => void): () => void;
|
|
43
|
-
};
|
|
44
|
-
export type PageQuery<TFilter = unknown, TSort = unknown> = Readonly<{
|
|
45
|
-
filter?: TFilter;
|
|
29
|
+
export type PageLoadContext<TParams = undefined> = Readonly<{
|
|
46
30
|
page: number;
|
|
47
31
|
pageSize: number;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}>;
|
|
51
|
-
export type PageQueryPatch<TFilter = unknown, TSort = unknown> = Readonly<{
|
|
52
|
-
filter?: TFilter | undefined;
|
|
53
|
-
page?: number;
|
|
54
|
-
pageSize?: number;
|
|
55
|
-
search?: string;
|
|
56
|
-
sort?: TSort | undefined;
|
|
32
|
+
params: TParams;
|
|
33
|
+
signal: AbortSignal;
|
|
57
34
|
}>;
|
|
58
35
|
export type PageResult<T> = Readonly<{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}>;
|
|
62
|
-
export type LoadContext<TQuery> = Readonly<{
|
|
63
|
-
query: TQuery;
|
|
64
|
-
signal: AbortSignal;
|
|
36
|
+
items: readonly T[];
|
|
37
|
+
totalItems: number;
|
|
65
38
|
}>;
|
|
66
|
-
export type PageSource<T,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
39
|
+
export type PageSource<T, TParams = undefined> = {
|
|
40
|
+
[Symbol.dispose](): void;
|
|
41
|
+
readonly disposalSignal: AbortSignal;
|
|
42
|
+
dispose(): void;
|
|
43
|
+
readonly disposed: boolean;
|
|
44
|
+
first(): Promise<void>;
|
|
45
|
+
goTo(page: number): Promise<void>;
|
|
46
|
+
last(): Promise<void>;
|
|
47
|
+
next(): Promise<void>;
|
|
48
|
+
previous(): Promise<void>;
|
|
73
49
|
reload(): Promise<void>;
|
|
74
|
-
|
|
50
|
+
setPageSize(pageSize: number): Promise<void>;
|
|
51
|
+
setParams(params: TParams): Promise<void>;
|
|
52
|
+
readonly state: PageSourceState<T, TParams>;
|
|
53
|
+
subscribe(listener: (state: PageSourceState<T, TParams>) => void): () => void;
|
|
75
54
|
};
|
|
76
|
-
export type PageSourceConfig<T,
|
|
77
|
-
|
|
78
|
-
initialQuery?: PageQueryPatch<TFilter, TSort>;
|
|
79
|
-
load(context: LoadContext<PageQuery<TFilter, TSort>>): Promise<PageResult<T>>;
|
|
80
|
-
}>;
|
|
81
|
-
export type LocalQuery = Readonly<{
|
|
82
|
-
page: number;
|
|
83
|
-
pageSize: number;
|
|
84
|
-
search: string;
|
|
85
|
-
}>;
|
|
86
|
-
export type LocalQueryPatch = Readonly<{
|
|
87
|
-
page?: number;
|
|
55
|
+
export type PageSourceConfig<T, TParams = undefined> = Readonly<{
|
|
56
|
+
load(context: PageLoadContext<TParams>): Promise<PageResult<T>>;
|
|
88
57
|
pageSize?: number;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
58
|
+
} & (undefined extends TParams ? {
|
|
59
|
+
params?: TParams;
|
|
60
|
+
} : {
|
|
61
|
+
params: TParams;
|
|
62
|
+
})>;
|
|
63
|
+
export type LocalSourceState<T, TParams = undefined> = Readonly<{
|
|
64
|
+
error: null;
|
|
65
|
+
items: readonly T[];
|
|
66
|
+
loading: false;
|
|
67
|
+
pagination: PagePagination;
|
|
68
|
+
params: TParams;
|
|
69
|
+
}>;
|
|
70
|
+
export type LocalSource<T, TParams = undefined> = {
|
|
71
|
+
[Symbol.dispose](): void;
|
|
72
|
+
readonly disposalSignal: AbortSignal;
|
|
73
|
+
dispose(): void;
|
|
74
|
+
readonly disposed: boolean;
|
|
75
|
+
first(): void;
|
|
76
|
+
goTo(page: number): void;
|
|
77
|
+
last(): void;
|
|
78
|
+
next(): void;
|
|
79
|
+
previous(): void;
|
|
80
|
+
setItems(items: readonly T[]): void;
|
|
81
|
+
setPageSize(pageSize: number): void;
|
|
82
|
+
setParams(params: TParams): void;
|
|
83
|
+
readonly state: LocalSourceState<T, TParams>;
|
|
84
|
+
subscribe(listener: (state: LocalSourceState<T, TParams>) => void): () => void;
|
|
100
85
|
};
|
|
101
|
-
export type LocalSourceConfig<T> = Readonly<{
|
|
102
|
-
|
|
103
|
-
|
|
86
|
+
export type LocalSourceConfig<T, TParams = undefined> = Readonly<{
|
|
87
|
+
filter?: (item: T, params: TParams) => boolean;
|
|
88
|
+
pageSize?: number;
|
|
89
|
+
} & (undefined extends TParams ? {
|
|
90
|
+
params?: TParams;
|
|
91
|
+
} : {
|
|
92
|
+
params: TParams;
|
|
93
|
+
})>;
|
|
94
|
+
export type CursorSourceState<T, TParams = undefined, TCursor = string> = Readonly<{
|
|
95
|
+
error: Error | null;
|
|
96
|
+
items: readonly T[];
|
|
97
|
+
loading: boolean;
|
|
98
|
+
pagination: CursorPagination<TCursor>;
|
|
99
|
+
params: TParams;
|
|
100
|
+
pendingParams?: TParams;
|
|
104
101
|
}>;
|
|
105
|
-
export type
|
|
102
|
+
export type CursorLoadContext<TParams = undefined, TCursor = string> = Readonly<{
|
|
106
103
|
after?: TCursor;
|
|
107
104
|
before?: TCursor;
|
|
108
105
|
pageSize: number;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
export type CursorQueryPatch<TCursor = string> = Readonly<{
|
|
112
|
-
after?: TCursor | undefined;
|
|
113
|
-
before?: TCursor | undefined;
|
|
114
|
-
pageSize?: number;
|
|
115
|
-
search?: string;
|
|
106
|
+
params: TParams;
|
|
107
|
+
signal: AbortSignal;
|
|
116
108
|
}>;
|
|
117
109
|
export type CursorResult<T, TCursor = string> = Readonly<{
|
|
118
|
-
|
|
110
|
+
items: readonly T[];
|
|
119
111
|
nextCursor?: TCursor;
|
|
120
112
|
previousCursor?: TCursor;
|
|
121
|
-
|
|
113
|
+
totalItems?: number;
|
|
122
114
|
}>;
|
|
123
|
-
export type CursorSource<T, TCursor = string> =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
115
|
+
export type CursorSource<T, TParams = undefined, TCursor = string> = {
|
|
116
|
+
[Symbol.dispose](): void;
|
|
117
|
+
readonly disposalSignal: AbortSignal;
|
|
118
|
+
dispose(): void;
|
|
119
|
+
readonly disposed: boolean;
|
|
120
|
+
next(): Promise<void>;
|
|
121
|
+
previous(): Promise<void>;
|
|
128
122
|
reload(): Promise<void>;
|
|
129
|
-
|
|
123
|
+
setPageSize(pageSize: number): Promise<void>;
|
|
124
|
+
setParams(params: TParams): Promise<void>;
|
|
125
|
+
readonly state: CursorSourceState<T, TParams, TCursor>;
|
|
126
|
+
subscribe(listener: (state: CursorSourceState<T, TParams, TCursor>) => void): () => void;
|
|
130
127
|
};
|
|
131
|
-
export type CursorSourceConfig<T, TCursor = string> = Readonly<{
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
load(context:
|
|
135
|
-
}>;
|
|
136
|
-
export type InfiniteQuery = Readonly<{
|
|
137
|
-
pageSize: number;
|
|
138
|
-
search: string;
|
|
139
|
-
}>;
|
|
140
|
-
export type InfiniteQueryPatch = Readonly<{
|
|
128
|
+
export type CursorSourceConfig<T, TParams = undefined, TCursor = string> = Readonly<{
|
|
129
|
+
after?: TCursor;
|
|
130
|
+
before?: TCursor;
|
|
131
|
+
load(context: CursorLoadContext<TParams, TCursor>): Promise<CursorResult<T, TCursor>>;
|
|
141
132
|
pageSize?: number;
|
|
142
|
-
|
|
133
|
+
} & (undefined extends TParams ? {
|
|
134
|
+
params?: TParams;
|
|
135
|
+
} : {
|
|
136
|
+
params: TParams;
|
|
137
|
+
})>;
|
|
138
|
+
export type InfiniteSourceState<T, TParams = undefined> = Readonly<{
|
|
139
|
+
error: Error | null;
|
|
140
|
+
items: readonly T[];
|
|
141
|
+
loading: boolean;
|
|
142
|
+
pagination: InfinitePagination;
|
|
143
|
+
params: TParams;
|
|
144
|
+
pendingParams?: TParams;
|
|
143
145
|
}>;
|
|
144
|
-
export type
|
|
146
|
+
export type InfiniteLoadContext<TParams = undefined> = Readonly<{
|
|
145
147
|
page: number;
|
|
146
148
|
pageSize: number;
|
|
147
|
-
|
|
149
|
+
params: TParams;
|
|
150
|
+
signal: AbortSignal;
|
|
148
151
|
}>;
|
|
149
|
-
export type InfiniteSource<T
|
|
152
|
+
export type InfiniteSource<T, TParams = undefined> = {
|
|
153
|
+
[Symbol.dispose](): void;
|
|
154
|
+
readonly disposalSignal: AbortSignal;
|
|
155
|
+
dispose(): void;
|
|
156
|
+
readonly disposed: boolean;
|
|
150
157
|
loadMore(): Promise<void>;
|
|
151
158
|
reload(): Promise<void>;
|
|
152
|
-
|
|
159
|
+
setPageSize(pageSize: number): Promise<void>;
|
|
160
|
+
setParams(params: TParams): Promise<void>;
|
|
161
|
+
readonly state: InfiniteSourceState<T, TParams>;
|
|
162
|
+
subscribe(listener: (state: InfiniteSourceState<T, TParams>) => void): () => void;
|
|
153
163
|
};
|
|
154
|
-
export type InfiniteSourceConfig<T> = Readonly<{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
164
|
+
export type InfiniteSourceConfig<T, TParams = undefined> = Readonly<{
|
|
165
|
+
load(context: InfiniteLoadContext<TParams>): Promise<PageResult<T>>;
|
|
166
|
+
pageSize?: number;
|
|
167
|
+
} & (undefined extends TParams ? {
|
|
168
|
+
params?: TParams;
|
|
169
|
+
} : {
|
|
170
|
+
params: TParams;
|
|
171
|
+
})>;
|
|
159
172
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,gBAAgB,CAAC,OAAO,GAAG,MAAM,IAAI,QAAQ,CAAC;IACxD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,c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C7E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vielzeug/sourcerer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Framework-agnostic reactive collection sources with local, page, cursor, and infinite pagination",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,19 +30,23 @@
|
|
|
30
30
|
"registry": "https://registry.npmjs.org/"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "vite build && pnpm run build:bundle && pnpm run build:types",
|
|
33
|
+
"build": "vite build && pnpm --silent run build:bundle && pnpm --silent run build:types && pnpm --silent run verify:exports",
|
|
34
34
|
"build:bundle": "vite build --config vite.bundle.config.ts",
|
|
35
35
|
"build:types": "tsc -p tsconfig.declarations.json",
|
|
36
36
|
"fix": "biome check --write src",
|
|
37
37
|
"lint": "biome ci src",
|
|
38
|
-
"prepublishOnly": "pnpm run build",
|
|
38
|
+
"prepublishOnly": "pnpm --silent run build",
|
|
39
39
|
"preview": "vite preview",
|
|
40
|
-
"test": "vitest"
|
|
40
|
+
"test": "vitest",
|
|
41
|
+
"verify:exports": "node verify-exports.mjs"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@vielzeug/arsenal": "3.0.0"
|
|
41
45
|
},
|
|
42
46
|
"devDependencies": {
|
|
43
|
-
"@types/node": "^26.
|
|
47
|
+
"@types/node": "^26.4.1",
|
|
44
48
|
"typescript": "^6.0.3",
|
|
45
|
-
"vite": "^8.2.
|
|
46
|
-
"vitest": "^
|
|
49
|
+
"vite": "^8.2.2",
|
|
50
|
+
"vitest": "^5.0.0"
|
|
47
51
|
}
|
|
48
52
|
}
|
package/dist/_dev.cjs
DELETED
package/dist/_dev.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_dev.cjs","names":[],"sources":["../src/_dev.ts"],"sourcesContent":["const isDev = !(globalThis as { __SOURCERER_PROD__?: boolean }).__SOURCERER_PROD__;\n\n/** @internal */\nexport function warn(msg: string): void {\n if (isDev) console.warn(`[@vielzeug/sourcerer] ${msg}`);\n}\n"],"mappings":"AAGA,SAAgB,EAAK,EAAmB,CAExC"}
|
package/dist/_dev.d.ts
DELETED
package/dist/_dev.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_dev.d.ts","sourceRoot":"","sources":["../src/_dev.ts"],"names":[],"mappings":""}
|
package/dist/_dev.js
DELETED
package/dist/_dev.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_dev.js","names":[],"sources":["../src/_dev.ts"],"sourcesContent":["const isDev = !(globalThis as { __SOURCERER_PROD__?: boolean }).__SOURCERER_PROD__;\n\n/** @internal */\nexport function warn(msg: string): void {\n if (isDev) console.warn(`[@vielzeug/sourcerer] ${msg}`);\n}\n"],"mappings":";AAGA,SAAgB,EAAK,GAAmB,CAExC"}
|