1 Commits

Author SHA1 Message Date
39ad851f4c Update actions/checkout action to v6
Some checks failed
Test / E2E (pull_request) Has been cancelled
Test / Basic (pull_request) Has been cancelled
2026-02-05 15:01:41 +00:00
19 changed files with 1672 additions and 4981 deletions

View File

@@ -1,5 +1,5 @@
{
"image": "mcr.microsoft.com/devcontainers/javascript-node:24",
"image": "mcr.microsoft.com/devcontainers/javascript-node:22",
"forwardPorts": [3000],
"portsAttributes": {
"3000": {

View File

@@ -3,6 +3,9 @@ name: RenovateBot
on:
schedule:
- cron: "@daily"
push:
branches:
- master
jobs:
renovate:

View File

@@ -1,9 +1,6 @@
name: Test
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
@@ -12,19 +9,14 @@ jobs:
name: Basic
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
- uses: actions/checkout@v6
- uses: actions/setup-node@v4
with:
node-version: 24
node-version: 22
cache: "npm"
cache-dependency-path: |
package-lock.json
playground/package-lock.json
- name: Write playground .env
run: |
printf '%s' "${{ secrets.PLAYGROUND_ENV_BASE64 }}" | base64 -d > playground/.env
- name: Install root deps
run: npm ci
- name: Build plugin
@@ -37,11 +29,59 @@ jobs:
mkdir -p playground/.yalc/strapi-plugin-checkbox-list
tar -xzf "$TARBALL" -C playground/.yalc/strapi-plugin-checkbox-list --strip-components=1
- name: Install playground deps
working-directory: playground
run: npm install
run: npm ci --prefix playground
- name: Build playground
working-directory: playground
run: npm run build --prefix playground
- name: Integration tests (Jest + Supertest)
run: npm run test:integration --prefix playground
e2e:
name: E2E
runs-on: ubuntu-latest
needs: test
env:
STRAPI_ADMIN_EMAIL: admin@example.com
STRAPI_ADMIN_PASSWORD: Admin12345
STRAPI_ADMIN_FIRSTNAME: Admin
STRAPI_ADMIN_LASTNAME: User
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"
cache-dependency-path: |
package-lock.json
playground/package-lock.json
- name: Install root deps
run: npm ci
- name: Build plugin
run: npm run build
- name: Integration tests
working-directory: playground
run: npm run test:integration
- name: Pack plugin into playground .yalc
run: |
TARBALL=$(npm pack --silent)
mkdir -p playground/.yalc/strapi-plugin-checkbox-list
tar -xzf "$TARBALL" -C playground/.yalc/strapi-plugin-checkbox-list --strip-components=1
- name: Install playground deps
run: npm ci --prefix playground
- name: Create admin user
run: |
cd playground
npx strapi admin:create-user \
--email "$STRAPI_ADMIN_EMAIL" \
--password "$STRAPI_ADMIN_PASSWORD" \
--firstname "$STRAPI_ADMIN_FIRSTNAME" \
--lastname "$STRAPI_ADMIN_LASTNAME"
- name: Start Strapi
run: |
npm run develop --prefix playground -- --host 0.0.0.0 --port 1337 &
echo $! > /tmp/strapi.pid
until curl -sSf http://127.0.0.1:1337/admin >/dev/null; do sleep 2; done
- name: E2E tests (Playwright/Cypress)
run: npm run e2e --prefix playground
- name: Stop Strapi
if: always()
run: |
if [ -f /tmp/strapi.pid ]; then
kill "$(cat /tmp/strapi.pid)" || true
fi

View File

@@ -1,89 +0,0 @@
name: Publish
on:
push:
tags:
- "v*"
permissions:
contents: read
id-token: write
jobs:
test:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
cache: "npm"
cache-dependency-path: |
package-lock.json
playground/package-lock.json
- name: Check tag matches package version
run: |
VERSION=$(node -p "require('./package.json').version")
TAG="${GITHUB_REF_NAME}"
if [ "v${VERSION}" != "${TAG}" ]; then
echo "Tag ${TAG} does not match package.json version v${VERSION}"
exit 1
fi
- name: Write playground .env
run: |
printf '%s' "${{ secrets.PLAYGROUND_ENV_BASE64 }}" | base64 -d > playground/.env
- name: Install root deps
run: npm ci
- name: Build plugin
run: npm run build
- name: Verify plugin
run: npm run verify
- name: Pack plugin into playground .yalc
run: |
TARBALL=$(npm pack --silent)
mkdir -p playground/.yalc/strapi-plugin-checkbox-list
tar -xzf "$TARBALL" -C playground/.yalc/strapi-plugin-checkbox-list --strip-components=1
- name: Install playground deps
working-directory: playground
run: npm install
- name: Build playground
working-directory: playground
run: npm run build
- name: Integration tests
working-directory: playground
run: npm run test:integration
publish:
name: Publish to NPM
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
cache: "npm"
cache-dependency-path: package-lock.json
- name: Upgrade npm for trusted publishing
run: npm install -g npm@^11.5.1
- name: Check tag matches package version
run: |
VERSION=$(node -p "require('./package.json').version")
TAG="${GITHUB_REF_NAME}"
if [ "v${VERSION}" != "${TAG}" ]; then
echo "Tag ${TAG} does not match package.json version v${VERSION}"
exit 1
fi
- name: Install deps
run: npm ci
- name: Build plugin
run: npm run build
- name: Verify plugin
run: npm run verify
- name: Publish
run: npm publish --provenance

View File

@@ -1,39 +0,0 @@
# Dependencies and logs
node_modules/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Caches and temp
.cache/
.tmp/
*.tgz
# VCS / CI / IDE
.git/
.gitea/
.github/
.gitlab/
.vscode/
.idea/
.DS_Store
# Playground / tests / coverage
playground/
tests/
coverage/
**/__tests__/
**/*.spec.*
**/*.test.*
# Source-only folders (built output lives in dist/)
admin/
server/
# Misc project files
renovate.config.cjs
package-lock.json
.env
.env.*

View File

@@ -1,39 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.1] (2026-02-07)
### Changed
- Bumped package version to `1.0.1`
- Updated dependency `yup` from `^0.32.11` to `^1.0.0`
- Updated `@types/node` in playground from `^20` to `^24.0.0`
- Updated Node.js version in CI workflows (`test` and `publish`) from `22` to `24`
- Updated devcontainer image from `javascript-node:22` to `javascript-node:24`
- Removed `push` trigger from Renovate workflow, leaving only scheduled runs
## [1.0.0] (2026-02-06)
### Added
- Custom checkbox list field for Strapi v5 Content Type Builder
- Multi-select interface with intuitive checkbox-based selection
- Flexible configuration for defining custom option lists per field instance
- Native integration with Strapi's Content Type Builder
- Full TypeScript support for type-safe development
- Playground environment for development and testing
- Watch mode for active development with automatic rebuilds
- Plugin linker support for local development workflow
### Documentation
- Comprehensive README with installation and usage instructions
- Development setup guide for contributors
- MIT License
[1.0.0]: https://code.popov.link/valentineus/strapi-plugin-checkbox-list/releases/tag/v1.0.0
[1.0.1]: https://code.popov.link/valentineus/strapi-plugin-checkbox-list/releases/tag/v1.0.1

View File

@@ -1,7 +0,0 @@
Copyright (c) 2026 Valentin Popov <valentin@popov.link>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,79 +1 @@
# Strapi Checkbox List Plugin
A custom field plugin for Strapi v5 that extends the Content Type Builder with a flexible checkbox list component. Enable content editors to select multiple values from predefined options with an intuitive interface that seamlessly integrates into the Strapi admin panel.
## Features
- **Multi-select interface**: Intuitive checkbox-based selection for content editors
- **Flexible configuration**: Define custom option lists for each field instance
- **Native integration**: Works seamlessly within Strapi's Content Type Builder
- **Type-safe**: Full TypeScript support for enhanced development experience
## Requirements
- Node.js and npm compatible with Strapi v5
## Installation
Install the package in your Strapi project:
```bash
npm install strapi-plugin-checkbox-list
```
Restart your Strapi application, then navigate to the Content Type Builder to add the **Checkbox list** custom field to your content types.
## Usage
After installation, the Checkbox list field type will be available in the Content Type Builder:
1. Open Content Type Builder
2. Select a content type or create a new one
3. Click "Add another field"
4. Choose "Checkbox list" from the custom fields
5. Configure your checkbox options
6. Save and use in your content entries
## Contributing & Support
This project is actively maintained and welcomes contributions. Issues and pull requests can be submitted through either repository:
- **Primary development**: [valentineus/strapi-plugin-checkbox-list](https://code.popov.link/valentineus/strapi-plugin-checkbox-list/issues)
- **GitHub mirror**: [valentineus/strapi-plugin-checkbox-list](https://github.com/valentineus/strapi-plugin-checkbox-list/issues)
Development primarily takes place on the self-hosted Git instance, with GitHub serving as a mirror for broader accessibility.
**Maintainer**: [Valentin Popov](mailto:valentin@popov.link)
## Development
Build the plugin:
```bash
npm install
npm run build
```
For active development with automatic rebuilds:
```bash
npm run watch
```
To run the test Strapi app from `playground/`:
```bash
cd playground
npm install
npm run develop
```
If you need the plugin linked into the playground app, use the Strapi plugin linker and point it at `playground/`:
```bash
npm run watch:link
```
## License
This project is licensed under the [MIT License](LICENSE.txt).
# strapi-plugin-checkbox-list

385
package-lock.json generated
View File

@@ -1,19 +1,19 @@
{
"name": "strapi-plugin-checkbox-list",
"version": "1.0.1",
"version": "0.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "strapi-plugin-checkbox-list",
"version": "1.0.1",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"@sindresorhus/slugify": "^3.0.0",
"@strapi/design-system": "^2.0.0-rc.30",
"@strapi/icons": "^2.0.0-rc.30",
"react-intl": "^7.1.14",
"yup": "^1.0.0"
"yup": "^0.32.11"
},
"devDependencies": {
"@strapi/sdk-plugin": "^5.4.0",
@@ -1081,19 +1081,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/@emotion/babel-plugin/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/@emotion/babel-plugin/node_modules/source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
@@ -4571,6 +4558,18 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@sindresorhus/slugify/node_modules/escape-string-regexp": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",
"integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@sindresorhus/transliterate": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/@sindresorhus/transliterate/-/transliterate-2.3.1.tgz",
@@ -5399,19 +5398,6 @@
"@types/react": "^18.0.0"
}
},
"node_modules/@strapi/content-manager/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/@strapi/content-manager/node_modules/intl-messageformat": {
"version": "10.5.11",
"resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.5.11.tgz",
@@ -5989,19 +5975,6 @@
"@types/react": "^18.0.0"
}
},
"node_modules/@strapi/content-type-builder/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/@strapi/content-type-builder/node_modules/intl-messageformat": {
"version": "10.5.11",
"resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.5.11.tgz",
@@ -6760,19 +6733,6 @@
"node": ">=8"
}
},
"node_modules/@strapi/generators/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/@strapi/generators/node_modules/lodash": {
"version": "4.17.23",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz",
@@ -8175,6 +8135,18 @@
"csstype": "^3.2.2"
}
},
"node_modules/@strapi/ui-primitives/node_modules/aria-hidden": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.4.tgz",
"integrity": "sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==",
"license": "MIT",
"dependencies": {
"tslib": "^2.0.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@strapi/ui-primitives/node_modules/react-remove-scroll": {
"version": "2.5.10",
"resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.5.10.tgz",
@@ -8464,19 +8436,6 @@
"@types/react": "^18.0.0"
}
},
"node_modules/@strapi/upload/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/@strapi/upload/node_modules/execa": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
@@ -8744,19 +8703,6 @@
"node": ">=8"
}
},
"node_modules/@strapi/utils/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/@strapi/utils/node_modules/execa": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
@@ -9600,7 +9546,6 @@
"version": "4.17.23",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.23.tgz",
"integrity": "sha512-RDvF6wTulMPjrNdCoYRC8gNR880JNGT8uB+REUpC2Ns4pRqQJhGz90wh7rgdXDPpCczF3VGktDuFGVnz8zP7HA==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/mdast": {
@@ -9628,9 +9573,9 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "25.2.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.1.tgz",
"integrity": "sha512-CPrnr8voK8vC6eEtyRzvMpgp3VyVRhgclonE7qYi6P9sXwYb59ucfrnmFBTaP0yUi8Gk4yZg/LlTJULGxvTNsg==",
"version": "25.2.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.0.tgz",
"integrity": "sha512-DZ8VwRFUNzuqJ5khrvwMXHmvPe+zGayJhr2CDNiKB1WBE1ST8Djl00D0IC4vvNmHMdj6DlbYRIaFE7WHjlDl5w==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -9740,13 +9685,12 @@
}
},
"node_modules/@types/send": {
"version": "0.17.6",
"resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.6.tgz",
"integrity": "sha512-Uqt8rPBE8SY0RK8JB1EzVOIZ32uqy8HwdxCnoCOsYrvnswqmFZ/k+9Ikidlk/ImhsdvBsloHbAlewb2IEBV/Og==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@types/send/-/send-1.2.1.tgz",
"integrity": "sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/mime": "^1",
"@types/node": "*"
}
},
@@ -9762,6 +9706,17 @@
"@types/send": "<1"
}
},
"node_modules/@types/serve-static/node_modules/@types/send": {
"version": "0.17.6",
"resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.6.tgz",
"integrity": "sha512-Uqt8rPBE8SY0RK8JB1EzVOIZ32uqy8HwdxCnoCOsYrvnswqmFZ/k+9Ikidlk/ImhsdvBsloHbAlewb2IEBV/Og==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/mime": "^1",
"@types/node": "*"
}
},
"node_modules/@types/stylis": {
"version": "4.2.7",
"resolved": "https://registry.npmjs.org/@types/stylis/-/stylis-4.2.7.tgz",
@@ -10417,9 +10372,9 @@
"license": "Python-2.0"
},
"node_modules/aria-hidden": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.4.tgz",
"integrity": "sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==",
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.6.tgz",
"integrity": "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA==",
"license": "MIT",
"dependencies": {
"tslib": "^2.0.0"
@@ -10889,6 +10844,28 @@
"nodemailer-shared": "1.1.0"
}
},
"node_modules/buildmail/node_modules/iconv-lite": {
"version": "0.4.13",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.13.tgz",
"integrity": "sha512-QwVuTNQv7tXC5mMWFX5N5wGjmybjNBBD8P3BReTkPmipoxTUFgWM2gXNvldHQr6T14DH0Dh6qBVg98iJt7u4mQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/buildmail/node_modules/libmime": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/libmime/-/libmime-2.1.0.tgz",
"integrity": "sha512-4be2R6/jOasyPTw0BkpIZBVk2cElqjdIdS0PRPhbOCV4wWuL/ZcYYpN1BCTVB+6eIQ0uuAwp5hQTHFrM5Joa8w==",
"dev": true,
"license": "MIT",
"dependencies": {
"iconv-lite": "0.4.13",
"libbase64": "0.1.0",
"libqp": "1.1.0"
}
},
"node_modules/byte-size": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/byte-size/-/byte-size-8.1.1.tgz",
@@ -13270,12 +13247,13 @@
"license": "MIT"
},
"node_modules/escape-string-regexp": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",
"integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",
"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": ">=12"
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@@ -14081,13 +14059,13 @@
}
},
"node_modules/framer-motion": {
"version": "12.33.0",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.33.0.tgz",
"integrity": "sha512-ca8d+rRPcDP5iIF+MoT3WNc0KHJMjIyFAbtVLvM9eA7joGSpeqDfiNH/kCs1t4CHi04njYvWyj0jS4QlEK/rJQ==",
"version": "12.31.1",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.31.1.tgz",
"integrity": "sha512-cMwCU/k6k7ktHbIXE5NFCgG+BLW2CmCahPMw2MuZuIUHOy1HEa4wnYXBWz4l16eQc8eRGHpO5umWQ0QDl+evPw==",
"dev": true,
"license": "MIT",
"dependencies": {
"motion-dom": "^12.33.0",
"motion-dom": "^12.30.1",
"motion-utils": "^12.29.2",
"tslib": "^2.4.0"
},
@@ -14403,9 +14381,9 @@
}
},
"node_modules/get-tsconfig": {
"version": "4.13.3",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.3.tgz",
"integrity": "sha512-vp8Cj/+9Q/ibZUrq1rhy8mCTQpCk31A3uu9wc1C50yAb3x2pFHOsGdAZQ7jD86ARayyxZUViYeIztW+GE8dcrg==",
"version": "4.13.1",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.1.tgz",
"integrity": "sha512-EoY1N2xCn44xU6750Sx7OjOIT59FkmstNc3X6y5xpz7D5cBtZRe/3pSlTkDJgqsOk3WwZPkWfonhhUJfttQo3w==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -16354,6 +16332,16 @@
"zod": "^3.19.1"
}
},
"node_modules/koa-body/node_modules/zod": {
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
},
"node_modules/koa-compose": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/koa-compose/-/koa-compose-4.1.0.tgz",
@@ -16691,25 +16679,25 @@
"license": "MIT"
},
"node_modules/libmime": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/libmime/-/libmime-2.1.0.tgz",
"integrity": "sha512-4be2R6/jOasyPTw0BkpIZBVk2cElqjdIdS0PRPhbOCV4wWuL/ZcYYpN1BCTVB+6eIQ0uuAwp5hQTHFrM5Joa8w==",
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/libmime/-/libmime-2.1.3.tgz",
"integrity": "sha512-ABr2f4O+K99sypmkF/yPz2aXxUFHEZzv+iUkxItCeKZWHHXdQPpDXd6rV1kBBwL4PserzLU09EIzJ2lxC9hPfQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"iconv-lite": "0.4.13",
"iconv-lite": "0.4.15",
"libbase64": "0.1.0",
"libqp": "1.1.0"
}
},
"node_modules/libmime/node_modules/iconv-lite": {
"version": "0.4.13",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.13.tgz",
"integrity": "sha512-QwVuTNQv7tXC5mMWFX5N5wGjmybjNBBD8P3BReTkPmipoxTUFgWM2gXNvldHQr6T14DH0Dh6qBVg98iJt7u4mQ==",
"version": "0.4.15",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.15.tgz",
"integrity": "sha512-RGR+c9Lm+tLsvU57FTJJtdbv2hQw42Yl2n26tVIBaYmZzLN+EGfroUugN/z9nJf9kOXd49hBmpoGr4FEm+A4pw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.8.0"
"node": ">=0.10.0"
}
},
"node_modules/libqp": {
@@ -16851,7 +16839,6 @@
"version": "4.17.23",
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.23.tgz",
"integrity": "sha512-kVI48u3PZr38HdYz98UmfPnXl2DXrpdctLrFLCd3kOx1xUkOmpFPx7gCWWM5MPkL/fD8zb+Ph0QzjGFs4+hHWg==",
"dev": true,
"license": "MIT"
},
"node_modules/lodash.clonedeep": {
@@ -17063,6 +17050,28 @@
"libmime": "2.1.0"
}
},
"node_modules/mailcomposer/node_modules/iconv-lite": {
"version": "0.4.13",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.13.tgz",
"integrity": "sha512-QwVuTNQv7tXC5mMWFX5N5wGjmybjNBBD8P3BReTkPmipoxTUFgWM2gXNvldHQr6T14DH0Dh6qBVg98iJt7u4mQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/mailcomposer/node_modules/libmime": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/libmime/-/libmime-2.1.0.tgz",
"integrity": "sha512-4be2R6/jOasyPTw0BkpIZBVk2cElqjdIdS0PRPhbOCV4wWuL/ZcYYpN1BCTVB+6eIQ0uuAwp5hQTHFrM5Joa8w==",
"dev": true,
"license": "MIT",
"dependencies": {
"iconv-lite": "0.4.13",
"libbase64": "0.1.0",
"libqp": "1.1.0"
}
},
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@@ -17229,19 +17238,6 @@
"node": ">=10"
}
},
"node_modules/matcher/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/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
@@ -17976,9 +17972,9 @@
"license": "MIT"
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"version": "1.54.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
"dev": true,
"license": "MIT",
"engines": {
@@ -17998,6 +17994,16 @@
"node": ">= 0.6"
}
},
"node_modules/mime-types/node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mimic-fn": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
@@ -18165,9 +18171,9 @@
}
},
"node_modules/motion-dom": {
"version": "12.33.0",
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.33.0.tgz",
"integrity": "sha512-XRPebVypsl0UM+7v0Hr8o9UAj0S2djsQWRdHBd5iVouVpMrQqAI0C/rDAT3QaYnXnHuC5hMcwDHCboNeyYjPoQ==",
"version": "12.30.1",
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.30.1.tgz",
"integrity": "sha512-QXB+iFJRzZTqL+Am4a1CRoHdH+0Nq12wLdqQQZZsfHlp9AMt6PA098L/61oVZsDA+Ep3QSGudzpViyRrhYhGcQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -18238,7 +18244,6 @@
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz",
"integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==",
"dev": true,
"license": "MIT"
},
"node_modules/nanoid": {
@@ -19766,9 +19771,10 @@
}
},
"node_modules/postcss": {
"version": "8.4.49",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz",
"integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==",
"version": "8.5.6",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
"integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
"dev": true,
"funding": [
{
"type": "opencollective",
@@ -19785,7 +19791,7 @@
],
"license": "MIT",
"dependencies": {
"nanoid": "^3.3.7",
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
"source-map-js": "^1.2.1"
},
@@ -21469,19 +21475,6 @@
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/sanitize-html/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/sanitize-html/node_modules/htmlparser2": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz",
@@ -21722,9 +21715,9 @@
}
},
"node_modules/sharp/node_modules/semver": {
"version": "7.7.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
"integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",
"version": "7.7.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz",
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==",
"dev": true,
"license": "ISC",
"bin": {
@@ -22068,9 +22061,9 @@
}
},
"node_modules/sort-package-json/node_modules/semver": {
"version": "7.7.4",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
"integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",
"version": "7.7.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz",
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==",
"dev": true,
"license": "ISC",
"bin": {
@@ -22484,6 +22477,34 @@
}
}
},
"node_modules/styled-components/node_modules/postcss": {
"version": "8.4.49",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz",
"integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==",
"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",
"dependencies": {
"nanoid": "^3.3.7",
"picocolors": "^1.1.1",
"source-map-js": "^1.2.1"
},
"engines": {
"node": "^10 || ^12 || >=14"
}
},
"node_modules/styled-components/node_modules/stylis": {
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.6.tgz",
@@ -22778,12 +22799,6 @@
"node": ">=8"
}
},
"node_modules/tiny-case": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tiny-case/-/tiny-case-1.0.3.tgz",
"integrity": "sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==",
"license": "MIT"
},
"node_modules/tiny-invariant": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",
@@ -24138,19 +24153,6 @@
"node": ">= 10"
}
},
"node_modules/webpack-bundle-analyzer/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/webpack-bundle-analyzer/node_modules/ws": {
"version": "7.5.10",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
@@ -24792,35 +24794,30 @@
}
},
"node_modules/yup": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/yup/-/yup-1.7.1.tgz",
"integrity": "sha512-GKHFX2nXul2/4Dtfxhozv701jLQHdf6J34YDh2cEkpqoo8le5Mg6/LrdseVLrFarmFygZTlfIhHx/QKfb/QWXw==",
"version": "0.32.11",
"resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz",
"integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==",
"license": "MIT",
"dependencies": {
"property-expr": "^2.0.5",
"tiny-case": "^1.0.3",
"toposort": "^2.0.2",
"type-fest": "^2.19.0"
}
"@babel/runtime": "^7.15.4",
"@types/lodash": "^4.14.175",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"nanoclone": "^0.2.1",
"property-expr": "^2.0.4",
"toposort": "^2.0.2"
},
"node_modules/yup/node_modules/type-fest": {
"version": "2.19.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz",
"integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==",
"license": "(MIT OR CC0-1.0)",
"engines": {
"node": ">=12.20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
"node": ">=10"
}
},
"node_modules/zod": {
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz",
"integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}

View File

@@ -1,5 +1,5 @@
{
"version": "1.0.1",
"version": "0.0.0",
"keywords": [],
"type": "commonjs",
"exports": {
@@ -35,7 +35,7 @@
"@strapi/design-system": "^2.0.0-rc.30",
"@strapi/icons": "^2.0.0-rc.30",
"react-intl": "^7.1.14",
"yup": "^1.0.0"
"yup": "^0.32.11"
},
"devDependencies": {
"@strapi/sdk-plugin": "^5.4.0",
@@ -69,11 +69,11 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/valentineus/strapi-plugin-checkbox-list.git"
"url": "git+ssh://git@popov.link/valentineus/strapi-plugin-checkbox-list.git"
},
"bugs": {
"url": "https://github.com/valentineus/strapi-plugin-checkbox-list/issues"
"url": "https://popov.link/valentineus/strapi-plugin-checkbox-list/issues"
},
"homepage": "https://github.com/valentineus/strapi-plugin-checkbox-list#readme",
"homepage": "https://popov.link/valentineus/strapi-plugin-checkbox-list#readme",
"author": "Valentin Popov <valentin@popov.link>"
}

View File

@@ -1,6 +0,0 @@
module.exports = {
testEnvironment: 'node',
testMatch: ['<rootDir>/tests/integration/**/*.test.js'],
testTimeout: 120000,
verbose: true,
};

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,6 @@
"seed:example": "node ./scripts/seed.js",
"start": "strapi start",
"strapi": "strapi",
"test:integration": "NODE_ENV=test STRAPI_DISABLE_ADMIN=true jest --runInBand",
"upgrade": "npx @strapi/upgrade latest",
"upgrade:dry": "npx @strapi/upgrade latest --dry"
},
@@ -21,8 +20,8 @@
"@strapi/plugin-users-permissions": "5.35.0",
"@strapi/strapi": "5.35.0",
"better-sqlite3": "12.6.2",
"fs-extra": "^11.0.0",
"mime-types": "^3.0.0",
"fs-extra": "^10.0.0",
"mime-types": "^2.1.27",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.0.0",
@@ -30,11 +29,9 @@
"styled-components": "^6.0.0"
},
"devDependencies": {
"@types/node": "^24.0.0",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"jest": "^30.0.0",
"supertest": "^7.0.0",
"typescript": "^5"
},
"engines": {

View File

@@ -1,51 +0,0 @@
{
"kind": "collectionType",
"collectionName": "checkbox_items",
"info": {
"singularName": "checkbox-item",
"pluralName": "checkbox-items",
"displayName": "Checkbox Item",
"description": "Content type for checkbox list integration tests"
},
"options": {
"draftAndPublish": false
},
"pluginOptions": {},
"attributes": {
"title": {
"type": "string",
"required": true
},
"choices": {
"type": "customField",
"customField": "plugin::checkbox-list.checkbox-list",
"options": {
"enum": ["alpha", "beta", "gamma"]
}
},
"choicesRequired": {
"type": "customField",
"customField": "plugin::checkbox-list.checkbox-list",
"options": {
"enum": ["alpha", "beta"]
},
"required": true
},
"choicesPrivate": {
"type": "customField",
"customField": "plugin::checkbox-list.checkbox-list",
"options": {
"enum": ["secret", "top-secret"]
},
"private": true
},
"choicesDefault": {
"type": "customField",
"customField": "plugin::checkbox-list.checkbox-list",
"options": {
"enum": ["defaultA", "defaultB"]
},
"default": ["defaultA"]
}
}
}

View File

@@ -1,7 +0,0 @@
/**
* checkbox-item controller
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreController('api::checkbox-item.checkbox-item');

View File

@@ -1,7 +0,0 @@
/**
* checkbox-item router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::checkbox-item.checkbox-item');

View File

@@ -1,7 +0,0 @@
/**
* checkbox-item service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::checkbox-item.checkbox-item');

View File

@@ -1,163 +0,0 @@
const fs = require('fs');
const path = require('path');
const supertest = require('supertest');
const { compileStrapi, createStrapi } = require('@strapi/core');
const appRoot = path.resolve(__dirname, '..', '..');
const dbFile = path.join(appRoot, '.tmp', 'test.db');
const ensurePublicPermissions = async (strapi, actions) => {
const role = await strapi.db.query('plugin::users-permissions.role').findOne({
where: { type: 'public' },
});
if (!role) {
throw new Error('Public role not found');
}
const permissions = strapi.db.query('plugin::users-permissions.permission');
for (const action of actions) {
const existing = await permissions.findOne({
where: { action, role: role.id },
});
if (!existing) {
await permissions.create({
data: {
action,
role: role.id,
enabled: true,
},
});
continue;
}
if (!existing.enabled) {
await permissions.update({
where: { id: existing.id },
data: { enabled: true },
});
}
}
};
describe('checkbox-list custom field (API)', () => {
let strapi;
let request;
beforeAll(async () => {
process.chdir(appRoot);
process.env.NODE_ENV = 'test';
process.env.HOST = '127.0.0.1';
process.env.PORT = '1339';
process.env.STRAPI_DISABLE_ADMIN = 'true';
process.env.STRAPI_TELEMETRY_DISABLED = 'true';
process.env.DATABASE_FILENAME = '.tmp/test.db';
process.env.JWT_SECRET = process.env.JWT_SECRET || 'test-jwt-secret';
process.env.ADMIN_JWT_SECRET = process.env.ADMIN_JWT_SECRET || 'test-admin-jwt-secret';
process.env.APP_KEYS =
process.env.APP_KEYS || 'testKey1,testKey2,testKey3,testKey4';
if (fs.existsSync(dbFile)) {
fs.rmSync(dbFile);
}
const appContext = await compileStrapi();
strapi = createStrapi(appContext);
strapi.log.level = 'error';
await strapi.start();
request = supertest(`http://127.0.0.1:${process.env.PORT}`);
await ensurePublicPermissions(strapi, [
'api::checkbox-item.checkbox-item.find',
'api::checkbox-item.checkbox-item.findOne',
'api::checkbox-item.checkbox-item.create',
'api::checkbox-item.checkbox-item.update',
'api::checkbox-item.checkbox-item.delete',
]);
});
afterAll(async () => {
if (strapi) {
await strapi.destroy();
}
});
test('creates and reads entries with checkbox list values', async () => {
const createResponse = await request.post('/api/checkbox-items').send({
data: {
title: 'First',
choices: ['alpha', 'beta'],
choicesRequired: ['alpha'],
choicesPrivate: ['secret'],
choicesDefault: ['defaultA'],
},
});
expect([200, 201]).toContain(createResponse.status);
const documentId = createResponse.body?.data?.documentId;
expect(documentId).toBeTruthy();
const fetchResponse = await request.get(`/api/checkbox-items/${documentId}`);
expect(fetchResponse.status).toBe(200);
expect(fetchResponse.body?.data?.choices).toEqual(['alpha', 'beta']);
});
test('enforces required checkbox list field', async () => {
const response = await request.post('/api/checkbox-items').send({
data: {
title: 'Missing required',
choices: ['alpha'],
},
});
expect(response.status).toBe(400);
});
test('applies default values and hides private field', async () => {
const createResponse = await request.post('/api/checkbox-items').send({
data: {
title: 'Defaults',
choices: ['beta'],
choicesRequired: ['beta'],
},
});
expect([200, 201]).toContain(createResponse.status);
const documentId = createResponse.body?.data?.documentId;
expect(documentId).toBeTruthy();
const fetchResponse = await request.get(`/api/checkbox-items/${documentId}`);
expect(fetchResponse.status).toBe(200);
const data = fetchResponse.body?.data;
expect(data?.choicesDefault).toEqual(['defaultA']);
expect(data?.choicesPrivate).toBeUndefined();
});
test('updates entries with checkbox list values', async () => {
const createResponse = await request.post('/api/checkbox-items').send({
data: {
title: 'Update me',
choices: ['alpha'],
choicesRequired: ['alpha'],
},
});
const documentId = createResponse.body?.data?.documentId;
expect(documentId).toBeTruthy();
const updateResponse = await request.put(`/api/checkbox-items/${documentId}`).send({
data: {
choices: ['alpha', 'gamma'],
choicesRequired: ['alpha'],
},
});
expect(updateResponse.status).toBe(200);
expect(updateResponse.body?.data?.choices).toEqual(['alpha', 'gamma']);
});
});

View File

@@ -503,57 +503,6 @@ export interface ApiCategoryCategory extends Struct.CollectionTypeSchema {
};
}
export interface ApiCheckboxItemCheckboxItem extends Struct.CollectionTypeSchema {
collectionName: 'checkbox_items';
info: {
description: 'Content type for checkbox list integration tests';
displayName: 'Checkbox Item';
pluralName: 'checkbox-items';
singularName: 'checkbox-item';
};
options: {
draftAndPublish: false;
};
attributes: {
choices: Schema.Attribute.CustomField<
'plugin::checkbox-list.checkbox-list',
{
enum: ['alpha', 'beta', 'gamma'];
}
>;
choicesDefault: Schema.Attribute.CustomField<
'plugin::checkbox-list.checkbox-list',
{
enum: ['defaultA', 'defaultB'];
}
> &
Schema.Attribute.DefaultTo<['defaultA']>;
choicesPrivate: Schema.Attribute.CustomField<
'plugin::checkbox-list.checkbox-list',
{
enum: ['secret', 'top-secret'];
}
> &
Schema.Attribute.Private;
choicesRequired: Schema.Attribute.CustomField<
'plugin::checkbox-list.checkbox-list',
{
enum: ['alpha', 'beta'];
}
> &
Schema.Attribute.Required;
createdAt: Schema.Attribute.DateTime;
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
locale: Schema.Attribute.String & Schema.Attribute.Private;
localizations: Schema.Attribute.Relation<'oneToMany', 'api::checkbox-item.checkbox-item'> &
Schema.Attribute.Private;
publishedAt: Schema.Attribute.DateTime;
title: Schema.Attribute.String & Schema.Attribute.Required;
updatedAt: Schema.Attribute.DateTime;
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> & Schema.Attribute.Private;
};
}
export interface ApiGlobalGlobal extends Struct.SingleTypeSchema {
collectionName: 'globals';
info: {
@@ -1014,7 +963,6 @@ declare module '@strapi/strapi' {
'api::article.article': ApiArticleArticle;
'api::author.author': ApiAuthorAuthor;
'api::category.category': ApiCategoryCategory;
'api::checkbox-item.checkbox-item': ApiCheckboxItemCheckboxItem;
'api::global.global': ApiGlobalGlobal;
'plugin::content-releases.release': PluginContentReleasesRelease;
'plugin::content-releases.release-action': PluginContentReleasesReleaseAction;