From 56aab1897aca04d756b80f5965d8a7440ccecfbc Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Mon, 16 Nov 2026 00:14:47 -0700 Subject: [PATCH 1/7] Add package scaffold, core layout engine and plugin shell Starts the build of the first checkpoint: package files copied from the sibling plugin's shape, a Payload-free layout engine (tokens, fitting, sheet positions, the 4 x 6 in preset), the provider contract types, and a plugin that registers the three collections with writes closed by default. Not tested: any database, PDF or SVG output, the print endpoint, the admin UI, site filtering for scopeField. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 12 + README.md | 27 +- RELEASING.md | 15 + docs/decisions.md | 11 + docs/test-audit.md | 6 + package-lock.json | 3147 +++++++++++++++++++++++++++++++++++++++ package.json | 67 + src/contracts/labels.ts | 45 + src/core/barcode.ts | 14 + src/core/fit.ts | 54 + src/core/index.ts | 8 + src/core/layout.ts | 77 + src/core/presets.ts | 16 + src/core/tokens.ts | 116 ++ src/core/types.ts | 84 ++ src/core/units.ts | 9 + src/index.ts | 102 ++ test/core.test.ts | 96 ++ test/plugin.test.ts | 56 + tsconfig.build.json | 5 + tsconfig.json | 16 + vitest.config.ts | 3 + 22 files changed, 3982 insertions(+), 4 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 RELEASING.md create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/contracts/labels.ts create mode 100644 src/core/barcode.ts create mode 100644 src/core/fit.ts create mode 100644 src/core/index.ts create mode 100644 src/core/layout.ts create mode 100644 src/core/presets.ts create mode 100644 src/core/tokens.ts create mode 100644 src/core/types.ts create mode 100644 src/core/units.ts create mode 100644 src/index.ts create mode 100644 test/core.test.ts create mode 100644 test/plugin.test.ts create mode 100644 tsconfig.build.json create mode 100644 tsconfig.json create mode 100644 vitest.config.ts diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5501eb2 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog + +## Unreleased + +- **Core engine** (`src/core`, no Payload, no React): `layout(template, data, media, context)` returns positioned marks in millimeters with warnings; field tokens with dotted paths (up to 4 segments) and the formatters `date`, `money`, `upper`, `lower`, `default` and `slice`, parsed without `eval`; text fitting by shrink, ellipsis or wrap; barcode value checks; sheet grid positions from a start slot; the 4 x 6 inch thermal preset. +- **Provider contract** (`src/contracts/labels.ts`, types only): templates, sets and tokens that other plugins can offer. +- **Plugin**: `labelsPlugin()` adds `label-templates`, `label-media` and `label-prints`. Writes are refused unless the site grants them with an `access` check that returns exactly `true`. Options `scopeField` with `scopeCollection`, and `log`. + +No version bump (still 0.0.0). + +Tested: 20 tests with made-up data. Core math and tokens, plus a Payload config build checking the collections, default access, strict access answers and the scope field. +Not tested: any database, PDF or SVG output (not built), barcode drawing, the print endpoint, the admin UI, site filtering for `scopeField` (fields only, no query filter yet), real printers. diff --git a/README.md b/README.md index f8fe472..d592029 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ Labels for Payload: design labels with field tokens in the admin, then print one, a few or every label for a document, on thermal rolls or Avery-style sheets. -**Status:** design only. No code yet, so nothing is tested. The build starts after a planned site tour, in three phases: 0.1 prints PDFs with form-based editing and a live preview, 0.2 adds a drag-and-drop label editor, 0.3 adds ZPL for Zebra printers. The design is in [docs/design.md](docs/design.md). +**Status:** early checkpoint, version 0.0.0, not published. Built and tested (20 tests): the layout engine in `src/core` (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset) and the plugin that adds the three collections with write access closed by default. Tested with made-up data and a Payload config build, not against a database. **Not built yet:** PDF printing, barcode drawing, the print endpoint and dialog, the admin inspector and live preview, the label-prints log writes, and site filtering for `scopeField`. The design is in [docs/design.md](docs/design.md). -## What it will do +## What it will do (the plan) - A label builder in the admin: pick the label size and the roll or sheet, then place text, barcodes, QR codes, images and lines. Field tokens such as `{{order.customer.name}}` fill them from the document, so labels always carry live data. - A "Print labels" menu on each document: print one label, a few, or every label that belongs to it, such as an order's box label and one label per kit. @@ -14,7 +14,7 @@ Labels for Payload: design labels with field tokens in the admin, then print one ## On its own, and with others -Nothing here is built yet, so this is the plan from [docs/design.md](docs/design.md). +This part is still the plan from [docs/design.md](docs/design.md). **On its own:** Labels will work on any Payload site with no other plugin. You design labels in the admin from your own collections' fields, and print them from each document. @@ -28,7 +28,26 @@ Nothing here is built yet, so this is the plan from [docs/design.md](docs/design ## Install or build -Not published yet. It will be `@extantape/payload-plugin-labels` on npm. +Not published yet. It will be `@extantape/payload-plugin-labels` on npm. To build it here: `npm install`, `npm test`, `npm run build`. + +## Use + +```ts +import { labelsPlugin } from '@extantape/payload-plugin-labels' + +export default buildConfig({ + plugins: [ + labelsPlugin({ + access: { manage: ({ req }) => req.user?.role === 'admin' }, + // scopeField: 'tenant', scopeCollection: 'tenants', + }), + ], +}) +``` + +With no `access` given, nobody can write labels through the API and only signed-in people can read them. A check counts only if it returns exactly `true`; an error counts as no. + +The layout engine works on its own, with no Payload and no React: `import { layout, THERMAL_4X6 } from '@extantape/payload-plugin-labels/core'`. `layout(template, record, media)` returns the marks of one label in millimeters, plus warnings for missing values, text that does not fit and marks outside the label. Text width is estimated from character counts until real font metrics arrive with PDF output. ## License diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..c11dacc --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,15 @@ +# Releasing + +One description everywhere: `package.json` (`description`, `keywords`) is the source; GitHub's description and topics are synced from it before each release, npm takes it at release, and the Release workflow refuses to stage if GitHub differs. + +One process for every EXTANT APE package: + +1. Bump `version` in `package.json` (and the changelog, if any), commit as `Release x.y.z`, tag `vx.y.z`, and push the commit and the tag. +2. The Release workflow builds, tests and **stages** the version on npm (trusted publishing, no stored token). +3. The npm account that owns the `extantape` org approves it with 2FA: npmjs.com → avatar → **Staged Packages** → **Approve**, or `npm stage list` then `npm stage approve `. Only then is it public. + +The very first version of a new package is published by hand (`npm publish --access public`), because npm can only trust a workflow for a package that exists; then run once: + +```bash +npm trust github --repo ExtantApe/ --file release.yml --allow-stage-publish --yes +``` diff --git a/docs/decisions.md b/docs/decisions.md index 9d9c359..5924422 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -15,3 +15,14 @@ Dated decisions for this repo, newest last. - 2026-11-10: build it right. Labels imports no other plugin; other plugins reach it through optional adapters. No plugin-family tags in `package.json` keywords yet. - 2026-11-11: categories are `admin-ui` and `ecommerce`. GitHub topics: payload, payload-plugin, payloadcms, admin-ui, ecommerce, labels, printing, barcode, qr-code, thermal-printer, pdf. When the package is created, its `keywords` are exactly these, in this order. - 2026-11-14: moved to the ExtantApe GitHub organization. The package will be `@extantape/payload-plugin-labels`. +- 2026-11-16: first build checkpoint (core and plugin shell). Choices made where the design was open: + - Text width is estimated from character count (0.52 em, 0.58 bold) until PDF output brings real font metrics. Fit results are approximate until then. + - `money` formats a number as it is, with two decimals and thousands separators (en-US); it does not divide minor units or add a currency symbol. + - Dates format in UTC, with the tokens YYYY, MMM, MM, DD and D. + - Token paths are capped at 4 segments (a field plus up to 3 relationship levels). Context roots (`label`, `printedAt`, `printedBy`, `site`) win over record fields of the same name. + - A missing value prints empty and is reported as a warning; `default` supplies a value and silences the warning. + - The media calibration offset is applied inside `layout`, so every output draws the same marks. + - The provider contract is typed without importing Payload (`payload` and `req` are `unknown`), so a provider can copy it. + - `scopeField` needs a `scopeCollection` option naming the collection it points at; the plugin throws without it. Site filtering of reads is not built yet. + - Read access defaults to any signed-in user when no `access` option is given; with `print` or `manage` given, only those pass. Writes default to no. The print log can never be written through the API. + - Template `width` and `height` are stored in mm as separate number fields, and `elements` and media `definition` are JSON, to be validated when the inspector is built. diff --git a/docs/test-audit.md b/docs/test-audit.md index 3b5aa01..50c349a 100644 --- a/docs/test-audit.md +++ b/docs/test-audit.md @@ -2,6 +2,12 @@ Newest first. +## 2026-11-16: core and plugin shell + +- Promises: tokens never run code; a missing value is reported; text fits by its rule; sheet positions follow the start slot; the 4 x 6 in preset size; writes are closed by default and only `true` passes; the print log is never writable through the API. +- Covered: all of the above in `test/core.test.ts` and `test/plugin.test.ts` (20 tests), including code-like tokens, inherited property names, a throwing access check and a truthy non-`true` answer. +- Gaps skipped (and why): no database tests, because nothing reads or writes records yet. Site isolation, the 2,000-label limit, PDF page checks and preview-equals-PDF wait for the code they test. + ## 2026-11-10: first audit (starter kit) - Promises: none yet. diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..eacca0d --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3147 @@ +{ + "name": "@extantape/payload-plugin-labels", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@extantape/payload-plugin-labels", + "version": "0.0.0", + "license": "MIT", + "devDependencies": { + "@payloadcms/db-mongodb": "^3.92.1", + "@types/node": "^24.19.2", + "graphql": "^16.15.0", + "payload": "^3.92.1", + "typescript": "^5.9.3", + "vitest": "^5.1.0" + }, + "engines": { + "node": ">=22" + }, + "peerDependencies": { + "payload": "^3.80.0" + } + }, + "node_modules/@apidevtools/json-schema-ref-parser": { + "version": "11.9.3", + "resolved": "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-11.9.3.tgz", + "integrity": "sha512-60vepv88RwcJtSHrD6MjIL6Ta3SOYbgfnkHb+ppAVK+o9mXprRtulx7VlRl3lN3bbvysAfCS7WMVfhUYemB0IQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jsdevtools/ono": "^7.1.3", + "@types/json-schema": "^7.0.15", + "js-yaml": "^4.1.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/philsturgeon" + } + }, + "node_modules/@borewit/text-codec": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.2.3.tgz", + "integrity": "sha512-49CycTz1aAZmvFcwkeFyhud1HUmRIB5Tabf7ALV+VA4Iu85MTfz2cUwzPagMFAdVBvrWdkCxG67I30tUwwpKsw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/@emnapi/core": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.2.tgz", + "integrity": "sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@emnapi/wasi-threads": "2.2.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.2.tgz", + "integrity": "sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz", + "integrity": "sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz", + "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@jsdevtools/ono": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@mongodb-js/saslprep": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.6.3.tgz", + "integrity": "sha512-aHGFvT95c82CoQ7hb6qXpz8Hcc5PJb3ZtQ+P01QDBbyQday0mjcrJPeNJOHCgWe0pGX0zKmKP+1mWi/I/BCX9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "sparse-bitfield": "^3.0.3" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.6.tgz", + "integrity": "sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || 2.0.0-beta.2", + "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" + } + }, + "node_modules/@next/env": { + "version": "15.5.29", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.5.29.tgz", + "integrity": "sha512-9SrTiTsgORa+KfhlXXAGC1eSs847E+d2MQTPUX+n7R5XA8g/B6ZitfL6GoYHNMLwG3Hzs1wjDH0/ME5WrGMqBQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@oxc-project/types": { + "version": "0.156.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", + "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", + "dev": true, + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@payloadcms/db-mongodb": { + "version": "3.93.0", + "resolved": "https://registry.npmjs.org/@payloadcms/db-mongodb/-/db-mongodb-3.93.0.tgz", + "integrity": "sha512-cXcDSraT+1Spyl7JoIgBp6rnuuvdHGCkDKVBh+gwEWcUdQskU8FETMzezSCYQobRpSUNZ4AgRcq5Q+usPRnpNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mongoose": "8.24.1", + "mongoose-paginate-v2": "1.9.4", + "prompts": "2.4.2", + "uuid": "13.0.2" + }, + "peerDependencies": { + "payload": "3.93.0" + } + }, + "node_modules/@payloadcms/translations": { + "version": "3.93.0", + "resolved": "https://registry.npmjs.org/@payloadcms/translations/-/translations-3.93.0.tgz", + "integrity": "sha512-lJl0KgaYH8FMjKCjd4AVjYAd9JDRR9+D5u+XQ47Tw4KJSD8q/P9PNqLNuSCXc0+u2+hAjJMEr93/9PpVDkFh5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "date-fns": "4.1.0" + } + }, + "node_modules/@pinojs/redact": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz", + "integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.19.tgz", + "integrity": "sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.19.tgz", + "integrity": "sha512-hOombrTJ+szt2ciEzS7oCA78lMPBgF5UMQWCJIyNfnrI7GLl8HYoFqCnpL2gcPOaXMqryGCU5ExdQKyDDcC+yA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.19.tgz", + "integrity": "sha512-XoMA2pwCKGTQzUjPgtRwkedH4WmXhdIPKT6l6oOxd1PUbNodGI6DcBekgN7EC//+x3pfBYX/qL1gNmZAqivw5g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.19.tgz", + "integrity": "sha512-zo8EsSSwMZCY/e+fRnGaX02YGgvJD0yvhNi/9hpGPA2MJ9ZF8dPCw75UGfpI6OpQ/myR/dIYmogRvqiZD0TrXg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.19.tgz", + "integrity": "sha512-O8ISAOfI1nj7AuBPd30FSF47z7f7lzlk5poQVGgiikvQuGEBFYvW8ki+UEnT+YJPnNGjQzn304klt4O9FUE7mA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.19.tgz", + "integrity": "sha512-/lYCba5NO0yq4S0jGMH8QTBtkvQxoXjoQWzF5BcWp9MjB9jxVRD1GQDNofkVjcOj30DWyhLIN/4Oe60JKzaONw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.19.tgz", + "integrity": "sha512-pm/apFMBnSbFb3O6nG5pHO1iqHhZrjGDFEjSm+ot9J17XXPvH9L90y5h+jgfHCE+Qdlsvy8qKEcU4VKxgjD+vA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.19.tgz", + "integrity": "sha512-K1SmQp3FFichn8oqrNIwvFoZ5wcvjC7goBzpaMNvLf9FZc+QB/QvLmnpJZgAAGHiD980tP8FZZnXk2K94rvlxg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.19.tgz", + "integrity": "sha512-I0xwD57jP/3A7+5UPZin2w8Y7XHEmEM5zqpYZOcQ45MlNW6tUJUziymV3yRr7rL4vwyfEcRsRksC4a7Kc08p5Q==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.19.tgz", + "integrity": "sha512-BrtEHT24SNXj9HiXqy+s/kXiSiQGt6EKCPUlRirAoIioVxKGnbXBUEkbZASAei7iZJB0/Ynm+0JP00Ipx7AnSw==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.19.tgz", + "integrity": "sha512-rm75/9DkHKeU2WnA8w4X94WGYgLlDCFCfkQC+4bguVJmC/jvDRv2B+2wLOYhyE0fVuv7//Ckk39OoOufyCu76Q==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.19.tgz", + "integrity": "sha512-irh/4+iYFM4GAzpluDErgjz89bj6NDtqqMAG/6O1LG38Ed3NpyebzCpcVNkFW8uhy+/3/BocUvnXDR33CXWe9A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.19.tgz", + "integrity": "sha512-+KWTWNoPt+CfSq94CiceWu3yPE+QzkaG+phPyz9G60tmZLwfQkcA4AeksafzvJAw4pvg1mcd5a1TkUqVv0s4JA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.2.19.tgz", + "integrity": "sha512-7EH+skOsl5qpWnK0vzamgJFhOv1cwxQpsxm8tI883K9fur5c27p8q87fzEO6BbBPabA2/+s/zR63/pLc137iOg==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@emnapi/core": "2.0.0-beta.2", + "@emnapi/runtime": "2.0.0-beta.2", + "@napi-rs/wasm-runtime": "1.2.6" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.19.tgz", + "integrity": "sha512-3Q1Yg1Q7tEvBWoZf5rFvG/GKZQPgwfru+p4wBajDfJFBs0SHCpL++dfTjW9gyAKd1T7ZpIYvdaUax7Pa/IhFVQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.19.tgz", + "integrity": "sha512-y/sqRRc6d7hECzOFc5n3LSeqctmIp9mMjY1Kq4s14uLPd/LZ4z7i1zrW6fMtp2mPeuQIC4e6ULMcwQzMomqQag==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.1.1.tgz", + "integrity": "sha512-glFIJDvLNDtJhT9qrMFWLPbvS+skxgt4L0K8Ei2YtnhPysAJnsI7nyxSJxKj4ADeKX0OLjC4ntRkwpLOoS3rwA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@tokenizer/inflate": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.4.1.tgz", + "integrity": "sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "token-types": "^6.1.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz", + "integrity": "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/busboy": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@types/busboy/-/busboy-1.5.4.tgz", + "integrity": "sha512-kG7WrUuAKK0NoyxfQHsVE6j1m01s6kMma64E+OZenQABMQyTJop1DumUWcLwAQ2JzpefU7PDYoRDKl8uZosFjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", + "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/lodash": { + "version": "4.17.27", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.27.tgz", + "integrity": "sha512-VenMRv/eKNrspX9v3H4dbmjsrnCOYdYBG3kxXKk3dG6X+urBGcj2Prww3xw1U5K4FV/mE4h5GbWd0szEKf+9ew==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.19.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.2.tgz", + "integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": ">=7.24.0 <7.24.7" + } + }, + "node_modules/@types/webidl-conversions": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", + "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/whatwg-url": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.5.tgz", + "integrity": "sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/webidl-conversions": "*" + } + }, + "node_modules/@vitest/mocker": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.0.tgz", + "integrity": "sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.31", + "@vitest/spy": "5.1.0", + "estree-walker": "^3.0.3", + "magic-string": "^1.4.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9 || ^3.0.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/spy": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.0.tgz", + "integrity": "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/ajv": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz", + "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/bson": { + "version": "6.10.4", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.10.4.tgz", + "integrity": "sha512-WIsKqkSC0ABoBJuT1LEX+2HEvNmNKKgnTAyd0fL8qzK4SH2i9NXg+t08YtdZp/V9IZ33cxe3iV4yM0qg8lMQng==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=16.20.1" + } + }, + "node_modules/bson-objectid": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/bson-objectid/-/bson-objectid-2.0.4.tgz", + "integrity": "sha512-vgnKAUzcDoa+AeyYwXCoHyF2q6u/8H46dxu5JN+4/TZeq/Dlinn0K6GvxsCLb3LHUJl0m/TLiEK31kUwtgocMQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dev": true, + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/chai": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", + "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/ci-info": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.5.0.tgz", + "integrity": "sha512-d1uM8k5UZEyPza1n/MG3ko8nKupKN0KJpFsipgPcgaCCvV+IqIfJ+NzTjetlLM+UcXZx3+cLrNr76+eAO7G1Mw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/console-table-printer": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/console-table-printer/-/console-table-printer-2.12.1.tgz", + "integrity": "sha512-wKGOQRRvdnd89pCeH96e2Fn4wkbenSP6LMHfjfyNLMbGuHEFbMqQNuxXqd0oXG9caIOQ1FTvc5Uijp9/4jujnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "simple-wcswidth": "^1.0.1" + } + }, + "node_modules/croner": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/croner/-/croner-10.0.1.tgz", + "integrity": "sha512-ixNtAJndqh173VQ4KodSdJEI6nuioBWI0V1ITNKhZZsO0pEMoDxz539T4FTTbSZ/xIOSuDnzxLVRqBVSvPNE2g==", + "dev": true, + "funding": [ + { + "type": "other", + "url": "https://paypal.me/hexagonpp" + }, + { + "type": "github", + "url": "https://github.com/sponsors/hexagon" + } + ], + "license": "MIT", + "engines": { + "node": ">=18.0" + } + }, + "node_modules/dataloader": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/dataloader/-/dataloader-2.2.3.tgz", + "integrity": "sha512-y2krtASINtPFS1rSDjacrFgn1dcUuoREVabwlOGOe4SdxenREqwjwjElAdwvbGM7kgZz9a3KVicWR7vcz8rnzA==", + "dev": true, + "license": "MIT" + }, + "node_modules/date-fns": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, + "node_modules/dateformat": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", + "integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/es-module-lexer": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fast-copy": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-3.1.0.tgz", + "integrity": "sha512-IuCOCDFM1F/s4LtG7Bjr3yUUwPHybyhqN74xk2cMYoP51vVeErMy8+6HGFchi/+45lW8uzhs6lBeEqks2GWt6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz", + "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-type": { + "version": "21.3.4", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-21.3.4.tgz", + "integrity": "sha512-Ievi/yy8DS3ygGvT47PjSfdFoX+2isQueoYP1cntFW1JLYAuS4GD7NUPGg4zv2iZfV52uDyk5w5Z0TdpRS6Q1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tokenizer/inflate": "^0.4.1", + "strtok3": "^10.3.4", + "token-types": "^6.1.1", + "uint8array-extras": "^1.4.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", + "integrity": "sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/graphql": { + "version": "16.15.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.15.0.tgz", + "integrity": "sha512-32kz9FecohDiC/tgcViwnRXM7HFBVTPiW7pHO+DikKOI5KjhU/jNULOReXsrFqt2WAYbE9xFXsTffJw6iTO8qw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, + "node_modules/help-me": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz", + "integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==", + "dev": true, + "license": "MIT" + }, + "node_modules/http-status": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/http-status/-/http-status-2.1.0.tgz", + "integrity": "sha512-O5kPr7AW7wYd/BBiOezTwnVAnmSNFY+J7hlZD2X5IOxVBetjcHAiTXhzj0gMrnojQlwy+UT1/Y3H3vJ3UlmvLA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/image-dimensions": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/image-dimensions/-/image-dimensions-2.5.1.tgz", + "integrity": "sha512-It7CkTNp7IYA8jhvGgz8K18OAbHF3/Juk8RNEyTyMFfolJOIU1Y2wGDnzDQPbGCjyxVF/++pwIZE0BKJUEOb1g==", + "dev": true, + "license": "MIT", + "bin": { + "image-dimensions": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ipaddr.js": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz", + "integrity": "sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jose": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/jose/-/jose-5.10.0.tgz", + "integrity": "sha512-s+3Al/p9g32Iq+oqXxkW//7jk2Vig6FF1CFqzVXoTUXt2qz89YWbL+OwS17NFYEvxC35n0FKeGO2LGYSxeM2Gg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-schema-to-typescript": { + "version": "15.0.3", + "resolved": "https://registry.npmjs.org/json-schema-to-typescript/-/json-schema-to-typescript-15.0.3.tgz", + "integrity": "sha512-iOKdzTUWEVM4nlxpFudFsWyUiu/Jakkga4OZPEt7CGoSEsAsUgdOZqR6pcgx2STBek9Gm4hcarJpXSzIvZ/hKA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@apidevtools/json-schema-ref-parser": "^11.5.5", + "@types/json-schema": "^7.0.15", + "@types/lodash": "^4.17.7", + "is-glob": "^4.0.3", + "js-yaml": "^4.1.0", + "lodash": "^4.17.21", + "minimist": "^1.2.8", + "prettier": "^3.2.5", + "tinyglobby": "^0.2.9" + }, + "bin": { + "json2ts": "dist/src/cli.js" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/kareem": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.6.3.tgz", + "integrity": "sha512-C3iHfuGUXK2u8/ipq9LfjFfXFxAZMQJJq7vLS45r3D9Y2xQ/m4S8zaR4zMLFWh9AsNPXmcFfUDhTEO8UIC/V6Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "peer": true, + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/magic-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, + "node_modules/memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "dev": true, + "license": "MIT" + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mongodb": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.20.0.tgz", + "integrity": "sha512-Tl6MEIU3K4Rq3TSHd+sZQqRBoGlFsOgNrH5ltAcFBV62Re3Fd+FcaVf8uSEQFOJ51SDowDVttBTONMfoYWrWlQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@mongodb-js/saslprep": "^1.3.0", + "bson": "^6.10.4", + "mongodb-connection-string-url": "^3.0.2" + }, + "engines": { + "node": ">=16.20.1" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.188.0", + "@mongodb-js/zstd": "^1.1.0 || ^2.0.0", + "gcp-metadata": "^5.2.0", + "kerberos": "^2.0.1", + "mongodb-client-encryption": ">=6.0.0 <7", + "snappy": "^7.3.2", + "socks": "^2.7.1" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "gcp-metadata": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + }, + "socks": { + "optional": true + } + } + }, + "node_modules/mongodb-connection-string-url": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.2.tgz", + "integrity": "sha512-rMO7CGo/9BFwyZABcKAWL8UJwH/Kc2x0g72uhDWzG48URRax5TCIcJ7Rc3RZqffZzO/Gwff/jyKwCU9TN8gehA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/whatwg-url": "^11.0.2", + "whatwg-url": "^14.1.0 || ^13.0.0" + } + }, + "node_modules/mongoose": { + "version": "8.24.1", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.24.1.tgz", + "integrity": "sha512-UpHBA0l5kHyKJQFjmBaFYQFo5sgz1DK0TRqDkOyBLYbqiIbKKhIvBpHWBXqeo0rgW4kGI1UhhAw+kTQZoj1BdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bson": "^6.10.4", + "kareem": "2.6.3", + "mongodb": "~6.20.0", + "mpath": "0.9.0", + "mquery": "5.0.0", + "ms": "2.1.3", + "sift": "17.1.3" + }, + "engines": { + "node": ">=16.20.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mongoose" + } + }, + "node_modules/mongoose-lean-virtuals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/mongoose-lean-virtuals/-/mongoose-lean-virtuals-1.1.1.tgz", + "integrity": "sha512-8chOqpVE3bcoWT2pIgcJeIZlXaOfQCavZgQZF4qytUtjRBqsNMyzUoR16qdw9XL2kC478N8iA8z0AA+NSS0d1A==", + "dev": true, + "license": "Apache 2.0", + "dependencies": { + "mpath": "^0.8.4" + }, + "engines": { + "node": ">=16.20.1" + }, + "peerDependencies": { + "mongoose": ">=5.11.10" + } + }, + "node_modules/mongoose-lean-virtuals/node_modules/mpath": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.4.tgz", + "integrity": "sha512-DTxNZomBcTWlrMW76jy1wvV37X/cNNxPW1y2Jzd4DZkAaC5ZGsm8bfGfNOthcDuRJujXLqiuS6o3Tpy0JEoh7g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/mongoose-paginate-v2": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/mongoose-paginate-v2/-/mongoose-paginate-v2-1.9.4.tgz", + "integrity": "sha512-0LOsVEQmjrbJKVDi/IvFEhIezmuRjUE4loGgslv57j9nK/NMC+mbKT0QnaPSPpib4lByKVBcy3VbDa1TvlHZjA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mongoose-lean-virtuals": "^1.1.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/mpath": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", + "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/mquery": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz", + "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4.x" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/obug": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz", + "integrity": "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/on-exit-leak-free": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", + "integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/payload": { + "version": "3.93.0", + "resolved": "https://registry.npmjs.org/payload/-/payload-3.93.0.tgz", + "integrity": "sha512-QUCVL1I1ZNSIvHMMniTtxlVDQiuunIuUZHgo6BP0421+qP3OrgP9cxbfwv7Qx+t18EniPQZlkxZQssFxlOa/AA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@next/env": "^15.1.5", + "@payloadcms/translations": "3.93.0", + "@types/busboy": "1.5.4", + "ajv": "8.18.0", + "bson-objectid": "2.0.4", + "busboy": "^1.6.0", + "ci-info": "^4.1.0", + "console-table-printer": "2.12.1", + "croner": "10.0.1", + "dataloader": "2.2.3", + "deepmerge": "4.3.1", + "file-type": "21.3.4", + "get-tsconfig": "4.8.1", + "http-status": "2.1.0", + "image-dimensions": "2.5.1", + "ipaddr.js": "2.2.0", + "jose": "5.10.0", + "json-schema-to-typescript": "15.0.3", + "minimist": "1.2.8", + "path-to-regexp": "6.3.0", + "pino": "9.14.0", + "pino-pretty": "13.1.2", + "pluralize": "8.0.0", + "qs-esm": "8.0.1", + "range-parser": "1.2.1", + "sanitize-filename": "1.6.3", + "sax": "1.6.1", + "ts-essentials": "10.0.3", + "tsx": "4.23.15", + "undici": "7.30.1", + "uuid": "13.0.2", + "ws": "^8.16.0" + }, + "bin": { + "payload": "bin.js" + }, + "engines": { + "node": "^22.23.4 || >=24.22.1" + }, + "peerDependencies": { + "graphql": "^16.8.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC", + "peer": true + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pino": { + "version": "9.14.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-9.14.0.tgz", + "integrity": "sha512-8OEwKp5juEvb/MjpIc4hjqfgCNysrS94RIOMXYvpYCdm/jglrKEiAYmiumbmGhCvs+IcInsphYDFwqrjr7398w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pinojs/redact": "^0.4.0", + "atomic-sleep": "^1.0.0", + "on-exit-leak-free": "^2.1.0", + "pino-abstract-transport": "^2.0.0", + "pino-std-serializers": "^7.0.0", + "process-warning": "^5.0.0", + "quick-format-unescaped": "^4.0.3", + "real-require": "^0.2.0", + "safe-stable-stringify": "^2.3.1", + "sonic-boom": "^4.0.1", + "thread-stream": "^3.0.0" + }, + "bin": { + "pino": "bin.js" + } + }, + "node_modules/pino-abstract-transport": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-2.0.0.tgz", + "integrity": "sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "split2": "^4.0.0" + } + }, + "node_modules/pino-pretty": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-13.1.2.tgz", + "integrity": "sha512-3cN0tCakkT4f3zo9RXDIhy6GTvtYD6bK4CRBLN9j3E/ePqN1tugAXD5rGVfoChW6s0hiek+eyYlLNqc/BG7vBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "colorette": "^2.0.7", + "dateformat": "^4.6.3", + "fast-copy": "^3.0.2", + "fast-safe-stringify": "^2.1.1", + "help-me": "^5.0.0", + "joycon": "^3.1.1", + "minimist": "^1.2.6", + "on-exit-leak-free": "^2.1.0", + "pino-abstract-transport": "^2.0.0", + "pump": "^3.0.0", + "secure-json-parse": "^4.0.0", + "sonic-boom": "^4.0.1", + "strip-json-comments": "^5.0.2" + }, + "bin": { + "pino-pretty": "bin.js" + } + }, + "node_modules/pino-std-serializers": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.1.0.tgz", + "integrity": "sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==", + "dev": true, + "license": "MIT" + }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss": { + "version": "8.5.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.33.tgz", + "integrity": "sha512-RVHEU9/Pp1Fnjr/MpAJsZoADukCKhfIi15OunEYiGktIkYLkPVvC1sioWolGDS7XByMTx9m/IGbro0Js13zhnQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prettier": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.10.1.tgz", + "integrity": "sha512-70vp3ZUYoPlFbF9uiTdXHUUCGEIp7d4+6p+8DYbkm2jP7x/3i/paXVF6dopSI3zd/CEitrZN1rc4i85xWmmXlg==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/process-warning": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.1.1.tgz", + "integrity": "sha512-oCkNVj4OKnKEcocVBcDfiIugN1/cE6rgfT3nCtzeqZPA8+rIxMaQ0xXzIkGP8Gj2qUaP1UR7uhJ1VD8lUCpzCg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/qs-esm": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/qs-esm/-/qs-esm-8.0.1.tgz", + "integrity": "sha512-eZ7l+0ZVy3He9c85pEM9KEBR9DFA4jrmWvIjm9wpcHvScwc/vgZDl2TNOF0pm0JsWKw24XBUZOY0Wxn7/nvJnw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/quick-format-unescaped": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", + "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", + "dev": true, + "license": "MIT" + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/real-require": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", + "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12.13.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/rolldown": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.19.tgz", + "integrity": "sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@oxc-project/types": "=0.156.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.19", + "@rolldown/binding-android-arm64": "1.2.19", + "@rolldown/binding-darwin-arm64": "1.2.19", + "@rolldown/binding-darwin-x64": "1.2.19", + "@rolldown/binding-freebsd-x64": "1.2.19", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.19", + "@rolldown/binding-linux-arm64-gnu": "1.2.19", + "@rolldown/binding-linux-arm64-musl": "1.2.19", + "@rolldown/binding-linux-ppc64-gnu": "1.2.19", + "@rolldown/binding-linux-s390x-gnu": "1.2.19", + "@rolldown/binding-linux-x64-gnu": "1.2.19", + "@rolldown/binding-linux-x64-musl": "1.2.19", + "@rolldown/binding-openharmony-arm64": "1.2.19", + "@rolldown/binding-wasm32-wasi": "1.2.19", + "@rolldown/binding-win32-arm64-msvc": "1.2.19", + "@rolldown/binding-win32-x64-msvc": "1.2.19" + } + }, + "node_modules/safe-stable-stringify": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/sanitize-filename": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", + "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", + "dev": true, + "license": "WTFPL OR ISC", + "dependencies": { + "truncate-utf8-bytes": "^1.0.0" + } + }, + "node_modules/sax": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz", + "integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=11.0.0" + } + }, + "node_modules/secure-json-parse": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-4.1.1.tgz", + "integrity": "sha512-lnd81MQEZKjhW/Gd2TQqdd4XP6QYNdDW/EP+I7nTrFHP9y2LmaGPIHk9xsnzcOiEr1c39c/e84xFgGviQKBTRw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/sift": { + "version": "17.1.3", + "resolved": "https://registry.npmjs.org/sift/-/sift-17.1.3.tgz", + "integrity": "sha512-Rtlj66/b0ICeFzYTuNvX/EF1igRbbnGSvEyT79McoZa/DeGhMyC5pWKOEsZKnpkqtSeovd5FL/bjHWC3CIIvCQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/simple-wcswidth": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/simple-wcswidth/-/simple-wcswidth-1.1.2.tgz", + "integrity": "sha512-j7piyCjAeTDSjzTSQ7DokZtMNwNlEAyxqSZeCS+CXH7fJ4jx3FuJ/mTW3mE+6JLs4VJBbcll0Kjn+KXI5t21Iw==", + "dev": true, + "license": "MIT" + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/sonic-boom": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.1.tgz", + "integrity": "sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "atomic-sleep": "^1.0.0" + } + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "memory-pager": "^1.0.2" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/std-env": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz", + "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==", + "dev": true, + "license": "MIT" + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "dev": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/strip-json-comments": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.1.0.tgz", + "integrity": "sha512-ErcwpJBYr8EfX/Br7JauOIGXoRE92w0hVtuS9j92UFgbATxA+WRSIZksSUDzEeItfWB/0QCEprTZT55RSINUHQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strtok3": { + "version": "10.8.0", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-10.8.0.tgz", + "integrity": "sha512-e6bW3fD6V01DPmcbLfNtn0cjsiHvTKS/hivgbzqYMfHb/nLes4QQ0H5QBxlkPQayF4xv08AvlSgptGwN86Eemw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tokenizer/token": "^0.3.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/thread-stream": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-3.2.0.tgz", + "integrity": "sha512-zLBvqpwr4Esa0kRjcrzGU6zL25lePWaCLMx0RQFrmteozIfeNdaMLpG5U7PeHzvlFkAWaRKA9/KVW4F60iB+qw==", + "dev": true, + "license": "MIT", + "dependencies": { + "real-require": "^0.2.0" + } + }, + "node_modules/tinybench": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.3.tgz", + "integrity": "sha512-Al01C2JIBnO2CXCAPbpAl6sUiOZHeThGtHYNTa51JRw9PyWOCdr+9Ong05R4qg/Sk3+H645E8ov1h2c58ityNw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/tinyexec": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", + "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/token-types": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.2.0.tgz", + "integrity": "sha512-s9euYHM//T3loJtbNUYdbAzsMlvKBeRS+XCLFy+UGosMQH19Hwjap5k19i4PPAEJJBsVIpMpVTxl4fIqCuNfUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@borewit/text-codec": "^0.2.3", + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/tr46": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", + "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==", + "dev": true, + "license": "WTFPL", + "dependencies": { + "utf8-byte-length": "^1.0.1" + } + }, + "node_modules/ts-essentials": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-10.0.3.tgz", + "integrity": "sha512-/FrVAZ76JLTWxJOERk04fm8hYENDo0PWSP3YLQKxevLwWtxemGcl5JJEzN4iqfDlRve0ckyfFaOBu4xbNH/wZw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "typescript": ">=4.5.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "dev": true, + "license": "0BSD", + "optional": true, + "peer": true + }, + "node_modules/tsx": { + "version": "4.23.15", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.15.tgz", + "integrity": "sha512-Yiex1Ovn8z2xPpOWckIiysV1SSyRMY9BkLF++q0yKiDxCqRhosKfMg3janKkiLBwZ5c/YryloKwGZcrEmtwxKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.28.0" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/uint8array-extras": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/uint8array-extras/-/uint8array-extras-1.6.0.tgz", + "integrity": "sha512-8iAasVS4wUx0gPLjH8Xtz2PeDzTSiy8QiLGu2DT3X5GU+egFEQhpnbtkehbAwjvDcxIERmCYcysiODFmE3Ud0Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/undici": { + "version": "7.30.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz", + "integrity": "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/undici-types": { + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", + "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", + "dev": true, + "license": "MIT" + }, + "node_modules/utf8-byte-length": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz", + "integrity": "sha512-Xn0w3MtiQ6zoz2vFyUVruaCL53O/DwUvkEeOvj+uulMm0BkUGYWmBYVyElqZaSLhY6ZD0ulfU3aBra2aVT4xfA==", + "dev": true, + "license": "(WTFPL OR MIT)" + }, + "node_modules/uuid": { + "version": "13.0.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-13.0.2.tgz", + "integrity": "sha512-vzi9uRZ926x4XV73S/4qQaTwPXM2JBj6/6lI/byHH1jOpCzb0zDbfytgA9LcN/hzb2l7WQSQnxITOVx5un/wGw==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist-node/bin/uuid" + } + }, + "node_modules/vite": { + "version": "8.3.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.8.tgz", + "integrity": "sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.32", + "rolldown": "~1.2.18", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vitest": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.0.tgz", + "integrity": "sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/mocker": "5.1.0", + "chai": "^6.3.0", + "es-module-lexer": "^2.3.2", + "expect-type": "^1.4.0", + "magic-string": "^1.4.3", + "obug": "^3.0.0", + "picomatch": "^4.0.7", + "std-env": "^4.3.0", + "tinybench": "^6.2.2", + "tinyexec": "^1.3.1", + "tinyglobby": "^0.2.17", + "why-is-node-running": "3.2.1" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^22.12.0 || ^24.0.0 || >=26.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "5.1.0", + "@vitest/browser-preview": "5.1.0", + "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", + "@vitest/coverage-istanbul": "5.1.0", + "@vitest/coverage-v8": "5.1.0", + "@vitest/ui": "5.1.0", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", + "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "^5.1.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/why-is-node-running": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz", + "integrity": "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==", + "dev": true, + "license": "MIT", + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=20.11" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.23.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.23.0.tgz", + "integrity": "sha512-wCkmX8QMOrKjgO8HW2WyDbTSGeqkocxgDzS9iR79rEAexty6/2qzilx3Ag8Tqf9ykop3irLKle0MtVn5qjVnoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..6af5dd1 --- /dev/null +++ b/package.json @@ -0,0 +1,67 @@ +{ + "name": "@extantape/payload-plugin-labels", + "version": "0.0.0", + "private": true, + "description": "Labels for Payload: design labels with field tokens, then print one, a few or every label for a document on thermal rolls or Avery-style sheets.", + "keywords": [ + "payload", + "payload-plugin", + "payloadcms", + "admin-ui", + "ecommerce", + "labels", + "printing", + "barcode", + "qr-code", + "thermal-printer", + "pdf" + ], + "license": "MIT", + "homepage": "https://github.com/ExtantApe/payload-plugin-labels#readme", + "bugs": { + "url": "https://github.com/ExtantApe/payload-plugin-labels/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ExtantApe/payload-plugin-labels.git" + }, + "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + }, + "./core": { + "types": "./dist/core/index.d.ts", + "import": "./dist/core/index.js" + } + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist", + "README.md", + "LICENSE" + ], + "engines": { + "node": ">=22" + }, + "scripts": { + "build": "rm -rf dist && tsc -p tsconfig.build.json", + "typecheck": "tsc --noEmit", + "test": "vitest run", + "prepack": "npm run build", + "prepublishOnly": "npm run typecheck && npm test" + }, + "peerDependencies": { + "payload": "^3.80.0" + }, + "devDependencies": { + "@payloadcms/db-mongodb": "^3.92.1", + "@types/node": "^24.19.2", + "graphql": "^16.15.0", + "payload": "^3.92.1", + "typescript": "^5.9.3", + "vitest": "^5.1.0" + } +} diff --git a/src/contracts/labels.ts b/src/contracts/labels.ts new file mode 100644 index 0000000..ece242a --- /dev/null +++ b/src/contracts/labels.ts @@ -0,0 +1,45 @@ +/** + * The contract other plugins and sites use to offer labels. Types only, no imports, so a provider can copy it or + * import it without pulling in anything. Labels reads `config.custom.labels.providers` at request time. + */ +import type { LabelElement, LabelMedia, LabelSize } from '../core/types.js' + +/** A ready-made template. It is copied into an editable record only when someone picks it. */ +export type LabelTemplatePreset = { + key: string + name: string + collection: string + size: LabelSize + elements: LabelElement[] + /** An array field to print one label per row of, such as order lines. */ + repeat?: string + copies?: number + /** A media preset key, such as `thermal-4x6`. */ + media?: string +} + +/** One step of a set: a template, for the document itself or for related documents reached through a relationship. */ +export type LabelSetStep = { + template: string + /** Omitted: the document itself. Set: print for each document in `collection` whose `field` points at this one. */ + related?: { collection: string; field: string } +} + +/** A named list of steps on one collection, such as "All labels for this order". */ +export type LabelSetPreset = { + key: string + name: string + collection: string + steps: LabelSetStep[] +} + +export type LabelProvider = { + /** Shown in the template library, such as "Kitting". Also the namespace of its tokens. */ + name: string + templates?: LabelTemplatePreset[] + sets?: LabelSetPreset[] + /** Extra tokens under the provider's namespace. `payload` and `req` are Payload's, typed loosely to stay import-free. */ + tokens?: (args: { collection: string; doc: object; payload: unknown; req: unknown }) => Promise> +} + +export type { LabelMedia } diff --git a/src/core/barcode.ts b/src/core/barcode.ts new file mode 100644 index 0000000..6c68c04 --- /dev/null +++ b/src/core/barcode.ts @@ -0,0 +1,14 @@ +import type { Symbology } from './types.js' + +/** Value checks per symbology. Drawing is not here yet. */ +export function validBarcode(symbology: Symbology | 'qr', value: string): boolean { + if (value === '') return false + switch (symbology) { + case 'code128': return /^[\x20-\x7e]+$/.test(value) + case 'code39': return /^[A-Z0-9 \-.$/+%]+$/.test(value) + case 'ean13': return /^\d{12,13}$/.test(value) + case 'upca': return /^\d{11,12}$/.test(value) + case 'datamatrix': + case 'qr': return true + } +} diff --git a/src/core/fit.ts b/src/core/fit.ts new file mode 100644 index 0000000..8ea1f64 --- /dev/null +++ b/src/core/fit.ts @@ -0,0 +1,54 @@ +import { pointsToMm } from './units.js' +import type { Overflow } from './types.js' + +/** No font files here, so width is estimated: an average glyph is about 0.52 em wide (0.58 bold). */ +export function textWidthMm(text: string, fontSize: number, bold = false): number { + return text.length * fontSize * (bold ? 0.58 : 0.52) * (25.4 / 72) +} +const LINE_HEIGHT = 1.2 +export const MIN_FONT_SIZE = 4 + +export type Fit = { lines: string[]; fontSize: number; overflow: boolean } + +function wrap(text: string, max: number, size: number, bold: boolean): string[] { + const lines: string[] = [] + let cur = '' + for (const word of text.split(/\s+/).filter(Boolean)) { + const next = cur ? `${cur} ${word}` : word + if (cur && textWidthMm(next, size, bold) > max) { + lines.push(cur) + cur = word + } else cur = next + } + if (cur) lines.push(cur) + return lines.length ? lines : [''] +} + +function ellipsize(text: string, max: number, size: number, bold: boolean): string { + if (textWidthMm(text, size, bold) <= max) return text + let s = text + while (s.length > 0 && textWidthMm(`${s}…`, size, bold) > max) s = s.slice(0, -1) + return `${s.trimEnd()}…` +} + +/** Fit text into a box with the element's overflow rule. `overflow: true` means it still doesn't fit. */ +export function fitText(text: string, width: number, height: number, size: number, rule: Overflow, bold = false, maxLines = 2): Fit { + const fitsHeight = (n: number, s: number) => n * pointsToMm(s) * LINE_HEIGHT <= height + 1e-9 + if (rule === 'shrink') { + let s = size + while (s > MIN_FONT_SIZE && (textWidthMm(text, s, bold) > width || !fitsHeight(1, s))) s -= 0.5 + return { lines: [text], fontSize: s, overflow: textWidthMm(text, s, bold) > width || !fitsHeight(1, s) } + } + if (rule === 'ellipsis') { + const line = ellipsize(text, width, size, bold) + return { lines: [line], fontSize: size, overflow: !fitsHeight(1, size) } + } + let lines = wrap(text, width, size, bold) + let overflow = lines.some((l) => textWidthMm(l, size, bold) > width) + if (lines.length > maxLines) { + lines = lines.slice(0, maxLines) + lines[maxLines - 1] = ellipsize(`${lines[maxLines - 1]} …`, width, size, bold) + overflow = true + } + return { lines, fontSize: size, overflow: overflow || !fitsHeight(lines.length, size) } +} diff --git a/src/core/index.ts b/src/core/index.ts new file mode 100644 index 0000000..7f83a2e --- /dev/null +++ b/src/core/index.ts @@ -0,0 +1,8 @@ +export * from './barcode.js' +export * from './fit.js' +export * from './layout.js' +export * from './presets.js' +export * from './tokens.js' +export * from './types.js' +export * from './units.js' +export type * from '../contracts/labels.js' diff --git a/src/core/layout.ts b/src/core/layout.ts new file mode 100644 index 0000000..62c1aa2 --- /dev/null +++ b/src/core/layout.ts @@ -0,0 +1,77 @@ +import { validBarcode } from './barcode.js' +import { fitText } from './fit.js' +import { resolveTokens } from './tokens.js' +import { round } from './units.js' +import type { LabelContext, LabelElement, LabelMedia, LabelTemplate, LayoutResult, Mark, Warning } from './types.js' + +/** + * One label: the template's elements with tokens resolved from `data`, as positioned marks in millimeters. + * Every output (SVG preview, PDF, ZPL) draws this list. The media's calibration offset is applied here. + */ +export function layout(template: LabelTemplate, data: unknown, media?: LabelMedia, context: LabelContext = {}): LayoutResult { + const warnings: Warning[] = [] + const marks: Mark[] = [] + const dx = media?.offset.x ?? 0 + const dy = media?.offset.y ?? 0 + const safe = media?.safeMargin ?? 0 + const { width: W, height: H } = template.size + + template.elements.forEach((el, i) => { + const rotation = el.rotation ?? 0 + const base = { x: round(el.x + dx), y: round(el.y + dy), width: el.width, height: el.height, rotation } + const warn = (kind: Warning['kind'], message: string) => warnings.push({ element: i, kind, message }) + const tokens = (text: string) => { + const r = resolveTokens(text, data, context) + for (const issue of r.issues) { + warn(issue.kind, issue.kind === 'missing' ? `No value for {{${issue.token}}}` : `{{${issue.token}}} is not a valid token`) + } + return r + } + + if (el.x < safe || el.y < safe || el.x + el.width > W - safe || el.y + el.height > H - safe) { + warn('outside-safe-area', safe > 0 ? `Outside the ${safe} mm safe area` : 'Outside the label') + } + + switch (el.type) { + case 'text': { + const r = tokens(el.content) + const fit = fitText(r.text, el.width, el.height, el.fontSize, el.overflow ?? 'shrink', el.bold, el.maxLines ?? 2) + if (fit.overflow) warn('overflow', 'Text does not fit its box') + marks.push({ type: 'text', ...base, lines: fit.lines, fontSize: fit.fontSize, font: el.font, bold: !!el.bold, italic: !!el.italic, align: el.align ?? 'left', missing: r.issues.length > 0 }) + break + } + case 'barcode': + case 'qr': { + const value = tokens(el.type === 'qr' ? el.value : el.value).text + const symbology = el.type === 'qr' ? 'qr' : el.symbology + if (!validBarcode(symbology, value)) warn('invalid-barcode', `"${value}" is not valid for ${symbology}`) + marks.push({ type: 'barcode', ...base, symbology, value, humanReadable: el.type === 'barcode' && el.humanReadable !== false }) + break + } + case 'image': + marks.push({ type: 'image', ...base, source: tokens(el.source).text }) + break + case 'line': + case 'box': + marks.push({ type: el.type, ...base, thickness: el.thickness ?? 0.25 }) + break + } + }) + return { width: W, height: H, marks, warnings } +} + +/** Top-left corner of each label on a sheet, in order, starting at a 0-based `start` position. */ +export function sheetPositions(media: Extract, count: number, start = 0): Array<{ page: number; x: number; y: number }> { + const perPage = media.columns * media.rows + return Array.from({ length: count }, (_, n) => { + const slot = start + n + const within = slot % perPage + return { + page: Math.floor(slot / perPage), + x: round(media.left + (within % media.columns) * media.pitchX + media.offset.x), + y: round(media.top + Math.floor(within / media.columns) * media.pitchY + media.offset.y), + } + }) +} + +export type { LabelElement } diff --git a/src/core/presets.ts b/src/core/presets.ts new file mode 100644 index 0000000..dd84822 --- /dev/null +++ b/src/core/presets.ts @@ -0,0 +1,16 @@ +import { inchesToMm } from './units.js' +import type { ThermalMedia } from './types.js' + +/** 4 x 6 inch thermal roll, 203 dpi. The 3 mm gap is a typical roll value; calibrate per printer. */ +export const THERMAL_4X6: ThermalMedia = { + kind: 'thermal', + key: 'thermal-4x6', + name: '4 x 6 in thermal', + width: inchesToMm(4), + height: inchesToMm(6), + gap: 3, + dpi: 203, + offset: { x: 0, y: 0 }, +} + +export const MEDIA_PRESETS: Record = { [THERMAL_4X6.key]: THERMAL_4X6 } diff --git a/src/core/tokens.ts b/src/core/tokens.ts new file mode 100644 index 0000000..7779d2f --- /dev/null +++ b/src/core/tokens.ts @@ -0,0 +1,116 @@ +import type { LabelContext } from './types.js' + +/** Tokens never run code: a path and a short list of known formatters, parsed by hand, no eval. */ +export const MAX_PATH_SEGMENTS = 4 +const PATH = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/ +const TOKEN = /\{\{([^{}]*)\}\}/g +const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + +export type TokenIssue = { token: string; kind: 'missing' | 'invalid-token' } +export type Resolved = { text: string; issues: TokenIssue[] } + +type Arg = string | number + +/** Split `a | fmt:"x":2` on pipes and colons outside double quotes. */ +function split(s: string, sep: string): string[] | null { + const out: string[] = [] + let cur = '' + let quoted = false + for (const ch of s) { + if (ch === '"') quoted = !quoted + if (ch === sep && !quoted) { + out.push(cur) + cur = '' + } else cur += ch + } + if (quoted) return null + out.push(cur) + return out +} + +function parseArg(raw: string): Arg | null { + const t = raw.trim() + if (/^"[^"]*"$/.test(t)) return t.slice(1, -1) + if (/^-?\d+(\.\d+)?$/.test(t)) return Number(t) + return null +} + +function lookup(path: string, data: unknown, context: LabelContext): unknown { + const parts = path.split('.') + let cur: unknown = parts[0]! in context ? context : data + for (const part of parts) { + if (cur === null || typeof cur !== 'object' || !Object.hasOwn(cur, part)) return undefined + cur = (cur as Record)[part] + } + return cur +} + +const empty = (v: unknown): boolean => v === undefined || v === null || v === '' + +function date(v: unknown, fmt: string): string | null { + const d = v instanceof Date ? v : typeof v === 'string' || typeof v === 'number' ? new Date(v) : null + if (!d || Number.isNaN(d.getTime())) return null + const pad = (n: number) => String(n).padStart(2, '0') + const map: Record = { + YYYY: String(d.getUTCFullYear()), + MMM: MONTHS[d.getUTCMonth()]!, + MM: pad(d.getUTCMonth() + 1), + DD: pad(d.getUTCDate()), + D: String(d.getUTCDate()), + } + return fmt.replace(/YYYY|MMM|MM|DD|D/g, (m) => map[m]!) +} + +function format(value: unknown, name: string, args: Arg[]): string | null { + const str = String(value ?? '') + switch (name) { + case 'upper': return str.toUpperCase() + case 'lower': return str.toLowerCase() + case 'default': return empty(value) ? String(args[0] ?? '') : str + case 'date': return date(value, String(args[0] ?? 'YYYY-MM-DD')) + case 'money': { + const n = Number(value) + return Number.isFinite(n) ? n.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : null + } + case 'slice': return str.slice(Number(args[0] ?? 0), args[1] === undefined ? undefined : Number(args[1])) + default: return null + } +} + +export function resolveToken(body: string, data: unknown, context: LabelContext = {}): { text: string; issue?: TokenIssue['kind'] } { + const pipes = split(body, '|') + if (!pipes) return { text: '', issue: 'invalid-token' } + const path = pipes[0]!.trim() + if (!PATH.test(path) || path.split('.').length > MAX_PATH_SEGMENTS) return { text: '', issue: 'invalid-token' } + const steps: Array<[string, Arg[]]> = [] + for (const raw of pipes.slice(1)) { + const bits = split(raw.trim(), ':') + const name = bits?.[0]?.trim() + if (!bits || !name || !/^[a-z]+$/.test(name)) return { text: '', issue: 'invalid-token' } + const args = bits.slice(1).map(parseArg) + if (args.some((a) => a === null)) return { text: '', issue: 'invalid-token' } + steps.push([name, args as Arg[]]) + } + let value = lookup(path, data, context) + const fallback = steps.some(([n]) => n === 'default') + if (empty(value) && !fallback) return { text: '', issue: 'missing' } + let text = String(value ?? '') + for (const [name, args] of steps) { + const out = format(value, name, args) + if (out === null) return { text: '', issue: 'invalid-token' } + value = out + text = out + } + return { text } +} + +/** Replace every `{{token}}` in `template`. A missing or invalid token becomes empty and is reported. */ +export function resolveTokens(template: string, data: unknown, context: LabelContext = {}): Resolved { + const issues: TokenIssue[] = [] + const text = template.replace(TOKEN, (_all, body: string) => { + const r = resolveToken(body, data, context) + if (r.issue) issues.push({ token: body.trim(), kind: r.issue }) + return r.text + }) + return { text, issues } +} diff --git a/src/core/types.ts b/src/core/types.ts new file mode 100644 index 0000000..d4af9d3 --- /dev/null +++ b/src/core/types.ts @@ -0,0 +1,84 @@ +/** All sizes and positions are millimeters. */ +export type Rotation = 0 | 90 | 180 | 270 +export type Overflow = 'shrink' | 'ellipsis' | 'wrap' +export type Symbology = 'code128' | 'code39' | 'ean13' | 'upca' | 'datamatrix' + +export type LabelSize = { width: number; height: number } + +type Box = { x: number; y: number; width: number; height: number; rotation?: Rotation } + +export type TextElement = Box & { + type: 'text' + /** Text with `{{tokens}}`. */ + content: string + font?: string + /** Points. */ + fontSize: number + bold?: boolean + italic?: boolean + align?: 'left' | 'center' | 'right' + overflow?: Overflow + /** For `wrap`. Default 2. */ + maxLines?: number +} +export type BarcodeElement = Box & { type: 'barcode'; symbology: Symbology; value: string; humanReadable?: boolean } +export type QrElement = Box & { type: 'qr'; value: string } +export type ImageElement = Box & { type: 'image'; /** An upload id, or a token naming an upload field. */ source: string } +export type LineElement = Box & { type: 'line'; thickness?: number } +export type BoxElement = Box & { type: 'box'; thickness?: number } +export type LabelElement = TextElement | BarcodeElement | QrElement | ImageElement | LineElement | BoxElement + +export type LabelTemplate = { + key: string + size: LabelSize + elements: LabelElement[] +} + +export type ThermalMedia = { + kind: 'thermal' + key: string + name: string + width: number + height: number + /** Gap between labels on the roll. */ + gap: number + dpi: 203 | 300 | 600 + offset: { x: number; y: number } + /** Keep marks this far inside the label edge, or get a warning. Default 0. */ + safeMargin?: number +} +export type SheetMedia = { + kind: 'sheet' + key: string + name: string + page: { width: number; height: number } + columns: number + rows: number + width: number + height: number + top: number + left: number + pitchX: number + pitchY: number + offset: { x: number; y: number } + safeMargin?: number +} +export type LabelMedia = ThermalMedia | SheetMedia + +export type Warning = { + /** Index of the element in the template. */ + element: number + kind: 'missing' | 'invalid-token' | 'overflow' | 'outside-safe-area' | 'invalid-barcode' | 'unreadable' + message: string +} + +export type Mark = + | { type: 'text'; x: number; y: number; width: number; height: number; rotation: Rotation; lines: string[]; fontSize: number; font?: string; bold: boolean; italic: boolean; align: 'left' | 'center' | 'right'; missing: boolean } + | { type: 'barcode'; x: number; y: number; width: number; height: number; rotation: Rotation; symbology: Symbology | 'qr'; value: string; humanReadable: boolean } + | { type: 'image'; x: number; y: number; width: number; height: number; rotation: Rotation; source: string } + | { type: 'line' | 'box'; x: number; y: number; width: number; height: number; rotation: Rotation; thickness: number } + +export type LayoutResult = { width: number; height: number; marks: Mark[]; warnings: Warning[] } + +/** Values the label context supplies: `label.number`, `label.of`, `printedAt`, `printedBy.name`, `site.name`. */ +export type LabelContext = Record diff --git a/src/core/units.ts b/src/core/units.ts new file mode 100644 index 0000000..a315e21 --- /dev/null +++ b/src/core/units.ts @@ -0,0 +1,9 @@ +export const MM_PER_INCH = 25.4 +export const MM_PER_POINT = 25.4 / 72 +export const inchesToMm = (inches: number): number => round(inches * MM_PER_INCH) +export const mmToInches = (mm: number): number => round(mm / MM_PER_INCH, 4) +export const pointsToMm = (pt: number): number => pt * MM_PER_POINT +export function round(n: number, places = 3): number { + const f = 10 ** places + return Math.round(n * f) / f +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..b493210 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,102 @@ +import type { Access, CollectionConfig, Config, Field, Plugin } from 'payload' + +import type { LabelProvider } from './contracts/labels.js' + +export * from './core/index.js' + +type Check = (args: { req: { user?: unknown } }) => boolean | Promise + +export type LabelsOptions = { + /** Plain Payload-style checks. Only an answer of exactly `true` passes; anything else, or an error, is a no. */ + access?: { print?: Check; manage?: Check } + /** Templates and media belong to a site; a record with no site is shared. Needs `scopeCollection`. */ + scopeField?: string + /** The collection the scope field points at, such as `tenants`. */ + scopeCollection?: string + /** The print log. Ids and counts only. Default on, 180 days. */ + log?: { enabled?: boolean; keepDays?: number } +} + +const strict = (check?: Check): Access => async (args) => { + if (!check) return false + try { + return (await check(args as never)) === true + } catch { + return false + } +} +const never: Access = () => false + +export const TEMPLATES_SLUG = 'label-templates' +export const MEDIA_SLUG = 'label-media' +export const PRINTS_SLUG = 'label-prints' + +export const labelsPlugin = + (options: LabelsOptions = {}): Plugin => + (config: Config): Config => { + if (options.scopeField && !options.scopeCollection) throw new Error('labels: scopeField needs scopeCollection') + const manage = strict(options.access?.manage) + const print = strict(options.access?.print) + // Reading needs a person who may print or manage. With neither check given, a signed-in user may read. + const read: Access = async (args) => + options.access?.print || options.access?.manage ? (await print(args)) === true || (await manage(args)) === true : Boolean(args.req.user) + const scope: Field[] = options.scopeField + ? [{ name: options.scopeField, type: 'relationship', relationTo: options.scopeCollection!, admin: { description: 'Leave empty to share with every site.' } }] + : [] + const writes = { create: manage, update: manage, delete: manage } + + const templates: CollectionConfig = { + slug: TEMPLATES_SLUG, + admin: { useAsTitle: 'name', group: 'Labels' }, + access: { read, ...writes }, + fields: [ + { name: 'name', type: 'text', required: true }, + { name: 'key', type: 'text', required: true, unique: true, index: true }, + { name: 'collection', type: 'text', required: true }, + { name: 'width', type: 'number', required: true, min: 1, admin: { description: 'Millimeters.' } }, + { name: 'height', type: 'number', required: true, min: 1, admin: { description: 'Millimeters.' } }, + { name: 'media', type: 'relationship', relationTo: MEDIA_SLUG }, + { name: 'elements', type: 'json', required: true, defaultValue: [] }, + { name: 'repeat', type: 'text' }, + { name: 'copies', type: 'number', defaultValue: 1, min: 1 }, + { name: 'active', type: 'checkbox', defaultValue: true }, + { name: 'notes', type: 'textarea' }, + ...scope, + ], + } + const media: CollectionConfig = { + slug: MEDIA_SLUG, + admin: { useAsTitle: 'name', group: 'Labels' }, + access: { read, ...writes }, + fields: [ + { name: 'name', type: 'text', required: true }, + { name: 'kind', type: 'select', required: true, options: ['thermal', 'sheet'] }, + { name: 'definition', type: 'json', required: true, admin: { description: 'Sizes in millimeters, as in the media presets.' } }, + ...scope, + ], + } + const prints: CollectionConfig = { + slug: PRINTS_SLUG, + admin: { group: 'Labels', description: 'Who printed what. Ids and counts only, never the label text.' }, + access: { read: manage, create: never, update: never, delete: never }, + fields: [ + { name: 'template', type: 'relationship', relationTo: TEMPLATES_SLUG }, + { name: 'collection', type: 'text' }, + { name: 'documentIds', type: 'json' }, + { name: 'labelCount', type: 'number' }, + { name: 'media', type: 'relationship', relationTo: MEDIA_SLUG }, + { name: 'printedBy', type: 'text' }, + ...scope, + ], + } + + const custom = (config.custom ?? {}) as { labels?: { providers?: Record } } + return { + ...config, + collections: [...(config.collections ?? []), templates, media, ...(options.log?.enabled === false ? [] : [prints])], + custom: { + ...custom, + labels: { ...custom.labels, options: { ...options, log: { enabled: true, keepDays: 180, ...options.log } }, providers: custom.labels?.providers ?? {} }, + }, + } + } diff --git a/test/core.test.ts b/test/core.test.ts new file mode 100644 index 0000000..e5c4def --- /dev/null +++ b/test/core.test.ts @@ -0,0 +1,96 @@ +import { describe, expect, it } from 'vitest' + +import { fitText, inchesToMm, layout, resolveTokens, sheetPositions, THERMAL_4X6, validBarcode, type LabelTemplate, type SheetMedia } from '../src/core/index.js' + +const order = { code: 'ORD-1042', total: 1234.5, notes: '', createdAt: '2026-03-07T10:00:00Z', customer: { name: 'Sam Example', email: 'sam@example.test' } } + +describe('units and preset', () => { + it('4x6 inch thermal is 101.6 x 152.4 mm at 203 dpi', () => { + expect([THERMAL_4X6.width, THERMAL_4X6.height, THERMAL_4X6.dpi]).toEqual([101.6, 152.4, 203]) + expect(inchesToMm(2.25)).toBe(57.15) + }) +}) + +describe('tokens', () => { + it('resolves dotted paths and context', () => { + const r = resolveTokens('{{code}} {{customer.name}} {{label.number}} of {{label.of}}', order, { label: { number: 3, of: 12 } }) + expect(r).toEqual({ text: 'ORD-1042 Sam Example 3 of 12', issues: [] }) + }) + it('applies formatters', () => { + expect(resolveTokens('{{createdAt | date:"MMM D, YYYY"}}|{{total | money}}|{{code | lower}}|{{code | slice:0:3}}|{{notes | default:"-"}}', order).text).toBe('Mar 7, 2026|1,234.50|ord-1042|ORD|-') + }) + it('reports missing tokens and prints them empty', () => { + const r = resolveTokens('a{{nope}}b', order) + expect(r.text).toBe('ab') + expect(r.issues).toEqual([{ token: 'nope', kind: 'missing' }]) + }) + it('refuses anything that looks like code', () => { + for (const body of ['constructor.constructor("x")()', 'code | eval', 'a.b.c.d.e', 'code | slice:foo']) { + expect(resolveTokens(`{{${body}}}`, order).issues[0]?.kind).toBe('invalid-token') + } + }) + it('does not read inherited properties', () => { + expect(resolveTokens('{{toString}}{{__proto__.x}}', order)).toEqual({ text: '', issues: [{ token: 'toString', kind: 'missing' }, { token: '__proto__.x', kind: 'missing' }] }) + }) +}) + +describe('fitting', () => { + it('shrinks to fit, down to a floor', () => { + expect(fitText('Short', 50, 10, 12, 'shrink').fontSize).toBe(12) + const f = fitText('A very long product name that cannot fit', 30, 10, 12, 'shrink') + expect(f.fontSize).toBeLessThan(12) + expect(fitText('x'.repeat(400), 30, 10, 12, 'shrink')).toMatchObject({ fontSize: 4, overflow: true }) + }) + it('cuts with an ellipsis', () => { + const f = fitText('A very long product name that cannot fit', 30, 10, 12, 'ellipsis') + expect(f.lines[0]!.endsWith('…')).toBe(true) + }) + it('wraps to a maximum number of lines', () => { + const f = fitText('one two three four five six seven eight nine ten', 30, 30, 12, 'wrap', false, 2) + expect(f.lines).toHaveLength(2) + expect(f.overflow).toBe(true) + }) +}) + +describe('layout', () => { + const tpl: LabelTemplate = { + key: 'order-box', + size: { width: THERMAL_4X6.width, height: THERMAL_4X6.height }, + elements: [ + { type: 'text', x: 5, y: 5, width: 90, height: 12, fontSize: 18, content: '{{customer.name}}' }, + { type: 'barcode', x: 5, y: 20, width: 60, height: 20, symbology: 'code128', value: '{{code}}' }, + { type: 'text', x: 5, y: 45, width: 90, height: 8, fontSize: 10, content: '{{missing.thing}}' }, + { type: 'box', x: 120, y: 0, width: 10, height: 10 }, + ], + } + const result = layout(tpl, order, { ...THERMAL_4X6, offset: { x: 1, y: -0.5 } }) + it('returns marks in mm with the calibration offset applied', () => { + expect(result.width).toBe(101.6) + expect(result.marks).toHaveLength(4) + expect(result.marks[0]).toMatchObject({ type: 'text', x: 6, y: 4.5, lines: ['Sam Example'] }) + expect(result.marks[1]).toMatchObject({ type: 'barcode', value: 'ORD-1042', humanReadable: true }) + }) + it('warns about missing values and marks outside the label', () => { + expect(result.warnings.map((w) => [w.element, w.kind])).toEqual([[2, 'missing'], [3, 'outside-safe-area']]) + expect(result.marks[2]).toMatchObject({ type: 'text', missing: true }) + }) + it('warns about a barcode value the symbology cannot hold', () => { + const r = layout({ ...tpl, elements: [{ type: 'barcode', x: 0, y: 0, width: 10, height: 10, symbology: 'ean13', value: '{{code}}' }] }, order) + expect(r.warnings[0]?.kind).toBe('invalid-barcode') + }) + it('validates barcode values', () => { + expect(validBarcode('ean13', '4006381333931')).toBe(true) + expect(validBarcode('code39', 'abc')).toBe(false) + expect(validBarcode('code128', '')).toBe(false) + }) +}) + +describe('sheet positions', () => { + const sheet: SheetMedia = { kind: 'sheet', key: 't', name: 't', page: { width: 215.9, height: 279.4 }, columns: 3, rows: 10, width: 66.675, height: 25.4, top: 12.7, left: 4.762, pitchX: 69.85, pitchY: 25.4, offset: { x: 0, y: 0 } } + it('starts at a chosen slot and rolls onto the next page', () => { + const p = sheetPositions(sheet, 3, 29) + expect(p[0]).toEqual({ page: 0, x: 144.462, y: 241.3 }) + expect(p[1]).toEqual({ page: 1, x: 4.762, y: 12.7 }) + expect(p[2]?.x).toBe(74.612) + }) +}) diff --git a/test/plugin.test.ts b/test/plugin.test.ts new file mode 100644 index 0000000..bdb4db7 --- /dev/null +++ b/test/plugin.test.ts @@ -0,0 +1,56 @@ +import { mongooseAdapter } from '@payloadcms/db-mongodb' +import { buildConfig } from 'payload' +import { describe, expect, it } from 'vitest' + +import { labelsPlugin, type LabelsOptions } from '../src/index.js' + +const build = (options?: LabelsOptions, extra: object = {}) => + buildConfig({ + secret: 'test-secret-not-for-production', + telemetry: false, + typescript: { autoGenerate: false }, + db: mongooseAdapter({ url: 'mongodb://127.0.0.1:1/unused' }), + collections: [{ slug: 'users', auth: true, fields: [] }, { slug: 'tenants', fields: [{ name: 'name', type: 'text' }] }], + plugins: [labelsPlugin(options)], + ...extra, + }) +const slugs = (c: Awaited>) => c.collections.map((x) => x.slug) +const call = (fn: unknown, user?: object) => (fn as (a: object) => unknown)({ req: { user } }) + +describe('labelsPlugin', () => { + it('adds the three collections', async () => { + expect(slugs(await build())).toEqual(expect.arrayContaining(['label-templates', 'label-media', 'label-prints'])) + }) + it('refuses every write by default, and reads for signed-out people', async () => { + const c = await build() + for (const slug of ['label-templates', 'label-media', 'label-prints']) { + const a = c.collections.find((x) => x.slug === slug)!.access + for (const op of ['create', 'update', 'delete'] as const) expect(await call(a[op], { id: '1' })).toBe(false) + } + expect(await call(c.collections.find((x) => x.slug === 'label-templates')!.access.read)).toBe(false) + expect(await call(c.collections.find((x) => x.slug === 'label-prints')!.access.read, { id: '1' })).toBe(false) + }) + it('lets the site grant writes, but only on exactly true; the log stays unwritable', async () => { + const c = await build({ access: { manage: ({ req }) => (req.user as { admin?: boolean } | undefined)?.admin === true, print: (() => 1) as never } }) + const t = c.collections.find((x) => x.slug === 'label-templates')!.access + expect(await call(t.create, { admin: true })).toBe(true) + expect(await call(t.create, { admin: false })).toBe(false) + expect(await call(t.read, { admin: true })).toBe(true) + expect(await call(c.collections.find((x) => x.slug === 'label-prints')!.access.create, { admin: true })).toBe(false) + }) + it('a throwing check is a no', async () => { + const c = await build({ access: { manage: () => { throw new Error('boom') } } }) + expect(await call(c.collections.find((x) => x.slug === 'label-templates')!.access.update, { id: '1' })).toBe(false) + }) + it('adds the scope field, and refuses a scope field without a collection', async () => { + const c = await build({ scopeField: 'tenant', scopeCollection: 'tenants' }) + const f = c.collections.find((x) => x.slug === 'label-templates')!.fields.map((x) => ('name' in x ? x.name : '')) + expect(f).toContain('tenant') + await expect(build({ scopeField: 'tenant' })).rejects.toThrow(/scopeCollection/) + }) + it('can switch the log off, and keeps providers other plugins added', async () => { + const c = await build({ log: { enabled: false } }, { custom: { labels: { providers: { kitting: { name: 'Kitting' } } } } }) + expect(slugs(c)).not.toContain('label-prints') + expect((c.custom as { labels: { providers: object } }).labels.providers).toHaveProperty('kitting') + }) +}) diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..1eb2d81 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { "noEmit": false, "declaration": true, "outDir": "dist", "rootDir": "src" }, + "include": ["src"] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..c01e361 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "lib": ["ES2023"], + "strict": true, + "noUncheckedIndexedAccess": true, + "skipLibCheck": true, + "esModuleInterop": true, + "isolatedModules": true, + "noEmit": true, + "types": ["node"] + }, + "include": ["src", "test"] +} diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..01d526e --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,3 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ test: { testTimeout: 60_000, hookTimeout: 120_000, fileParallelism: false } }) From 851e5094f55c075636827b387a20979fabee2e03 Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Mon, 16 Nov 2026 00:16:21 -0700 Subject: [PATCH 2/7] Filter labels collections by scope and add integration tests Reads, creates, updates and deletes now stay inside the person's own scope when scopeField is set, with scopeOf resolving the scope and failing closed. Shared (no scope) templates are readable by all and changed only by a platform admin. Covered on an in-memory MongoDB with two made-up sites. Not tested: the print endpoint's scope check (not built), a real site, a browser. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 +- README.md | 9 +- docs/decisions.md | 1 + docs/test-audit.md | 8 +- package-lock.json | 552 +++++++++++++++++++++++++++++++++++++++++++- package.json | 1 + src/index.ts | 66 +++++- test/plugin.test.ts | 4 +- test/scope.test.ts | 104 +++++++++ 9 files changed, 733 insertions(+), 18 deletions(-) create mode 100644 test/scope.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 5501eb2..46e8778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,9 @@ - **Core engine** (`src/core`, no Payload, no React): `layout(template, data, media, context)` returns positioned marks in millimeters with warnings; field tokens with dotted paths (up to 4 segments) and the formatters `date`, `money`, `upper`, `lower`, `default` and `slice`, parsed without `eval`; text fitting by shrink, ellipsis or wrap; barcode value checks; sheet grid positions from a start slot; the 4 x 6 inch thermal preset. - **Provider contract** (`src/contracts/labels.ts`, types only): templates, sets and tokens that other plugins can offer. -- **Plugin**: `labelsPlugin()` adds `label-templates`, `label-media` and `label-prints`. Writes are refused unless the site grants them with an `access` check that returns exactly `true`. Options `scopeField` with `scopeCollection`, and `log`. +- **Plugin**: `labelsPlugin()` adds `label-templates`, `label-media` and `label-prints`. Writes are refused unless the site grants them with an `access` check that returns exactly `true`. Options `scopeField` with `scopeCollection` and `scopeOf`, and `log`. With a scope field, reads, creates, updates and deletes are limited to the person's own scope (records with no scope are readable by all, and changed only by a platform admin); no scope means no access. No version bump (still 0.0.0). -Tested: 20 tests with made-up data. Core math and tokens, plus a Payload config build checking the collections, default access, strict access answers and the scope field. -Not tested: any database, PDF or SVG output (not built), barcode drawing, the print endpoint, the admin UI, site filtering for `scopeField` (fields only, no query filter yet), real printers. +Tested: 28 tests with made-up data. Core math and tokens; a Payload config build checking the collections, default access and strict answers; and an in-memory MongoDB run with two sites proving cross-scope reads, creates, updates, deletes and moves are refused, the shared template is admin-only, the print log is unwritable, and signed-out and scope-less users get nothing. +Not tested: any database, PDF or SVG output (not built), barcode drawing, the print endpoint, the admin UI, real printers. diff --git a/README.md b/README.md index d592029..329cfa2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Labels for Payload: design labels with field tokens in the admin, then print one, a few or every label for a document, on thermal rolls or Avery-style sheets. -**Status:** early checkpoint, version 0.0.0, not published. Built and tested (20 tests): the layout engine in `src/core` (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset) and the plugin that adds the three collections with write access closed by default. Tested with made-up data and a Payload config build, not against a database. **Not built yet:** PDF printing, barcode drawing, the print endpoint and dialog, the admin inspector and live preview, the label-prints log writes, and site filtering for `scopeField`. The design is in [docs/design.md](docs/design.md). +**Status:** early checkpoint, version 0.0.0, not published. Built and tested (28 tests): the layout engine in `src/core` (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset), and the plugin that adds the three collections with write access closed by default and scope filtering on reads and writes. The scope rules are tested against an in-memory MongoDB with two made-up sites. Not tested with a real site or in a browser. **Not built yet:** PDF printing, barcode drawing, the print endpoint and dialog, the admin inspector and live preview, and the writes to the print log. The design is in [docs/design.md](docs/design.md). ## What it will do (the plan) @@ -39,13 +39,16 @@ export default buildConfig({ plugins: [ labelsPlugin({ access: { manage: ({ req }) => req.user?.role === 'admin' }, - // scopeField: 'tenant', scopeCollection: 'tenants', + // Per site: scopeField: 'tenant', scopeCollection: 'tenants', + // scopeOf: ({ req }) => (req.user?.role === 'platform' ? ALL_SCOPES : req.user?.tenant), }), ], }) ``` -With no `access` given, nobody can write labels through the API and only signed-in people can read them. A check counts only if it returns exactly `true`; an error counts as no. +With no `access` given, nobody can write labels through the API and only signed-in people can read them. With `scopeField`, you also give `scopeOf`, which says which site the person belongs to (an id, `ALL_SCOPES` for a platform admin, or nothing). A person reads and writes only their own site's templates, media and print log, and can also read templates with no site, which only a platform admin can change. No site, an error or no sign-in means no access. A record cannot be moved to another site. + +A check counts only if it returns exactly `true`; an error counts as no. The layout engine works on its own, with no Payload and no React: `import { layout, THERMAL_4X6 } from '@extantape/payload-plugin-labels/core'`. `layout(template, record, media)` returns the marks of one label in millimeters, plus warnings for missing values, text that does not fit and marks outside the label. Text width is estimated from character counts until real font metrics arrive with PDF output. diff --git a/docs/decisions.md b/docs/decisions.md index 5924422..eb70023 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -26,3 +26,4 @@ Dated decisions for this repo, newest last. - `scopeField` needs a `scopeCollection` option naming the collection it points at; the plugin throws without it. Site filtering of reads is not built yet. - Read access defaults to any signed-in user when no `access` option is given; with `print` or `manage` given, only those pass. Writes default to no. The print log can never be written through the API. - Template `width` and `height` are stored in mm as separate number fields, and `elements` and media `definition` are JSON, to be validated when the inspector is built. +- 2026-11-16: scope filtering (design: templates and media belong to a site, a template with no site is shared, a platform admin manages shared ones). The design did not say how a user's site is found, so there is a `scopeOf(req)` option: it returns the scope id, `ALL_SCOPES` for a platform admin, or nothing. Nothing, an error or no sign-in fails closed. Templates and media: own scope plus shared on read; own scope only on update and delete; create must name the person's own scope; a record cannot be moved to another scope. Print log: own scope only, never written through the API. `scopeField` now throws without `scopeCollection` and `scopeOf`. diff --git a/docs/test-audit.md b/docs/test-audit.md index 50c349a..92cfa57 100644 --- a/docs/test-audit.md +++ b/docs/test-audit.md @@ -2,10 +2,16 @@ Newest first. +## 2026-11-16: scope filtering + +- Promises: a person sees and changes only their own site's templates, media and print log; shared templates are readable by all and changed only by a platform admin; no scope or no sign-in means no access; the print log is never written through the API. +- Covered: `test/scope.test.ts` on an in-memory MongoDB, two sites plus a platform admin, a scope-less user and a signed-out request (8 tests): cross-scope read, create, update, delete and move are refused, shared template rules, media, log. +- Gaps skipped (and why): the print endpoint's own scope check (printing only reads the person's site) waits for the endpoint. A scopeOf that throws is covered by the shared strict-answer code path rather than its own test. + ## 2026-11-16: core and plugin shell - Promises: tokens never run code; a missing value is reported; text fits by its rule; sheet positions follow the start slot; the 4 x 6 in preset size; writes are closed by default and only `true` passes; the print log is never writable through the API. -- Covered: all of the above in `test/core.test.ts` and `test/plugin.test.ts` (20 tests), including code-like tokens, inherited property names, a throwing access check and a truthy non-`true` answer. +- Covered: all of the above in `test/core.test.ts` and `test/plugin.test.ts` (28 tests), including code-like tokens, inherited property names, a throwing access check and a truthy non-`true` answer. - Gaps skipped (and why): no database tests, because nothing reads or writes records yet. Site isolation, the 2,000-label limit, PDF page checks and preview-equals-PDF wait for the code they test. ## 2026-11-10: first audit (starter kit) diff --git a/package-lock.json b/package-lock.json index eacca0d..f8bbb00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@payloadcms/db-mongodb": "^3.92.1", "@types/node": "^24.19.2", "graphql": "^16.15.0", + "mongodb-memory-server": "^11.3.0", "payload": "^3.92.1", "typescript": "^5.9.3", "vitest": "^5.1.0" @@ -1117,6 +1118,16 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, "node_modules/ajv": { "version": "8.18.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz", @@ -1151,6 +1162,16 @@ "node": ">=12" } }, + "node_modules/async-mutex": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.5.0.tgz", + "integrity": "sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/atomic-sleep": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", @@ -1161,6 +1182,117 @@ "node": ">=8.0.0" } }, + "node_modules/b4a": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.9.0.tgz", + "integrity": "sha512-dpfcF9fDNR6++cthXR67iyhgqWy9CBouAvIWhIntzBG6cvK/cnIPiZQjBwi/ZqjjBEDGfoNDtmB0kTjroOJ3pQ==", + "dev": true, + "license": "Apache-2.0", + "peerDependencies": { + "react-native-b4a": "*" + }, + "peerDependenciesMeta": { + "react-native-b4a": { + "optional": true + } + } + }, + "node_modules/bare-buffer": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bare-buffer/-/bare-buffer-3.7.2.tgz", + "integrity": "sha512-kI35SYpVg0JCk+a+gkUEJZY39mt+g71y1NRwBrEj7SbxLnwngYYMf0T/kouYIujlJwelvPZ9TTbBCbCSPw059Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "bare": ">=1.20.0" + } + }, + "node_modules/bare-events": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.9.2.tgz", + "integrity": "sha512-AIPKioV7/Y/8KfZ3AAhjPJxLLbY49S64Ym5DakZlUg75qQiTgUq9hEJoEwa4eUezPUlXRy/i5NpsKvo9jgKmoA==", + "dev": true, + "license": "Apache-2.0", + "peerDependencies": { + "bare-abort-controller": "*" + }, + "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + } + } + }, + "node_modules/bare-fs": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.8.4.tgz", + "integrity": "sha512-MPC2eyrpbk3A873sK4y6rk+Iv4o2enxTjHZ8zH3HO0mjrpm5XjnguY2XmfidIsDV6vnjpbMBKUAJpV0ISD2SsQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bare-events": "^2.5.4", + "bare-path": "^3.0.0", + "bare-stream": "^2.6.4", + "bare-url": "^2.2.2", + "fast-fifo": "^1.3.2" + }, + "engines": { + "bare": ">=1.28.0" + }, + "peerDependencies": { + "bare-buffer": "*" + }, + "peerDependenciesMeta": { + "bare-buffer": { + "optional": true + } + } + }, + "node_modules/bare-path": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.1.3.tgz", + "integrity": "sha512-8r+FVU/o4zcFmpCDqbqAYhHHbtXPP+cyZKo7DRGRWc7OLlNs4TMaSQEpXL/sIdzyEG0M7RHw4B7xYMGrTc+qrg==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/bare-stream": { + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.4.tgz", + "integrity": "sha512-PcrQ8lVLbiJscNm1Kez+Yp4Gy4AHGcN1lzwjvf5NybWen7VvEgUfyfnXYJ2zNqWnzOfCb1Abq6lH8ti0syQszA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "b4a": "^1.8.1", + "streamx": "^2.25.0", + "teex": "^1.0.1" + }, + "peerDependencies": { + "bare-abort-controller": "*", + "bare-buffer": "*", + "bare-events": "*" + }, + "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + }, + "bare-buffer": { + "optional": true + }, + "bare-events": { + "optional": true + } + } + }, + "node_modules/bare-url": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.5.7.tgz", + "integrity": "sha512-pWAiECRdNYPJAXYKVOb4HuTQedQyRjtGBUu86kO/vOt4GM7e45PghHXQ/Erm5NumaDSWNBzehIfpc768esW7gA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bare-buffer": "^3.0.0", + "bare-path": "^3.0.0" + } + }, "node_modules/bson": { "version": "6.10.4", "resolved": "https://registry.npmjs.org/bson/-/bson-6.10.4.tgz", @@ -1190,6 +1322,19 @@ "node": ">=10.16.0" } }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/chai": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", @@ -1223,6 +1368,13 @@ "dev": true, "license": "MIT" }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true, + "license": "MIT" + }, "node_modules/console-table-printer": { "version": "2.12.1", "resolved": "https://registry.npmjs.org/console-table-printer/-/console-table-printer-2.12.1.tgz", @@ -1389,6 +1541,16 @@ "@types/estree": "^1.0.0" } }, + "node_modules/events-universal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz", + "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bare-events": "^2.7.0" + } + }, "node_modules/expect-type": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", @@ -1413,6 +1575,13 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", + "dev": true, + "license": "MIT" + }, "node_modules/fast-safe-stringify": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", @@ -1474,6 +1643,59 @@ "url": "https://github.com/sindresorhus/file-type?sponsor=1" } }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "license": "MIT", + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/follow-redirects": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.3.tgz", + "integrity": "sha512-toOSoqN6d51Wjf1aOFJYcoVv1aND9rj/CwjLU0Vz40oDuSpWDayCeKe4JpL5NL0WdFvoOOCI3BRo69HahjbR1A==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -1529,6 +1751,20 @@ "node": ">= 0.4.0" } }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -1978,6 +2214,19 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/lodash": { "version": "4.18.1", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", @@ -1995,6 +2244,32 @@ "@jridgewell/sourcemap-codec": "^1.6.0" } }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.2.tgz", + "integrity": "sha512-GYrCADwpu6yV5OAvchkQ27Z5wwMxWAEMg5NNWjyHh/5DboFFqbdbvYNIvZouQpxXyeMPoTOh0vdPYKlf0ZswdQ==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/memory-pager": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", @@ -2070,6 +2345,126 @@ "whatwg-url": "^14.1.0 || ^13.0.0" } }, + "node_modules/mongodb-memory-server": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/mongodb-memory-server/-/mongodb-memory-server-11.3.0.tgz", + "integrity": "sha512-8ZCDrraqKqmAikoeKuEq+16jeWdVKwjtEAuMxxeQctHiGSGYt17W9LmoRzV1Nwnz7owyxwDKMhow4IVkNYYRKw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "mongodb-memory-server-core": "11.3.0", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/mongodb-memory-server-core": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/mongodb-memory-server-core/-/mongodb-memory-server-core-11.3.0.tgz", + "integrity": "sha512-QBu/RsRpBfcNd5CrBDfCzqcaFPaYpivUzGYUy9YgVc3up78ff0gIHQVD9PLmBLOOxFX6BM9hU6YT0HocZH+s1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-mutex": "^0.5.0", + "camelcase": "^6.3.0", + "debug": "^4.4.3", + "find-cache-dir": "^3.3.2", + "follow-redirects": "^1.16.0", + "https-proxy-agent": "^7.0.6", + "mongodb": "~7.5.0", + "new-find-package-json": "^2.0.0", + "semver": "^7.8.5", + "tar-stream": "^3.2.1", + "tslib": "^2.8.1", + "yauzl": "^3.4.0" + }, + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/@types/whatwg-url": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-13.0.0.tgz", + "integrity": "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/webidl-conversions": "*" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/bson": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/bson/-/bson-7.3.4.tgz", + "integrity": "sha512-eb33j2Ha6xgygjJ8bhI3sYaI9cLAbSaopZLRJQ5/rxk32XyBSoVVcbeHIzVGJx1SyQpyyoElkoEZgQrg+RVVoA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/mongodb-memory-server-core/node_modules/mongodb": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.5.0.tgz", + "integrity": "sha512-5FnrEDLnvp6ycUOGLNLLU33BfCx2qmp2mJjGPDwKLruYsVzXVSK5fsGpoDXvsXJwBfBsD7ebMRdawbDxC2814g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@mongodb-js/saslprep": "^1.4.11", + "bson": "^7.2.0", + "mongodb-connection-string-url": "^7.0.1" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.806.0", + "@mongodb-js/zstd": "^7.0.0", + "gcp-metadata": "^7.0.1", + "kerberos": "^7.0.0", + "mongodb-client-encryption": "^7.2.0", + "snappy": "^7.3.2", + "socks": "^2.8.6" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "gcp-metadata": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + }, + "socks": { + "optional": true + } + } + }, + "node_modules/mongodb-memory-server-core/node_modules/mongodb-connection-string-url": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.2.tgz", + "integrity": "sha512-ZoS07RoFqpKYQwAk59qmrx8+jJHNHU30UjlU96QktiGn1ltvDr+vCznLX5DiUBLEpMAHatHNWV1nM/74ul66kA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/whatwg-url": "^13.0.0", + "whatwg-url": "^14.1.0" + }, + "engines": { + "node": ">=20.19.0" + } + }, "node_modules/mongoose": { "version": "8.24.1", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.24.1.tgz", @@ -2182,6 +2577,19 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/new-find-package-json": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/new-find-package-json/-/new-find-package-json-2.0.0.tgz", + "integrity": "sha512-lDcBsjBSMlj3LXH2v/FW3txlh2pYTjmbOXPYJD93HI5EwuLzI11tdHSIpUMmfq/IOsldj4Ps8M8flhm+pCK4Ew==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">=12.22.0" + } + }, "node_modules/obug": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz", @@ -2216,6 +2624,55 @@ "wrappy": "1" } }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/path-to-regexp": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", @@ -2273,6 +2730,13 @@ "graphql": "^16.8.1" } }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true, + "license": "MIT" + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -2359,6 +2823,19 @@ "dev": true, "license": "MIT" }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/pluralize": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", @@ -2610,6 +3087,19 @@ ], "license": "BSD-3-Clause" }, + "node_modules/semver": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz", + "integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/sift": { "version": "17.1.3", "resolved": "https://registry.npmjs.org/sift/-/sift-17.1.3.tgz", @@ -2688,6 +3178,18 @@ "node": ">=10.0.0" } }, + "node_modules/streamx": { + "version": "2.28.1", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.28.1.tgz", + "integrity": "sha512-zEzXb0s5Cds7tqMH6rhZ05lcJydCWiQPEwiNngVqzsxCc962vLY4Uw+mW7od8kDH258k2Uz/JrOkdIAAhSh9VA==", + "dev": true, + "license": "MIT", + "dependencies": { + "events-universal": "^1.0.0", + "fast-fifo": "^1.3.2", + "text-decoder": "^1.1.0" + } + }, "node_modules/strip-json-comments": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.1.0.tgz", @@ -2718,6 +3220,39 @@ "url": "https://github.com/sponsors/Borewit" } }, + "node_modules/tar-stream": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.2.2.tgz", + "integrity": "sha512-+8NeqHRjQWH9nYlwo2gamAMImZCVzI4UoEgDpWorBt9OEfppiZn+uSkskzQKPWIZyji/C8fpWO7u69G0DX0tbg==", + "dev": true, + "license": "MIT", + "dependencies": { + "b4a": "^1.9.0", + "bare-fs": "^4.8.2", + "fast-fifo": "^1.3.2", + "streamx": "^2.28.1" + } + }, + "node_modules/teex": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz", + "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "streamx": "^2.12.5" + } + }, + "node_modules/text-decoder": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.7.tgz", + "integrity": "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "b4a": "^1.6.4" + } + }, "node_modules/thread-stream": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-3.2.0.tgz", @@ -2827,9 +3362,7 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", "dev": true, - "license": "0BSD", - "optional": true, - "peer": true + "license": "0BSD" }, "node_modules/tsx": { "version": "4.23.15", @@ -3142,6 +3675,19 @@ "optional": true } } + }, + "node_modules/yauzl": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-3.4.0.tgz", + "integrity": "sha512-jIH9yLR9wqr0wOS0TpBvo/g/2UgZH5qePVbjgRliiF0BYvOZyaBknKsF+x9Iht0O6sqgnB93rCICdOZFecJuDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + }, + "engines": { + "node": ">=12" + } } } } diff --git a/package.json b/package.json index 6af5dd1..eafb3c0 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "@payloadcms/db-mongodb": "^3.92.1", "@types/node": "^24.19.2", "graphql": "^16.15.0", + "mongodb-memory-server": "^11.3.0", "payload": "^3.92.1", "typescript": "^5.9.3", "vitest": "^5.1.0" diff --git a/src/index.ts b/src/index.ts index b493210..b14c080 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import type { Access, CollectionConfig, Config, Field, Plugin } from 'payload' +import type { Access, CollectionConfig, Config, Field, Plugin, Where } from 'payload' import type { LabelProvider } from './contracts/labels.js' @@ -13,6 +13,11 @@ export type LabelsOptions = { scopeField?: string /** The collection the scope field points at, such as `tenants`. */ scopeCollection?: string + /** + * Which scope (site) the person belongs to: its id, `ALL_SCOPES` for a platform admin, or null for none. Needed with + * `scopeField`. No answer, an error or null means no access at all. + */ + scopeOf?: (args: { req: { user?: unknown } }) => ScopeAnswer | Promise /** The print log. Ids and counts only. Default on, 180 days. */ log?: { enabled?: boolean; keepDays?: number } } @@ -27,6 +32,19 @@ const strict = (check?: Check): Access => async (args) => { } const never: Access = () => false +/** A platform admin's answer from `scopeOf`: every scope, including records shared by all. */ +export const ALL_SCOPES = '*' as const +export type ScopeAnswer = string | number | typeof ALL_SCOPES | null | undefined + +async function scopeFor(options: LabelsOptions, req: unknown): Promise { + try { + const a = await options.scopeOf?.({ req: req as { user?: unknown } }) + return a === ALL_SCOPES || typeof a === 'string' || typeof a === 'number' ? (a === '' ? null : a) : null + } catch { + return null + } +} + export const TEMPLATES_SLUG = 'label-templates' export const MEDIA_SLUG = 'label-media' export const PRINTS_SLUG = 'label-prints' @@ -34,21 +52,56 @@ export const PRINTS_SLUG = 'label-prints' export const labelsPlugin = (options: LabelsOptions = {}): Plugin => (config: Config): Config => { - if (options.scopeField && !options.scopeCollection) throw new Error('labels: scopeField needs scopeCollection') + const field = options.scopeField + if (field && (!options.scopeCollection || !options.scopeOf)) throw new Error('labels: scopeField needs scopeCollection and scopeOf') const manage = strict(options.access?.manage) const print = strict(options.access?.print) // Reading needs a person who may print or manage. With neither check given, a signed-in user may read. const read: Access = async (args) => options.access?.print || options.access?.manage ? (await print(args)) === true || (await manage(args)) === true : Boolean(args.req.user) + // With a scope field, every answer is narrowed to the person's own scope. No scope means no access. + const scoped = (base: Access, shared: boolean): Access => async (args) => { + const ok = await base(args) + if (ok !== true || !field) return ok + const who = await scopeFor(options, args.req) + if (who === null) return false + if (who === ALL_SCOPES) return true + const own: Where = { [field]: { equals: who } } + return shared ? { or: [own, { [field]: { exists: false } }] } : own + } + const scopedCreate: Access = async (args) => { + if ((await manage(args)) !== true) return false + if (!field) return true + const who = await scopeFor(options, args.req) + if (who === null) return false + if (who === ALL_SCOPES) return true + const given = (args.data as Record | undefined)?.[field] + return given !== undefined && given !== null && String(given) === String(who) + } + const keepInScope: CollectionConfig['hooks'] = field + ? { + beforeChange: [ + async ({ data, req }) => { + if (!req.user) return data + const who = await scopeFor(options, req) + if (who === null) throw new Error('labels: no scope for this user') + const given = (data as Record)[field] + if (who !== ALL_SCOPES && String(given) !== String(who)) throw new Error('labels: a record can only belong to your own scope') + return data + }, + ], + } + : undefined const scope: Field[] = options.scopeField ? [{ name: options.scopeField, type: 'relationship', relationTo: options.scopeCollection!, admin: { description: 'Leave empty to share with every site.' } }] : [] - const writes = { create: manage, update: manage, delete: manage } + const writes = { create: scopedCreate, update: scoped(manage, false), delete: scoped(manage, false) } const templates: CollectionConfig = { slug: TEMPLATES_SLUG, admin: { useAsTitle: 'name', group: 'Labels' }, - access: { read, ...writes }, + access: { read: scoped(read, true), ...writes }, + hooks: keepInScope, fields: [ { name: 'name', type: 'text', required: true }, { name: 'key', type: 'text', required: true, unique: true, index: true }, @@ -67,7 +120,8 @@ export const labelsPlugin = const media: CollectionConfig = { slug: MEDIA_SLUG, admin: { useAsTitle: 'name', group: 'Labels' }, - access: { read, ...writes }, + access: { read: scoped(read, true), ...writes }, + hooks: keepInScope, fields: [ { name: 'name', type: 'text', required: true }, { name: 'kind', type: 'select', required: true, options: ['thermal', 'sheet'] }, @@ -78,7 +132,7 @@ export const labelsPlugin = const prints: CollectionConfig = { slug: PRINTS_SLUG, admin: { group: 'Labels', description: 'Who printed what. Ids and counts only, never the label text.' }, - access: { read: manage, create: never, update: never, delete: never }, + access: { read: scoped(manage, false), create: never, update: never, delete: never }, fields: [ { name: 'template', type: 'relationship', relationTo: TEMPLATES_SLUG }, { name: 'collection', type: 'text' }, diff --git a/test/plugin.test.ts b/test/plugin.test.ts index bdb4db7..ceb38b3 100644 --- a/test/plugin.test.ts +++ b/test/plugin.test.ts @@ -43,10 +43,10 @@ describe('labelsPlugin', () => { expect(await call(c.collections.find((x) => x.slug === 'label-templates')!.access.update, { id: '1' })).toBe(false) }) it('adds the scope field, and refuses a scope field without a collection', async () => { - const c = await build({ scopeField: 'tenant', scopeCollection: 'tenants' }) + const c = await build({ scopeField: 'tenant', scopeCollection: 'tenants', scopeOf: () => null }) const f = c.collections.find((x) => x.slug === 'label-templates')!.fields.map((x) => ('name' in x ? x.name : '')) expect(f).toContain('tenant') - await expect(build({ scopeField: 'tenant' })).rejects.toThrow(/scopeCollection/) + await expect(build({ scopeField: 'tenant', scopeCollection: 'tenants' })).rejects.toThrow(/scopeOf/) }) it('can switch the log off, and keeps providers other plugins added', async () => { const c = await build({ log: { enabled: false } }, { custom: { labels: { providers: { kitting: { name: 'Kitting' } } } } }) diff --git a/test/scope.test.ts b/test/scope.test.ts new file mode 100644 index 0000000..f972d57 --- /dev/null +++ b/test/scope.test.ts @@ -0,0 +1,104 @@ +import { mongooseAdapter } from '@payloadcms/db-mongodb' +import { MongoMemoryReplSet } from 'mongodb-memory-server' +import { buildConfig, getPayload, type Payload } from 'payload' +import { afterAll, beforeAll, describe, expect, it } from 'vitest' + +import { ALL_SCOPES, labelsPlugin } from '../src/index.js' + +/** Two made-up sites, a user in each, a platform admin, a user with no site, and one template shared by all. */ +let payload: Payload +let mongo: MongoMemoryReplSet +const u: Record = {} +const t: Record = {} +const tpl = (key: string, tenant?: string | number) => ({ name: key, key, collection: 'orders', width: 100, height: 50, ...(tenant ? { tenant } : {}) }) +const as = (user: string) => ({ user: { collection: 'users', ...u[user] } as never, overrideAccess: false }) +const keys = async (user: string, collection = 'label-templates') => + (await payload.find({ collection: collection as never, limit: 50, ...as(user) })).docs.map((d) => (d as { key?: string; name?: string }).key ?? '').sort() + +beforeAll(async () => { + mongo = await MongoMemoryReplSet.create({ replSet: { count: 1, storageEngine: 'wiredTiger' } }) + payload = await getPayload({ + config: await buildConfig({ + secret: 'test-secret-not-for-production', + telemetry: false, + typescript: { autoGenerate: false }, + db: mongooseAdapter({ url: mongo.getUri('labels'), ensureIndexes: true }), + collections: [ + { slug: 'users', auth: true, fields: [{ name: 'role', type: 'text' }, { name: 'tenant', type: 'relationship', relationTo: 'tenants' }] }, + { slug: 'tenants', fields: [{ name: 'name', type: 'text' }] }, + ], + plugins: [ + labelsPlugin({ + access: { manage: ({ req }) => Boolean(req.user), print: ({ req }) => Boolean(req.user) }, + scopeField: 'tenant', + scopeCollection: 'tenants', + scopeOf: ({ req }) => { + const user = req.user as { role?: string; tenant?: { id?: string | number } | string | number } | undefined + if (user?.role === 'platform') return ALL_SCOPES + const tn = user?.tenant + return typeof tn === 'object' ? tn?.id : tn + }, + }), + ], + }), + }) + for (const n of ['a', 'b']) t[n] = (await payload.create({ collection: 'tenants', data: { name: `Site ${n}` } })).id + for (const [n, role, tn] of [['alice', 'staff', 'a'], ['bob', 'staff', 'b'], ['root', 'platform', undefined], ['drifter', 'staff', undefined]] as const) { + const doc = await payload.create({ collection: 'users', data: { email: `${n}@example.test`, password: 'test-pass-123', role, ...(tn ? { tenant: t[tn] } : {}) } as never }) + u[n] = { id: doc.id, role, tenant: tn ? t[tn] : undefined } + } + for (const [key, tn] of [['a-box', 'a'], ['b-box', 'b'], ['shared', undefined]] as const) await payload.create({ collection: 'label-templates' as never, data: tpl(key, tn ? t[tn] : undefined) as never }) + await payload.create({ collection: 'label-prints' as never, data: { collection: 'orders', labelCount: 2, tenant: t.a } as never }) + await payload.create({ collection: 'label-prints' as never, data: { collection: 'orders', labelCount: 1, tenant: t.b } as never }) +}) +afterAll(async () => { + await payload?.db.destroy?.() + await mongo?.stop() +}) + +describe('scope isolation', () => { + it('each site reads its own templates and the shared one', async () => { + expect(await keys('alice')).toEqual(['a-box', 'shared']) + expect(await keys('bob')).toEqual(['b-box', 'shared']) + }) + it('the platform admin reads everything', async () => { + expect(await keys('root')).toEqual(['a-box', 'b-box', 'shared']) + }) + it('a user with no scope reads nothing, and a signed-out request is refused', async () => { + await expect(keys('drifter')).rejects.toThrow() + await expect(payload.find({ collection: 'label-templates' as never, overrideAccess: false })).rejects.toThrow() + }) + it('cannot create in another scope, or in no scope', async () => { + await expect(payload.create({ collection: 'label-templates' as never, data: tpl('x1', t.b) as never, ...as('alice') })).rejects.toThrow() + await expect(payload.create({ collection: 'label-templates' as never, data: tpl('x2') as never, ...as('alice') })).rejects.toThrow() + const ok = await payload.create({ collection: 'label-templates' as never, data: tpl('a-two', t.a) as never, ...as('alice') }) + expect((ok as unknown as { key: string }).key).toBe('a-two') + }) + it('cannot update or delete another scope, nor the shared template, nor move a record out', async () => { + const b = (await payload.find({ collection: 'label-templates' as never, where: { key: { equals: 'b-box' } } as never })).docs[0]! + const shared = (await payload.find({ collection: 'label-templates' as never, where: { key: { equals: 'shared' } } as never })).docs[0]! + const mine = (await payload.find({ collection: 'label-templates' as never, where: { key: { equals: 'a-box' } } as never })).docs[0]! + await expect(payload.update({ collection: 'label-templates' as never, id: b.id, data: { name: 'hijack' } as never, ...as('alice') })).rejects.toThrow() + await expect(payload.delete({ collection: 'label-templates' as never, id: b.id, ...as('alice') })).rejects.toThrow() + await expect(payload.update({ collection: 'label-templates' as never, id: shared.id, data: { name: 'edit' } as never, ...as('alice') })).rejects.toThrow() + await expect(payload.update({ collection: 'label-templates' as never, id: mine.id, data: { tenant: t.b } as never, ...as('alice') })).rejects.toThrow() + expect(((await payload.findByID({ collection: 'label-templates' as never, id: b.id })) as unknown as { name: string }).name).toBe('b-box') + }) + it('the platform admin can manage the shared template', async () => { + const shared = (await payload.find({ collection: 'label-templates' as never, where: { key: { equals: 'shared' } } as never })).docs[0]! + await payload.update({ collection: 'label-templates' as never, id: shared.id, data: { notes: 'ok' } as never, ...as('root') }) + }) + it('media follows the same rules', async () => { + const m = (tn?: string | number) => ({ name: 'm', kind: 'thermal', definition: {}, ...(tn ? { tenant: tn } : {}) }) + await expect(payload.create({ collection: 'label-media' as never, data: m(t.b) as never, ...as('alice') })).rejects.toThrow() + await payload.create({ collection: 'label-media' as never, data: m(t.a) as never, ...as('alice') }) + expect((await payload.find({ collection: 'label-media' as never, ...as('bob') })).totalDocs).toBe(0) + }) + it('the print log is read in scope and never written through the API', async () => { + expect((await payload.find({ collection: 'label-prints' as never, ...as('alice') })).docs.map((d) => (d as unknown as { labelCount: number }).labelCount)).toEqual([2]) + expect((await payload.find({ collection: 'label-prints' as never, ...as('root') })).totalDocs).toBe(2) + for (const user of ['alice', 'root']) { + await expect(payload.create({ collection: 'label-prints' as never, data: { collection: 'orders', tenant: t.a } as never, ...as(user) })).rejects.toThrow() + } + }) +}) From fa94765cf43d88d165bdd595d9dde08940183db3 Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Mon, 16 Nov 2026 00:18:10 -0700 Subject: [PATCH 3/7] Add SVG and PDF output drawn from the layout marks Both outputs draw the same marks, with barcodes, QR and Data Matrix as vectors from bwip-js (MIT) and the PDF written with pdfkit (MIT). The PDF writer is its own export so the plugin config does not load pdfkit. Not tested: PDF in a viewer or printer, SVG in a browser, scanning a printed code, sheet pages, images. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 +- README.md | 6 +- docs/decisions.md | 1 + docs/test-audit.md | 6 ++ package-lock.json | 201 +++++++++++++++++++++++++++++++++++++++++++- package.json | 9 ++ src/core/index.ts | 2 + src/core/svg.ts | 44 ++++++++++ src/core/vector.ts | 41 +++++++++ src/pdf.ts | 60 +++++++++++++ test/render.test.ts | 59 +++++++++++++ 11 files changed, 430 insertions(+), 5 deletions(-) create mode 100644 src/core/svg.ts create mode 100644 src/core/vector.ts create mode 100644 src/pdf.ts create mode 100644 test/render.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 46e8778..d45a4bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,9 @@ - **Provider contract** (`src/contracts/labels.ts`, types only): templates, sets and tokens that other plugins can offer. - **Plugin**: `labelsPlugin()` adds `label-templates`, `label-media` and `label-prints`. Writes are refused unless the site grants them with an `access` check that returns exactly `true`. Options `scopeField` with `scopeCollection` and `scopeOf`, and `log`. With a scope field, reads, creates, updates and deletes are limited to the person's own scope (records with no scope are readable by all, and changed only by a platform admin); no scope means no access. +- **Outputs**: `renderSvg` (core) and `renderPdf` (`./pdf` export, pdfkit), one label per page, from the same marks. Barcodes, QR and Data Matrix are drawn as vectors with bwip-js; a value that can't be encoded draws a dashed box and the layout already warns. New dependencies: pdfkit and bwip-js (both MIT). + No version bump (still 0.0.0). -Tested: 28 tests with made-up data. Core math and tokens; a Payload config build checking the collections, default access and strict answers; and an in-memory MongoDB run with two sites proving cross-scope reads, creates, updates, deletes and moves are refused, the shared template is admin-only, the print log is unwritable, and signed-out and scope-less users get nothing. -Not tested: any database, PDF or SVG output (not built), barcode drawing, the print endpoint, the admin UI, real printers. +Tested: 34 tests with made-up data. Core math and tokens; PDF page count and size (288 x 432 pt for 4 x 6 in), SVG viewBox, text escaping, rotation, vector barcodes, invalid barcode without a crash; a Payload config build checking the collections, default access and strict answers; and an in-memory MongoDB run with two sites proving cross-scope reads, creates, updates, deletes and moves are refused, the shared template is admin-only, the print log is unwritable, and signed-out and scope-less users get nothing. +Not tested: PDF in a viewer or printer, SVG in a browser, scanning a printed barcode, sheet pages, images in output, real font metrics, the print endpoint, the admin UI, real printers. diff --git a/README.md b/README.md index 329cfa2..68cf1e8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Labels for Payload: design labels with field tokens in the admin, then print one, a few or every label for a document, on thermal rolls or Avery-style sheets. -**Status:** early checkpoint, version 0.0.0, not published. Built and tested (28 tests): the layout engine in `src/core` (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset), and the plugin that adds the three collections with write access closed by default and scope filtering on reads and writes. The scope rules are tested against an in-memory MongoDB with two made-up sites. Not tested with a real site or in a browser. **Not built yet:** PDF printing, barcode drawing, the print endpoint and dialog, the admin inspector and live preview, and the writes to the print log. The design is in [docs/design.md](docs/design.md). +**Status:** early checkpoint, version 0.0.0, not published. Built and tested (34 tests): the layout engine in `src/core` (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset), and the plugin that adds the three collections with write access closed by default and scope filtering on reads and writes, plus SVG and PDF output drawn from the layout marks, with barcodes, QR and Data Matrix as vectors (bwip-js). The scope rules are tested against an in-memory MongoDB with two made-up sites. The PDF was checked for page count and page size in points, not opened in a printer or viewer; the SVG was checked as text, not in a browser; no barcode has been scanned. **Not built yet:** sheet (Avery) pages, images in output, the print endpoint and dialog, the admin inspector and live preview, and the writes to the print log. The design is in [docs/design.md](docs/design.md). ## What it will do (the plan) @@ -50,7 +50,9 @@ With no `access` given, nobody can write labels through the API and only signed- A check counts only if it returns exactly `true`; an error counts as no. -The layout engine works on its own, with no Payload and no React: `import { layout, THERMAL_4X6 } from '@extantape/payload-plugin-labels/core'`. `layout(template, record, media)` returns the marks of one label in millimeters, plus warnings for missing values, text that does not fit and marks outside the label. Text width is estimated from character counts until real font metrics arrive with PDF output. +The layout engine works on its own, with no Payload and no React: `import { layout, THERMAL_4X6 } from '@extantape/payload-plugin-labels/core'`. `layout(template, record, media)` returns the marks of one label in millimeters, plus warnings for missing values, text that does not fit and marks outside the label. Text width is estimated from character counts, so fitting is approximate. + +Output: `renderSvg(layoutResult)` (in `/core`) gives an SVG in millimeters for previews. `renderPdf([layoutResult, ...])` from `@extantape/payload-plugin-labels/pdf` gives a PDF with one label per page, each page the label's size. Both draw the same marks. Images draw as a placeholder box for now. ## License diff --git a/docs/decisions.md b/docs/decisions.md index eb70023..56d0177 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -27,3 +27,4 @@ Dated decisions for this repo, newest last. - Read access defaults to any signed-in user when no `access` option is given; with `print` or `manage` given, only those pass. Writes default to no. The print log can never be written through the API. - Template `width` and `height` are stored in mm as separate number fields, and `elements` and media `definition` are JSON, to be validated when the inspector is built. - 2026-11-16: scope filtering (design: templates and media belong to a site, a template with no site is shared, a platform admin manages shared ones). The design did not say how a user's site is found, so there is a `scopeOf(req)` option: it returns the scope id, `ALL_SCOPES` for a platform admin, or nothing. Nothing, an error or no sign-in fails closed. Templates and media: own scope plus shared on read; own scope only on update and delete; create must name the person's own scope; a record cannot be moved to another scope. Print log: own scope only, never written through the API. `scopeField` now throws without `scopeCollection` and `scopeOf`. +- 2026-11-16: outputs. SVG and PDF both draw the layout's mark list. Dependencies, licenses checked in their package files: pdfkit 0.20 (MIT), bwip-js 4.11 (MIT), @types/pdfkit (MIT, dev). Both runtime packages are real dependencies, as the design names them. Choices: the PDF has one label per page (sheet pages come later); the SVG helper lives in `/core` and the PDF writer in its own `/pdf` export, so the plugin config never loads pdfkit; barcode vectors come from bwip-js's SVG output and the same path data feeds both renderers; the human-readable line under a linear barcode is drawn by us at 7 pt in Helvetica; images draw as a placeholder box until upload resolving exists; text fitting still uses the estimated width. Rotation turns a mark about the center of its box. diff --git a/docs/test-audit.md b/docs/test-audit.md index 92cfa57..c2c3afb 100644 --- a/docs/test-audit.md +++ b/docs/test-audit.md @@ -2,6 +2,12 @@ Newest first. +## 2026-11-16: SVG and PDF output + +- Promises: a 4 x 6 in label makes a one-page PDF 288 x 432 pt; the SVG viewBox is the label in mm; text is escaped; barcodes render as vectors; an invalid value warns and never crashes either output; both outputs draw one mark list. +- Covered: `test/render.test.ts` (6 tests). +- Gaps skipped (and why): reading the PDF back with a parser or scanning a barcode (needs extra tools; hands-on check with a printer instead); a byte-level preview-equals-PDF comparison, because the PDF carries a creation date and both outputs are fed the same marks by construction. + ## 2026-11-16: scope filtering - Promises: a person sees and changes only their own site's templates, media and print log; shared templates are readable by all and changed only by a platform admin; no scope or no sign-in means no access; the print log is never written through the API. diff --git a/package-lock.json b/package-lock.json index f8bbb00..d6b0959 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,9 +8,14 @@ "name": "@extantape/payload-plugin-labels", "version": "0.0.0", "license": "MIT", + "dependencies": { + "bwip-js": "^4.11.4", + "pdfkit": "^0.20.2" + }, "devDependencies": { "@payloadcms/db-mongodb": "^3.92.1", "@types/node": "^24.19.2", + "@types/pdfkit": "^0.17.7", "graphql": "^16.15.0", "mongodb-memory-server": "^11.3.0", "payload": "^3.92.1", @@ -607,6 +612,30 @@ "dev": true, "license": "MIT" }, + "node_modules/@noble/ciphers": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", + "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@oxc-project/types": { "version": "0.156.0", "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", @@ -967,6 +996,12 @@ "license": "MIT", "peer": true }, + "node_modules/@swc/helpers": { + "version": "0.5.24", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.24.tgz", + "integrity": "sha512-6tcXo4kA8HgGO7AVmawB57RYi/piBPYVHVcO6dXjX+SZw8GoHmi262sp4v2Ha2kNP9Cx84qei27yT+fjS1lxgg==", + "license": "Apache-2.0" + }, "node_modules/@tokenizer/inflate": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.4.1.tgz", @@ -1063,6 +1098,16 @@ "undici-types": ">=7.24.0 <7.24.7" } }, + "node_modules/@types/pdfkit": { + "version": "0.17.7", + "resolved": "https://registry.npmjs.org/@types/pdfkit/-/pdfkit-0.17.7.tgz", + "integrity": "sha512-VMOZDWw7HtNtLbjIuHIhVArm9PlV0gxpz32jAl1IuXWlIgbr1lKFoTsrtvEzY8a9BIpQJEE5DwNPKD50otTs6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/webidl-conversions": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", @@ -1293,6 +1338,35 @@ "bare-path": "^3.0.0" } }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/brotli": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.3.tgz", + "integrity": "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==", + "license": "MIT", + "dependencies": { + "base64-js": "^1.1.2" + } + }, "node_modules/bson": { "version": "6.10.4", "resolved": "https://registry.npmjs.org/bson/-/bson-6.10.4.tgz", @@ -1322,6 +1396,15 @@ "node": ">=10.16.0" } }, + "node_modules/bwip-js": { + "version": "4.11.4", + "resolved": "https://registry.npmjs.org/bwip-js/-/bwip-js-4.11.4.tgz", + "integrity": "sha512-FOXnOQkinxog8FwxdnPB+8k2wRqwPnqXwxX37KcXOtMNW+9CinOkGv9MtIoRC4HX/UyogT0/9lIp6FDm2DcquQ==", + "license": "MIT", + "bin": { + "bwip-js": "bin/bwip-js.js" + } + }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -1361,6 +1444,15 @@ "node": ">=8" } }, + "node_modules/clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, "node_modules/colorette": { "version": "2.0.20", "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", @@ -1472,6 +1564,12 @@ "node": ">=8" } }, + "node_modules/dfa": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/dfa/-/dfa-1.2.0.tgz", + "integrity": "sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q==", + "license": "MIT" + }, "node_modules/end-of-stream": { "version": "1.4.5", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", @@ -1572,7 +1670,6 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, "license": "MIT" }, "node_modules/fast-fifo": { @@ -1624,6 +1721,12 @@ } } }, + "node_modules/fflate": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.3.tgz", + "integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==", + "license": "MIT" + }, "node_modules/file-type": { "version": "21.3.4", "resolved": "https://registry.npmjs.org/file-type/-/file-type-21.3.4.tgz", @@ -1696,6 +1799,23 @@ } } }, + "node_modules/fontkit": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/fontkit/-/fontkit-2.0.4.tgz", + "integrity": "sha512-syetQadaUEDNdxdugga9CpEYVaQIxOwk7GlwZWWZ19//qW4zE5bknOKeMBDYAASwnpaSHKJITRLMF9m1fp3s6g==", + "license": "MIT", + "dependencies": { + "@swc/helpers": "^0.5.12", + "brotli": "^1.3.2", + "clone": "^2.1.2", + "dfa": "^1.2.0", + "fast-deep-equal": "^3.1.3", + "restructure": "^3.0.0", + "tiny-inflate": "^1.0.3", + "unicode-properties": "^1.4.0", + "unicode-trie": "^2.0.0" + } + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -2214,6 +2334,25 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/linebreak": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/linebreak/-/linebreak-1.1.0.tgz", + "integrity": "sha512-MHp03UImeVhB7XZtjd0E4n6+3xr5Dq/9xI/5FptGk5FrbDR3zagPa2DS6U8ks/3HjbKWG9Q1M2ufOzxV2qLYSQ==", + "license": "MIT", + "dependencies": { + "base64-js": "0.0.8", + "unicode-trie": "^2.0.0" + } + }, + "node_modules/linebreak/node_modules/base64-js": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.8.tgz", + "integrity": "sha512-3XSA2cR/h/73EzlXXdU6YNycmYI7+kicTxks4eJg2g39biHR84slg2+des+p7iHYhbRg/udIS4TD53WabcOUkw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -2663,6 +2802,12 @@ "node": ">=6" } }, + "node_modules/pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==", + "license": "MIT" + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -2730,6 +2875,20 @@ "graphql": "^16.8.1" } }, + "node_modules/pdfkit": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/pdfkit/-/pdfkit-0.20.2.tgz", + "integrity": "sha512-Q/w03ICAQyXfHNfTsg1udp0ADerdBN0s7a6XSPL7J7Ro6ABnafoBOCDBstIO9U02mvzHEV8HrvFIw5iV5ejIRA==", + "license": "MIT", + "dependencies": { + "@noble/ciphers": "^1.3.0", + "@noble/hashes": "^1.8.0", + "fflate": "^0.8.3", + "fontkit": "^2.0.4", + "linebreak": "^1.1.0", + "png-js": "^2.0.0" + } + }, "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -2846,6 +3005,14 @@ "node": ">=4" } }, + "node_modules/png-js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/png-js/-/png-js-2.0.0.tgz", + "integrity": "sha512-GdzJuUMc6ZSpxFJWVxtOH1bzYHym+TOnveqUjb+VJIbZWbZzyiRGFiKhbiielfpYbgMlhHVhsJ0FTazfuRFkMA==", + "dependencies": { + "fflate": "^0.8.2" + } + }, "node_modules/postcss": { "version": "8.5.33", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.33.tgz", @@ -3004,6 +3171,12 @@ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } }, + "node_modules/restructure": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/restructure/-/restructure-3.0.2.tgz", + "integrity": "sha512-gSfoiOEA0VPE6Tukkrr7I0RBdE0s7H1eFCDBk05l1KIQT1UIKNc5JZy6jdyW6eYH3aR3g5b3PuL77rq0hvwtAw==", + "license": "MIT" + }, "node_modules/rolldown": { "version": "1.2.19", "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.19.tgz", @@ -3263,6 +3436,12 @@ "real-require": "^0.2.0" } }, + "node_modules/tiny-inflate": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz", + "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", + "license": "MIT" + }, "node_modules/tinybench": { "version": "6.2.3", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.3.tgz", @@ -3427,6 +3606,26 @@ "dev": true, "license": "MIT" }, + "node_modules/unicode-properties": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unicode-properties/-/unicode-properties-1.4.1.tgz", + "integrity": "sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg==", + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.0", + "unicode-trie": "^2.0.0" + } + }, + "node_modules/unicode-trie": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-trie/-/unicode-trie-2.0.0.tgz", + "integrity": "sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ==", + "license": "MIT", + "dependencies": { + "pako": "^0.2.5", + "tiny-inflate": "^1.0.0" + } + }, "node_modules/utf8-byte-length": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz", diff --git a/package.json b/package.json index eafb3c0..6e98563 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,10 @@ "./core": { "types": "./dist/core/index.d.ts", "import": "./dist/core/index.js" + }, + "./pdf": { + "types": "./dist/pdf.d.ts", + "import": "./dist/pdf.js" } }, "main": "./dist/index.js", @@ -59,10 +63,15 @@ "devDependencies": { "@payloadcms/db-mongodb": "^3.92.1", "@types/node": "^24.19.2", + "@types/pdfkit": "^0.17.7", "graphql": "^16.15.0", "mongodb-memory-server": "^11.3.0", "payload": "^3.92.1", "typescript": "^5.9.3", "vitest": "^5.1.0" + }, + "dependencies": { + "bwip-js": "^4.11.4", + "pdfkit": "^0.20.2" } } diff --git a/src/core/index.ts b/src/core/index.ts index 7f83a2e..783addc 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -6,3 +6,5 @@ export * from './tokens.js' export * from './types.js' export * from './units.js' export type * from '../contracts/labels.js' +export * from './svg.js' +export * from './vector.js' diff --git a/src/core/svg.ts b/src/core/svg.ts new file mode 100644 index 0000000..8cec1c1 --- /dev/null +++ b/src/core/svg.ts @@ -0,0 +1,44 @@ +import { barcodePlacement, barcodeVector } from './vector.js' +import { pointsToMm } from './units.js' +import type { LayoutResult, Mark } from './types.js' + +const esc = (s: string) => s.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"') +const n = (v: number) => String(Math.round(v * 1000) / 1000) +const ANCHOR = { left: 'start', center: 'middle', right: 'end' } as const +const FAMILY = 'Helvetica, Arial, sans-serif' + +function markSvg(m: Mark): string { + switch (m.type) { + case 'text': { + const size = pointsToMm(m.fontSize) + const x = m.align === 'center' ? m.x + m.width / 2 : m.align === 'right' ? m.x + m.width : m.x + const style = `font-family="${FAMILY}" font-size="${n(size)}"${m.bold ? ' font-weight="bold"' : ''}${m.italic ? ' font-style="italic"' : ''}${m.missing ? ' fill="#c2410c"' : ''}` + return m.lines.map((l, i) => `${esc(l)}`).join('') + } + case 'barcode': { + const v = barcodeVector(m.symbology, m.value) + if (!v) return `` + const p = barcodePlacement(m, v) + const paths = v.paths.map((q) => (q.stroke ? `` : ``)).join('') + const text = p.text ? `${esc(m.value)}` : '' + return `${paths}${text}` + } + case 'image': + return `` + case 'line': + return `` + case 'box': + return `` + } +} + +/** The label as SVG in millimeters (viewBox 0 0 width height), for the preview. Draws the same marks as the PDF. */ +export function renderSvg(result: LayoutResult): string { + const body = result.marks + .map((m) => { + const s = markSvg(m) + return m.rotation ? `${s}` : s + }) + .join('\n') + return `\n${body}\n` +} diff --git a/src/core/vector.ts b/src/core/vector.ts new file mode 100644 index 0000000..2554eb1 --- /dev/null +++ b/src/core/vector.ts @@ -0,0 +1,41 @@ +import bwip from 'bwip-js' + +import { pointsToMm } from './units.js' +import type { Mark } from './types.js' + +/** One drawn path in the barcode's own units: a stroked line set (bars) or a filled shape (QR, Data Matrix). */ +export type VectorPath = { d: string; stroke?: number } +export type BarcodeVector = { width: number; height: number; paths: VectorPath[] } +type BarcodeMark = Extract + +const BCID: Record = { code128: 'code128', code39: 'code39', ean13: 'ean13', upca: 'upca', datamatrix: 'datamatrix', qr: 'qrcode' } + +/** Vector drawing of a barcode (bwip-js). Returns null if the value can't be encoded; the caller draws an empty box. */ +export function barcodeVector(symbology: BarcodeMark['symbology'], value: string): BarcodeVector | null { + try { + const svg = bwip.toSVG({ bcid: BCID[symbology], text: value, scale: 1, includetext: false }) + const vb = /viewBox="0 0 (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)"/.exec(svg) + if (!vb) return null + const paths = [...svg.matchAll(/]*?)\/>/g)].map((m): VectorPath => { + const attrs = m[1]! + const stroke = /stroke-width="([\d.]+)"/.exec(attrs) + return { d: /\sd="([^"]*)"/.exec(` ${attrs}`)?.[1] ?? '', ...(stroke ? { stroke: Number(stroke[1]) } : {}) } + }) + return paths.length ? { width: Number(vb[1]), height: Number(vb[2]), paths } : null + } catch { + return null + } +} + +/** Where a barcode sits inside its mark: a transform for the vector, and the text line under 1D codes. Millimeters. */ +export function barcodePlacement(m: BarcodeMark, v: BarcodeVector) { + const twoD = m.symbology === 'qr' || m.symbology === 'datamatrix' + const textSize = 7 + const textH = !twoD && m.humanReadable ? pointsToMm(textSize) * 1.3 : 0 + const h = Math.max(m.height - textH, 0.1) + const sx = twoD ? Math.min(m.width / v.width, h / v.height) : m.width / v.width + const sy = twoD ? sx : h / v.height + const tx = m.x + (twoD ? (m.width - v.width * sx) / 2 : 0) + const ty = m.y + (twoD ? (h - v.height * sy) / 2 : 0) + return { sx, sy, tx, ty, text: textH > 0 ? { x: m.x, y: m.y + h, width: m.width, size: textSize } : null } +} diff --git a/src/pdf.ts b/src/pdf.ts new file mode 100644 index 0000000..390c1a7 --- /dev/null +++ b/src/pdf.ts @@ -0,0 +1,60 @@ +import PDFDocument from 'pdfkit' + +import { MM_PER_POINT, barcodePlacement, barcodeVector, type LayoutResult, type Mark } from './core/index.js' + +const pt = (mm: number) => mm / MM_PER_POINT + +function drawMark(doc: PDFKit.PDFDocument, m: Mark): void { + doc.save() + if (m.rotation) doc.rotate(m.rotation, { origin: [pt(m.x + m.width / 2), pt(m.y + m.height / 2)] }) + switch (m.type) { + case 'text': { + const font = `Helvetica${m.bold || m.italic ? '-' : ''}${m.bold ? 'Bold' : ''}${m.italic ? 'Oblique' : ''}` + doc.font(font).fontSize(m.fontSize).fillColor(m.missing ? '#c2410c' : '#000') + m.lines.forEach((line, i) => doc.text(line, pt(m.x), pt(m.y) + i * m.fontSize * 1.2, { width: pt(m.width), align: m.align, lineBreak: false })) + break + } + case 'barcode': { + const v = barcodeVector(m.symbology, m.value) + if (!v) { + doc.dash(2, { space: 2 }).lineWidth(0.7).strokeColor('#c2410c').rect(pt(m.x), pt(m.y), pt(m.width), pt(m.height)).stroke() + break + } + const p = barcodePlacement(m, v) + doc.save().translate(pt(p.tx), pt(p.ty)).scale(pt(p.sx), pt(p.sy)) + for (const q of v.paths) { + if (q.stroke) doc.path(q.d).lineWidth(q.stroke).strokeColor('#000').stroke() + else doc.path(q.d).fillColor('#000').fill() + } + doc.restore() + if (p.text) doc.font('Helvetica').fontSize(p.text.size).fillColor('#000').text(m.value, pt(p.text.x), pt(p.text.y), { width: pt(p.text.width), align: 'center', lineBreak: false }) + break + } + case 'image': + doc.lineWidth(0.6).strokeColor('#999').rect(pt(m.x), pt(m.y), pt(m.width), pt(m.height)).stroke() + break + case 'line': + doc.lineWidth(pt(m.thickness)).strokeColor('#000').moveTo(pt(m.x), pt(m.y)).lineTo(pt(m.x + m.width), pt(m.y + m.height)).stroke() + break + case 'box': + doc.lineWidth(pt(m.thickness)).strokeColor('#000').rect(pt(m.x), pt(m.y), pt(m.width), pt(m.height)).stroke() + break + } + doc.restore() +} + +/** One page per label, each page the label's size, drawn from the same marks as the SVG preview. */ +export function renderPdf(labels: LayoutResult[]): Promise { + return new Promise((resolve, reject) => { + const doc = new PDFDocument({ autoFirstPage: false, margin: 0, info: { Title: 'Labels' } }) + const chunks: Buffer[] = [] + doc.on('data', (c: Buffer) => chunks.push(c)) + doc.on('end', () => resolve(new Uint8Array(Buffer.concat(chunks)))) + doc.on('error', reject) + for (const l of labels) { + doc.addPage({ size: [pt(l.width), pt(l.height)], margin: 0 }) + for (const m of l.marks) drawMark(doc, m) + } + doc.end() + }) +} diff --git a/test/render.test.ts b/test/render.test.ts new file mode 100644 index 0000000..1ba0fb4 --- /dev/null +++ b/test/render.test.ts @@ -0,0 +1,59 @@ +import { describe, expect, it } from 'vitest' + +import { layout, renderSvg, THERMAL_4X6, type LabelTemplate } from '../src/core/index.js' +import { renderPdf } from '../src/pdf.js' + +const kit = { code: 'KIT-0042', lot: 'L-77', name: 'Sample & more' } +const tpl: LabelTemplate = { + key: 'kit-bag', + size: { width: THERMAL_4X6.width, height: THERMAL_4X6.height }, + elements: [ + { type: 'text', x: 5, y: 5, width: 90, height: 12, fontSize: 18, bold: true, content: '{{name}}' }, + { type: 'barcode', x: 5, y: 25, width: 70, height: 25, symbology: 'code128', value: '{{code}}' }, + { type: 'qr', x: 5, y: 60, width: 30, height: 30, value: 'https://example.test/k/{{code}}' }, + { type: 'barcode', x: 40, y: 60, width: 30, height: 30, symbology: 'datamatrix', value: '{{lot}}' }, + { type: 'box', x: 2, y: 2, width: 97, height: 148 }, + { type: 'line', x: 5, y: 55, width: 90, height: 0 }, + { type: 'text', x: 5, y: 95, width: 40, height: 6, fontSize: 9, rotation: 90, content: 'Lot {{lot}}' }, + ], +} +const result = layout(tpl, kit, THERMAL_4X6) +const text = (b: Uint8Array) => Buffer.from(b).toString('latin1') + +describe('PDF', () => { + it('makes one page at 4 x 6 in (288 x 432 pt) per label', async () => { + const one = text(await renderPdf([result])) + expect(one.startsWith('%PDF-')).toBe(true) + expect(one.match(/\/Type \/Page\b(?!s)/g)).toHaveLength(1) + expect(one).toMatch(/\/MediaBox \[0 0 28[78]\.\d+ 43[12]\.\d+\]|\/MediaBox \[0 0 288 432\]/) + expect(text(await renderPdf([result, result, result])).match(/\/Type \/Page\b(?!s)/g)).toHaveLength(3) + }) + it('does not crash on an invalid barcode, and the layout warns', async () => { + const bad = layout({ ...tpl, elements: [{ type: 'barcode', x: 0, y: 0, width: 40, height: 15, symbology: 'ean13', value: '{{code}}' }] }, kit) + expect(bad.warnings[0]?.kind).toBe('invalid-barcode') + expect((await renderPdf([bad])).length).toBeGreaterThan(100) + expect(renderSvg(bad)).toContain('stroke-dasharray') + }) +}) + +describe('SVG', () => { + const svg = renderSvg(result) + it('uses the label size in millimeters as its viewBox, and escapes text', () => { + expect(svg).toContain('viewBox="0 0 101.6 152.4"') + expect(svg).toContain('Sample <kit> & more') + expect(svg).not.toContain('') + }) + it('draws barcodes, a QR and a Data Matrix as vectors, with the value under the linear one', () => { + expect(svg.match(/ { + const again = layout(tpl, kit, THERMAL_4X6) + expect(again.marks).toEqual(result.marks) + expect(renderSvg(again)).toBe(svg) + }) +}) From 8ea83fa69e09ebe4e0e20915d673cfdbaa2122ad Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Mon, 16 Nov 2026 00:19:58 -0700 Subject: [PATCH 4/7] Add the print endpoint with scope and access checks POST /api/labels/print renders a PDF for given documents and a template. It refuses signed-out requests, people with no scope, another scope's template, any document the person cannot read and more than 2,000 labels, and writes one log entry of ids and counts. Not tested: over real HTTP, render time at 2,000 labels, sets, media choice, sheet pages. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 ++- README.md | 4 +- docs/decisions.md | 1 + docs/test-audit.md | 6 +++ src/index.ts | 15 ++++++ src/print.ts | 98 +++++++++++++++++++++++++++++++++++++++ test/print.test.ts | 112 +++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 239 insertions(+), 3 deletions(-) create mode 100644 src/print.ts create mode 100644 test/print.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index d45a4bd..20c05f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,9 @@ - **Outputs**: `renderSvg` (core) and `renderPdf` (`./pdf` export, pdfkit), one label per page, from the same marks. Barcodes, QR and Data Matrix are drawn as vectors with bwip-js; a value that can't be encoded draws a dashed box and the layout already warns. New dependencies: pdfkit and bwip-js (both MIT). +- **Print endpoint** `POST /api/labels/print` (`template`, `ids`, `copies`): a PDF, one label per page. Refuses with a plain message when signed out, without the print right, without a scope, for another scope's template, for any document the person cannot read, and over 2,000 labels. Writes one print-log entry (ids and counts only) server-side. + No version bump (still 0.0.0). -Tested: 34 tests with made-up data. Core math and tokens; PDF page count and size (288 x 432 pt for 4 x 6 in), SVG viewBox, text escaping, rotation, vector barcodes, invalid barcode without a crash; a Payload config build checking the collections, default access and strict answers; and an in-memory MongoDB run with two sites proving cross-scope reads, creates, updates, deletes and moves are refused, the shared template is admin-only, the print log is unwritable, and signed-out and scope-less users get nothing. -Not tested: PDF in a viewer or printer, SVG in a browser, scanning a printed barcode, sheet pages, images in output, real font metrics, the print endpoint, the admin UI, real printers. +Tested: 40 tests with made-up data. Core math and tokens; PDF page count and size (288 x 432 pt for 4 x 6 in), SVG viewBox, text escaping, rotation, vector barcodes, invalid barcode without a crash; the print endpoint on in-memory MongoDB (page count, one log entry with ids only, 2,001-over refusal with count, signed-out, no scope, other site's template, an unreadable record, bad requests); a Payload config build checking the collections, default access and strict answers; and an in-memory MongoDB run with two sites proving cross-scope reads, creates, updates, deletes and moves are refused, the shared template is admin-only, the print log is unwritable, and signed-out and scope-less users get nothing. +Not tested: the endpoint over real HTTP, 2,000 labels' render time (the 2,000 limit is a guess), PDF in a viewer or printer, SVG in a browser, scanning a printed barcode, sheet pages, images in output, real font metrics, real printers. diff --git a/README.md b/README.md index 68cf1e8..e4e7e00 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Labels for Payload: design labels with field tokens in the admin, then print one, a few or every label for a document, on thermal rolls or Avery-style sheets. -**Status:** early checkpoint, version 0.0.0, not published. Built and tested (34 tests): the layout engine in `src/core` (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset), and the plugin that adds the three collections with write access closed by default and scope filtering on reads and writes, plus SVG and PDF output drawn from the layout marks, with barcodes, QR and Data Matrix as vectors (bwip-js). The scope rules are tested against an in-memory MongoDB with two made-up sites. The PDF was checked for page count and page size in points, not opened in a printer or viewer; the SVG was checked as text, not in a browser; no barcode has been scanned. **Not built yet:** sheet (Avery) pages, images in output, the print endpoint and dialog, the admin inspector and live preview, and the writes to the print log. The design is in [docs/design.md](docs/design.md). +**Status:** early checkpoint, version 0.0.0, not published. Built and tested (40 tests): the layout engine in `src/core` (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset), and the plugin that adds the three collections with write access closed by default and scope filtering on reads and writes, plus SVG and PDF output drawn from the layout marks, with barcodes, QR and Data Matrix as vectors (bwip-js), and the print endpoint `POST /api/labels/print`. The scope rules are tested against an in-memory MongoDB with two made-up sites. The PDF was checked for page count and page size in points, not opened in a printer or viewer; the SVG was checked as text, not in a browser; no barcode has been scanned. The endpoint is tested by calling its handler against an in-memory MongoDB, not over HTTP. **Not built yet:** sheet (Avery) pages, images in output, sets, the print dialog and button, the admin inspector and live preview. The design is in [docs/design.md](docs/design.md). ## What it will do (the plan) @@ -52,6 +52,8 @@ A check counts only if it returns exactly `true`; an error counts as no. The layout engine works on its own, with no Payload and no React: `import { layout, THERMAL_4X6 } from '@extantape/payload-plugin-labels/core'`. `layout(template, record, media)` returns the marks of one label in millimeters, plus warnings for missing values, text that does not fit and marks outside the label. Text width is estimated from character counts, so fitting is approximate. +Printing: `POST /api/labels/print` with `{ "template": "", "ids": [...], "copies": 1 }` returns a PDF, one label per page. It needs a signed-in person with the `print` check (or, with no `print` check given, any signed-in person), a scope when `scopeField` is set, a template in their scope, and read access to every document through Payload's own rules for that collection. If any document is missing or unreadable, nothing prints. A request over 2,000 labels (documents times copies) is refused with its count. Each print writes one log entry with the template, collection, document ids, label count and who printed, and never the label text. If the log write fails, nothing is returned. The 4 x 6 in thermal media is used for every template for now. + Output: `renderSvg(layoutResult)` (in `/core`) gives an SVG in millimeters for previews. `renderPdf([layoutResult, ...])` from `@extantape/payload-plugin-labels/pdf` gives a PDF with one label per page, each page the label's size. Both draw the same marks. Images draw as a placeholder box for now. ## License diff --git a/docs/decisions.md b/docs/decisions.md index 56d0177..b62a796 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -28,3 +28,4 @@ Dated decisions for this repo, newest last. - Template `width` and `height` are stored in mm as separate number fields, and `elements` and media `definition` are JSON, to be validated when the inspector is built. - 2026-11-16: scope filtering (design: templates and media belong to a site, a template with no site is shared, a platform admin manages shared ones). The design did not say how a user's site is found, so there is a `scopeOf(req)` option: it returns the scope id, `ALL_SCOPES` for a platform admin, or nothing. Nothing, an error or no sign-in fails closed. Templates and media: own scope plus shared on read; own scope only on update and delete; create must name the person's own scope; a record cannot be moved to another scope. Print log: own scope only, never written through the API. `scopeField` now throws without `scopeCollection` and `scopeOf`. - 2026-11-16: outputs. SVG and PDF both draw the layout's mark list. Dependencies, licenses checked in their package files: pdfkit 0.20 (MIT), bwip-js 4.11 (MIT), @types/pdfkit (MIT, dev). Both runtime packages are real dependencies, as the design names them. Choices: the PDF has one label per page (sheet pages come later); the SVG helper lives in `/core` and the PDF writer in its own `/pdf` export, so the plugin config never loads pdfkit; barcode vectors come from bwip-js's SVG output and the same path data feeds both renderers; the human-readable line under a linear barcode is drawn by us at 7 pt in Helvetica; images draw as a placeholder box until upload resolving exists; text fitting still uses the estimated width. Rotation turns a mark about the center of its box. +- 2026-11-16: print endpoint. Follows the design's `POST /api/labels/print` and its 2,000-label limit (documents times copies, checked before any read). Choices where the design was open: the request takes `template` (key or id), `ids` and `copies` only for now (sets, media and start position come with the dialog); the template is read as the person, so scope rules apply; documents are read with the person's access (`overrideAccess: false`, depth 3) and one unreadable or missing document refuses the whole request, because a silent gap on a printed run is worse than a refusal; with no `print` check configured any signed-in person may print what they can read, with one only exactly `true` passes; the log entry is written by the server and a failed log write refuses the request, so nothing prints unlogged; `printedBy` holds the user id only; the log takes the person's scope, or the template's for a platform admin; pdfkit loads on the first request, not at config time; thermal 4 x 6 in media is used until media choice is built. diff --git a/docs/test-audit.md b/docs/test-audit.md index c2c3afb..49bc0a4 100644 --- a/docs/test-audit.md +++ b/docs/test-audit.md @@ -2,6 +2,12 @@ Newest first. +## 2026-11-16: print endpoint + +- Promises: signed-out, no-scope, other-scope template, unreadable record and over-limit requests are refused and print nothing; a good request returns a PDF with one page per label and writes one log entry holding ids and counts only; the log cannot be written through the API. +- Covered: `test/print.test.ts` (6 tests) on in-memory MongoDB with two sites and site-limited read access on the printed collection. +- Gaps skipped (and why): HTTP-level routing (Payload's own); the no-`print`-check default and a `print` check returning non-true are covered by the shared access code, not repeated here; render time at 2,000 labels (the test renders 2,000 pages but does not measure time). + ## 2026-11-16: SVG and PDF output - Promises: a 4 x 6 in label makes a one-page PDF 288 x 432 pt; the SVG viewBox is the label in mm; text is escaped; barcodes render as vectors; an invalid value warns and never crashes either output; both outputs draw one mark list. diff --git a/src/index.ts b/src/index.ts index b14c080..d1898e8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,7 @@ import type { Access, CollectionConfig, Config, Field, Plugin, Where } from 'payload' import type { LabelProvider } from './contracts/labels.js' +import { printEndpoint } from './print.js' export * from './core/index.js' @@ -45,6 +46,7 @@ async function scopeFor(options: LabelsOptions, req: unknown): Promise (options.access?.print ? (await print({ req } as never)) === true : Boolean(req.user)), + scope: async (req) => { + if (!field) return { all: true } + const who = await scopeFor(options, req) + return who === null ? null : who === ALL_SCOPES ? { all: true } : { id: who } + }, + scopeField: field, + log: options.log?.enabled !== false, + }) const custom = (config.custom ?? {}) as { labels?: { providers?: Record } } return { ...config, + endpoints: [...(config.endpoints ?? []), endpoint], collections: [...(config.collections ?? []), templates, media, ...(options.log?.enabled === false ? [] : [prints])], custom: { ...custom, diff --git a/src/print.ts b/src/print.ts new file mode 100644 index 0000000..a082d41 --- /dev/null +++ b/src/print.ts @@ -0,0 +1,98 @@ +import type { Endpoint, PayloadRequest } from 'payload' + +import { layout, THERMAL_4X6, type LabelElement, type LabelTemplate } from './core/index.js' + +/** The most labels one request may print (documents times copies). A guess for what renders in a few seconds. */ +export const MAX_LABELS = 2000 + +export type PrintDeps = { + slugs: { templates: string; prints: string } + /** `strict` answer of the site's print check. */ + mayPrint: (req: PayloadRequest) => Promise + /** The person's scope: null for none, `{ all: true }` for a platform admin, else `{ id }`. Without a scope field: `{ all: true }`. */ + scope: (req: PayloadRequest) => Promise<{ all: true } | { id: string | number } | null> + scopeField?: string + log: boolean +} + +const refuse = (status: number, message: string) => Response.json({ message }, { status }) + +/** + * POST /api/labels/print with `{ template, ids, copies? }` returns a PDF, one label per page. It fails closed: no + * sign-in, no print right, no scope, another scope's template, a record the person can't read, or too many labels is + * a plain refusal. Records are read with the person's own access (never overrideAccess), and one log entry holds ids + * and counts only. + */ +export const printEndpoint = (deps: PrintDeps): Endpoint => ({ + path: '/labels/print', + method: 'post', + handler: async (req) => { + const { payload, user } = req + if (!user) return refuse(401, 'Sign in to print labels.') + if (!(await deps.mayPrint(req))) return refuse(403, 'You may not print labels.') + const scope = await deps.scope(req) + if (!scope) return refuse(403, 'Your account is not set up for any site, so it cannot print labels.') + + let body: { template?: unknown; ids?: unknown; copies?: unknown } + try { + body = (await req.json?.()) as typeof body + } catch { + return refuse(400, 'The request was not valid JSON.') + } + const ids = Array.isArray(body?.ids) ? [...new Set(body.ids.filter((i): i is string | number => typeof i === 'string' || typeof i === 'number').map(String))] : [] + const copies = body?.copies === undefined ? 1 : body.copies + if (typeof body?.template !== 'string' && typeof body?.template !== 'number') return refuse(400, 'Say which template to print.') + if (!ids.length) return refuse(400, 'Pick at least one document.') + if (typeof copies !== 'number' || !Number.isInteger(copies) || copies < 1) return refuse(400, 'Copies must be a whole number of 1 or more.') + if (ids.length * copies > MAX_LABELS) return refuse(413, `That is ${ids.length * copies} labels. One request prints at most ${MAX_LABELS}.`) + + // The template: by key or id, through the same scope rules as reading it in the admin. + const found = await payload.find({ + collection: deps.slugs.templates as never, + where: { or: [{ key: { equals: String(body.template) } }, ...(/^[0-9a-f]{24}$/i.test(String(body.template)) || typeof body.template === 'number' ? [{ id: { equals: body.template } }] : [])] } as never, + limit: 1, + user, + overrideAccess: false, + depth: 0, + }) + const tpl = found.docs[0] as unknown as { id: string | number; key: string; collection: string; width: number; height: number; elements: unknown; active?: boolean; copies?: number } | undefined + if (!tpl || tpl.active === false) return refuse(403, 'That template does not exist or you may not use it.') + if (!Array.isArray(tpl.elements) || !(tpl.width > 0) || !(tpl.height > 0)) return refuse(422, 'That template is not complete.') + if (!payload.collections[tpl.collection as never]) return refuse(422, 'That template prints from a collection that does not exist.') + + // The documents: Payload's own access for their collection, as the person. Any one missing refuses the lot. + const docs = await payload.find({ collection: tpl.collection as never, where: { id: { in: ids } } as never, limit: ids.length, pagination: false, user, overrideAccess: false, depth: 3 }) + if (docs.docs.length !== ids.length) return refuse(403, 'One or more of those documents does not exist or you may not read them. Nothing was printed.') + const byId = new Map(docs.docs.map((d) => [String((d as { id: unknown }).id), d])) + + const template: LabelTemplate = { key: tpl.key, size: { width: tpl.width, height: tpl.height }, elements: tpl.elements as LabelElement[] } + const total = ids.length * copies + const printedAt = new Date().toISOString() + const u = user as { name?: unknown } + const results = [] + let n = 0 + for (const id of ids) { + for (let c = 0; c < copies; c++) { + n++ + results.push(layout(template, byId.get(id), THERMAL_4X6, { label: { number: n, of: total }, printedAt, printedBy: { name: typeof u.name === 'string' ? u.name : '' } })) + } + } + const { renderPdf } = await import('./pdf.js') + const pdf = await renderPdf(results) + + if (deps.log) { + const tplScope = deps.scopeField ? (tpl as unknown as Record)[deps.scopeField] : undefined + const scopeValue = 'id' in scope ? scope.id : tplScope && typeof tplScope === 'object' ? (tplScope as { id?: unknown }).id : tplScope + try { + await payload.create({ + collection: deps.slugs.prints as never, + data: { template: tpl.id, collection: tpl.collection, documentIds: ids, labelCount: total, printedBy: String((user as { id: unknown }).id), ...(deps.scopeField && scopeValue ? { [deps.scopeField]: scopeValue } : {}) } as never, + overrideAccess: true, + }) + } catch { + return refuse(500, 'The print log could not be written, so nothing was printed.') + } + } + return new Response(new Blob([pdf as Uint8Array]), { headers: { 'Content-Type': 'application/pdf', 'Content-Disposition': 'inline; filename="labels.pdf"' } }) + }, +}) diff --git a/test/print.test.ts b/test/print.test.ts new file mode 100644 index 0000000..0adfff1 --- /dev/null +++ b/test/print.test.ts @@ -0,0 +1,112 @@ +import { mongooseAdapter } from '@payloadcms/db-mongodb' +import { MongoMemoryReplSet } from 'mongodb-memory-server' +import { buildConfig, getPayload, type Payload } from 'payload' +import { afterAll, beforeAll, describe, expect, it } from 'vitest' + +import { ALL_SCOPES, labelsPlugin, MAX_LABELS } from '../src/index.js' + +/** Two made-up sites. Orders are readable only by users of their own site, so the print route must follow that. */ +let payload: Payload +let mongo: MongoMemoryReplSet +const u: Record = {} +const t: Record = {} +const orders: Record = {} +const pages = (b: Uint8Array) => Buffer.from(b).toString('latin1').match(/\/Type \/Page\b(?!s)/g)?.length ?? 0 + +async function post(user: string | null, body: unknown) { + const ep = payload.config.endpoints.find((e) => e.path === '/labels/print')! + const req = { payload, user: user ? { collection: 'users', ...u[user] } : null, json: async () => body } as never + return (await ep.handler(req)) as Response +} +const logs = async () => (await payload.find({ collection: 'label-prints' as never, limit: 50 })).docs as unknown as Array> + +beforeAll(async () => { + mongo = await MongoMemoryReplSet.create({ replSet: { count: 1, storageEngine: 'wiredTiger' } }) + payload = await getPayload({ + config: await buildConfig({ + secret: 'test-secret-not-for-production', + telemetry: false, + typescript: { autoGenerate: false }, + db: mongooseAdapter({ url: mongo.getUri('print'), ensureIndexes: true }), + collections: [ + { slug: 'users', auth: true, fields: [{ name: 'role', type: 'text' }, { name: 'tenant', type: 'relationship', relationTo: 'tenants' }] }, + { slug: 'tenants', fields: [{ name: 'name', type: 'text' }] }, + { + slug: 'orders', + fields: [{ name: 'code', type: 'text' }, { name: 'tenant', type: 'relationship', relationTo: 'tenants' }], + access: { read: ({ req }) => (req.user ? { tenant: { equals: (req.user as { tenant?: unknown }).tenant } } : false) }, + }, + ], + plugins: [ + labelsPlugin({ + access: { manage: ({ req }) => Boolean(req.user) }, + scopeField: 'tenant', + scopeCollection: 'tenants', + scopeOf: ({ req }) => { + const user = req.user as { role?: string; tenant?: string | number } | undefined + return user?.role === 'platform' ? ALL_SCOPES : user?.tenant + }, + }), + ], + }), + }) + for (const n of ['a', 'b']) t[n] = (await payload.create({ collection: 'tenants', data: { name: `Site ${n}` } })).id + for (const [n, role, tn] of [['alice', 'staff', 'a'], ['bob', 'staff', 'b'], ['drifter', 'staff', undefined]] as const) { + const d = await payload.create({ collection: 'users', data: { email: `${n}@example.test`, password: 'test-pass-123', role, ...(tn ? { tenant: t[tn] } : {}) } as never }) + u[n] = { id: d.id, role, tenant: tn ? t[tn] : undefined } + } + const el = [{ type: 'text', x: 5, y: 5, width: 80, height: 10, fontSize: 14, content: '{{code}} {{label.number}}/{{label.of}}' }, { type: 'barcode', x: 5, y: 20, width: 60, height: 20, symbology: 'code128', value: '{{code}}' }] + const base = { collection: 'orders', width: 101.6, height: 152.4, elements: el } + await payload.create({ collection: 'label-templates' as never, data: { ...base, name: 'A box', key: 'a-box', tenant: t.a } as never }) + await payload.create({ collection: 'label-templates' as never, data: { ...base, name: 'B box', key: 'b-box', tenant: t.b } as never }) + for (const [k, tn] of [['a1', 'a'], ['a2', 'a'], ['b1', 'b']] as const) orders[k] = (await payload.create({ collection: 'orders' as never, data: { code: k.toUpperCase(), tenant: t[tn] } as never })).id +}) +afterAll(async () => { + await payload?.db.destroy?.() + await mongo?.stop() +}) + +describe('POST /labels/print', () => { + it('returns a PDF with one page per label and writes one log entry with ids and counts only', async () => { + const before = (await logs()).length + const r = await post('alice', { template: 'a-box', ids: [orders.a1, orders.a2], copies: 2 }) + expect(r.status).toBe(200) + expect(r.headers.get('content-type')).toBe('application/pdf') + expect(pages(new Uint8Array(await r.arrayBuffer()))).toBe(4) + const all = await logs() + expect(all).toHaveLength(before + 1) + const entry = all.at(-1)! + expect(entry).toMatchObject({ labelCount: 4, collection: 'orders', printedBy: String(u.alice!.id) }) + expect(entry.documentIds).toEqual([String(orders.a1), String(orders.a2)]) + expect(JSON.stringify(entry)).not.toMatch(/A1|A2/) + }) + it(`refuses more than ${MAX_LABELS} labels with the number, and logs nothing`, async () => { + const before = (await logs()).length + const r = await post('alice', { template: 'a-box', ids: [orders.a1, orders.a2], copies: 1000 }) + expect(r.status).toBe(200) + const over = await post('alice', { template: 'a-box', ids: [orders.a1, orders.a2], copies: 1001 }) + expect(over.status).toBe(413) + expect(((await over.json()) as { message: string }).message).toContain('2002') + expect((await logs()).length).toBe(before + 1) + }) + it('refuses a signed-out request and a person with no site', async () => { + expect((await post(null, { template: 'a-box', ids: [orders.a1] })).status).toBe(401) + expect((await post('drifter', { template: 'a-box', ids: [orders.a1] })).status).toBe(403) + }) + it("refuses another site's template, and a record the person cannot read, printing nothing", async () => { + const before = (await logs()).length + expect((await post('alice', { template: 'b-box', ids: [orders.a1] })).status).toBe(403) + expect((await post('alice', { template: 'a-box', ids: [orders.a1, orders.b1] })).status).toBe(403) + expect((await post('alice', { template: 'a-box', ids: [orders.a1, '000000000000000000000000'] })).status).toBe(403) + expect((await logs()).length).toBe(before) + }) + it('refuses bad requests plainly', async () => { + expect((await post('alice', { ids: [orders.a1] })).status).toBe(400) + expect((await post('alice', { template: 'a-box', ids: [] })).status).toBe(400) + expect((await post('alice', { template: 'a-box', ids: [orders.a1], copies: 0 })).status).toBe(400) + expect((await post('alice', { template: 'a-box', ids: [orders.a1], copies: 1.5 })).status).toBe(400) + }) + it('the log cannot be written through the API', async () => { + await expect(payload.create({ collection: 'label-prints' as never, data: { collection: 'orders', tenant: t.a } as never, user: { collection: 'users', ...u.alice } as never, overrideAccess: false })).rejects.toThrow() + }) +}) From e562dabfa1e0b3a0bf2be4cf929651af1ce60909 Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Mon, 16 Nov 2026 07:00:31 -0700 Subject: [PATCH 5/7] Fail closed when no access options are set The plugin now throws at config time unless access.manage or access.print is set, and no longer lets any signed-in person read templates or print. access.print decides printing, otherwise access.manage does. Template lookup tries the key, then the id as given, so numeric ids work on SQL databases. Not tested: numeric ids on a real SQL database; the cost of reading documents at depth 3. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 ++++-- README.md | 13 ++++++++----- docs/decisions.md | 1 + docs/test-audit.md | 6 ++++++ src/index.ts | 12 +++++++----- src/print.ts | 26 ++++++++++++++++---------- test/plugin.test.ts | 38 +++++++++++++++++++++++++++++++++----- test/print.test.ts | 20 ++++++++++++++++++++ 8 files changed, 95 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20c05f5..ab21480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,9 @@ - **Print endpoint** `POST /api/labels/print` (`template`, `ids`, `copies`): a PDF, one label per page. Refuses with a plain message when signed out, without the print right, without a scope, for another scope's template, for any document the person cannot read, and over 2,000 labels. Writes one print-log entry (ids and counts only) server-side. +- **Fail closed.** The plugin throws at config time unless `access.manage` or `access.print` is set. `access.print` decides printing; without it only `access.manage` may print. Templates and media are read by whoever may manage or print (a printer must read the template); the log is read by `manage` only. There is no signed-in fallback. The template lookup tries the key, then the id exactly as given, so numeric ids work on Postgres and SQLite. + No version bump (still 0.0.0). -Tested: 40 tests with made-up data. Core math and tokens; PDF page count and size (288 x 432 pt for 4 x 6 in), SVG viewBox, text escaping, rotation, vector barcodes, invalid barcode without a crash; the print endpoint on in-memory MongoDB (page count, one log entry with ids only, 2,001-over refusal with count, signed-out, no scope, other site's template, an unreadable record, bad requests); a Payload config build checking the collections, default access and strict answers; and an in-memory MongoDB run with two sites proving cross-scope reads, creates, updates, deletes and moves are refused, the shared template is admin-only, the print log is unwritable, and signed-out and scope-less users get nothing. -Not tested: the endpoint over real HTTP, 2,000 labels' render time (the 2,000 limit is a guess), PDF in a viewer or printer, SVG in a browser, scanning a printed barcode, sheet pages, images in output, real font metrics, real printers. +Tested: 44 tests with made-up data. Core math and tokens; PDF page count and size (288 x 432 pt for 4 x 6 in), SVG viewBox, text escaping, rotation, vector barcodes, invalid barcode without a crash; the print endpoint on in-memory MongoDB (page count, one log entry with ids only, 2,001-over refusal with count, signed-out, no scope, other site's template, an unreadable record, bad requests); config throws with neither access option, manage-only and print-only behavior, and the template lookup order with a stand-in for Payload; a Payload config build checking the collections, default access and strict answers; and an in-memory MongoDB run with two sites proving cross-scope reads, creates, updates, deletes and moves are refused, the shared template is admin-only, the print log is unwritable, and signed-out and scope-less users get nothing. +Not tested: the cost of reading printed documents at depth 3 (to revisit before 0.1), numeric ids on a real SQL database, the endpoint over real HTTP, 2,000 labels' render time (the 2,000 limit is a guess), PDF in a viewer or printer, SVG in a browser, scanning a printed barcode, sheet pages, images in output, real font metrics, real printers. diff --git a/README.md b/README.md index e4e7e00..b337e42 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Labels for Payload: design labels with field tokens in the admin, then print one, a few or every label for a document, on thermal rolls or Avery-style sheets. -**Status:** early checkpoint, version 0.0.0, not published. Built and tested (40 tests): the layout engine in `src/core` (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset), and the plugin that adds the three collections with write access closed by default and scope filtering on reads and writes, plus SVG and PDF output drawn from the layout marks, with barcodes, QR and Data Matrix as vectors (bwip-js), and the print endpoint `POST /api/labels/print`. The scope rules are tested against an in-memory MongoDB with two made-up sites. The PDF was checked for page count and page size in points, not opened in a printer or viewer; the SVG was checked as text, not in a browser; no barcode has been scanned. The endpoint is tested by calling its handler against an in-memory MongoDB, not over HTTP. **Not built yet:** sheet (Avery) pages, images in output, sets, the print dialog and button, the admin inspector and live preview. The design is in [docs/design.md](docs/design.md). +**Status:** early checkpoint, version 0.0.0, not published. Built and tested (44 tests): the layout engine in `src/core` (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset), and the plugin that adds the three collections with write access closed by default and scope filtering on reads and writes, plus SVG and PDF output drawn from the layout marks, with barcodes, QR and Data Matrix as vectors (bwip-js), and the print endpoint `POST /api/labels/print`. The scope rules are tested against an in-memory MongoDB with two made-up sites. The PDF was checked for page count and page size in points, not opened in a printer or viewer; the SVG was checked as text, not in a browser; no barcode has been scanned. The endpoint is tested by calling its handler against an in-memory MongoDB, not over HTTP. **Not built yet:** sheet (Avery) pages, images in output, sets, the print dialog and button, the admin inspector and live preview. The design is in [docs/design.md](docs/design.md). ## What it will do (the plan) @@ -38,7 +38,10 @@ import { labelsPlugin } from '@extantape/payload-plugin-labels' export default buildConfig({ plugins: [ labelsPlugin({ - access: { manage: ({ req }) => req.user?.role === 'admin' }, + access: { + manage: ({ req }) => req.user?.role === 'admin', + print: ({ req }) => Boolean(req.user?.canPrint), + }, // Per site: scopeField: 'tenant', scopeCollection: 'tenants', // scopeOf: ({ req }) => (req.user?.role === 'platform' ? ALL_SCOPES : req.user?.tenant), }), @@ -46,13 +49,13 @@ export default buildConfig({ }) ``` -With no `access` given, nobody can write labels through the API and only signed-in people can read them. With `scopeField`, you also give `scopeOf`, which says which site the person belongs to (an id, `ALL_SCOPES` for a platform admin, or nothing). A person reads and writes only their own site's templates, media and print log, and can also read templates with no site, which only a platform admin can change. No site, an error or no sign-in means no access. A record cannot be moved to another site. +You must set `access.manage` (who may change templates and media), `access.print` (who may print), or both. With neither, the plugin throws when the config loads and names the missing option. Nobody is allowed by default. Only an answer of exactly `true` passes. Templates and media can be read by people the `manage` or `print` check allows, and the print log only by `manage`. With `scopeField`, you also give `scopeOf`, which says which site the person belongs to (an id, `ALL_SCOPES` for a platform admin, or nothing). A person reads and writes only their own site's templates, media and print log, and can also read templates with no site, which only a platform admin can change. No site, an error or no sign-in means no access. A record cannot be moved to another site. + -A check counts only if it returns exactly `true`; an error counts as no. The layout engine works on its own, with no Payload and no React: `import { layout, THERMAL_4X6 } from '@extantape/payload-plugin-labels/core'`. `layout(template, record, media)` returns the marks of one label in millimeters, plus warnings for missing values, text that does not fit and marks outside the label. Text width is estimated from character counts, so fitting is approximate. -Printing: `POST /api/labels/print` with `{ "template": "", "ids": [...], "copies": 1 }` returns a PDF, one label per page. It needs a signed-in person with the `print` check (or, with no `print` check given, any signed-in person), a scope when `scopeField` is set, a template in their scope, and read access to every document through Payload's own rules for that collection. If any document is missing or unreadable, nothing prints. A request over 2,000 labels (documents times copies) is refused with its count. Each print writes one log entry with the template, collection, document ids, label count and who printed, and never the label text. If the log write fails, nothing is returned. The 4 x 6 in thermal media is used for every template for now. +Printing: `POST /api/labels/print` with `{ "template": "", "ids": [...], "copies": 1 }` returns a PDF, one label per page. It needs a signed-in person with the `print` check (or, with no `print` check, the `manage` check), a scope when `scopeField` is set, a template in their scope, and read access to every document through Payload's own rules for that collection. If any document is missing or unreadable, nothing prints. A request over 2,000 labels (documents times copies) is refused with its count. Each print writes one log entry with the template, collection, document ids, label count and who printed, and never the label text. If the log write fails, nothing is returned. The 4 x 6 in thermal media is used for every template for now. Output: `renderSvg(layoutResult)` (in `/core`) gives an SVG in millimeters for previews. `renderPdf([layoutResult, ...])` from `@extantape/payload-plugin-labels/pdf` gives a PDF with one label per page, each page the label's size. Both draw the same marks. Images draw as a placeholder box for now. diff --git a/docs/decisions.md b/docs/decisions.md index b62a796..0efabd3 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -29,3 +29,4 @@ Dated decisions for this repo, newest last. - 2026-11-16: scope filtering (design: templates and media belong to a site, a template with no site is shared, a platform admin manages shared ones). The design did not say how a user's site is found, so there is a `scopeOf(req)` option: it returns the scope id, `ALL_SCOPES` for a platform admin, or nothing. Nothing, an error or no sign-in fails closed. Templates and media: own scope plus shared on read; own scope only on update and delete; create must name the person's own scope; a record cannot be moved to another scope. Print log: own scope only, never written through the API. `scopeField` now throws without `scopeCollection` and `scopeOf`. - 2026-11-16: outputs. SVG and PDF both draw the layout's mark list. Dependencies, licenses checked in their package files: pdfkit 0.20 (MIT), bwip-js 4.11 (MIT), @types/pdfkit (MIT, dev). Both runtime packages are real dependencies, as the design names them. Choices: the PDF has one label per page (sheet pages come later); the SVG helper lives in `/core` and the PDF writer in its own `/pdf` export, so the plugin config never loads pdfkit; barcode vectors come from bwip-js's SVG output and the same path data feeds both renderers; the human-readable line under a linear barcode is drawn by us at 7 pt in Helvetica; images draw as a placeholder box until upload resolving exists; text fitting still uses the estimated width. Rotation turns a mark about the center of its box. - 2026-11-16: print endpoint. Follows the design's `POST /api/labels/print` and its 2,000-label limit (documents times copies, checked before any read). Choices where the design was open: the request takes `template` (key or id), `ids` and `copies` only for now (sets, media and start position come with the dialog); the template is read as the person, so scope rules apply; documents are read with the person's access (`overrideAccess: false`, depth 3) and one unreadable or missing document refuses the whole request, because a silent gap on a printed run is worse than a refusal; with no `print` check configured any signed-in person may print what they can read, with one only exactly `true` passes; the log entry is written by the server and a failed log write refuses the request, so nothing prints unlogged; `printedBy` holds the user id only; the log takes the person's scope, or the template's for a platform admin; pdfkit loads on the first request, not at config time; thermal 4 x 6 in media is used until media choice is built. +- 2026-11-16: fail closed (review). The earlier default let any signed-in person read templates and print. Now `access.manage` or `access.print` must be set or the plugin throws at config time. `access.print` decides printing; without it only `access.manage` may print. The design has no separate read option, so templates and media are read by whoever may manage or print, because printing reads the template as the person; the print log is read by `manage` only. Template lookup tries the key, then the id as given, with no format guess. Printing reads documents at depth 3; its cost is not measured and is a later item. diff --git a/docs/test-audit.md b/docs/test-audit.md index 49bc0a4..e4f028a 100644 --- a/docs/test-audit.md +++ b/docs/test-audit.md @@ -2,6 +2,12 @@ Newest first. +## 2026-11-16: fail closed and template lookup + +- Promises: with neither `access.manage` nor `access.print` the config throws and names them; manage-only means a plain signed-in member can neither print nor read templates; print-only lets printers print and read templates but not change them or read the log; a template is found by key, then by id as given. +- Covered: three tests in `test/plugin.test.ts` and one in `test/print.test.ts` (the lookup uses a stand-in for Payload, so it does not depend on Mongo ids). +- Gaps skipped (and why): numeric ids on a real Postgres or SQLite (needs another database; the lookup passes the id through unchanged). + ## 2026-11-16: print endpoint - Promises: signed-out, no-scope, other-scope template, unreadable record and over-limit requests are refused and print nothing; a good request returns a PDF with one page per label and writes one log entry holding ids and counts only; the log cannot be written through the API. diff --git a/src/index.ts b/src/index.ts index d1898e8..1807baa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -54,13 +54,15 @@ export const PRINTS_SLUG = 'label-prints' export const labelsPlugin = (options: LabelsOptions = {}): Plugin => (config: Config): Config => { + if (!options.access?.manage && !options.access?.print) { + throw new Error('labels: set access.manage (who may change templates and media) or access.print (who may print). With neither, nobody could use the plugin.') + } const field = options.scopeField if (field && (!options.scopeCollection || !options.scopeOf)) throw new Error('labels: scopeField needs scopeCollection and scopeOf') const manage = strict(options.access?.manage) const print = strict(options.access?.print) - // Reading needs a person who may print or manage. With neither check given, a signed-in user may read. - const read: Access = async (args) => - options.access?.print || options.access?.manage ? (await print(args)) === true || (await manage(args)) === true : Boolean(args.req.user) + // Reading templates and media needs a person who may manage or print (printing reads the template). No fallback. + const read: Access = async (args) => (await manage(args)) === true || (await print(args)) === true // With a scope field, every answer is narrowed to the person's own scope. No scope means no access. const scoped = (base: Access, shared: boolean): Access => async (args) => { const ok = await base(args) @@ -148,8 +150,8 @@ export const labelsPlugin = const endpoint = printEndpoint({ slugs: { templates: TEMPLATES_SLUG, prints: PRINTS_SLUG }, - // Without a print check, any signed-in person may print what they can read. With one, only exactly true passes. - mayPrint: async (req) => (options.access?.print ? (await print({ req } as never)) === true : Boolean(req.user)), + // access.print decides printing; without it, only access.manage may print. Only exactly true passes. + mayPrint: async (req) => (options.access?.print ? (await print({ req } as never)) === true : (await manage({ req } as never)) === true), scope: async (req) => { if (!field) return { all: true } const who = await scopeFor(options, req) diff --git a/src/print.ts b/src/print.ts index a082d41..8d5c333 100644 --- a/src/print.ts +++ b/src/print.ts @@ -15,6 +15,20 @@ export type PrintDeps = { log: boolean } +type TemplateDoc = { id: string | number; key: string; collection: string; width: number; height: number; elements: unknown; active?: boolean; copies?: number } + +/** Find a template by key, then by its id as given. Reads as the person, so access and scope rules apply. */ +export async function findTemplate(payload: PayloadRequest['payload'], slug: string, ref: string, user: unknown): Promise { + const opts = { user, overrideAccess: false, depth: 0 } as never + const byKey = await payload.find({ collection: slug as never, where: { key: { equals: ref } } as never, limit: 1, ...(opts as object) }) + if (byKey.docs[0]) return byKey.docs[0] as unknown as TemplateDoc + try { + return (await payload.findByID({ collection: slug as never, id: ref, ...(opts as object) })) as unknown as TemplateDoc + } catch { + return undefined + } +} + const refuse = (status: number, message: string) => Response.json({ message }, { status }) /** @@ -46,16 +60,8 @@ export const printEndpoint = (deps: PrintDeps): Endpoint => ({ if (typeof copies !== 'number' || !Number.isInteger(copies) || copies < 1) return refuse(400, 'Copies must be a whole number of 1 or more.') if (ids.length * copies > MAX_LABELS) return refuse(413, `That is ${ids.length * copies} labels. One request prints at most ${MAX_LABELS}.`) - // The template: by key or id, through the same scope rules as reading it in the admin. - const found = await payload.find({ - collection: deps.slugs.templates as never, - where: { or: [{ key: { equals: String(body.template) } }, ...(/^[0-9a-f]{24}$/i.test(String(body.template)) || typeof body.template === 'number' ? [{ id: { equals: body.template } }] : [])] } as never, - limit: 1, - user, - overrideAccess: false, - depth: 0, - }) - const tpl = found.docs[0] as unknown as { id: string | number; key: string; collection: string; width: number; height: number; elements: unknown; active?: boolean; copies?: number } | undefined + // The template: by key first, then by id exactly as given, both as the person (scope rules apply). + const tpl = await findTemplate(payload, deps.slugs.templates, String(body.template), user) if (!tpl || tpl.active === false) return refuse(403, 'That template does not exist or you may not use it.') if (!Array.isArray(tpl.elements) || !(tpl.width > 0) || !(tpl.height > 0)) return refuse(422, 'That template is not complete.') if (!payload.collections[tpl.collection as never]) return refuse(422, 'That template prints from a collection that does not exist.') diff --git a/test/plugin.test.ts b/test/plugin.test.ts index ceb38b3..a69dfa1 100644 --- a/test/plugin.test.ts +++ b/test/plugin.test.ts @@ -14,15 +14,43 @@ const build = (options?: LabelsOptions, extra: object = {}) => plugins: [labelsPlugin(options)], ...extra, }) +const closed = { access: { manage: () => false } } const slugs = (c: Awaited>) => c.collections.map((x) => x.slug) const call = (fn: unknown, user?: object) => (fn as (a: object) => unknown)({ req: { user } }) +const printAs = async (c: Awaited>, user: object) => { + const ep = c.endpoints.find((e) => e.path === '/labels/print')! + return (await ep.handler({ user, payload: {}, json: async () => ({}) } as never)) as Response +} +const col = (c: Awaited>, slug: string) => c.collections.find((x) => x.slug === slug)!.access + describe('labelsPlugin', () => { + it('throws at config time when neither access.manage nor access.print is set, naming both', async () => { + await expect(build()).rejects.toThrow(/access\.manage.*access\.print/) + await expect(build({ access: {} })).rejects.toThrow(/access\.manage/) + }) + it('with only manage set, managers print and read, and a plain signed-in member is refused everywhere', async () => { + const c = await build({ access: { manage: ({ req }) => (req.user as { admin?: boolean }).admin === true } }) + expect((await printAs(c, { admin: false })).status).toBe(403) + expect((await printAs(c, { admin: true })).status).toBe(400) + expect(await call(col(c, 'label-templates').read, { admin: false })).toBe(false) + expect(await call(col(c, 'label-media').read, { admin: false })).toBe(false) + expect(await call(col(c, 'label-templates').read, { admin: true })).toBe(true) + }) + it('with only print set, printers may print and read templates but not change them or read the log', async () => { + const c = await build({ access: { print: ({ req }) => (req.user as { printer?: boolean }).printer === true } }) + expect((await printAs(c, { printer: false })).status).toBe(403) + expect((await printAs(c, { printer: true })).status).toBe(400) + expect(await call(col(c, 'label-templates').read, { printer: true })).toBe(true) + expect(await call(col(c, 'label-templates').read, { printer: false })).toBe(false) + expect(await call(col(c, 'label-templates').update, { printer: true })).toBe(false) + expect(await call(col(c, 'label-prints').read, { printer: true })).toBe(false) + }) it('adds the three collections', async () => { - expect(slugs(await build())).toEqual(expect.arrayContaining(['label-templates', 'label-media', 'label-prints'])) + expect(slugs(await build(closed))).toEqual(expect.arrayContaining(['label-templates', 'label-media', 'label-prints'])) }) it('refuses every write by default, and reads for signed-out people', async () => { - const c = await build() + const c = await build(closed) for (const slug of ['label-templates', 'label-media', 'label-prints']) { const a = c.collections.find((x) => x.slug === slug)!.access for (const op of ['create', 'update', 'delete'] as const) expect(await call(a[op], { id: '1' })).toBe(false) @@ -43,13 +71,13 @@ describe('labelsPlugin', () => { expect(await call(c.collections.find((x) => x.slug === 'label-templates')!.access.update, { id: '1' })).toBe(false) }) it('adds the scope field, and refuses a scope field without a collection', async () => { - const c = await build({ scopeField: 'tenant', scopeCollection: 'tenants', scopeOf: () => null }) + const c = await build({ scopeField: 'tenant', scopeCollection: 'tenants', scopeOf: () => null, ...closed }) const f = c.collections.find((x) => x.slug === 'label-templates')!.fields.map((x) => ('name' in x ? x.name : '')) expect(f).toContain('tenant') - await expect(build({ scopeField: 'tenant', scopeCollection: 'tenants' })).rejects.toThrow(/scopeOf/) + await expect(build({ ...closed, scopeField: 'tenant', scopeCollection: 'tenants' })).rejects.toThrow(/scopeOf/) }) it('can switch the log off, and keeps providers other plugins added', async () => { - const c = await build({ log: { enabled: false } }, { custom: { labels: { providers: { kitting: { name: 'Kitting' } } } } }) + const c = await build({ ...closed, log: { enabled: false } }, { custom: { labels: { providers: { kitting: { name: 'Kitting' } } } } }) expect(slugs(c)).not.toContain('label-prints') expect((c.custom as { labels: { providers: object } }).labels.providers).toHaveProperty('kitting') }) diff --git a/test/print.test.ts b/test/print.test.ts index 0adfff1..5cfe211 100644 --- a/test/print.test.ts +++ b/test/print.test.ts @@ -4,6 +4,7 @@ import { buildConfig, getPayload, type Payload } from 'payload' import { afterAll, beforeAll, describe, expect, it } from 'vitest' import { ALL_SCOPES, labelsPlugin, MAX_LABELS } from '../src/index.js' +import { findTemplate } from '../src/print.js' /** Two made-up sites. Orders are readable only by users of their own site, so the print route must follow that. */ let payload: Payload @@ -109,4 +110,23 @@ describe('POST /labels/print', () => { it('the log cannot be written through the API', async () => { await expect(payload.create({ collection: 'label-prints' as never, data: { collection: 'orders', tenant: t.a } as never, user: { collection: 'users', ...u.alice } as never, overrideAccess: false })).rejects.toThrow() }) + + it('looks a template up by key first, then by the id exactly as given', async () => { + const calls: string[] = [] + const fake = { + find: async (a: { where: { key: { equals: string } } }) => { + calls.push(`find:${a.where.key.equals}`) + return { docs: a.where.key.equals === 'known-key' ? [{ id: 7, key: 'known-key' }] : [] } + }, + findByID: async (a: { id: string; overrideAccess: boolean }) => { + calls.push(`id:${a.id}:${a.overrideAccess}`) + if (a.id === '42') return { id: 42, key: 'numeric' } + throw new Error('not found') + }, + } + expect((await findTemplate(fake as never, 'label-templates', 'known-key', {}))?.id).toBe(7) + expect((await findTemplate(fake as never, 'label-templates', '42', {}))?.id).toBe(42) + expect(await findTemplate(fake as never, 'label-templates', '99', {})).toBeUndefined() + expect(calls).toEqual(['find:known-key', 'find:42', 'id:42:false', 'find:99', 'id:99:false']) + }) }) From 63766b7b31a2c4d064a5b824f58838ef08e8e90b Mon Sep 17 00:00:00 2001 From: Michael Gilardi <11632652+mgilardi@users.noreply.github.com> Date: Mon, 16 Nov 2026 07:21:50 -0700 Subject: [PATCH 6/7] Add the template editor: layers, inspector and live preview An admin field component for a template's elements. A layers list with keyboard selection and announced reorder, hide and delete; an inspector for the selected layer; and an SVG preview from the same layout as printing, with a sample record and a warnings list. Styled with Payload theme variables. Not tested: a real browser, a screen reader, the Payload admin, color contrast. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 +- README.md | 6 +- docs/decisions.md | 1 + docs/test-audit.md | 6 + package-lock.json | 2956 +++++++++++++++++++++++++++- package.json | 14 +- src/client/TemplateEditor.tsx | 211 ++ src/client/TemplateEditorField.tsx | 14 + src/client/index.ts | 5 + src/client/styles.ts | 21 + src/index.ts | 2 +- test/editor.test.tsx | 108 + tsconfig.json | 3 +- 13 files changed, 3250 insertions(+), 103 deletions(-) create mode 100644 src/client/TemplateEditor.tsx create mode 100644 src/client/TemplateEditorField.tsx create mode 100644 src/client/index.ts create mode 100644 src/client/styles.ts create mode 100644 test/editor.test.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index ab21480..e71768a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,9 @@ - **Fail closed.** The plugin throws at config time unless `access.manage` or `access.print` is set. `access.print` decides printing; without it only `access.manage` may print. Templates and media are read by whoever may manage or print (a printer must read the template); the log is read by `manage` only. There is no signed-in fallback. The template lookup tries the key, then the id exactly as given, so numeric ids work on Postgres and SQLite. +- **Template editor** (`/client`): layers list with keyboard selection and announced reorder, hide and delete; an inspector for position, size, rotation, text, font size, fit rule and barcode settings; a live SVG preview from the same layout as printing, with a sample record and a warnings list. Installed on the `elements` field. New peer dependencies: `react` and `@payloadcms/ui`. + No version bump (still 0.0.0). -Tested: 44 tests with made-up data. Core math and tokens; PDF page count and size (288 x 432 pt for 4 x 6 in), SVG viewBox, text escaping, rotation, vector barcodes, invalid barcode without a crash; the print endpoint on in-memory MongoDB (page count, one log entry with ids only, 2,001-over refusal with count, signed-out, no scope, other site's template, an unreadable record, bad requests); config throws with neither access option, manage-only and print-only behavior, and the template lookup order with a stand-in for Payload; a Payload config build checking the collections, default access and strict answers; and an in-memory MongoDB run with two sites proving cross-scope reads, creates, updates, deletes and moves are refused, the shared template is admin-only, the print log is unwritable, and signed-out and scope-less users get nothing. -Not tested: the cost of reading printed documents at depth 3 (to revisit before 0.1), numeric ids on a real SQL database, the endpoint over real HTTP, 2,000 labels' render time (the 2,000 limit is a guess), PDF in a viewer or printer, SVG in a browser, scanning a printed barcode, sheet pages, images in output, real font metrics, real printers. +Tested: 54 tests with made-up data. Core math and tokens; PDF page count and size (288 x 432 pt for 4 x 6 in), SVG viewBox, text escaping, rotation, vector barcodes, invalid barcode without a crash; the print endpoint on in-memory MongoDB (page count, one log entry with ids only, 2,001-over refusal with count, signed-out, no scope, other site's template, an unreadable record, bad requests); the editor in jsdom (preview follows the sample and inspector edits, edits write back to the elements, keyboard selection and reorder with announcements, hide, delete, add, warnings per layer, invalid sample JSON, every control labeled); config throws with neither access option, manage-only and print-only behavior, and the template lookup order with a stand-in for Payload; a Payload config build checking the collections, default access and strict answers; and an in-memory MongoDB run with two sites proving cross-scope reads, creates, updates, deletes and moves are refused, the shared template is admin-only, the print log is unwritable, and signed-out and scope-less users get nothing. +Not tested: the editor in a real browser, with a screen reader, in the Payload admin (the field wrapper that reads the form is not run in any test), color contrast; the cost of reading printed documents at depth 3 (to revisit before 0.1), numeric ids on a real SQL database, the endpoint over real HTTP, 2,000 labels' render time (the 2,000 limit is a guess), PDF in a viewer or printer, SVG in a browser, scanning a printed barcode, sheet pages, images in output, real font metrics, real printers. diff --git a/README.md b/README.md index b337e42..f191d16 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Labels for Payload: design labels with field tokens in the admin, then print one, a few or every label for a document, on thermal rolls or Avery-style sheets. -**Status:** early checkpoint, version 0.0.0, not published. Built and tested (44 tests): the layout engine in `src/core` (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset), and the plugin that adds the three collections with write access closed by default and scope filtering on reads and writes, plus SVG and PDF output drawn from the layout marks, with barcodes, QR and Data Matrix as vectors (bwip-js), and the print endpoint `POST /api/labels/print`. The scope rules are tested against an in-memory MongoDB with two made-up sites. The PDF was checked for page count and page size in points, not opened in a printer or viewer; the SVG was checked as text, not in a browser; no barcode has been scanned. The endpoint is tested by calling its handler against an in-memory MongoDB, not over HTTP. **Not built yet:** sheet (Avery) pages, images in output, sets, the print dialog and button, the admin inspector and live preview. The design is in [docs/design.md](docs/design.md). +**Status:** early checkpoint, version 0.0.0, not published. Built and tested (54 tests): the layout engine in `src/core` (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset), and the plugin that adds the three collections with write access closed by default and scope filtering on reads and writes, plus SVG and PDF output drawn from the layout marks, with barcodes, QR and Data Matrix as vectors (bwip-js), and the print endpoint `POST /api/labels/print`. The scope rules are tested against an in-memory MongoDB with two made-up sites. The PDF was checked for page count and page size in points, not opened in a printer or viewer; the SVG was checked as text, not in a browser; no barcode has been scanned. The endpoint is tested by calling its handler against an in-memory MongoDB, not over HTTP. The admin editor (layers list, inspector, live preview) is tested in jsdom only: it has not been seen in a real browser, with a screen reader, or inside the Payload admin. **Not built yet:** the drag-and-drop canvas, sheet (Avery) pages, images in output, sets, the print dialog and button. The design is in [docs/design.md](docs/design.md). ## What it will do (the plan) @@ -26,6 +26,10 @@ This part is still the plan from [docs/design.md](docs/design.md). **Family:** Labels sits in the Fulfillment family, with Kitting, Restock, Sample Kits, Shipping, Scan, Wizards, Custody and Sequences, though the families are a working draft and Fulfillment is due to be split into different groups. +## The template editor + +The `elements` field of a template uses an editor from `@extantape/payload-plugin-labels/client` (set up by the plugin; the site needs `react` and `@payloadcms/ui`, and the admin import map regenerated). It has three parts: a layers list (arrow keys move the selection; buttons move a layer up or down, hide it from the preview, or delete it; each result is announced), a preview drawn from the same layout as printing, and an inspector for the selected layer (position and size in mm, rotation, text and tokens, font size, fit rule, barcode type and value). A sample record, edited as JSON, fills the tokens, and a warnings list names the layer for each missing value, text that does not fit and bad barcode value. Hiding a layer affects the preview only and is not saved. The label's width and height come from the template's own fields. Placing layers by dragging comes later. + ## Install or build Not published yet. It will be `@extantape/payload-plugin-labels` on npm. To build it here: `npm install`, `npm test`, `npm run build`. diff --git a/docs/decisions.md b/docs/decisions.md index 0efabd3..809825f 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -30,3 +30,4 @@ Dated decisions for this repo, newest last. - 2026-11-16: outputs. SVG and PDF both draw the layout's mark list. Dependencies, licenses checked in their package files: pdfkit 0.20 (MIT), bwip-js 4.11 (MIT), @types/pdfkit (MIT, dev). Both runtime packages are real dependencies, as the design names them. Choices: the PDF has one label per page (sheet pages come later); the SVG helper lives in `/core` and the PDF writer in its own `/pdf` export, so the plugin config never loads pdfkit; barcode vectors come from bwip-js's SVG output and the same path data feeds both renderers; the human-readable line under a linear barcode is drawn by us at 7 pt in Helvetica; images draw as a placeholder box until upload resolving exists; text fitting still uses the estimated width. Rotation turns a mark about the center of its box. - 2026-11-16: print endpoint. Follows the design's `POST /api/labels/print` and its 2,000-label limit (documents times copies, checked before any read). Choices where the design was open: the request takes `template` (key or id), `ids` and `copies` only for now (sets, media and start position come with the dialog); the template is read as the person, so scope rules apply; documents are read with the person's access (`overrideAccess: false`, depth 3) and one unreadable or missing document refuses the whole request, because a silent gap on a printed run is worse than a refusal; with no `print` check configured any signed-in person may print what they can read, with one only exactly `true` passes; the log entry is written by the server and a failed log write refuses the request, so nothing prints unlogged; `printedBy` holds the user id only; the log takes the person's scope, or the template's for a platform admin; pdfkit loads on the first request, not at config time; thermal 4 x 6 in media is used until media choice is built. - 2026-11-16: fail closed (review). The earlier default let any signed-in person read templates and print. Now `access.manage` or `access.print` must be set or the plugin throws at config time. `access.print` decides printing; without it only `access.manage` may print. The design has no separate read option, so templates and media are read by whoever may manage or print, because printing reads the template as the person; the print log is read by `manage` only. Template lookup tries the key, then the id as given, with no format guess. Printing reads documents at depth 3; its cost is not measured and is a later item. +- 2026-11-16: template editor (design, builder section, without the canvas). The editor replaces the `elements` field's input through `admin.components.Field`; the label size comes from the template's `width` and `height` fields. Hide in the layers list affects the preview only and is not stored, since the design saves only what prints. Sample data is a JSON text box with a made-up default, because the plugin cannot know a site's fields; pulling a real document into the preview waits for the print dialog's document picker. The editor styles itself with Payload theme variables and fallbacks, and every result of a button is announced in a status line. New peer dependencies: `react` and `@payloadcms/ui` (both MIT); dev: jsdom, @testing-library/react. The drag-and-drop canvas, rulers and snapping stay in K7. diff --git a/docs/test-audit.md b/docs/test-audit.md index e4f028a..0c35465 100644 --- a/docs/test-audit.md +++ b/docs/test-audit.md @@ -2,6 +2,12 @@ Newest first. +## 2026-11-16: template editor + +- Promises: the preview follows the sample and edits; inspector edits write back to the elements; arrow keys move the selection; reordering follows the layer and announces the result; warnings name the right layer; every control has a label; a bad sample does not break the editor. +- Covered: `test/editor.test.tsx` (10 tests, jsdom). +- Gaps skipped (and why): the Payload field wrapper (`TemplateEditorField`, three lines over `useField`) needs the admin to run; focus outline and color contrast need a real browser; screen reader behavior needs a hands-on check. + ## 2026-11-16: fail closed and template lookup - Promises: with neither `access.manage` nor `access.print` the config throws and names them; manage-only means a plain signed-in member can neither print nor read templates; print-only lets printers print and read templates but not change them or read the log; a template is found by key, then by id as given. diff --git a/package-lock.json b/package-lock.json index d6b0959..70bf97e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,11 +14,17 @@ }, "devDependencies": { "@payloadcms/db-mongodb": "^3.92.1", + "@payloadcms/ui": "^3.93.0", + "@testing-library/react": "^16.3.3", "@types/node": "^24.19.2", "@types/pdfkit": "^0.17.7", + "@types/react": "^19.3.0", "graphql": "^16.15.0", + "jsdom": "^31.0.1", "mongodb-memory-server": "^11.3.0", "payload": "^3.92.1", + "react": "^19.3.1", + "react-dom": "^19.3.1", "typescript": "^5.9.3", "vitest": "^5.1.0" }, @@ -47,6 +53,156 @@ "url": "https://github.com/sponsors/philsturgeon" } }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.14.tgz", + "integrity": "sha512-qSY56jgW5JnSXzuekLVil6zaOQxOCtOHidr65KkaMBw772IuAY28Qx4ZykAcDn8+FRF15qk80XzKwgSc/RYW6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.14", + "@babel/types": "^7.29.14", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.14.tgz", + "integrity": "sha512-CXvKMFvM80ihI7Vox9jb+kQjnyjESQNPM+vB7U0Zz6TWuZA+Z/FL0QPMH300h33qJtIx+REeBhXqWOPW48TcAQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.14.tgz", + "integrity": "sha512-VL220vXuyO2z3rNIQwY7ftj9UwpqOt+33sH+sBWkOekbsSR2g7EEMnOx24ZlCH0xOA3DM/33SifVFGbnJD8r/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.14" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.14.tgz", + "integrity": "sha512-Y5tqevQaUAZhhj82BpYMNC1ssvLQTVAfwKdm8iy8qwmhvC2/CpcAu8OC+QEtjM7pMk7knx83u1Qj8gzkicyelw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.14.tgz", + "integrity": "sha512-RAdQJrBgmIH1FWvN0X+1hoDxzMzlP4cv/1Zi4dn4tG1H0cTb+rw7CzUxQJhp1f4ANd8j5vH3fy8BAWFGkBDEsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.14", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.14", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.14", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.14", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.14.tgz", + "integrity": "sha512-UjI/dKmwJwT9pOszJitq2G6EObZPnsZUfdCr92z2TlF3EZK9J3EdfOKUrCzHl6wFthbzwhzl1Soc/UIwxRiq6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.14", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@borewit/text-codec": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.2.3.tgz", @@ -58,6 +214,70 @@ "url": "https://github.com/sponsors/Borewit" } }, + "node_modules/@date-fns/tz": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@date-fns/tz/-/tz-1.2.0.tgz", + "integrity": "sha512-LBrd7MiJZ9McsOgxqWX7AaxrDjcFVjWH/tIKJd7pnR7McaslGYOP1QmmiBXdJH/H/yLCT+rcQ7FaPBUxRGUtrg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@dnd-kit/accessibility": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@dnd-kit/accessibility/-/accessibility-3.1.1.tgz", + "integrity": "sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0" + } + }, + "node_modules/@dnd-kit/core": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz", + "integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@dnd-kit/accessibility": "^3.1.1", + "@dnd-kit/utilities": "^3.2.2", + "tslib": "^2.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@dnd-kit/sortable": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@dnd-kit/sortable/-/sortable-10.0.0.tgz", + "integrity": "sha512-+xqhmIIzvAYMGfBYYnbKuNicfSsk4RksY2XdmJhT+HAC01nix6fHCztU68jooFiMUB01Ky3F0FyOvhG/BZrWkg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@dnd-kit/utilities": "^3.2.2", + "tslib": "^2.0.0" + }, + "peerDependencies": { + "@dnd-kit/core": "^6.3.0", + "react": ">=16.8.0" + } + }, + "node_modules/@dnd-kit/utilities": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@dnd-kit/utilities/-/utilities-3.2.2.tgz", + "integrity": "sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0" + } + }, "node_modules/@emnapi/core": { "version": "2.0.0-beta.2", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.2.tgz", @@ -95,6 +315,131 @@ "tslib": "^2.4.0" } }, + "node_modules/@emotion/babel-plugin": { + "version": "11.13.5", + "resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.13.5.tgz", + "integrity": "sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.16.7", + "@babel/runtime": "^7.18.3", + "@emotion/hash": "^0.9.2", + "@emotion/memoize": "^0.9.0", + "@emotion/serialize": "^1.3.3", + "babel-plugin-macros": "^3.1.0", + "convert-source-map": "^1.5.0", + "escape-string-regexp": "^4.0.0", + "find-root": "^1.1.0", + "source-map": "^0.5.7", + "stylis": "4.2.0" + } + }, + "node_modules/@emotion/cache": { + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.14.0.tgz", + "integrity": "sha512-L/B1lc/TViYk4DcpGxtAVbx0ZyiKM5ktoIyafGkH6zg/tj+mA+NE//aPYKG0k8kCHSHVJrpLpcAlOBEXQ3SavA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@emotion/memoize": "^0.9.0", + "@emotion/sheet": "^1.4.0", + "@emotion/utils": "^1.4.2", + "@emotion/weak-memoize": "^0.4.0", + "stylis": "4.2.0" + } + }, + "node_modules/@emotion/hash": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.2.tgz", + "integrity": "sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@emotion/memoize": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.9.0.tgz", + "integrity": "sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@emotion/react": { + "version": "11.14.0", + "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.14.0.tgz", + "integrity": "sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.18.3", + "@emotion/babel-plugin": "^11.13.5", + "@emotion/cache": "^11.14.0", + "@emotion/serialize": "^1.3.3", + "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0", + "@emotion/utils": "^1.4.2", + "@emotion/weak-memoize": "^0.4.0", + "hoist-non-react-statics": "^3.3.1" + }, + "peerDependencies": { + "react": ">=16.8.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@emotion/serialize": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-1.3.3.tgz", + "integrity": "sha512-EISGqt7sSNWHGI76hC7x1CksiXPahbxEOrC5RjmFRJTqLyEK9/9hZvBbiYn70dw4wuwMKiEMCUlR6ZXTSWQqxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@emotion/hash": "^0.9.2", + "@emotion/memoize": "^0.9.0", + "@emotion/unitless": "^0.10.0", + "@emotion/utils": "^1.4.2", + "csstype": "^3.0.2" + } + }, + "node_modules/@emotion/sheet": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.4.0.tgz", + "integrity": "sha512-fTBW9/8r2w3dXWYM4HCB1Rdp8NLibOw2+XELH5m5+AkWiL/KqYX6dc0kKYlaYyKjrQ6ds33MCdMPEwgs2z1rqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@emotion/unitless": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.10.0.tgz", + "integrity": "sha512-dFoMUuQA20zvtVTuxZww6OHoJYgrzfKM1t52mVySDJnMSEa08ruEvdYQbhvyu6soU+NeLVd3yKfTfT0NeV6qGg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@emotion/use-insertion-effect-with-fallbacks": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.2.0.tgz", + "integrity": "sha512-yJMtVdH59sxi/aVJBpk9FQq+OR8ll5GT8oWd57UpeaKEVGab41JWaCFA7FRLoMLloOZF/c/wsPoe+bfGmRKgDg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "react": ">=16.8.0" + } + }, + "node_modules/@emotion/utils": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-1.4.2.tgz", + "integrity": "sha512-3vLclRofFziIa3J2wDh9jjbkUz9qk5Vi3IZ/FSTKViB0k+ef0fPV7dYrUIugbgupYDx7v9ud/SjrtEP8Y4xLoA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@emotion/weak-memoize": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.4.0.tgz", + "integrity": "sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==", + "dev": true, + "license": "MIT" + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.28.2", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", @@ -537,86 +882,1025 @@ "node": ">=18" } }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz", - "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==", + "node_modules/@exodus/bytes": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.16.0.tgz", + "integrity": "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==", "dev": true, "license": "MIT", "engines": { - "node": ">=6.0.0" + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } } }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", - "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "node_modules/@faceless-ui/modal": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@faceless-ui/modal/-/modal-3.0.0.tgz", + "integrity": "sha512-o3oEFsot99EQ8RJc1kL3s/nNMHX+y+WMXVzSSmca9L0l2MR6ez2QM1z1yIelJX93jqkLXQ9tW+R9tmsYa+O4Qg==", "dev": true, - "license": "MIT" + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/jacobsfletch" + } + ], + "license": "MIT", + "dependencies": { + "body-scroll-lock": "4.0.0-beta.0", + "focus-trap": "7.5.4", + "react-transition-group": "4.4.5" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "node_modules/@faceless-ui/scroll-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@faceless-ui/scroll-info/-/scroll-info-2.0.0.tgz", + "integrity": "sha512-BkyJ9OQ4bzpKjE3UhI8BhcG36ZgfB4run8TmlaR4oMFUbl59dfyarNfjveyimrxIso9RhFEja/AJ5nQmbcR9hw==", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/jacobsfletch" + } + ], "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, - "node_modules/@jsdevtools/ono": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", - "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", + "node_modules/@faceless-ui/window-info": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@faceless-ui/window-info/-/window-info-3.0.1.tgz", + "integrity": "sha512-uPjdJYE/j7hqVNelE9CRUNOeXuXDdPxR4DMe+oz3xwyZi2Y4CxsfpfdPTqqwmNAZa1P33O+ZiCyIkBEeNed0kw==", "dev": true, - "license": "MIT" + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/jacobsfletch" + } + ], + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } }, - "node_modules/@mongodb-js/saslprep": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.6.3.tgz", - "integrity": "sha512-aHGFvT95c82CoQ7hb6qXpz8Hcc5PJb3ZtQ+P01QDBbyQday0mjcrJPeNJOHCgWe0pGX0zKmKP+1mWi/I/BCX9Q==", + "node_modules/@floating-ui/core": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz", + "integrity": "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ==", "dev": true, "license": "MIT", "dependencies": { - "sparse-bitfield": "^3.0.3" + "@floating-ui/utils": "^0.2.12" } }, - "node_modules/@napi-rs/wasm-runtime": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.6.tgz", - "integrity": "sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==", + "node_modules/@floating-ui/dom": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.8.0.tgz", + "integrity": "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==", "dev": true, "license": "MIT", - "optional": true, - "peer": true, "dependencies": { - "@tybys/wasm-util": "^0.10.3" - }, - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + "@floating-ui/core": "^1.8.0", + "@floating-ui/utils": "^0.2.12" + } + }, + "node_modules/@floating-ui/react": { + "version": "0.27.20", + "resolved": "https://registry.npmjs.org/@floating-ui/react/-/react-0.27.20.tgz", + "integrity": "sha512-CMqMy7OaXl9W0eq1Uy7L7i2Y/anPvHmFmESd2CEw0t5YvZhcVCeo4MBevAmswRllX7Y2dEidA4ozGPunLSTQpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.1.9", + "@floating-ui/utils": "^0.2.12", + "tabbable": "^6.0.0" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Brooooooklyn" + "peerDependencies": { + "react": ">=17.0.0", + "react-dom": ">=17.0.0" + } + }, + "node_modules/@floating-ui/react-dom": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.9.tgz", + "integrity": "sha512-JDjEFGCpImxDCA7JJKviA0M9+RtmJdj0m/NVU5IMgBK+AmZouAQQ7/+2GLH0GXXY0YMw9oXPB8hKdbPYg5QLYg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@floating-ui/dom": "^1.8.0" }, "peerDependencies": { - "@emnapi/core": "^1.7.1 || 2.0.0-beta.2", - "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" + "react": ">=16.8.0", + "react-dom": ">=16.8.0" } }, - "node_modules/@next/env": { - "version": "15.5.29", - "resolved": "https://registry.npmjs.org/@next/env/-/env-15.5.29.tgz", - "integrity": "sha512-9SrTiTsgORa+KfhlXXAGC1eSs847E+d2MQTPUX+n7R5XA8g/B6ZitfL6GoYHNMLwG3Hzs1wjDH0/ME5WrGMqBQ==", + "node_modules/@floating-ui/utils": { + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.12.tgz", + "integrity": "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==", "dev": true, "license": "MIT" }, - "node_modules/@noble/ciphers": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", - "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==", - "license": "MIT", + "node_modules/@img/colour": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz", + "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz", + "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz", + "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz", + "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz", + "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz", + "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz", + "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz", + "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz", + "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz", + "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz", + "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz", + "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz", + "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz", + "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz", + "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz", + "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz", + "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz", + "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz", + "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz", + "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz", + "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz", + "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==", + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "peer": true, + "dependencies": { + "@emnapi/runtime": "^1.11.3" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-wasm32/node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@img/sharp-webcontainers-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz", + "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "peer": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz", + "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz", + "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": "^20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz", + "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz", + "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@jsdevtools/ono": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz", + "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@monaco-editor/loader": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@monaco-editor/loader/-/loader-1.7.0.tgz", + "integrity": "sha512-gIwR1HrJrrx+vfyOhYmCZ0/JcWqG5kbfG7+d3f/C1LXk2EvzAbHSg3MQ5lO2sMlo9izoAZ04shohfKLVT6crVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "state-local": "^1.0.6" + } + }, + "node_modules/@monaco-editor/react": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@monaco-editor/react/-/react-4.7.0.tgz", + "integrity": "sha512-cyzXQCtO47ydzxpQtCGSQGOC8Gk3ZUeBXFAxD+CWXYFo5OqZyZUonFl0DwUlTyAfRHntBfw2p3w4s9R6oe1eCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@monaco-editor/loader": "^1.5.0" + }, + "peerDependencies": { + "monaco-editor": ">= 0.25.0 < 1", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@mongodb-js/saslprep": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.6.3.tgz", + "integrity": "sha512-aHGFvT95c82CoQ7hb6qXpz8Hcc5PJb3ZtQ+P01QDBbyQday0mjcrJPeNJOHCgWe0pGX0zKmKP+1mWi/I/BCX9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "sparse-bitfield": "^3.0.3" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.6.tgz", + "integrity": "sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || 2.0.0-beta.2", + "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" + } + }, + "node_modules/@next/env": { + "version": "15.5.29", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.5.29.tgz", + "integrity": "sha512-9SrTiTsgORa+KfhlXXAGC1eSs847E+d2MQTPUX+n7R5XA8g/B6ZitfL6GoYHNMLwG3Hzs1wjDH0/ME5WrGMqBQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "16.4.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.4.6.tgz", + "integrity": "sha512-kJ4VVZkley17xKaJx72QN2IBqjrj7zenCQZaUF0l9ShS/1Mt2kW4+Z5KGG6vgr3L/J562xTOizVyM1iA/u5nlg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "16.4.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.4.6.tgz", + "integrity": "sha512-eIPGZIqC+8JKaeZmvnCANJQF4xWkkHqSnAAajtFxgwDMAOnCgxNvP52SeWZ41PyVwoe+Le/NQuZSaQ8j7YshSA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "16.4.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.4.6.tgz", + "integrity": "sha512-9nI6O8vvczH2D9ZNdMGqb/3NuT15T9ksOZnAmx9/gjF2cOi74+xxyf1Hk96uIMfm14c9y6wHeBq6SH8g6udvcA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "16.4.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.4.6.tgz", + "integrity": "sha512-7/qPhTxDp2ScluOJOhLuhWmlA17o1yZ0SIgpISBCpBxXgtnK4+KGywBpFkfLPiU1rnSM1faFGzYkH6i7JdTrqA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "16.4.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.4.6.tgz", + "integrity": "sha512-oOpbNa8XOW1qCGd9VvzC4fbkkRxEls7/WI6tz+YHC0xRA7KpV1U7DrAnCPjzVyOk/karzWEepCOcTIDmwK8FwQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "16.4.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.4.6.tgz", + "integrity": "sha512-aM8CZ+OR2EwXaAYw7KGkW2GDmNDsLBIRe1MMRZCJPTdw/xhTD0IMUVO4sf3KqrzuRouGzwwLZn34+gFeVXiUQA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "16.4.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.4.6.tgz", + "integrity": "sha512-U0p7/tEtqvHX2crhd841CDwKtp5CFkKXVjOhmfccR3Pvp64sj8KBwRqsvltqLOwVBbj0NtkxwXSDpEHYGbxeXQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "16.4.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.4.6.tgz", + "integrity": "sha512-3ZG15/5WIdlTQsIEvc9sPTTSL5XFrlLklIKmfF4fwsDnoAhu6NcBDXsk3mbGxNyo6aVLEGex+fHCv2MahY7a9g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@noble/ciphers": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", + "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==", + "license": "MIT", "engines": { "node": "^14.21.3 || >=16" }, @@ -673,6 +1957,48 @@ "date-fns": "4.1.0" } }, + "node_modules/@payloadcms/ui": { + "version": "3.93.0", + "resolved": "https://registry.npmjs.org/@payloadcms/ui/-/ui-3.93.0.tgz", + "integrity": "sha512-wmGrvxXv38yryNp07Fh4rUqWNgV5DBZpvC/PBju1T2EVOnNpzfbpT2beADw2m+k4HFt9RAio79wULW+lyKUqxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@date-fns/tz": "1.2.0", + "@dnd-kit/core": "6.3.1", + "@dnd-kit/sortable": "10.0.0", + "@dnd-kit/utilities": "3.2.2", + "@faceless-ui/modal": "3.0.0", + "@faceless-ui/scroll-info": "2.0.0", + "@faceless-ui/window-info": "3.0.1", + "@monaco-editor/react": "4.7.0", + "@payloadcms/translations": "3.93.0", + "@swc/helpers": ">=0.5.17", + "bson-objectid": "2.0.4", + "date-fns": "4.1.0", + "dequal": "2.0.3", + "md5": "2.3.0", + "object-to-formdata": "4.5.1", + "qs-esm": "8.0.1", + "react-datepicker": "7.6.0", + "react-image-crop": "10.1.8", + "react-select": "5.9.0", + "scheduler": "0.25.0", + "sonner": "^1.7.2", + "ts-essentials": "10.0.3", + "use-context-selector": "2.0.0", + "uuid": "13.0.2" + }, + "engines": { + "node": "^22.23.4 || >=24.22.1" + }, + "peerDependencies": { + "next": ">=15.2.9 <15.3.0 || >=15.3.9 <15.4.0 || >=15.4.11 <15.5.0 || >=16.3.3 <17.0.0", + "payload": "3.93.0", + "react": "^19.0.1 || ^19.1.2 || ^19.2.1", + "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1" + } + }, "node_modules/@pinojs/redact": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz", @@ -1002,6 +2328,55 @@ "integrity": "sha512-6tcXo4kA8HgGO7AVmawB57RYi/piBPYVHVcO6dXjX+SZw8GoHmi262sp4v2Ha2kNP9Cx84qei27yT+fjS1lxgg==", "license": "Apache-2.0" }, + "node_modules/@testing-library/dom": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.2.tgz", + "integrity": "sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^5.0.1", + "aria-query": "5.3.0", + "dom-accessibility-api": "^0.5.9", + "lz-string": "^1.5.0", + "picocolors": "1.1.1", + "pretty-format": "^27.0.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@testing-library/react": { + "version": "16.3.3", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.3.tgz", + "integrity": "sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.5" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@testing-library/dom": "^10.0.0", + "@types/react": "^18.0.0 || ^19.0.0", + "@types/react-dom": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@tokenizer/inflate": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.4.1.tgz", @@ -1039,6 +2414,14 @@ "tslib": "^2.4.0" } }, + "node_modules/@types/aria-query": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/@types/busboy": { "version": "1.5.4", "resolved": "https://registry.npmjs.org/@types/busboy/-/busboy-1.5.4.tgz", @@ -1098,6 +2481,13 @@ "undici-types": ">=7.24.0 <7.24.7" } }, + "node_modules/@types/parse-json": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/pdfkit": { "version": "0.17.7", "resolved": "https://registry.npmjs.org/@types/pdfkit/-/pdfkit-0.17.7.tgz", @@ -1108,6 +2498,35 @@ "@types/node": "*" } }, + "node_modules/@types/react": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-transition-group": { + "version": "4.4.12", + "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.12.tgz", + "integrity": "sha512-8TV6R3h2j7a91c+1DXdJi3Syo69zzIZbz7Lg5tORM5LEJG7X/E6a1V3drRyBRZq7/utz7A+c4OgYLiLcYGHG6w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "*" + } + }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true + }, "node_modules/@types/webidl-conversions": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", @@ -1190,6 +2609,31 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -1197,6 +2641,17 @@ "dev": true, "license": "Python-2.0" }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, "node_modules/assertion-error": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", @@ -1242,6 +2697,22 @@ } } }, + "node_modules/babel-plugin-macros": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", + "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.5", + "cosmiconfig": "^7.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">=10", + "npm": ">=6" + } + }, "node_modules/bare-buffer": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bare-buffer/-/bare-buffer-3.7.2.tgz", @@ -1358,6 +2829,54 @@ ], "license": "MIT" }, + "node_modules/baseline-browser-mapping": { + "version": "2.11.37", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.37.tgz", + "integrity": "sha512-QYph+vfurmaxhNwi9FprfmtkT5cx2Keg8FzZ0vnjO8ukscIybVyZGMFwdllKGlTI6qyU8ck43OM9UXh+IFJihQ==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/bcp-47": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bcp-47/-/bcp-47-2.1.2.tgz", + "integrity": "sha512-wsv86UuNFuPnVieKLyECTT+CP1WSAHeoIg5P3xu2kA9Z+7fVPoKt7dxzSeEhtJel0AI+NW3fIW3KtTKQKUCngg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/bcp-47-match": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/bcp-47-match/-/bcp-47-match-2.0.3.tgz", + "integrity": "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/body-scroll-lock": { + "version": "4.0.0-beta.0", + "resolved": "https://registry.npmjs.org/body-scroll-lock/-/body-scroll-lock-4.0.0-beta.0.tgz", + "integrity": "sha512-a7tP5+0Mw3YlUJcGAKUqIBkYYGlYxk2fnCasq/FUph1hadxlTRjF+gAcZksxANnaMnALjxEddmSi/H3OR8ugcQ==", + "dev": true, + "license": "MIT" + }, "node_modules/brotli": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.3.tgz", @@ -1405,6 +2924,16 @@ "bwip-js": "bin/bwip-js.js" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -1418,6 +2947,28 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/caniuse-lite": { + "version": "1.0.30001826", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001826.tgz", + "integrity": "sha512-wTB+9tIbLro/BCXwLuNV1meHE4L9dS6dArMDwgYfNBPMYScqClHyGunhkCSDtHhe/69Xl0sHlKgBVZ+fNsYtWA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0", + "peer": true + }, "node_modules/chai": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", @@ -1428,6 +2979,16 @@ "node": ">=18" } }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, "node_modules/ci-info": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.5.0.tgz", @@ -1444,6 +3005,14 @@ "node": ">=8" } }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "dev": true, + "license": "MIT", + "peer": true + }, "node_modules/clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", @@ -1453,6 +3022,16 @@ "node": ">=0.8" } }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/colorette": { "version": "2.0.20", "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", @@ -1477,6 +3056,40 @@ "simple-wcswidth": "^1.0.1" } }, + "node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true, + "license": "MIT" + }, + "node_modules/cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cosmiconfig/node_modules/yaml": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz", + "integrity": "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 6" + } + }, "node_modules/croner": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/croner/-/croner-10.0.1.tgz", @@ -1497,6 +3110,75 @@ "node": ">=18.0" } }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/data-urls": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-8.0.0.tgz", + "integrity": "sha512-JQUCCK+/CAGbGGx618PlFZMXH81Jtj7t73CHv9dd/zVWvxgGT2zLFRjnKb+Ng46GIwcy+f7f88qd4duqllK+WQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^17.1.2" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/data-urls/node_modules/tr46": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-7.0.0.tgz", + "integrity": "sha512-BcDSDW+SIGWVOns1Zm6Yg91q9AEj7eaID0QDY9oIqJD1A8dscNwMcl9Sms2DeuWCNov1X0/oXanHGYQBSLwZsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/data-urls/node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/data-urls/node_modules/whatwg-url": { + "version": "17.3.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.3.0.tgz", + "integrity": "sha512-KwOAJrpf+GTgBvcBQJcP38sMF0DsQKdwtG+TxM2pW44P6E5k0hDbWrDmyuJDIF0Uef0aQq0ZoJs+5oI+k8ddhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.16.0", + "tr46": "^7.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, "node_modules/dataloader": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/dataloader/-/dataloader-2.2.3.tgz", @@ -1543,6 +3225,13 @@ } } }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, "node_modules/deepmerge": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", @@ -1553,6 +3242,16 @@ "node": ">=0.10.0" } }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/detect-libc": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", @@ -1570,6 +3269,36 @@ "integrity": "sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q==", "license": "MIT" }, + "node_modules/dom-accessibility-api": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", + "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/dom-helpers": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz", + "integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.8.7", + "csstype": "^3.0.2" + } + }, + "node_modules/dompurify": { + "version": "3.4.15", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.15.tgz", + "integrity": "sha512-EUBjM+B+lkDE41iE82DDSCfkoPGfXx8IxFxPMjNzm/Uk4xDet77rTN9wqlxlVg71kK7XGuUMv6wUxJUwwv+Xyw==", + "dev": true, + "license": "(MPL-2.0 OR Apache-2.0)", + "peer": true, + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } + }, "node_modules/end-of-stream": { "version": "1.4.5", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", @@ -1580,6 +3309,39 @@ "once": "^1.4.0" } }, + "node_modules/entities": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-9.0.0.tgz", + "integrity": "sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-module-lexer": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", @@ -1629,6 +3391,19 @@ "@esbuild/win32-x64": "0.28.2" } }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/estree-walker": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", @@ -1764,6 +3539,13 @@ "url": "https://github.com/avajs/find-cache-dir?sponsor=1" } }, + "node_modules/find-root": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", + "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", + "dev": true, + "license": "MIT" + }, "node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", @@ -1778,6 +3560,16 @@ "node": ">=8" } }, + "node_modules/focus-trap": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.5.4.tgz", + "integrity": "sha512-N7kHdlgsO/v+iD/dMoJKtsSqs5Dz/dXZVebRgJw23LDk+jMi/974zyiOYDziY2JPp8xivq9BmUGwIJMiuSBi7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "tabbable": "^6.2.0" + } + }, "node_modules/follow-redirects": { "version": "1.16.3", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.3.tgz", @@ -1831,6 +3623,16 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-tsconfig": { "version": "4.8.1", "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", @@ -1854,6 +3656,19 @@ "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/help-me": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz", @@ -1861,6 +3676,36 @@ "dev": true, "license": "MIT" }, + "node_modules/hoist-non-react-statics": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", + "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "react-is": "^16.7.0" + } + }, + "node_modules/hoist-non-react-statics/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/html-encoding-sniffer": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-7.0.0.tgz", + "integrity": "sha512-UikN5yr7xsCDAq87Or5or0PAlD3HJJOKVzM05az588WnpDJ4Ux7a2A53Qi6gofGg2/EtvF/H4hCi/TXfCW4Y6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.15.1" + }, + "engines": { + "node": "^22.13.0 || >=24.0.0" + } + }, "node_modules/http-status": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/http-status/-/http-status-2.1.0.tgz", @@ -1890,46 +3735,130 @@ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/image-dimensions": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/image-dimensions/-/image-dimensions-2.5.1.tgz", + "integrity": "sha512-It7CkTNp7IYA8jhvGgz8K18OAbHF3/Juk8RNEyTyMFfolJOIU1Y2wGDnzDQPbGCjyxVF/++pwIZE0BKJUEOb1g==", + "dev": true, + "license": "MIT", + "bin": { + "image-dimensions": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ipaddr.js": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz", + "integrity": "sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true, + "license": "MIT" }, - "node_modules/image-dimensions": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/image-dimensions/-/image-dimensions-2.5.1.tgz", - "integrity": "sha512-It7CkTNp7IYA8jhvGgz8K18OAbHF3/Juk8RNEyTyMFfolJOIU1Y2wGDnzDQPbGCjyxVF/++pwIZE0BKJUEOb1g==", + "node_modules/is-core-module": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.18.0.tgz", + "integrity": "sha512-qyax9fgaKOEC4qK8WZn7Q4IcoZC9RC1O1fFxRcRTq/oMMkWT/uXpqpXa12kzWR409zAt1drYN9N9BO26UmBCmw==", "dev": true, "license": "MIT", - "bin": { - "image-dimensions": "cli.js" + "dependencies": { + "hasown": "^2.0.4" }, "engines": { - "node": ">=18" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/ipaddr.js": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz", - "integrity": "sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==", + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", "dev": true, "license": "MIT", - "engines": { - "node": ">= 10" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, "node_modules/is-extglob": { @@ -1955,6 +3884,13 @@ "node": ">=0.10.0" } }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, "node_modules/jose": { "version": "5.10.0", "resolved": "https://registry.npmjs.org/jose/-/jose-5.10.0.tgz", @@ -1975,6 +3911,13 @@ "node": ">=10" } }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, "node_modules/js-yaml": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", @@ -1998,6 +3941,112 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsdom": { + "version": "31.0.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-31.0.1.tgz", + "integrity": "sha512-CbhJL8ZQg3eKswxSZth4QO9tW0jPIhmR0vtSXQSbKSfWbwIT6hoRc17wdHIVTQ43KI0mdV5iTJr3281IDgVZ5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.16.0", + "bcp-47": "^2.1.2", + "bcp-47-match": "^2.0.3", + "data-urls": "^8.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^7.0.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.3", + "parse5": "^8.1.0", + "parse5-parser-stream": "^8.1.0", + "saxes": "^6.0.0", + "tough-cookie": "^6.0.2", + "undici": "^8.12.3", + "w3c-xmlserializer": "^6.0.0", + "webidl-conversions": "^8.0.1", + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^17.3.0", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + }, + "peerDependencies": { + "@napi-rs/canvas": "^1.0.13" + }, + "peerDependenciesMeta": { + "@napi-rs/canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/tr46": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-7.0.0.tgz", + "integrity": "sha512-BcDSDW+SIGWVOns1Zm6Yg91q9AEj7eaID0QDY9oIqJD1A8dscNwMcl9Sms2DeuWCNov1X0/oXanHGYQBSLwZsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/jsdom/node_modules/undici": { + "version": "8.12.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-8.12.4.tgz", + "integrity": "sha512-8Mx+uNKKER2bA4AdtedkqRbwUCIJFr2nJckXRe5yrDqzePqwLP7VNcctN8/XdmDSbF7mS+jJKIszlL+vbam1VA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22.19.0" + } + }, + "node_modules/jsdom/node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/jsdom/node_modules/whatwg-url": { + "version": "17.3.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.3.0.tgz", + "integrity": "sha512-KwOAJrpf+GTgBvcBQJcP38sMF0DsQKdwtG+TxM2pW44P6E5k0hDbWrDmyuJDIF0Uef0aQq0ZoJs+5oI+k8ddhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.16.0", + "tr46": "^7.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, "node_modules/json-schema-to-typescript": { "version": "15.0.3", "resolved": "https://registry.npmjs.org/json-schema-to-typescript/-/json-schema-to-typescript-15.0.3.tgz", @@ -2353,6 +4402,13 @@ "node": ">= 0.4" } }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -2373,6 +4429,40 @@ "dev": true, "license": "MIT" }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/lz-string": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "lz-string": "bin/bin.js" + } + }, "node_modules/magic-string": { "version": "1.4.5", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", @@ -2409,6 +4499,39 @@ "semver": "bin/semver.js" } }, + "node_modules/marked": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-14.0.0.tgz", + "integrity": "sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, + "node_modules/memoize-one": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", + "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==", + "dev": true, + "license": "MIT" + }, "node_modules/memory-pager": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", @@ -2426,6 +4549,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/monaco-editor": { + "version": "0.57.0", + "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.57.0.tgz", + "integrity": "sha512-5BkI9KGoqrNvBGUe15/QlZq3OooZ8WLg1AxTpaqHRCP3HNpzPPZKE2EDz8M7c+VRmCeUw1Brp4cx/PWm3kI/5A==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "dompurify": "3.4.15", + "marked": "14.0.0" + } + }, "node_modules/mongodb": { "version": "6.20.0", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.20.0.tgz", @@ -2729,6 +4864,127 @@ "node": ">=12.22.0" } }, + "node_modules/next": { + "version": "16.4.6", + "resolved": "https://registry.npmjs.org/next/-/next-16.4.6.tgz", + "integrity": "sha512-QZJiYhaZLJMo2KpkQGQIwvmd79WVsAWeYIU554a8d7zArS3si/IRy3lBNV/rtYhE70oLwdLYhPAXLPx8HwcwtA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@next/env": "16.4.6", + "@swc/helpers": "0.5.23", + "baseline-browser-mapping": "^2.9.19", + "caniuse-lite": "^1.0.30001579", + "postcss": "8.5.23", + "styled-jsx": "5.1.6" + }, + "bin": { + "next": "dist/bin/next" + }, + "engines": { + "node": ">=20.9.0" + }, + "optionalDependencies": { + "@next/swc-darwin-arm64": "16.4.6", + "@next/swc-darwin-x64": "16.4.6", + "@next/swc-linux-arm64-gnu": "16.4.6", + "@next/swc-linux-arm64-musl": "16.4.6", + "@next/swc-linux-x64-gnu": "16.4.6", + "@next/swc-linux-x64-musl": "16.4.6", + "@next/swc-win32-arm64-msvc": "16.4.6", + "@next/swc-win32-x64-msvc": "16.4.6", + "sharp": "^0.35.5" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.1.0", + "@playwright/test": "^1.51.1", + "babel-plugin-react-compiler": "*", + "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "sass": "^1.3.0" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "@playwright/test": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + }, + "sass": { + "optional": true + } + } + }, + "node_modules/next/node_modules/@next/env": { + "version": "16.4.6", + "resolved": "https://registry.npmjs.org/@next/env/-/env-16.4.6.tgz", + "integrity": "sha512-SunBjJ6t+oBtecS3dTjdVuMhUogP5wD/vrGL5EVuQYM1iS4O5ilL51HkiJ3sPjMzRHiCChvr4dbaSJbR7F3lxA==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/next/node_modules/@swc/helpers": { + "version": "0.5.23", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.23.tgz", + "integrity": "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/next/node_modules/postcss": { + "version": "8.5.23", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.23.tgz", + "integrity": "sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "nanoid": "^3.3.16", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-to-formdata": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/object-to-formdata/-/object-to-formdata-4.5.1.tgz", + "integrity": "sha512-QiM9D0NiU5jV6J6tjE1g7b4Z2tcUnKs1OPUi4iMb2zH+7jwlcUrASghgkFk9GtzqNNq8rTQJtT8AzjBAvLoNMw==", + "dev": true, + "license": "MIT" + }, "node_modules/obug": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz", @@ -2786,28 +5042,86 @@ "dev": true, "license": "MIT", "dependencies": { - "p-limit": "^2.2.0" + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==", + "license": "MIT" + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse5": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.1.1.tgz", + "integrity": "sha512-EcR/6WDcU7b2N3vQSxKALCk9lXGtUMQxXio008OEMBE0kavu/7JLfBEeFPzi43nMqVDSbEn3QCK+BMCc9zO//w==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^9.0.0" }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "node_modules/parse5-parser-stream": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-8.1.1.tgz", + "integrity": "sha512-hMcVbbUJcQmP8rURWUdYrT1flRiBiBVjq/RYGguJpDUgIXSqdYKlE0CxthmdMWoSlBAuL5bUBa73g0pttSy7Hw==", "dev": true, "license": "MIT", - "engines": { - "node": ">=6" + "dependencies": { + "parse5": "^8.1.1" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "node_modules/pako": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", - "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==", - "license": "MIT" - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -2818,6 +5132,13 @@ "node": ">=8" } }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, "node_modules/path-to-regexp": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", @@ -2825,6 +5146,16 @@ "dev": true, "license": "MIT" }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/payload": { "version": "3.93.0", "resolved": "https://registry.npmjs.org/payload/-/payload-3.93.0.tgz", @@ -2901,8 +5232,7 @@ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "dev": true, - "license": "ISC", - "peer": true + "license": "ISC" }, "node_modules/picomatch": { "version": "4.0.7", @@ -3059,6 +5389,22 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, "node_modules/process-warning": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.1.1.tgz", @@ -3090,6 +5436,25 @@ "node": ">= 6" } }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/prop-types/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true, + "license": "MIT" + }, "node_modules/pump": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", @@ -3141,6 +5506,120 @@ "node": ">= 0.6" } }, + "node_modules/react": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", + "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-datepicker": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-7.6.0.tgz", + "integrity": "sha512-9cQH6Z/qa4LrGhzdc3XoHbhrxNcMi9MKjZmYgF/1MNNaJwvdSjv3Xd+jjvrEEbKEf71ZgCA3n7fQbdwd70qCRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@floating-ui/react": "^0.27.0", + "clsx": "^2.1.1", + "date-fns": "^3.6.0" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc", + "react-dom": "^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc" + } + }, + "node_modules/react-datepicker/node_modules/date-fns": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", + "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, + "node_modules/react-dom": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz", + "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "scheduler": "^0.28.0" + }, + "peerDependencies": { + "react": "^19.3.1" + } + }, + "node_modules/react-dom/node_modules/scheduler": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "dev": true, + "license": "MIT" + }, + "node_modules/react-image-crop": { + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/react-image-crop/-/react-image-crop-10.1.8.tgz", + "integrity": "sha512-4rb8XtXNx7ZaOZarKKnckgz4xLMvds/YrU6mpJfGhGAsy2Mg4mIw1x+DCCGngVGq2soTBVVOxx2s/C6mTX9+pA==", + "dev": true, + "license": "ISC", + "peerDependencies": { + "react": ">=16.13.1" + } + }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/react-select": { + "version": "5.9.0", + "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.9.0.tgz", + "integrity": "sha512-nwRKGanVHGjdccsnzhFte/PULziueZxGD8LL2WojON78Mvnq7LdAMEtu2frrwld1fr3geixg3iiMBIc/LLAZpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.0", + "@emotion/cache": "^11.4.0", + "@emotion/react": "^11.8.1", + "@floating-ui/dom": "^1.0.1", + "@types/react-transition-group": "^4.4.0", + "memoize-one": "^6.0.0", + "prop-types": "^15.6.0", + "react-transition-group": "^4.3.0", + "use-isomorphic-layout-effect": "^1.2.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/react-transition-group": { + "version": "4.4.5", + "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", + "integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/runtime": "^7.5.5", + "dom-helpers": "^5.0.1", + "loose-envify": "^1.4.0", + "prop-types": "^15.6.2" + }, + "peerDependencies": { + "react": ">=16.6.0", + "react-dom": ">=16.6.0" + } + }, "node_modules/real-require": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", @@ -3161,6 +5640,38 @@ "node": ">=0.10.0" } }, + "node_modules/resolve": { + "version": "1.22.14", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.14.tgz", + "integrity": "sha512-1ZjYvR9sbkiwC5+9QHetqW5HmA2pHRMaoupD01t2HlYnV/vydC2zPwLixhsMieSWVZt0JJRg5LVIk0Ow1D/TrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "is-core-module": "^2.18.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/resolve-pkg-maps": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", @@ -3243,6 +5754,26 @@ "node": ">=11.0.0" } }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/scheduler": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz", + "integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==", + "dev": true, + "license": "MIT" + }, "node_modules/secure-json-parse": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-4.1.1.tgz", @@ -3273,6 +5804,58 @@ "node": ">=10" } }, + "node_modules/sharp": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz", + "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "peer": true, + "dependencies": { + "@img/colour": "^1.1.0", + "detect-libc": "^2.1.2", + "semver": "^7.8.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.35.5", + "@img/sharp-darwin-x64": "0.35.5", + "@img/sharp-freebsd-wasm32": "0.35.5", + "@img/sharp-libvips-darwin-arm64": "1.3.4", + "@img/sharp-libvips-darwin-x64": "1.3.4", + "@img/sharp-libvips-linux-arm": "1.3.4", + "@img/sharp-libvips-linux-arm64": "1.3.4", + "@img/sharp-libvips-linux-ppc64": "1.3.4", + "@img/sharp-libvips-linux-riscv64": "1.3.4", + "@img/sharp-libvips-linux-s390x": "1.3.4", + "@img/sharp-libvips-linux-x64": "1.3.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", + "@img/sharp-libvips-linuxmusl-x64": "1.3.4", + "@img/sharp-linux-arm": "0.35.5", + "@img/sharp-linux-arm64": "0.35.5", + "@img/sharp-linux-ppc64": "0.35.5", + "@img/sharp-linux-riscv64": "0.35.5", + "@img/sharp-linux-s390x": "0.35.5", + "@img/sharp-linux-x64": "0.35.5", + "@img/sharp-linuxmusl-arm64": "0.35.5", + "@img/sharp-linuxmusl-x64": "0.35.5", + "@img/sharp-webcontainers-wasm32": "0.35.5", + "@img/sharp-win32-arm64": "0.35.5", + "@img/sharp-win32-ia32": "0.35.5", + "@img/sharp-win32-x64": "0.35.5" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, "node_modules/sift": { "version": "17.1.3", "resolved": "https://registry.npmjs.org/sift/-/sift-17.1.3.tgz", @@ -3304,6 +5887,27 @@ "atomic-sleep": "^1.0.0" } }, + "node_modules/sonner": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/sonner/-/sonner-1.7.4.tgz", + "integrity": "sha512-DIS8z4PfJRbIyfVFDVnK9rO3eYDtse4Omcm6bt0oEr5/jtLgysmjuBl1frJ9E/EQZrFmKx2A8m/s5s9CRXIzhw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc", + "react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc" + } + }, + "node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-js": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", @@ -3335,6 +5939,13 @@ "node": ">= 10.x" } }, + "node_modules/state-local": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/state-local/-/state-local-1.0.7.tgz", + "integrity": "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w==", + "dev": true, + "license": "MIT" + }, "node_modules/std-env": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz", @@ -3393,6 +6004,58 @@ "url": "https://github.com/sponsors/Borewit" } }, + "node_modules/styled-jsx": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz", + "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "client-only": "0.0.1" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/stylis": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.2.0.tgz", + "integrity": "sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==", + "dev": true, + "license": "MIT" + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tabbable": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.5.2.tgz", + "integrity": "sha512-XgdnB1nGU6KU4VgMnZPaZCx7M1hBrLyEiZYau2G2gq9UT0d7d4FUBlNX7vvPlm/B1vk1PjrzJBx9Lbv4fsqS9g==", + "dev": true, + "license": "MIT" + }, "node_modules/tar-stream": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.2.2.tgz", @@ -3479,6 +6142,26 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/tldts": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.5.4.tgz", + "integrity": "sha512-Rn2ABgjHZrA+jzqom5zhxA0hLohzYrIgfCPyhpTUxqsUrcsBYuab49LseR9waB9Jr8/MxdodvMHA91oRiGLO3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^7.5.4" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.5.4.tgz", + "integrity": "sha512-9+4zWtKEDZ3V3FoZ1B97rv+5z5oqp7yeXGVze3CxgQ+CJro9do9DCPD00wxstYZDXDMXsurkBerFfiB6GYtPbA==", + "dev": true, + "license": "MIT" + }, "node_modules/token-types": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.2.0.tgz", @@ -3498,6 +6181,19 @@ "url": "https://github.com/sponsors/Borewit" } }, + "node_modules/tough-cookie": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.1.0.tgz", + "integrity": "sha512-FTxc8u8Kl2tz0Lat1u8ksvcy8bwHRyEMawwTWybo51JqaC6O7SvfuhAKg+Ld6VqyIe2QRJBzY9HA7y2WyFRT2w==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/tr46": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", @@ -3626,6 +6322,32 @@ "tiny-inflate": "^1.0.0" } }, + "node_modules/use-context-selector": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/use-context-selector/-/use-context-selector-2.0.0.tgz", + "integrity": "sha512-owfuSmUNd3eNp3J9CdDl0kMgfidV+MkDvHPpvthN5ThqM+ibMccNE0k+Iq7TWC6JPFvGZqanqiGCuQx6DyV24g==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "react": ">=18.0.0", + "scheduler": ">=0.19.0" + } + }, + "node_modules/use-isomorphic-layout-effect": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.2.1.tgz", + "integrity": "sha512-tpZZ+EX0gaghDAiFR37hj5MgY6ZN55kLiPkJsKxBMZ6GZdOSPJXiOzPM984oPYZ5AnehYx5WQp1+ME8I/P/pRA==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/utf8-byte-length": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz", @@ -3809,6 +6531,19 @@ } } }, + "node_modules/w3c-xmlserializer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-6.0.0.tgz", + "integrity": "sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, "node_modules/webidl-conversions": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", @@ -3819,6 +6554,16 @@ "node": ">=12" } }, + "node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, "node_modules/whatwg-url": { "version": "14.2.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", @@ -3875,6 +6620,23 @@ } } }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, "node_modules/yauzl": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-3.4.0.tgz", diff --git a/package.json b/package.json index 6e98563..770cb6f 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,10 @@ "./pdf": { "types": "./dist/pdf.d.ts", "import": "./dist/pdf.js" + }, + "./client": { + "types": "./dist/client/index.d.ts", + "import": "./dist/client/index.js" } }, "main": "./dist/index.js", @@ -58,15 +62,23 @@ "prepublishOnly": "npm run typecheck && npm test" }, "peerDependencies": { - "payload": "^3.80.0" + "payload": "^3.80.0", + "react": "^19.0.0", + "@payloadcms/ui": "^3.80.0" }, "devDependencies": { "@payloadcms/db-mongodb": "^3.92.1", + "@payloadcms/ui": "^3.93.0", + "@testing-library/react": "^16.3.3", "@types/node": "^24.19.2", "@types/pdfkit": "^0.17.7", + "@types/react": "^19.3.0", "graphql": "^16.15.0", + "jsdom": "^31.0.1", "mongodb-memory-server": "^11.3.0", "payload": "^3.92.1", + "react": "^19.3.1", + "react-dom": "^19.3.1", "typescript": "^5.9.3", "vitest": "^5.1.0" }, diff --git a/src/client/TemplateEditor.tsx b/src/client/TemplateEditor.tsx new file mode 100644 index 0000000..98bf30b --- /dev/null +++ b/src/client/TemplateEditor.tsx @@ -0,0 +1,211 @@ +'use client' +import { useId, useMemo, useState, type KeyboardEvent, type ReactNode } from 'react' + +import { layout, renderSvg, THERMAL_4X6, type LabelElement, type LabelTemplate, type Warning } from '../core/index.js' +import { LABELS_STYLES } from './styles.js' + +export type TemplateEditorProps = { + elements: LabelElement[] + onChange: (elements: LabelElement[]) => void + /** Label size in millimeters. */ + size: { width: number; height: number } + /** Sample record as JSON text, to fill tokens in the preview. */ + sample?: string +} + +const TYPES: LabelElement['type'][] = ['text', 'barcode', 'qr', 'image', 'line', 'box'] +const SYMBOLOGIES = ['code128', 'code39', 'ean13', 'upca', 'datamatrix'] as const +export const DEFAULT_SAMPLE = '{\n "name": "Example item",\n "code": "ABC-123"\n}' + +const NEW: Record = { + text: { type: 'text', x: 5, y: 5, width: 40, height: 8, fontSize: 12, content: '{{name}}', overflow: 'shrink' }, + barcode: { type: 'barcode', x: 5, y: 20, width: 40, height: 15, symbology: 'code128', value: '{{code}}' }, + qr: { type: 'qr', x: 5, y: 40, width: 20, height: 20, value: '{{code}}' }, + image: { type: 'image', x: 5, y: 5, width: 20, height: 20, source: '' }, + line: { type: 'line', x: 5, y: 30, width: 40, height: 0, thickness: 0.25 }, + box: { type: 'box', x: 5, y: 5, width: 40, height: 20, thickness: 0.25 }, +} + +const name = (el: LabelElement, i: number) => `${i + 1}. ${el.type}${el.type === 'text' ? `: ${el.content.slice(0, 20)}` : ''}` + +/** Layers list, inspector and live preview for one template. The drag-and-drop canvas is a later addition. */ +export function TemplateEditor({ elements, onChange, size, sample = DEFAULT_SAMPLE }: TemplateEditorProps): ReactNode { + const id = useId() + const [selected, setSelected] = useState(0) + const [hidden, setHidden] = useState([]) + const [sampleText, setSampleText] = useState(sample) + const [said, setSaid] = useState('') + const sel = Math.min(selected, elements.length - 1) + const el = elements[sel] + + const parsed = useMemo(() => { + try { + return { data: JSON.parse(sampleText) as unknown, error: '' } + } catch { + return { data: {}, error: 'The sample is not valid JSON, so the preview uses an empty record.' } + } + }, [sampleText]) + + const { svg, warnings } = useMemo(() => { + const shown = elements.map((e, i) => ({ e, i })).filter(({ i }) => !hidden.includes(i)) + const tpl: LabelTemplate = { key: 'preview', size, elements: shown.map((s) => s.e) } + const r = layout(tpl, parsed.data, { ...THERMAL_4X6, width: size.width, height: size.height }) + const mapped: Array = r.warnings.map((w) => ({ ...w, layer: shown[w.element]!.i })) + return { svg: renderSvg(r), warnings: mapped } + }, [elements, hidden, size, parsed.data]) + + const update = (patch: Record) => onChange(elements.map((e, i) => (i === sel ? ({ ...e, ...patch } as LabelElement) : e))) + const num = (key: string, label: string, step = 0.1) => ( + + ) + const txt = (key: string, label: string, area = false) => ( +