The Parse Cloud Code SDK.
Interfaces
- AfterFindRequest
- BeforeFindRequest
- ConnectTriggerRequest
- FileTriggerRequest
- FunctionRequest
- JobRequest
- LiveQueryEventTrigger
- TriggerRequest
- ValidatorObject
Methods
(static) afterDelete(arg1, func, validator)
Registers an after delete function.
Available in Cloud Code only.
If you want to use afterDelete for a predefined class in the Parse JavaScript SDK (e.g. Parse.User
or Parse.File
), you should pass the class itself and not the String for arg1.
Parse.Cloud.afterDelete('MyCustomClass', async (request) => {
// code here
}, (request) => {
// validation code here
});
Parse.Cloud.afterDelete(Parse.User, async (request) => {
// code here
}, { ...validationObject });
Name | Type | Description |
---|---|---|
arg1 | String | | The Parse.Object subclass to register the after delete function for. This can instead be a String that is the className of the subclass. |
func | function | The function to run after a delete. This function can be async and should take just one parameter, |
validator | Object | | An optional function to help validating cloud code. This function can be an async function and should take one parameter a |
(static) afterFind(arg1, func, validator)
Registers an after find function.
Available in Cloud Code only.
If you want to use afterFind for a predefined class in the Parse JavaScript SDK (e.g. Parse.User
or Parse.File
), you should pass the class itself and not the String for arg1.
Parse.Cloud.afterFind('MyCustomClass', async (request) => {
// code here
}, (request) => {
// validation code here
});
Parse.Cloud.afterFind(Parse.User, async (request) => {
// code here
}, { ...validationObject });
Name | Type | Description |
---|---|---|
arg1 | String | | The Parse.Object subclass to register the after find function for. This can instead be a String that is the className of the subclass. |
func | function | The function to run before a find. This function can be async and should take just one parameter, |
validator | Object | | An optional function to help validating cloud code. This function can be an async function and should take one parameter a |
(static) afterLiveQueryEvent(arg1, func, validator)
Registers an after live query server event function.
Available in Cloud Code only.
Parse.Cloud.afterLiveQueryEvent('MyCustomClass', (request) => {
// code here
}, (request) => {
// validation code here
});
Parse.Cloud.afterLiveQueryEvent('MyCustomClass', (request) => {
// code here
}, { ...validationObject });
Name | Type | Description |
---|---|---|
arg1 | String | | The Parse.Object subclass to register the after live query event function for. This can instead be a String that is the className of the subclass. |
func | function | The function to run after a live query event. This function can be async and should take one parameter, a |
validator | Object | | An optional function to help validating cloud code. This function can be an async function and should take one parameter a |
(static) afterLogin(func)
Registers the after login function.
Available in Cloud Code only.
This function is triggered after a user logs in successfully, and after a _Session object has been created.
Parse.Cloud.afterLogin((request) => {
// code here
});
Name | Type | Description |
---|---|---|
func | function | The function to run after a login. This function can be async and should take one parameter a |
(static) afterLogout(func)
Registers the after logout function.
Available in Cloud Code only.
This function is triggered after a user logs out.
Parse.Cloud.afterLogout((request) => {
// code here
});
Name | Type | Description |
---|---|---|
func | function | The function to run after a logout. This function can be async and should take one parameter a |
(static) afterSave(arg1, func, validator)
Registers an after save function.
Available in Cloud Code only.
If you want to use afterSave for a predefined class in the Parse JavaScript SDK (e.g. Parse.User
or Parse.File
), you should pass the class itself and not the String for arg1.
Parse.Cloud.afterSave('MyCustomClass', async function(request) {
// code here
}, (request) => {
// validation code here
});
Parse.Cloud.afterSave(Parse.User, async function(request) {
// code here
}, { ...validationObject });
Name | Type | Description |
---|---|---|
arg1 | String | | The Parse.Object subclass to register the after save function for. This can instead be a String that is the className of the subclass. |
func | function | The function to run after a save. This function can be an async function and should take just one parameter, |
validator | Object | | An optional function to help validating cloud code. This function can be an async function and should take one parameter a |
(static) beforeConnect(func, validator)
Registers a before live query server connect function.
Available in Cloud Code only.
Parse.Cloud.beforeConnect(async (request) => {
// code here
}, (request) => {
// validation code here
});
Parse.Cloud.beforeConnect(async (request) => {
// code here
}, { ...validationObject });
Name | Type | Description |
---|---|---|
func | function | The function to before connection is made. This function can be async and should take just one parameter, |
validator | Object | | An optional function to help validating cloud code. This function can be an async function and should take one parameter a |
(static) beforeDelete(arg1, func, validator)
Registers a before delete function.
Available in Cloud Code only.
If you want to use beforeDelete for a predefined class in the Parse JavaScript SDK (e.g. Parse.User
or Parse.File
), you should pass the class itself and not the String for arg1.
Parse.Cloud.beforeDelete('MyCustomClass', (request) => {
// code here
}, (request) => {
// validation code here
});
Parse.Cloud.beforeDelete(Parse.User, (request) => {
// code here
}, { ...validationObject })
Name | Type | Description |
---|---|---|
arg1 | String | | The Parse.Object subclass to register the before delete function for. This can instead be a String that is the className of the subclass. |
func | function | The function to run before a delete. This function can be async and should take one parameter, a |
validator | Object | | An optional function to help validating cloud code. This function can be an async function and should take one parameter a |
(static) beforeFind(arg1, func, validator)
Registers a before find function.
Available in Cloud Code only.
If you want to use beforeFind for a predefined class in the Parse JavaScript SDK (e.g. Parse.User
or Parse.File
), you should pass the class itself and not the String for arg1.
Parse.Cloud.beforeFind('MyCustomClass', async (request) => {
// code here
}, (request) => {
// validation code here
});
Parse.Cloud.beforeFind(Parse.User, async (request) => {
// code here
}, { ...validationObject });
Name | Type | Description |
---|---|---|
arg1 | String | | The Parse.Object subclass to register the before find function for. This can instead be a String that is the className of the subclass. |
func | function | The function to run before a find. This function can be async and should take just one parameter, |
validator | Object | | An optional function to help validating cloud code. This function can be an async function and should take one parameter a |
(static) beforeLogin(func)
Registers the before login function.
Available in Cloud Code only.
This function provides further control in validating a login attempt. Specifically, it is triggered after a user enters correct credentials (or other valid authData), but prior to a session being generated.
Parse.Cloud.beforeLogin((request) => {
// code here
})
Name | Type | Description |
---|---|---|
func | function | The function to run before a login. This function can be async and should take one parameter a |
(static) beforeSave(arg1, func, validator)
Registers a before save function.
Available in Cloud Code only.
If you want to use beforeSave for a predefined class in the Parse JavaScript SDK (e.g. Parse.User
or Parse.File
), you should pass the class itself and not the String for arg1.
Parse.Cloud.beforeSave('MyCustomClass', (request) => {
// code here
}, (request) => {
// validation code here
});
Parse.Cloud.beforeSave(Parse.User, (request) => {
// code here
}, { ...validationObject })
Name | Type | Description |
---|---|---|
arg1 | String | | The Parse.Object subclass to register the after save function for. This can instead be a String that is the className of the subclass. |
func | function | The function to run before a save. This function can be async and should take one parameter a |
validator | Object | | An optional function to help validating cloud code. This function can be an async function and should take one parameter a |
(static) beforeSubscribe(arg1, func, validator)
Registers a before live query subscription function.
Available in Cloud Code only.
If you want to use beforeSubscribe for a predefined class in the Parse JavaScript SDK (e.g. Parse.User
or Parse.File
), you should pass the class itself and not the String for arg1.
Parse.Cloud.beforeSubscribe('MyCustomClass', (request) => {
// code here
}, (request) => {
// validation code here
});
Parse.Cloud.beforeSubscribe(Parse.User, (request) => {
// code here
}, { ...validationObject });
Name | Type | Description |
---|---|---|
arg1 | String | | The Parse.Object subclass to register the before subscription function for. This can instead be a String that is the className of the subclass. |
func | function | The function to run before a subscription. This function can be async and should take one parameter, a |
validator | Object | | An optional function to help validating cloud code. This function can be an async function and should take one parameter a |
(static) job(name, func)
Defines a Background Job.
Available in Cloud Code only.
Name | Type | Description |
---|---|---|
name | String | The name of the Background Job |
func | function | The Background Job to register. This function can be async should take a single parameters a |
(static) sendEmail(data)
Sends an email through the Parse Server mail adapter.
Available in Cloud Code only. Requires a mail adapter to be configured for Parse Server.
Parse.Cloud.sendEmail({
from: 'Example <[email protected]>',
to: '[email protected]',
subject: 'Test email',
text: 'This email is a test.'
});
Name | Type | Description |
---|---|---|
data | Object | The object of the mail data to send. |