Reference
Decorators
Every decorator the package exports, with its signature.
Model
| Decorator | Target | Purpose |
|---|---|---|
@ParseClass(name, options?) | class | Registers the subclass, CLP, ACL template, compound indexes; registers with OpenAPI and flushes pending triggers |
@ParseField(options) | property | Declares a field and its accessor |
@ParseVersionField(options?) | property | Declares the optimistic-lock version field |
Endpoints
@CloudFunction(config) | static method | Registers a cloud function with HTTP methods, validation and roles |
@ProtectedCloudFunction(config?) | static method | As above, with POST and requireUser pre-applied |
@Route(ModelOrString) | class | Maps the class's methods to /api/{prefix}/{method} |
@Transactional() | method | Runs the method in a transaction |
Triggers
All take an optional {description?, validation?}.
| Object | @BeforeSave @AfterSave @BeforeDelete @AfterDelete @BeforeFind @AfterFind |
| Auth | @BeforeLogin @AfterLogin @AfterLogout @BeforePasswordResetRequest |
| File | @BeforeSaveFile @AfterSaveFile @BeforeDeleteFile @AfterDeleteFile @BeforeFindFile @AfterFindFile |
| Config | @BeforeSaveConfig @AfterSaveConfig |
| LiveQuery | @BeforeConnect @BeforeSubscribe @AfterEvent |
| Scheduled | @Cron(config) |
Registries
Each is initialised once at boot, after Parse Server is mounted.
CloudFunctionRegistry | initialize() also builds the route map and reports the versioning setup |
TriggerRegistry | initialize(), getTriggers(), getTriggersForClass(name) |
CronRegistry | initialize(), getJobs(), stopJob, startJob, stopAll, runNow |
RouteRegistry | resolve(path), getPrefixes() |
SwaggerRegistry | getModels(), getFunctions() |
VersionRegistry | classNames(), isVersioned(name), adapterIsInstalled() |
Registration hooks
For integrations that need to observe registration as it happens.
import {
onClassRegistered, onFieldRegistered, onFunctionRegistered,
} from 'parse-server-kit';
onClassRegistered((className, constructor, fields, options) => { … });
onFieldRegistered((constructor, fieldName, fieldMeta) => { … });
onFunctionRegistered((name, config, target) => { … });