Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

nocobase-app-plugin-repository-example

БесплатноБез исполняемых скриптовНе проверен

Use the NocoBase 3 Repository API example plugin to demonstrate array and streamed findMany queries, CRM and order CRUD, relation reads and writes, optimistic…

nocobaseот nocobase★ 25 082 звезды на GitHub

Об этом скилле

Repository example

This plugin owns thirteen isolated example collections, five authenticated list pages, and four API example pages in three sidebar groups, each CRUD entity having a detail child route. Use it when explaining or trying the Repository HTTP adapter. Do not use it as a production CRM or modify its tables to store unrelated application data.

Prerequisites and registration

The application must register @nocobase/app-plugin-authentication and this plugin on the Server, and this plugin's Client factory. It needs the normal apiClientToken and a working database. Apply application migrations and seeds before opening the pages. In this repository:

pnpm nocobase plugin register repository-example --workspace-root . --app app-template-default
pnpm --filter @nocobase/app-template-default exec nocobase db apply

db apply runs pending migrations and then seeds. Inside an installed application, run pnpm nocobase db apply from the application root.

Public surfaces

  • Client factory: @nocobase/app-plugin-repository-example/client.
  • Server definition: @nocobase/app-plugin-repository-example/server.
  • CRM group: customers at /repository-example/crm, contacts at /repository-example/crm/contacts.
  • Orders group: orders at /repository-example/orders, items at /repository-example/orders/items, products at /repository-example/orders/products. Paths are relative to the application mount point; each entity has its own URL.
  • Detail routes append /details/:recordId to the list path. New and Edit use a right-side drawer; errors preserve input, and successful saves refresh the current page.
  • Repositories: repositoryExampleCustomers, repositoryExampleContacts, repositoryExampleProducts, repositoryExampleOrders, repositoryExampleOrderItems.
  • Relationship-write page: /repository-example/relation-mutations, in the Repository examples group. Seven independent cards each provide preparation, a form, a target table, a request preview and the last executed response for create/connect/disconnect/set/update/upsert/delete. Choose hasOne profile, hasMany tasks or belongsToMany tags; set is to-many only (20 supported combinations). Preparation creates a fresh project and four isolated targets, requires migrations but no seeds, and retains old records when repeated. Page load performs no writes. Target tables distinguish association state from record existence, retain absent rows after delete and show through.role. Tag create/connect/set expose a role input. Upsert can update the same target on repeated execution; set checkboxes may all be cleared. Each root HTTP mutation is transactional; multi-request preparation is not. Write failures preserve inputs; refresh failures after a successful write require a read-only table refresh. The page calls only api.repository(name) through authenticated routes. See client/relation-lab.ts.
  • findMany page: /repository-example/find-many, in the Repository examples group. It queries repositoryExampleFindManyRecords, initialized with 24 deterministic records. The two panels execute identical sorted queries: await repository.findMany(options) requests JSON and returns an array, while for await (const record of repository.findMany(options)) requests framed NDJSON and yields records as they arrive. Create a new query for each consumption mode; one query cannot mix modes.
  • Atomic update page: /repository-example/atomic, in the Repository examples group. It uses repositoryExampleAtomicCounters, initialized by a separate migration and seed with stock, wallet, points and visits records. It demonstrates increment, guarded decrement, multiply and ten concurrent increments. Mutations use numeric operation objects; never read and send an absolute replacement value. Concurrent requests commit independently, and failed requests are not automatically retried.
  • Aggregate page: /repository-example/aggregate, in the Repository examples group. It reuses existing seeds and shows item COUNT/SUM/AVG/MIN/MAX, status-filtered order counts, product groupBy with HAVING and sorting, and customer relation counts (first 50 customers, including zero). The status filter affects every panel; minimum quantity affects only grouped products. It calls api.repository(name).aggregate() and .groupBy() using JSON ASTs through authenticated defineRepositoryApiRoutes actions. The example-specific GET endpoint has been removed. The actual requests are in client/aggregate.ts, with product lookup batches of 100. Enum status counts use one groupBy query with exact member identity, including case and trailing spaces. Enum field sorting remains unsupported; the page uses aggregate sorting and explicit presentation order. Prices are cents; AVG is unweighted; empty-set sums and price metrics are NULL; separate panel queries are not a single snapshot.
  • Additional groupBy panels on the Aggregate page: customer order ranking (customerId), customer × en
Полный SKILL.md на GitHub

Установить nocobase-app-plugin-repository-example в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл nocobase-app-plugin-repository-example?

Use the NocoBase 3 Repository API example plugin to demonstrate array and streamed findMany queries, CRM and order CRUD, relation reads and writes, optimistic locking, atomic numeric updates, and aggregate queries.

Как установить скилл nocobase-app-plugin-repository-example?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл nocobase-app-plugin-repository-example запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить nocobase-app-plugin-repository-example с