@burojs/pocketbase 0.2.0 → 0.5.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/index.cjs +338 -281
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -11
- package/dist/index.d.ts +13 -11
- package/dist/index.js +337 -279
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/data-provider.ts","../src/auth-provider.ts"],"names":[],"mappings":";;;AASA,SAAS,IAAI,KAAA,EAAwB;AACnC,EAAA,OAAO,CAAA,CAAA,EAAI,MAAA,CAAO,KAAK,CAAA,CAAE,OAAA,CAAQ,KAAA,EAAO,MAAM,CAAA,CAAE,OAAA,CAAQ,IAAA,EAAM,KAAK,CAAC,CAAA,CAAA,CAAA;AACtE;AAcO,IAAM,gCAAA,GAAmC;AAEhD,SAAS,mBAAA,CAAoB,OAAe,EAAA,EAAuB;AACjE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,YAAA;AAAA,IACN,IAAA,EAAM,gCAAA;AAAA,IACN,OAAA,EAAS,CAAA,yDAAA,EAA4D,EAAE,CAAA,OAAA,EAAU,KAAK,CAAA,GAAA;AAAA,GACxF;AACF;AAiCA,IAAM,IAAA,GAAmB,EAAE,IAAA,EAAM,MAAA,EAAO;AACxC,IAAM,WAAW,CAAC,KAAA,MAAgC,EAAE,IAAA,EAAM,SAAS,KAAA,EAAM,CAAA;AAwBzE,IAAM,iBAAA,GAAoB,mBAAA;AAY1B,SAAS,OAAA,CAAQ,UAA8B,EAAA,EAA8B;AAC3E,EAAA,IAAI,SAAS,MAAA,KAAW,CAAA,EAAG,OAAO,QAAA,CAAS,OAAO,KAAK,CAAA;AACvD,EAAA,MAAM,YAAY,EAAA,KAAO,IAAA;AACzB,EAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,GAAA,CAAI,eAAe,CAAA;AA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AkB;AAC9B,MAAA,OAAO,EAAE,MAAA,EAAQ,WAAA,EAAa,KAAA,EAAM;AAAA,IACtC,CAAA;AAAA,IAEA,MAAM,WAAA,GAAc;AAClB,MAAA,MAAM,UAAU,IAAA,EAAK;AACrB,MAAA,IAAI,CAAC,SAAS,OAAO,IAAA;AACrB,MAAA,OAAO,EAAE,EAAA,EAAI,OAAA,CAAQ,MAAA,CAAO,EAAA,EAAI,IAAA,EAAM,OAAA,CAAQ,MAAA,CAAO,IAAA,IAAQ,OAAA,CAAQ,MAAA,CAAO,KAAA,EAAM;AAAA,IACpF;AAAA,GACF;AACF","file":"index.js","sourcesContent":["import { defineDataProvider, type DataError, type DataProvider, type RecordId } from '@burojs/core';\n\nexport interface PocketbaseDataProviderOpts {\n baseUrl: string;\n getToken: () => string | null;\n fetchImpl?: typeof fetch;\n}\n\n/** Escapes a value for a PocketBase filter string literal. */\nfunction lit(value: unknown): string {\n return `\"${String(value).replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"')}\"`;\n}\n\n/**\n * The shared refusal code for \"this provider cannot express that filter\n * operator\". `@burojs/hasura` exports the identical string as\n * `FILTER_OPERATOR_UNSUPPORTED_CODE` and throws the same `kind`, so an\n * application that handles one handles the other.\n *\n * The two packages do not import from each other (neither depends on the\n * other, and a shared constant would have to live in `@burojs/core`, which\n * owns the filter AST but not its transports). The agreement is therefore\n * pinned by a test that drives BOTH providers:\n * `examples/marketplace-ops/tests/provider-agreement.test.ts`.\n */\nexport const FILTER_OPERATOR_UNSUPPORTED_CODE = 'filter-operator-unsupported';\n\nfunction unsupportedOperator(field: string, op: string): DataError {\n return {\n kind: 'capability',\n code: FILTER_OPERATOR_UNSUPPORTED_CODE,\n message: `@burojs/pocketbase does not support the filter operator '${op}' (on '${field}').`,\n };\n}\n\n/**\n * What one filter node translated to. Three outcomes, not two — that missing\n * third outcome IS the defect this type exists to make unrepresentable.\n *\n * THE CLASS, stated once. The old signature was `string | undefined`, and\n * `undefined` carried two incompatible meanings at once:\n *\n * - \"no constraint was expressed here — drop me\" (no value supplied, an\n * unrecognised node), and\n * - \"this node is a constant\", which is what a BRANCHLESS COMBINATOR is:\n * `{and: []}` is vacuously TRUE, `{or: []}` is vacuously FALSE, `in: []`\n * is an empty-set membership test and therefore FALSE.\n *\n * Dropping a node is sound only when the node is TRUE and sits in an AND\n * position, where a TRUE conjunct is genuinely absorbed. Everywhere else —\n * under `not`, beside a disjunct in an `or`, or alone at the top level, where\n * the caller turns `undefined` into no `filter` param at all and the server\n * answers with EVERY row — dropping a false node inverts the query.\n *\n * The sibling `@burojs/hasura` closed the same class in `filtersToWhere` by\n * emitting `{_and: []}` / `{_or: []}` explicitly, because Hasura's `bool_exp`\n * has a literal for both truth values. PocketBase's filter grammar has none\n * (every term is `field op value`), so this half CANNOT emit a truth value as\n * a term; it folds instead and materialises only the one constant it cannot\n * fold away — see {@link MATCHES_NO_RECORD}.\n */\ntype FilterNode =\n | { readonly kind: 'expr'; readonly text: string }\n | { readonly kind: 'const'; readonly value: boolean }\n | { readonly kind: 'drop' };\n\nconst DROP: FilterNode = { kind: 'drop' };\nconst constant = (value: boolean): FilterNode => ({ kind: 'const', value });\n\n/**\n * A PocketBase filter expression that matches NO record.\n *\n * It has to be a real expression: PocketBase's filter grammar has no boolean\n * literal and no nullary operator — every term is `field op value`, combined\n * with `&&`, `||`, `!(…)` and parentheses (the grammar `@burojs/mock-kit`'s\n * `parsePbFilter` implements, and the one this file's own emitters produce).\n * So \"match nothing\" is spelled as a CONTRADICTION over a column that every\n * record has.\n *\n * Why this particular one: `id=\"\" && id!=\"\"` is false for every possible value\n * of `id`, by the definition of `=` / `!=` alone. It does not depend on what\n * `id` contains, on the collection's schema, or on PocketBase's own guarantee\n * that a record id is a non-empty 15-character string — that guarantee would\n * make the shorter `id=\"\"` sufficient, but the contradiction needs no such\n * premise and stays false under SQL three-valued logic too (a NULL comparison\n * is not TRUE, so the row is still excluded).\n *\n * There is no TRUE counterpart because none is ever needed: a TRUE node is\n * absorbed by every AND, collapses every OR to TRUE, and at the top level is\n * exactly \"send no `filter` param\", which already means every row.\n */\nconst MATCHES_NO_RECORD = '(id=\"\" && id!=\"\")';\n\n/**\n * Fold a combinator's branches. `op` supplies its own absorbing element\n * (FALSE for `and`, TRUE for `or`) and identity element (the other one).\n *\n * The branchless case is checked on the SOURCE array, before mapping, and is\n * deliberately NOT the same case as \"every branch mapped away because no VALUE\n * was supplied\". That second case still yields `drop`, and `@burojs/hasura`\n * drops on exactly the same condition — a missing or `undefined` value, never\n * on `''`, which both providers translate.\n */\nfunction combine(branches: readonly unknown[], op: 'and' | 'or'): FilterNode {\n if (branches.length === 0) return constant(op === 'and');\n const absorbing = op === 'or';\n const nodes = branches.map(translateFilter);\n if (nodes.some((node) => node.kind === 'const' && node.value === absorbing)) {\n return constant(absorbing);\n }\n const parts = nodes.flatMap((node) => (node.kind === 'expr' ? [node.text] : []));\n if (parts.length > 0)\n return { kind: 'expr', text: `(${parts.join(op === 'and' ? ' && ' : ' || ')})` };\n // Nothing left to write down. A surviving identity-element constant still\n // has to be reported as a constant (it may sit under a `not`); if there were\n // no constants at all, every branch was a drop and so is the combinator.\n return nodes.some((node) => node.kind === 'const') ? constant(!absorbing) : DROP;\n}\n\nfunction translateFilter(filter: unknown): FilterNode {\n if (filter === null || typeof filter !== 'object') return DROP;\n const candidate = filter as Record<string, unknown>;\n if (Array.isArray(candidate.and)) return combine(candidate.and, 'and');\n if (Array.isArray(candidate.or)) return combine(candidate.or, 'or');\n if ('not' in candidate) {\n const inner = translateFilter(candidate.not);\n if (inner.kind === 'drop') return DROP;\n if (inner.kind === 'const') return constant(!inner.value);\n return { kind: 'expr', text: `!(${inner.text})` };\n }\n if (typeof candidate.field !== 'string' || typeof candidate.op !== 'string') return DROP;\n\n const { field, op, value } = candidate;\n // `isNull`/`isNotNull` carry no value and are answered before the value\n // check, exactly as `@burojs/hasura` orders it.\n if (op === 'isNull') return { kind: 'expr', text: `${field}=null` };\n if (op === 'isNotNull') return { kind: 'expr', text: `${field}!=null` };\n // Missing / `undefined` value: no constraint was expressed, so drop — the\n // same rule, in the same position, as `@burojs/hasura`'s. Before this, an\n // absent value was stringified into the literal filter `a=\"undefined\"`,\n // which matches rows whose column really contains the text \"undefined\".\n //\n // `''` is deliberately NOT dropped, in either provider. See the matching\n // comment in `@burojs/hasura`'s `filtersToWhere`: the empty-search-box idiom\n // that motivated dropping it is already handled by `searchToFilter`\n // (`@burojs/core`), which never builds a predicate for an empty query, so\n // dropping it again here only cost the ordinary `eq: ''` case.\n if (!('value' in candidate) || value === undefined) return DROP;\n /**\n * The four set-valued operators. PocketBase has no native `in`; each is\n * expanded into an `||`/`&&` chain of comparisons, and an EMPTY chain is not\n * expressible in the grammar at all — which is precisely why the empty case\n * must become a folded constant rather than a dropped node.\n *\n * The two truth values come from set semantics, not from a capture (this\n * repo holds no captured PocketBase responses): `x ∈ ∅` is false, `x ∉ ∅` is\n * true, \"has any of ∅\" is false, and \"has all of ∅\" is vacuously true.\n */\n const chain = (\n join: ' || ' | ' && ',\n term: (entry: unknown) => string,\n empty: boolean,\n ): FilterNode => {\n if (!Array.isArray(value)) return DROP;\n if (value.length === 0) return constant(empty);\n return { kind: 'expr', text: `(${value.map(term).join(join)})` };\n };\n\n switch (op) {\n case 'eq':\n return { kind: 'expr', text: `${field}=${lit(value)}` };\n case 'neq':\n return { kind: 'expr', text: `${field}!=${lit(value)}` };\n case 'contains':\n return { kind: 'expr', text: `${field}~${lit(value)}` };\n case 'startsWith':\n return { kind: 'expr', text: `${field}~${lit(`${String(value)}%`)}` };\n case 'endsWith':\n return { kind: 'expr', text: `${field}~${lit(`%${String(value)}`)}` };\n case 'gt':\n return { kind: 'expr', text: `${field}>${lit(value)}` };\n case 'gte':\n return { kind: 'expr', text: `${field}>=${lit(value)}` };\n case 'lt':\n return { kind: 'expr', text: `${field}<${lit(value)}` };\n case 'lte':\n return { kind: 'expr', text: `${field}<=${lit(value)}` };\n case 'in':\n return chain(' || ', (entry) => `${field}=${lit(entry)}`, false);\n case 'notIn':\n return chain(' && ', (entry) => `${field}!=${lit(entry)}`, true);\n case 'has':\n return { kind: 'expr', text: `${field}~${lit(value)}` };\n case 'hasAny':\n return chain(' || ', (entry) => `${field}~${lit(entry)}`, false);\n case 'hasAll':\n return chain(' && ', (entry) => `${field}~${lit(entry)}`, true);\n // An operator this provider cannot express fails LOUDLY, and with the same\n // `kind` and `code` `@burojs/hasura` uses. It used to return DROP, i.e. \"no\n // constraint\" — so an unknown operator quietly matched every record here\n // while the sibling quietly turned it into `_eq`. Two silent, DIFFERENT\n // wrong answers for one input is the same defect class as the branchless\n // combinators, one hop out.\n default:\n throw unsupportedOperator(field, op);\n }\n}\n\n/**\n * Translate a portable filter expression into a PocketBase `filter` string.\n *\n * `undefined` means **matches every record** — send no `filter` param. It is\n * the answer for both a constraint-free filter and a filter that folds to\n * TRUE; the two are indistinguishable on the wire and there is nothing to\n * gain by distinguishing them.\n *\n * A filter that folds to FALSE returns {@link MATCHES_NO_RECORD} — a real\n * expression that matches nothing — never `undefined`. Returning `undefined`\n * for it is the inversion described on {@link FilterNode}: the caller omits\n * the param and PocketBase answers with every row.\n */\nexport function filterExpression(filter: unknown): string | undefined {\n const node = translateFilter(filter);\n if (node.kind === 'expr') return node.text;\n if (node.kind === 'const') return node.value ? undefined : MATCHES_NO_RECORD;\n return undefined;\n}\n\nfunction recordResult(record: unknown, idField: string) {\n if (record === null || typeof record !== 'object') {\n throw {\n kind: 'protocol',\n code: 'invalid-record',\n message: 'PocketBase returned a non-object record.',\n } satisfies DataError;\n }\n const id = (record as Record<string, unknown>)[idField];\n if (typeof id !== 'string' && (typeof id !== 'number' || !Number.isFinite(id))) {\n throw {\n kind: 'protocol',\n code: 'invalid-record-id',\n message: `PocketBase record is missing a valid ${idField} field.`,\n } satisfies DataError;\n }\n return { kind: 'record' as const, id: id as RecordId, record, completeness: 'full' as const };\n}\n\nexport function createPocketbaseDataProvider(opts: PocketbaseDataProviderOpts): DataProvider {\n const base = opts.baseUrl.replace(/\\/+$/, '');\n const records = (resource: string) => `${base}/api/collections/${resource}/records`;\n\n async function call(url: string, init: RequestInit = {}, signal?: AbortSignal): Promise<unknown> {\n try {\n const token = opts.getToken();\n const headers = new Headers(init.headers);\n if (token) headers.set('authorization', token);\n if (init.body && !(init.body instanceof FormData))\n headers.set('content-type', 'application/json');\n\n const response = await (opts.fetchImpl ?? fetch)(url, { ...init, headers, signal });\n const text = await response.text();\n let json: Record<string, unknown> = {};\n if (text) {\n try {\n json = JSON.parse(text) as Record<string, unknown>;\n } catch {\n throw {\n kind: 'protocol',\n code: 'invalid-json',\n message: 'PocketBase returned invalid JSON.',\n status: response.status,\n } satisfies DataError;\n }\n }\n if (!response.ok) {\n throw {\n kind: 'transport',\n code: 'pocketbase-request-failed',\n message:\n typeof json.message === 'string' ? json.message : `PocketBase error ${response.status}`,\n status: response.status,\n details: json,\n } satisfies DataError;\n }\n return json;\n } catch (error) {\n if (error !== null && typeof error === 'object' && 'kind' in error) throw error;\n throw {\n kind: signal?.aborted ? 'cancelled' : 'transport',\n code: signal?.aborted ? 'request-aborted' : 'pocketbase-request-failed',\n message: error instanceof Error ? error.message : 'PocketBase request failed.',\n cause: error,\n } satisfies DataError;\n }\n }\n\n const body = (input: unknown): BodyInit =>\n input instanceof FormData ? input : JSON.stringify(input);\n\n return defineDataProvider({\n queries: {\n async list(descriptor, context) {\n const params = new URLSearchParams();\n if (descriptor.pagination?.kind === 'offset') {\n params.set('page', String(descriptor.pagination.page));\n params.set('perPage', String(descriptor.pagination.pageSize));\n } else if (descriptor.pagination?.kind === 'cursor') {\n throw {\n kind: 'capability',\n code: 'cursor-pagination-unsupported',\n message: 'PocketBase provider supports offset pagination only.',\n } satisfies DataError;\n }\n // No `filter` param means \"every record\", and that is exactly what an\n // absent `filterExpression` result now means (see its doc comment).\n // A filter that means \"match nothing\" comes back as a real expression,\n // so it is sent rather than silently omitted.\n const filter = filterExpression(descriptor.filter);\n if (filter) params.set('filter', filter);\n if (descriptor.sort?.length) {\n params.set(\n 'sort',\n descriptor.sort\n .map(({ field, direction }) => `${direction === 'desc' ? '-' : '+'}${field}`)\n .join(','),\n );\n }\n const json = (await call(\n `${records(descriptor.resource)}?${params}`,\n {},\n context.signal,\n )) as { items?: unknown[]; totalItems?: number };\n return {\n data: json.items ?? [],\n ...(typeof json.totalItems === 'number' ? { total: json.totalItems } : {}),\n };\n },\n async one(descriptor, context) {\n return {\n data: await call(\n `${records(descriptor.resource)}/${encodeURIComponent(String(descriptor.id))}`,\n {},\n context.signal,\n ),\n };\n },\n async many(descriptor, context) {\n if (descriptor.ids.length === 0) return { data: [] };\n const filter = descriptor.ids.map((id) => `id=${lit(id)}`).join(' || ');\n const json = (await call(\n `${records(descriptor.resource)}?filter=${encodeURIComponent(filter)}&perPage=${descriptor.ids.length}`,\n {},\n context.signal,\n )) as { items?: unknown[] };\n return { data: json.items ?? [] };\n },\n },\n mutations: {\n async createOne(descriptor, context) {\n const record = await call(\n records(descriptor.resource),\n { method: 'POST', body: body(descriptor.input) },\n context.signal,\n );\n return recordResult(record, descriptor.idField);\n },\n async updateOne(descriptor, context) {\n const record = await call(\n `${records(descriptor.resource)}/${encodeURIComponent(String(descriptor.id))}`,\n { method: 'PATCH', body: body(descriptor.input) },\n context.signal,\n );\n return recordResult(record, descriptor.idField);\n },\n async deleteOne(descriptor, context) {\n await call(\n `${records(descriptor.resource)}/${encodeURIComponent(String(descriptor.id))}`,\n { method: 'DELETE' },\n context.signal,\n );\n return { kind: 'identity', id: descriptor.id };\n },\n },\n });\n}\n","import type { AuthProvider, DataError } from '@burojs/core';\n\nexport interface PocketbaseAuthOpts {\n baseUrl: string;\n fetchImpl?: typeof fetch;\n storageKey?: string;\n}\n\ninterface Session {\n token: string;\n record: { id: string; email?: string; name?: string; avatar?: string };\n}\n\n/**\n * Password auth against a PocketBase `users` collection, with the session in\n * localStorage. Deliberately tiny: the example exists to demonstrate the file\n * storage port, not to be an auth reference.\n */\nexport function createPocketbaseAuthProvider(\n opts: PocketbaseAuthOpts,\n): AuthProvider & { getToken(): string | null } {\n const base = opts.baseUrl.replace(/\\/+$/, '');\n const key = opts.storageKey ?? 'buro-example-vite-auth';\n\n const read = (): Session | null => {\n try {\n const raw = localStorage.getItem(key);\n if (!raw) return null;\n const parsed = JSON.parse(raw) as Partial<Session> | null;\n // The try/catch above only guards JSON.parse throwing — it says nothing\n // about the parsed SHAPE. A value that is valid JSON but not a Session\n // (a stale format from an earlier version, manual tampering) must be\n // treated as \"not logged in\", not crash `getIdentity` reading\n // `record.id` off `undefined`.\n if (!parsed || typeof parsed.token !== 'string' || typeof parsed.record?.id !== 'string') {\n return null;\n }\n return parsed as Session;\n } catch {\n return null;\n }\n };\n\n return {\n getToken: () => read()?.token ?? null,\n\n async login(params: unknown) {\n const { email, password } = params as { email: string; password: string };\n // Resolved HERE, per call — not once at construction. Captured at\n // construction, a `fetch` installed afterwards is unreachable for the life\n // of the provider: a test stub set after the factory ran silently never\n // applies and the call escapes to the real network instead. The sibling\n // `data-provider.ts` carried the identical bug, and it stayed invisible\n // until something needed real fixture data from it.\n const fetchImpl = opts.fetchImpl ?? fetch;\n const res = await fetchImpl(`${base}/api/collections/users/auth-with-password`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ identity: email, password }),\n });\n if (!res.ok) {\n return {\n success: false,\n error: { kind: 'auth', code: 'invalid-credentials', message: 'Invalid credentials' },\n };\n }\n localStorage.setItem(key, JSON.stringify((await res.json()) as Session));\n return { success: true };\n },\n\n async logout() {\n localStorage.removeItem(key);\n return { success: true };\n },\n\n async check() {\n return read() ? { authenticated: true } : { authenticated: false, reason: 'signed-out' };\n },\n\n async onError(error: DataError) {\n return { action: 'propagate', error };\n },\n\n async getIdentity() {\n const session = read();\n if (!session) return null;\n return { id: session.record.id, name: session.record.name ?? session.record.email };\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/data-provider.ts","../src/auth-provider.ts"],"sourcesContent":["import {\n defineDataProvider,\n type DataError,\n type DataErrorKind,\n type DataProvider,\n type RecordId,\n} from '@burojs/core';\n\nexport interface PocketbaseDataProviderOpts {\n baseUrl: string;\n getToken: () => string | null;\n fetchImpl?: typeof fetch;\n}\n\n/**\n * Escapes a value for a PocketBase filter string literal.\n *\n * ⚠️ **EVERY literal is double-quoted, whatever its type, and for a BOOLEAN\n * that silently returns the wrong rows.** Measured against a real PocketBase\n * (v0.39.11, three rows, filters generated by `filterExpression` itself):\n * `active=\"true\"` matched **0 rows** where 2 were expected, `active=\"false\"`\n * matched 0 where 1 was expected, and `active!=\"true\"` matched **all 3**. No\n * error is raised — a boolean facet over this provider reads to the user as\n * \"no matches\".\n *\n * Numbers are NOT affected: SQLite applies the column's numeric affinity to\n * the quoted comparand, so `total_cents>\"250000\"` compares numerically, and an\n * ordering probe (`>\"9\"` over 50 / 250000 / 563109) returned all three rather\n * than the lexical answer. `isNull` / `isNotNull` are not affected either —\n * they never reach this function (see the bare `field=null` below). The one\n * remaining null hazard is an `eq` against a literal `null`, which goes out as\n * `=\"null\"` and matches nothing.\n *\n * Carried as **F19** in\n * `docs/superpowers/specs/2026-08-15-marketplace-ops-follow-ups.md`, with the\n * decision the fix needs (this function sees a VALUE, not a column type, so\n * unquoting booleans has to answer what a text column compared to `\"true\"`\n * does). Nothing in this repository filters a boolean over PocketBase today.\n */\nfunction lit(value: unknown): string {\n return `\"${String(value).replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"')}\"`;\n}\n\n/**\n * The shared refusal code for \"this provider cannot express that filter\n * operator\". `@burojs/hasura` exports the identical string as\n * `FILTER_OPERATOR_UNSUPPORTED_CODE` and throws the same `kind`, so an\n * application that handles one handles the other.\n *\n * The two packages do not import from each other (neither depends on the\n * other, and a shared constant would have to live in `@burojs/core`, which\n * owns the filter AST but not its transports). The agreement is therefore\n * pinned by a test that drives BOTH providers:\n * `examples/marketplace-ops/tests/provider-agreement.test.ts`.\n */\nexport const FILTER_OPERATOR_UNSUPPORTED_CODE = 'filter-operator-unsupported';\n\nfunction unsupportedOperator(field: string, op: string): DataError {\n return {\n kind: 'capability',\n code: FILTER_OPERATOR_UNSUPPORTED_CODE,\n message: `@burojs/pocketbase does not support the filter operator '${op}' (on '${field}').`,\n };\n}\n\n/**\n * What one filter node translated to. Three outcomes, not two — that missing\n * third outcome IS the defect this type exists to make unrepresentable.\n *\n * THE CLASS, stated once. The old signature was `string | undefined`, and\n * `undefined` carried two incompatible meanings at once:\n *\n * - \"no constraint was expressed here — drop me\" (no value supplied, an\n * unrecognised node), and\n * - \"this node is a constant\", which is what a BRANCHLESS COMBINATOR is:\n * `{and: []}` is vacuously TRUE, `{or: []}` is vacuously FALSE, `in: []`\n * is an empty-set membership test and therefore FALSE.\n *\n * Dropping a node is sound only when the node is TRUE and sits in an AND\n * position, where a TRUE conjunct is genuinely absorbed. Everywhere else —\n * under `not`, beside a disjunct in an `or`, or alone at the top level, where\n * the caller turns `undefined` into no `filter` param at all and the server\n * answers with EVERY row — dropping a false node inverts the query.\n *\n * The sibling `@burojs/hasura` closed the same class in `filtersToWhere` by\n * emitting `{_and: []}` / `{_or: []}` explicitly, because Hasura's `bool_exp`\n * has a literal for both truth values. PocketBase's filter grammar has none\n * (every term is `field op value`), so this half CANNOT emit a truth value as\n * a term; it folds instead and materialises only the one constant it cannot\n * fold away — see {@link MATCHES_NO_RECORD}.\n */\ntype FilterNode =\n | { readonly kind: 'expr'; readonly text: string }\n | { readonly kind: 'const'; readonly value: boolean }\n | { readonly kind: 'drop' };\n\nconst DROP: FilterNode = { kind: 'drop' };\nconst constant = (value: boolean): FilterNode => ({ kind: 'const', value });\n\n/**\n * A PocketBase filter expression that matches NO record.\n *\n * It has to be a real expression: PocketBase's filter grammar has no boolean\n * literal and no nullary operator — every term is `field op value`, combined\n * with `&&`, `||`, `!(…)` and parentheses (the grammar `@burojs/mock-kit`'s\n * `parsePbFilter` implements, and the one this file's own emitters produce).\n * So \"match nothing\" is spelled as a CONTRADICTION over a column that every\n * record has.\n *\n * Why this particular one: `id=\"\" && id!=\"\"` is false for every possible value\n * of `id`, by the definition of `=` / `!=` alone. It does not depend on what\n * `id` contains, on the collection's schema, or on PocketBase's own guarantee\n * that a record id is a non-empty 15-character string — that guarantee would\n * make the shorter `id=\"\"` sufficient, but the contradiction needs no such\n * premise and stays false under SQL three-valued logic too (a NULL comparison\n * is not TRUE, so the row is still excluded).\n *\n * There is no TRUE counterpart because none is ever needed: a TRUE node is\n * absorbed by every AND, collapses every OR to TRUE, and at the top level is\n * exactly \"send no `filter` param\", which already means every row.\n */\nconst MATCHES_NO_RECORD = '(id=\"\" && id!=\"\")';\n\n/**\n * Fold a combinator's branches. `op` supplies its own absorbing element\n * (FALSE for `and`, TRUE for `or`) and identity element (the other one).\n *\n * The branchless case is checked on the SOURCE array, before mapping, and is\n * deliberately NOT the same case as \"every branch mapped away because no VALUE\n * was supplied\". That second case still yields `drop`, and `@burojs/hasura`\n * drops on exactly the same condition — a missing or `undefined` value, never\n * on `''`, which both providers translate.\n */\nfunction combine(branches: readonly unknown[], op: 'and' | 'or'): FilterNode {\n if (branches.length === 0) return constant(op === 'and');\n const absorbing = op === 'or';\n const nodes = branches.map(translateFilter);\n if (nodes.some((node) => node.kind === 'const' && node.value === absorbing)) {\n return constant(absorbing);\n }\n const parts = nodes.flatMap((node) => (node.kind === 'expr' ? [node.text] : []));\n if (parts.length > 0)\n return { kind: 'expr', text: `(${parts.join(op === 'and' ? ' && ' : ' || ')})` };\n // Nothing left to write down. A surviving identity-element constant still\n // has to be reported as a constant (it may sit under a `not`); if there were\n // no constants at all, every branch was a drop and so is the combinator.\n return nodes.some((node) => node.kind === 'const') ? constant(!absorbing) : DROP;\n}\n\nfunction translateFilter(filter: unknown): FilterNode {\n if (filter === null || typeof filter !== 'object') return DROP;\n const candidate = filter as Record<string, unknown>;\n if (Array.isArray(candidate.and)) return combine(candidate.and, 'and');\n if (Array.isArray(candidate.or)) return combine(candidate.or, 'or');\n if ('not' in candidate) {\n const inner = translateFilter(candidate.not);\n if (inner.kind === 'drop') return DROP;\n if (inner.kind === 'const') return constant(!inner.value);\n return { kind: 'expr', text: `!(${inner.text})` };\n }\n if (typeof candidate.field !== 'string' || typeof candidate.op !== 'string') return DROP;\n\n const { field, op, value } = candidate;\n // A relation path (`documents.document_id`). `@burojs/hasura` nests these\n // into its `where`; this provider refuses, and does so BEFORE any other\n // branch so a valueless operator cannot slip out through the `isNull`\n // early return below.\n //\n // Refused rather than guessed, for the reason `unsupportedOperator` above\n // already states about the collection operators: PocketBase's traversal\n // syntax depends on the relation's kind and direction, nothing on the\n // descriptor declares either, and this repository has no PocketBase stand\n // to check a guess against. Emitted as-is the path would be read as a\n // literal column name — an error at best, a differently-meaning query at\n // worst.\n if (field.includes('.')) {\n throw {\n kind: 'capability',\n code: FILTER_OPERATOR_UNSUPPORTED_CODE,\n message:\n `@burojs/pocketbase cannot express a filter across a relation ('${field}'): ` +\n `PocketBase's traversal syntax depends on the relation's kind and direction, ` +\n `which nothing on the descriptor declares. Filter on a field of this collection.`,\n } satisfies DataError;\n }\n // `isNull`/`isNotNull` carry no value and are answered before the value\n // check, exactly as `@burojs/hasura` orders it.\n if (op === 'isNull') return { kind: 'expr', text: `${field}=null` };\n if (op === 'isNotNull') return { kind: 'expr', text: `${field}!=null` };\n // Missing / `undefined` value: no constraint was expressed, so drop — the\n // same rule, in the same position, as `@burojs/hasura`'s. Before this, an\n // absent value was stringified into the literal filter `a=\"undefined\"`,\n // which matches rows whose column really contains the text \"undefined\".\n //\n // `''` is deliberately NOT dropped, in either provider. See the matching\n // comment in `@burojs/hasura`'s `filtersToWhere`: the empty-search-box idiom\n // that motivated dropping it is already handled by `searchToFilter`\n // (`@burojs/core`), which never builds a predicate for an empty query, so\n // dropping it again here only cost the ordinary `eq: ''` case.\n if (!('value' in candidate) || value === undefined) return DROP;\n /**\n * The four set-valued operators. PocketBase has no native `in`; each is\n * expanded into an `||`/`&&` chain of comparisons, and an EMPTY chain is not\n * expressible in the grammar at all — which is precisely why the empty case\n * must become a folded constant rather than a dropped node.\n *\n * The two truth values come from set semantics, not from a capture (this\n * repo holds no captured PocketBase responses): `x ∈ ∅` is false, `x ∉ ∅` is\n * true, \"has any of ∅\" is false, and \"has all of ∅\" is vacuously true.\n */\n const chain = (\n join: ' || ' | ' && ',\n term: (entry: unknown) => string,\n empty: boolean,\n ): FilterNode => {\n if (!Array.isArray(value)) return DROP;\n if (value.length === 0) return constant(empty);\n return { kind: 'expr', text: `(${value.map(term).join(join)})` };\n };\n\n switch (op) {\n case 'eq':\n return { kind: 'expr', text: `${field}=${lit(value)}` };\n case 'neq':\n return { kind: 'expr', text: `${field}!=${lit(value)}` };\n case 'contains':\n return { kind: 'expr', text: `${field}~${lit(value)}` };\n case 'startsWith':\n return { kind: 'expr', text: `${field}~${lit(`${String(value)}%`)}` };\n case 'endsWith':\n return { kind: 'expr', text: `${field}~${lit(`%${String(value)}`)}` };\n case 'gt':\n return { kind: 'expr', text: `${field}>${lit(value)}` };\n case 'gte':\n return { kind: 'expr', text: `${field}>=${lit(value)}` };\n case 'lt':\n return { kind: 'expr', text: `${field}<${lit(value)}` };\n case 'lte':\n return { kind: 'expr', text: `${field}<=${lit(value)}` };\n case 'in':\n return chain(' || ', (entry) => `${field}=${lit(entry)}`, false);\n case 'notIn':\n return chain(' && ', (entry) => `${field}!=${lit(entry)}`, true);\n case 'has':\n return { kind: 'expr', text: `${field}~${lit(value)}` };\n case 'hasAny':\n return chain(' || ', (entry) => `${field}~${lit(entry)}`, false);\n case 'hasAll':\n return chain(' && ', (entry) => `${field}~${lit(entry)}`, true);\n // An operator this provider cannot express fails LOUDLY, and with the same\n // `kind` and `code` `@burojs/hasura` uses. It used to return DROP, i.e. \"no\n // constraint\" — so an unknown operator quietly matched every record here\n // while the sibling quietly turned it into `_eq`. Two silent, DIFFERENT\n // wrong answers for one input is the same defect class as the branchless\n // combinators, one hop out.\n default:\n throw unsupportedOperator(field, op);\n }\n}\n\n/**\n * Translate a portable filter expression into a PocketBase `filter` string.\n *\n * `undefined` means **matches every record** — send no `filter` param. It is\n * the answer for both a constraint-free filter and a filter that folds to\n * TRUE; the two are indistinguishable on the wire and there is nothing to\n * gain by distinguishing them.\n *\n * A filter that folds to FALSE returns {@link MATCHES_NO_RECORD} — a real\n * expression that matches nothing — never `undefined`. Returning `undefined`\n * for it is the inversion described on {@link FilterNode}: the caller omits\n * the param and PocketBase answers with every row.\n */\nexport function filterExpression(filter: unknown): string | undefined {\n const node = translateFilter(filter);\n if (node.kind === 'expr') return node.text;\n if (node.kind === 'const') return node.value ? undefined : MATCHES_NO_RECORD;\n return undefined;\n}\n\nfunction recordResult(record: unknown, idField: string) {\n if (record === null || typeof record !== 'object') {\n throw {\n kind: 'protocol',\n code: 'invalid-record',\n message: 'PocketBase returned a non-object record.',\n } satisfies DataError;\n }\n const id = (record as Record<string, unknown>)[idField];\n if (typeof id !== 'string' && (typeof id !== 'number' || !Number.isFinite(id))) {\n throw {\n kind: 'protocol',\n code: 'invalid-record-id',\n message: `PocketBase record is missing a valid ${idField} field.`,\n } satisfies DataError;\n }\n return { kind: 'record' as const, id: id as RecordId, record, completeness: 'full' as const };\n}\n\n/**\n * The kind a non-ok PocketBase answer is reported as, read from the status alone — never from\n * the body, which a gateway in front of PocketBase may have replaced with an HTML page.\n *\n * - `400` → `validation` for a write: PocketBase refused the input (its `data` names the fields).\n * A read answered 400 carries a filter or sort PocketBase cannot parse — a programming error,\n * not input a user can correct — so it is `protocol`, as Hasura's `validation-failed` on a read.\n * - `401` → `auth`: the credential was rejected, so the runtime's auth recovery may run.\n * - `403` → `forbidden`, `404` → `not-found` (a row it does not hold, or one outside scope).\n * - `409` → `conflict`.\n * - `>= 500` → `sent` for a write: PocketBase or a gateway answered with a failure after the\n * request reached it, so the write may have been applied. A read in that state is `transport`.\n * - any other status → `transport`.\n *\n * The status is kept on the error either way.\n */\nfunction statusKind(\n status: number,\n write: boolean,\n): Extract<\n DataErrorKind,\n 'validation' | 'protocol' | 'auth' | 'forbidden' | 'not-found' | 'conflict' | 'sent' | 'transport'\n> {\n if (status === 400) return write ? 'validation' : 'protocol';\n if (status === 401) return 'auth';\n if (status === 403) return 'forbidden';\n if (status === 404) return 'not-found';\n if (status === 409) return 'conflict';\n if (status >= 500) return write ? 'sent' : 'transport';\n return 'transport';\n}\n\nexport function createPocketbaseDataProvider(opts: PocketbaseDataProviderOpts): DataProvider {\n const base = opts.baseUrl.replace(/\\/+$/, '');\n const records = (resource: string) => `${base}/api/collections/${resource}/records`;\n\n async function call(url: string, init: RequestInit = {}, signal?: AbortSignal): Promise<unknown> {\n const method = (init.method ?? 'GET').toUpperCase();\n let handedOver = false;\n let answered = false;\n try {\n const token = opts.getToken();\n const headers = new Headers(init.headers);\n if (token) headers.set('authorization', token);\n if (init.body && !(init.body instanceof FormData))\n headers.set('content-type', 'application/json');\n\n handedOver = true;\n const response = await (opts.fetchImpl ?? fetch)(url, { ...init, headers, signal });\n answered = true;\n const write = method !== 'GET';\n // The status decides first. The body is only read for its message: a gateway's HTML 502\n // must classify by its status, not fail as unparsable JSON.\n if (!response.ok) {\n const kind = statusKind(response.status, write);\n let json: Record<string, unknown> = {};\n try {\n const parsed: unknown = JSON.parse(await response.text());\n if (parsed !== null && typeof parsed === 'object')\n json = parsed as Record<string, unknown>;\n } catch {\n // An unreadable error body changes nothing: the status already classified it.\n }\n throw {\n kind,\n code: kind === 'sent' ? 'pocketbase-answer-lost' : 'pocketbase-request-failed',\n message:\n typeof json.message === 'string' ? json.message : `PocketBase error ${response.status}`,\n status: response.status,\n ...(kind === 'sent' ? { retryable: false } : {}),\n details: json,\n } satisfies DataError;\n }\n // A 2xx whose body cannot be read or parsed: a write was probably applied, so it is `sent`;\n // a read is a protocol failure.\n const unreadable = (cause: unknown): DataError =>\n write\n ? {\n kind: 'sent',\n code: 'pocketbase-answer-unreadable',\n message:\n 'PocketBase answered a write with a body that could not be read; it may have been applied.',\n status: response.status,\n retryable: false,\n cause,\n }\n : {\n kind: 'protocol',\n code: 'invalid-json',\n message: 'PocketBase returned invalid JSON.',\n status: response.status,\n cause,\n };\n let text: string;\n try {\n text = await response.text();\n } catch (cause) {\n if (signal?.aborted) throw cause;\n throw unreadable(cause);\n }\n // A create or an update answers with the record; an empty body there is an answer lost on\n // the way back. A delete answers 204 with no body, and that is a success.\n if (!text && write && method !== 'DELETE') throw unreadable(undefined);\n let json: Record<string, unknown> = {};\n if (text) {\n try {\n json = JSON.parse(text) as Record<string, unknown>;\n } catch (cause) {\n throw unreadable(cause);\n }\n }\n return json;\n } catch (error) {\n if (error !== null && typeof error === 'object' && 'kind' in error) throw error;\n // A write handed to fetch that got no answer may have been applied.\n if (handedOver && !answered && method !== 'GET' && !signal?.aborted)\n throw {\n kind: 'sent',\n code: 'pocketbase-request-sent',\n message: 'PocketBase did not answer a write request; it may have been applied.',\n retryable: false,\n cause: error,\n } satisfies DataError;\n throw {\n kind: signal?.aborted ? 'cancelled' : 'transport',\n code: signal?.aborted ? 'request-aborted' : 'pocketbase-request-failed',\n message: error instanceof Error ? error.message : 'PocketBase request failed.',\n cause: error,\n } satisfies DataError;\n }\n }\n\n const body = (input: unknown): BodyInit =>\n input instanceof FormData ? input : JSON.stringify(input);\n\n return defineDataProvider({\n queries: {\n async list(descriptor, context) {\n const params = new URLSearchParams();\n if (descriptor.pagination?.kind === 'offset') {\n params.set('page', String(descriptor.pagination.page));\n params.set('perPage', String(descriptor.pagination.pageSize));\n } else if (descriptor.pagination?.kind === 'cursor') {\n throw {\n kind: 'capability',\n code: 'cursor-pagination-unsupported',\n message: 'PocketBase provider supports offset pagination only.',\n } satisfies DataError;\n }\n // No `filter` param means \"every record\", and that is exactly what an\n // absent `filterExpression` result now means (see its doc comment).\n // A filter that means \"match nothing\" comes back as a real expression,\n // so it is sent rather than silently omitted.\n const filter = filterExpression(descriptor.filter);\n if (filter) params.set('filter', filter);\n if (descriptor.sort?.length) {\n params.set(\n 'sort',\n descriptor.sort\n .map(({ field, direction }) => `${direction === 'desc' ? '-' : '+'}${field}`)\n .join(','),\n );\n }\n const json = (await call(\n `${records(descriptor.resource)}?${params}`,\n {},\n context.signal,\n )) as { items?: unknown[]; totalItems?: number };\n return {\n data: json.items ?? [],\n ...(typeof json.totalItems === 'number' ? { total: json.totalItems } : {}),\n };\n },\n async one(descriptor, context) {\n return {\n data: await call(\n `${records(descriptor.resource)}/${encodeURIComponent(String(descriptor.id))}`,\n {},\n context.signal,\n ),\n };\n },\n async many(descriptor, context) {\n if (descriptor.ids.length === 0) return { data: [] };\n const filter = descriptor.ids.map((id) => `id=${lit(id)}`).join(' || ');\n const json = (await call(\n `${records(descriptor.resource)}?filter=${encodeURIComponent(filter)}&perPage=${descriptor.ids.length}`,\n {},\n context.signal,\n )) as { items?: unknown[] };\n return { data: json.items ?? [] };\n },\n },\n mutations: {\n async createOne(descriptor, context) {\n const record = await call(\n records(descriptor.resource),\n { method: 'POST', body: body(descriptor.input) },\n context.signal,\n );\n return recordResult(record, descriptor.idField);\n },\n async updateOne(descriptor, context) {\n const record = await call(\n `${records(descriptor.resource)}/${encodeURIComponent(String(descriptor.id))}`,\n { method: 'PATCH', body: body(descriptor.input) },\n context.signal,\n );\n return recordResult(record, descriptor.idField);\n },\n async deleteOne(descriptor, context) {\n await call(\n `${records(descriptor.resource)}/${encodeURIComponent(String(descriptor.id))}`,\n { method: 'DELETE' },\n context.signal,\n );\n return { kind: 'identity', id: descriptor.id };\n },\n },\n });\n}\n","import type { AuthProvider, DataError } from '@burojs/core';\n\nexport interface PocketbaseAuthOpts {\n baseUrl: string;\n fetchImpl?: typeof fetch;\n storageKey?: string;\n}\n\ninterface Session {\n token: string;\n record: { id: string; email?: string; name?: string; avatar?: string };\n}\n\n/**\n * Password auth against a PocketBase `users` collection, with the session in\n * localStorage. Deliberately tiny: the example exists to demonstrate the file\n * storage port, not to be an auth reference.\n */\nexport function createPocketbaseAuthProvider(\n opts: PocketbaseAuthOpts,\n): AuthProvider & { getToken(): string | null } {\n const base = opts.baseUrl.replace(/\\/+$/, '');\n const key = opts.storageKey ?? 'buro-example-vite-auth';\n\n const read = (): Session | null => {\n try {\n const raw = localStorage.getItem(key);\n if (!raw) return null;\n const parsed = JSON.parse(raw) as Partial<Session> | null;\n // The try/catch above only guards JSON.parse throwing — it says nothing\n // about the parsed SHAPE. A value that is valid JSON but not a Session\n // (a stale format from an earlier version, manual tampering) must be\n // treated as \"not logged in\", not crash `getIdentity` reading\n // `record.id` off `undefined`.\n if (!parsed || typeof parsed.token !== 'string' || typeof parsed.record?.id !== 'string') {\n return null;\n }\n return parsed as Session;\n } catch {\n return null;\n }\n };\n\n return {\n getToken: () => read()?.token ?? null,\n\n async login(params: unknown) {\n const { email, password } = params as { email: string; password: string };\n // Resolved HERE, per call — not once at construction. Captured at\n // construction, a `fetch` installed afterwards is unreachable for the life\n // of the provider: a test stub set after the factory ran silently never\n // applies and the call escapes to the real network instead. The sibling\n // `data-provider.ts` carried the identical bug, and it stayed invisible\n // until something needed real fixture data from it.\n const fetchImpl = opts.fetchImpl ?? fetch;\n const res = await fetchImpl(`${base}/api/collections/users/auth-with-password`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ identity: email, password }),\n });\n if (!res.ok) {\n return {\n success: false,\n error: { kind: 'auth', code: 'invalid-credentials', message: 'Invalid credentials' },\n };\n }\n localStorage.setItem(key, JSON.stringify((await res.json()) as Session));\n return { success: true };\n },\n\n async logout() {\n localStorage.removeItem(key);\n return { success: true };\n },\n\n async check() {\n return read() ? { authenticated: true } : { authenticated: false, reason: 'signed-out' };\n },\n\n async onError(error: DataError) {\n return { action: 'propagate', error };\n },\n\n async getIdentity() {\n const session = read();\n if (!session) return null;\n return { id: session.record.id, name: session.record.name ?? session.record.email };\n },\n };\n}\n"],"mappings":";;AAuCA,SAAS,IAAI,OAAwB;CACnC,OAAO,IAAI,OAAO,KAAK,CAAC,CAAC,QAAQ,OAAO,MAAM,CAAC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O;IAAS,CAAC;GACpD,CAAC;GACD,IAAI,CAAC,IAAI,IACP,OAAO;IACL,SAAS;IACT,OAAO;KAAE,MAAM;KAAQ,MAAM;KAAuB,SAAS;IAAsB;GACrF;GAEF,aAAa,QAAQ,KAAK,KAAK,UAAW,MAAM,IAAI,KAAK,CAAa,CAAC;GACvE,OAAO,EAAE,SAAS,KAAK;EACzB;EAEA,MAAM,SAAS;GACb,aAAa,WAAW,GAAG;GAC3B,OAAO,EAAE,SAAS,KAAK;EACzB;EAEA,MAAM,QAAQ;GACZ,OAAO,KAAK,IAAI,EAAE,eAAe,KAAK,IAAI;IAAE,eAAe;IAAO,QAAQ;GAAa;EACzF;EAEA,MAAM,QAAQ,OAAkB;GAC9B,OAAO;IAAE,QAAQ;IAAa;GAAM;EACtC;EAEA,MAAM,cAAc;GAClB,MAAM,UAAU,KAAK;GACrB,IAAI,CAAC,SAAS,OAAO;GACrB,OAAO;IAAE,IAAI,QAAQ,OAAO;IAAI,MAAM,QAAQ,OAAO,QAAQ,QAAQ,OAAO;GAAM;EACpF;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burojs/pocketbase",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Buro: PocketBase data provider and auth provider",
|
|
6
6
|
"type": "module",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@burojs/core": "0.
|
|
28
|
+
"@burojs/core": "0.5.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"jsdom": "^26.0.0",
|
|
32
|
-
"tsup": "^8.3.0",
|
|
33
32
|
"typescript": "^5.5.0",
|
|
34
|
-
"vitest": "^
|
|
33
|
+
"vitest": "^4.0.0",
|
|
34
|
+
"@burojs/test-helpers": "0.5.0",
|
|
35
35
|
"@burojs/tooling-eslint": "0.0.0",
|
|
36
36
|
"@burojs/tooling-tsconfig": "0.0.0"
|
|
37
37
|
},
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
|
-
"build": "
|
|
43
|
-
"dev": "
|
|
42
|
+
"build": "tsdown",
|
|
43
|
+
"dev": "tsdown --watch",
|
|
44
44
|
"typecheck": "tsc --noEmit",
|
|
45
45
|
"typecheck:tests": "tsc -p tsconfig.test.json"
|
|
46
46
|
}
|