Reference

Decorators

Every decorator the package exports, with its signature.

Model

DecoratorTargetPurpose
@ParseClass(name, options?)classRegisters the subclass, CLP, ACL template, compound indexes; registers with OpenAPI and flushes pending triggers
@ParseField(options)propertyDeclares a field and its accessor
@ParseVersionField(options?)propertyDeclares the optimistic-lock version field

Endpoints

@CloudFunction(config)static methodRegisters a cloud function with HTTP methods, validation and roles
@ProtectedCloudFunction(config?)static methodAs above, with POST and requireUser pre-applied
@Route(ModelOrString)classMaps the class's methods to /api/{prefix}/{method}
@Transactional()methodRuns 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.

CloudFunctionRegistryinitialize() also builds the route map and reports the versioning setup
TriggerRegistryinitialize(), getTriggers(), getTriggersForClass(name)
CronRegistryinitialize(), getJobs(), stopJob, startJob, stopAll, runNow
RouteRegistryresolve(path), getPrefixes()
SwaggerRegistrygetModels(), getFunctions()
VersionRegistryclassNames(), 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) => { … });