Files
kami-parse-server/src/cloud-code/Parse.Cloud.js

644 lines
21 KiB
JavaScript
Raw Normal View History

import { Parse } from 'parse/node';
import * as triggers from '../triggers';
function isParseObjectConstructor(object) {
return (
typeof object === 'function' &&
Object.prototype.hasOwnProperty.call(object, 'className')
);
}
function getClassName(parseClass) {
if (parseClass && parseClass.className) {
return parseClass.className;
}
return parseClass;
}
/** @namespace
* @name Parse
* @description The Parse SDK.
* see [api docs](https://docs.parseplatform.org/js/api) and [guide](https://docs.parseplatform.org/js/guide)
*/
/** @namespace
* @name Parse.Cloud
* @memberof Parse
* @description The Parse Cloud Code SDK.
*/
var ParseCloud = {};
/**
* Defines a Cloud Function.
*
* **Available in Cloud Code only.**
* @static
* @memberof Parse.Cloud
* @param {String} name The name of the Cloud Function
* @param {Function} data The Cloud Function to register. This function can be an async function and should take one parameter a {@link Parse.Cloud.FunctionRequest}.
*/
2020-07-13 13:06:52 -05:00
ParseCloud.define = function (functionName, handler, validationHandler) {
triggers.addFunction(
functionName,
handler,
validationHandler,
Parse.applicationId
);
};
/**
* Defines a Background Job.
*
* **Available in Cloud Code only.**
*
* @method job
* @name Parse.Cloud.job
* @param {String} name The name of the Background Job
* @param {Function} func The Background Job to register. This function can be async should take a single parameters a {@link Parse.Cloud.JobRequest}
*
*/
2020-07-13 13:06:52 -05:00
ParseCloud.job = function (functionName, handler) {
triggers.addJob(functionName, handler, Parse.applicationId);
};
/**
*
* 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. {@link Parse.User}), you should pass the class itself and not the String for arg1.
*
* ```
* Parse.Cloud.beforeSave('MyCustomClass', (request) => {
* // code here
* })
*
* Parse.Cloud.beforeSave(Parse.User, (request) => {
* // code here
* })
* ```
*
* @method beforeSave
* @name Parse.Cloud.beforeSave
* @param {(String|Parse.Object)} arg1 The Parse.Object subclass to register the after save function for. This can instead be a String that is the className of the subclass.
* @param {Function} func The function to run before a save. This function can be async and should take one parameter a {@link Parse.Cloud.TriggerRequest};
*/
2020-07-13 13:06:52 -05:00
ParseCloud.beforeSave = function (parseClass, handler) {
var className = getClassName(parseClass);
triggers.addTrigger(
triggers.Types.beforeSave,
className,
handler,
Parse.applicationId
);
};
/**
* 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. {@link Parse.User}), you should pass the class itself and not the String for arg1.
* ```
* Parse.Cloud.beforeDelete('MyCustomClass', (request) => {
* // code here
* })
*
* Parse.Cloud.beforeDelete(Parse.User, (request) => {
* // code here
* })
*```
*
* @method beforeDelete
* @name Parse.Cloud.beforeDelete
* @param {(String|Parse.Object)} arg1 The Parse.Object subclass to register the before delete function for. This can instead be a String that is the className of the subclass.
* @param {Function} func The function to run before a delete. This function can be async and should take one parameter, a {@link Parse.Cloud.TriggerRequest}.
*/
2020-07-13 13:06:52 -05:00
ParseCloud.beforeDelete = function (parseClass, handler) {
var className = getClassName(parseClass);
triggers.addTrigger(
triggers.Types.beforeDelete,
className,
handler,
Parse.applicationId
);
};
/**
*
* 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
* })
*
* ```
*
* @method beforeLogin
* @name Parse.Cloud.beforeLogin
* @param {Function} func The function to run before a login. This function can be async and should take one parameter a {@link Parse.Cloud.TriggerRequest};
*/
2020-07-13 13:06:52 -05:00
ParseCloud.beforeLogin = function (handler) {
let className = '_User';
if (typeof handler === 'string' || isParseObjectConstructor(handler)) {
// validation will occur downstream, this is to maintain internal
// code consistency with the other hook types.
className = getClassName(handler);
handler = arguments[1];
}
triggers.addTrigger(
triggers.Types.beforeLogin,
className,
handler,
Parse.applicationId
);
};
/**
*
* 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
* })
*
* ```
*
* @method afterLogin
* @name Parse.Cloud.afterLogin
* @param {Function} func The function to run after a login. This function can be async and should take one parameter a {@link Parse.Cloud.TriggerRequest};
*/
2020-07-13 13:06:52 -05:00
ParseCloud.afterLogin = function (handler) {
let className = '_User';
if (typeof handler === 'string' || isParseObjectConstructor(handler)) {
// validation will occur downstream, this is to maintain internal
// code consistency with the other hook types.
className = getClassName(handler);
handler = arguments[1];
}
triggers.addTrigger(
triggers.Types.afterLogin,
className,
handler,
Parse.applicationId
);
};
/**
*
* 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
* })
*
* ```
*
* @method afterLogout
* @name Parse.Cloud.afterLogout
* @param {Function} func The function to run after a logout. This function can be async and should take one parameter a {@link Parse.Cloud.TriggerRequest};
*/
2020-07-13 13:06:52 -05:00
ParseCloud.afterLogout = function (handler) {
let className = '_Session';
if (typeof handler === 'string' || isParseObjectConstructor(handler)) {
// validation will occur downstream, this is to maintain internal
// code consistency with the other hook types.
className = getClassName(handler);
handler = arguments[1];
}
triggers.addTrigger(
triggers.Types.afterLogout,
className,
handler,
Parse.applicationId
);
};
/**
* 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. {@link Parse.User}), you should pass the class itself and not the String for arg1.
*
* ```
* Parse.Cloud.afterSave('MyCustomClass', async function(request) {
* // code here
* })
*
* Parse.Cloud.afterSave(Parse.User, async function(request) {
* // code here
* })
* ```
*
* @method afterSave
* @name Parse.Cloud.afterSave
* @param {(String|Parse.Object)} arg1 The Parse.Object subclass to register the after save function for. This can instead be a String that is the className of the subclass.
* @param {Function} func The function to run after a save. This function can be an async function and should take just one parameter, {@link Parse.Cloud.TriggerRequest}.
*/
2020-07-13 13:06:52 -05:00
ParseCloud.afterSave = function (parseClass, handler) {
var className = getClassName(parseClass);
triggers.addTrigger(
triggers.Types.afterSave,
className,
handler,
Parse.applicationId
);
};
/**
* 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. {@link Parse.User}), you should pass the class itself and not the String for arg1.
* ```
* Parse.Cloud.afterDelete('MyCustomClass', async (request) => {
* // code here
* })
*
* Parse.Cloud.afterDelete(Parse.User, async (request) => {
* // code here
* })
*```
*
* @method afterDelete
* @name Parse.Cloud.afterDelete
* @param {(String|Parse.Object)} arg1 The Parse.Object subclass to register the after delete function for. This can instead be a String that is the className of the subclass.
* @param {Function} func The function to run after a delete. This function can be async and should take just one parameter, {@link Parse.Cloud.TriggerRequest}.
*/
2020-07-13 13:06:52 -05:00
ParseCloud.afterDelete = function (parseClass, handler) {
var className = getClassName(parseClass);
triggers.addTrigger(
triggers.Types.afterDelete,
className,
handler,
Parse.applicationId
);
};
/**
* 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. {@link Parse.User}), you should pass the class itself and not the String for arg1.
* ```
* Parse.Cloud.beforeFind('MyCustomClass', async (request) => {
* // code here
* })
*
* Parse.Cloud.beforeFind(Parse.User, async (request) => {
* // code here
* })
*```
*
* @method beforeFind
* @name Parse.Cloud.beforeFind
* @param {(String|Parse.Object)} arg1 The Parse.Object subclass to register the before find function for. This can instead be a String that is the className of the subclass.
* @param {Function} func The function to run before a find. This function can be async and should take just one parameter, {@link Parse.Cloud.BeforeFindRequest}.
*/
2020-07-13 13:06:52 -05:00
ParseCloud.beforeFind = function (parseClass, handler) {
var className = getClassName(parseClass);
triggers.addTrigger(
triggers.Types.beforeFind,
className,
handler,
Parse.applicationId
);
};
/**
* 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. {@link Parse.User}), you should pass the class itself and not the String for arg1.
* ```
* Parse.Cloud.afterFind('MyCustomClass', async (request) => {
* // code here
* })
*
* Parse.Cloud.afterFind(Parse.User, async (request) => {
* // code here
* })
*```
*
* @method afterFind
* @name Parse.Cloud.afterFind
* @param {(String|Parse.Object)} arg1 The Parse.Object subclass to register the after find function for. This can instead be a String that is the className of the subclass.
* @param {Function} func The function to run before a find. This function can be async and should take just one parameter, {@link Parse.Cloud.AfterFindRequest}.
*/
2020-07-13 13:06:52 -05:00
ParseCloud.afterFind = function (parseClass, handler) {
2016-11-12 09:35:34 -08:00
const className = getClassName(parseClass);
triggers.addTrigger(
triggers.Types.afterFind,
className,
handler,
Parse.applicationId
);
2016-11-12 09:35:34 -08:00
};
/**
* Registers a before save file function.
*
* **Available in Cloud Code only.**
*
* ```
* Parse.Cloud.beforeSaveFile(async (request) => {
* // code here
* })
*```
*
* @method beforeSaveFile
* @name Parse.Cloud.beforeSaveFile
* @param {Function} func The function to run before saving a file. This function can be async and should take just one parameter, {@link Parse.Cloud.FileTriggerRequest}.
*/
2020-07-13 13:06:52 -05:00
ParseCloud.beforeSaveFile = function (handler) {
triggers.addFileTrigger(
triggers.Types.beforeSaveFile,
handler,
Parse.applicationId
);
};
/**
* Registers an after save file function.
*
* **Available in Cloud Code only.**
*
* ```
* Parse.Cloud.afterSaveFile(async (request) => {
* // code here
* })
*```
*
* @method afterSaveFile
* @name Parse.Cloud.afterSaveFile
* @param {Function} func The function to run after saving a file. This function can be async and should take just one parameter, {@link Parse.Cloud.FileTriggerRequest}.
*/
2020-07-13 13:06:52 -05:00
ParseCloud.afterSaveFile = function (handler) {
triggers.addFileTrigger(
triggers.Types.afterSaveFile,
handler,
Parse.applicationId
);
};
/**
* Registers a before delete file function.
*
* **Available in Cloud Code only.**
*
* ```
* Parse.Cloud.beforeDeleteFile(async (request) => {
* // code here
* })
*```
*
* @method beforeDeleteFile
* @name Parse.Cloud.beforeDeleteFile
* @param {Function} func The function to run before deleting a file. This function can be async and should take just one parameter, {@link Parse.Cloud.FileTriggerRequest}.
*/
2020-07-13 13:06:52 -05:00
ParseCloud.beforeDeleteFile = function (handler) {
triggers.addFileTrigger(
triggers.Types.beforeDeleteFile,
handler,
2020-07-13 13:06:52 -05:00
Parse.applicationId
);
};
/**
* Registers an after delete file function.
*
* **Available in Cloud Code only.**
*
* ```
* Parse.Cloud.afterDeleteFile(async (request) => {
* // code here
* })
*```
*
* @method afterDeleteFile
* @name Parse.Cloud.afterDeleteFile
* @param {Function} func The function to after before deleting a file. This function can be async and should take just one parameter, {@link Parse.Cloud.FileTriggerRequest}.
*/
2020-07-13 13:06:52 -05:00
ParseCloud.afterDeleteFile = function (handler) {
triggers.addFileTrigger(
triggers.Types.afterDeleteFile,
handler,
2020-07-13 13:06:52 -05:00
Parse.applicationId
);
};
/**
* Registers a before live query server connect function.
*
* **Available in Cloud Code only.**
*
* ```
* Parse.Cloud.beforeConnect(async (request) => {
* // code here
* })
*```
*
* @method beforeConnect
* @name Parse.Cloud.beforeConnect
* @param {Function} func The function to before connection is made. This function can be async and should take just one parameter, {@link Parse.Cloud.ConnectTriggerRequest}.
*/
ParseCloud.beforeConnect = function (handler) {
triggers.addConnectTrigger(
triggers.Types.beforeConnect,
handler,
Parse.applicationId
);
};
/**
* 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. {@link Parse.User}), you should pass the class itself and not the String for arg1.
* ```
* Parse.Cloud.beforeSubscribe('MyCustomClass', (request) => {
* // code here
* })
*
* Parse.Cloud.beforeSubscribe(Parse.User, (request) => {
* // code here
* })
*```
*
* @method beforeSubscribe
* @name Parse.Cloud.beforeSubscribe
* @param {(String|Parse.Object)} arg1 The Parse.Object subclass to register the before subscription function for. This can instead be a String that is the className of the subclass.
* @param {Function} func The function to run before a subscription. This function can be async and should take one parameter, a {@link Parse.Cloud.TriggerRequest}.
*/
ParseCloud.beforeSubscribe = function (parseClass, handler) {
var className = getClassName(parseClass);
triggers.addTrigger(
triggers.Types.beforeSubscribe,
className,
handler,
Parse.applicationId
);
};
2020-07-13 13:06:52 -05:00
ParseCloud.onLiveQueryEvent = function (handler) {
triggers.addLiveQueryEventHandler(handler, Parse.applicationId);
};
Create Cloud function afterLiveQueryEvent (#6859) * Before Connect + Before Subscribe #1 * Cleanup and Documentation * Add E2E tests * Bump parse to 2.15.0 * Create afterLiveQueryEvent * Revert "Create afterLiveQueryEvent" This reverts commit 828c678a6995216b843a75f5b3c864aec063ba43. * afterLiveQueryEvent * Add delete event * Fix failing tests * Fix lint * Update ParseLiveQueryServer.js * Remove Facebook AccountKit auth (#6870) * Remove Facebook AccountKit auth Account Kit services are no longer available. https://developers.facebook.com/blog/post/2019/09/09/account-kit-services-no-longer-available-starting-march/ https://www.sinch.com/blog/facebook-account-kit-is-closing-down-are-your-apps-covered/ * remove flaky test * fix: upgrade uuid from 8.2.0 to 8.3.0 (#6865) Snyk has created this PR to upgrade uuid from 8.2.0 to 8.3.0. See this package in npm: https://www.npmjs.com/package/uuid See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr Co-authored-by: Diamond Lewis <findlewis@gmail.com> * fix: package.json & package-lock.json to reduce vulnerabilities (#6864) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-LODASH-590103 Co-authored-by: Diamond Lewis <findlewis@gmail.com> * fix: upgrade ldapjs from 2.0.0 to 2.1.0 (#6857) Snyk has created this PR to upgrade ldapjs from 2.0.0 to 2.1.0. See this package in npm: https://www.npmjs.com/package/ldapjs See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr Co-authored-by: Diamond Lewis <findlewis@gmail.com> * fix: upgrade apollo-server-express from 2.15.1 to 2.16.0 (#6851) Snyk has created this PR to upgrade apollo-server-express from 2.15.1 to 2.16.0. See this package in npm: https://www.npmjs.com/package/apollo-server-express See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr Co-authored-by: Diamond Lewis <findlewis@gmail.com> * fix: upgrade @graphql-tools/stitch from 6.0.12 to 6.0.13 (#6845) Snyk has created this PR to upgrade @graphql-tools/stitch from 6.0.12 to 6.0.13. See this package in npm: https://www.npmjs.com/package/@graphql-tools/stitch See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr Co-authored-by: Diamond Lewis <findlewis@gmail.com> * fix: upgrade @graphql-tools/utils from 6.0.12 to 6.0.13 (#6846) Snyk has created this PR to upgrade @graphql-tools/utils from 6.0.12 to 6.0.13. See this package in npm: https://www.npmjs.com/package/@graphql-tools/utils See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr Co-authored-by: Diamond Lewis <findlewis@gmail.com> * [Snyk] Upgrade winston from 3.2.1 to 3.3.2 (#6799) * fix: upgrade winston from 3.2.1 to 3.3.2 Snyk has created this PR to upgrade winston from 3.2.1 to 3.3.2. See this package in NPM: https://www.npmjs.com/package/winston See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr * fix tests Co-authored-by: Diamond Lewis <findlewis@gmail.com> * afterLiveQueryEvent * Add delete event * Fix failing tests * Before Connect + Before Subscribe #1 * Cleanup and Documentation * Create afterLiveQueryEvent * Revert "Create afterLiveQueryEvent" This reverts commit 828c678a6995216b843a75f5b3c864aec063ba43. * Update ParseLiveQueryServer.js * Rebase * Remove return value / deduplicate tests * Add docs * Add additional data to trigger Co-authored-by: Diamond Lewis <findlewis@gmail.com> Co-authored-by: Snyk bot <snyk-bot@snyk.io>
2020-10-20 02:38:55 +11:00
/**
* Registers an after live query server event function.
*
* **Available in Cloud Code only.**
*
* ```
* Parse.Cloud.afterLiveQueryEvent('MyCustomClass', (request) => {
* // code here
* })
*```
*
* @method afterLiveQueryEvent
* @name Parse.Cloud.afterLiveQueryEvent
* @param {(String|Parse.Object)} arg1 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.
* @param {Function} func The function to run after a live query event. This function can be async and should take one parameter, a {@link Parse.Cloud.LiveQueryEventTrigger}.
*/
ParseCloud.afterLiveQueryEvent = function (parseClass, handler) {
const className = getClassName(parseClass);
triggers.addTrigger(
triggers.Types.afterEvent,
className,
handler,
Parse.applicationId
);
};
ParseCloud._removeAllHooks = () => {
triggers._unregisterAll();
};
ParseCloud.useMasterKey = () => {
// eslint-disable-next-line
console.warn(
'Parse.Cloud.useMasterKey is deprecated (and has no effect anymore) on parse-server, please refer to the cloud code migration notes: http://docs.parseplatform.org/parse-server/guide/#master-key-must-be-passed-explicitly'
);
};
ParseCloud.httpRequest = require('./httpRequest');
module.exports = ParseCloud;
/**
* @interface Parse.Cloud.TriggerRequest
* @property {String} installationId If set, the installationId triggering the request.
* @property {Boolean} master If true, means the master key was used.
* @property {Parse.User} user If set, the user that made the request.
* @property {Parse.Object} object The object triggering the hook.
* @property {String} ip The IP address of the client making the request.
* @property {Object} headers The original HTTP headers for the request.
* @property {String} triggerName The name of the trigger (`beforeSave`, `afterSave`, ...)
* @property {Object} log The current logger inside Parse Server.
* @property {Parse.Object} original If set, the object, as currently stored.
*/
/**
* @interface Parse.Cloud.FileTriggerRequest
* @property {String} installationId If set, the installationId triggering the request.
* @property {Boolean} master If true, means the master key was used.
* @property {Parse.User} user If set, the user that made the request.
* @property {Parse.File} file The file that triggered the hook.
* @property {Integer} fileSize The size of the file in bytes.
* @property {Integer} contentLength The value from Content-Length header
* @property {String} ip The IP address of the client making the request.
* @property {Object} headers The original HTTP headers for the request.
* @property {String} triggerName The name of the trigger (`beforeSaveFile`, `afterSaveFile`)
* @property {Object} log The current logger inside Parse Server.
*/
/**
* @interface Parse.Cloud.ConnectTriggerRequest
* @property {String} installationId If set, the installationId triggering the request.
* @property {Boolean} useMasterKey If true, means the master key was used.
* @property {Parse.User} user If set, the user that made the request.
* @property {Integer} clients The number of clients connected.
* @property {Integer} subscriptions The number of subscriptions connected.
* @property {String} sessionToken If set, the session of the user that made the request.
*/
Create Cloud function afterLiveQueryEvent (#6859) * Before Connect + Before Subscribe #1 * Cleanup and Documentation * Add E2E tests * Bump parse to 2.15.0 * Create afterLiveQueryEvent * Revert "Create afterLiveQueryEvent" This reverts commit 828c678a6995216b843a75f5b3c864aec063ba43. * afterLiveQueryEvent * Add delete event * Fix failing tests * Fix lint * Update ParseLiveQueryServer.js * Remove Facebook AccountKit auth (#6870) * Remove Facebook AccountKit auth Account Kit services are no longer available. https://developers.facebook.com/blog/post/2019/09/09/account-kit-services-no-longer-available-starting-march/ https://www.sinch.com/blog/facebook-account-kit-is-closing-down-are-your-apps-covered/ * remove flaky test * fix: upgrade uuid from 8.2.0 to 8.3.0 (#6865) Snyk has created this PR to upgrade uuid from 8.2.0 to 8.3.0. See this package in npm: https://www.npmjs.com/package/uuid See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr Co-authored-by: Diamond Lewis <findlewis@gmail.com> * fix: package.json & package-lock.json to reduce vulnerabilities (#6864) The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-LODASH-590103 Co-authored-by: Diamond Lewis <findlewis@gmail.com> * fix: upgrade ldapjs from 2.0.0 to 2.1.0 (#6857) Snyk has created this PR to upgrade ldapjs from 2.0.0 to 2.1.0. See this package in npm: https://www.npmjs.com/package/ldapjs See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr Co-authored-by: Diamond Lewis <findlewis@gmail.com> * fix: upgrade apollo-server-express from 2.15.1 to 2.16.0 (#6851) Snyk has created this PR to upgrade apollo-server-express from 2.15.1 to 2.16.0. See this package in npm: https://www.npmjs.com/package/apollo-server-express See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr Co-authored-by: Diamond Lewis <findlewis@gmail.com> * fix: upgrade @graphql-tools/stitch from 6.0.12 to 6.0.13 (#6845) Snyk has created this PR to upgrade @graphql-tools/stitch from 6.0.12 to 6.0.13. See this package in npm: https://www.npmjs.com/package/@graphql-tools/stitch See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr Co-authored-by: Diamond Lewis <findlewis@gmail.com> * fix: upgrade @graphql-tools/utils from 6.0.12 to 6.0.13 (#6846) Snyk has created this PR to upgrade @graphql-tools/utils from 6.0.12 to 6.0.13. See this package in npm: https://www.npmjs.com/package/@graphql-tools/utils See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr Co-authored-by: Diamond Lewis <findlewis@gmail.com> * [Snyk] Upgrade winston from 3.2.1 to 3.3.2 (#6799) * fix: upgrade winston from 3.2.1 to 3.3.2 Snyk has created this PR to upgrade winston from 3.2.1 to 3.3.2. See this package in NPM: https://www.npmjs.com/package/winston See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr * fix tests Co-authored-by: Diamond Lewis <findlewis@gmail.com> * afterLiveQueryEvent * Add delete event * Fix failing tests * Before Connect + Before Subscribe #1 * Cleanup and Documentation * Create afterLiveQueryEvent * Revert "Create afterLiveQueryEvent" This reverts commit 828c678a6995216b843a75f5b3c864aec063ba43. * Update ParseLiveQueryServer.js * Rebase * Remove return value / deduplicate tests * Add docs * Add additional data to trigger Co-authored-by: Diamond Lewis <findlewis@gmail.com> Co-authored-by: Snyk bot <snyk-bot@snyk.io>
2020-10-20 02:38:55 +11:00
/**
* @interface Parse.Cloud.LiveQueryEventTrigger
* @property {String} installationId If set, the installationId triggering the request.
* @property {Boolean} useMasterKey If true, means the master key was used.
* @property {Parse.User} user If set, the user that made the request.
* @property {String} sessionToken If set, the session of the user that made the request.
* @property {String} event The live query event that triggered the request.
* @property {Parse.Object} object The object triggering the hook.
* @property {Parse.Object} original If set, the object, as currently stored.
* @property {Integer} clients The number of clients connected.
* @property {Integer} subscriptions The number of subscriptions connected.
*/
/**
* @interface Parse.Cloud.BeforeFindRequest
* @property {String} installationId If set, the installationId triggering the request.
* @property {Boolean} master If true, means the master key was used.
* @property {Parse.User} user If set, the user that made the request.
* @property {Parse.Query} query The query triggering the hook.
* @property {String} ip The IP address of the client making the request.
* @property {Object} headers The original HTTP headers for the request.
* @property {String} triggerName The name of the trigger (`beforeSave`, `afterSave`, ...)
* @property {Object} log The current logger inside Parse Server.
* @property {Boolean} isGet wether the query a `get` or a `find`
*/
/**
* @interface Parse.Cloud.AfterFindRequest
* @property {String} installationId If set, the installationId triggering the request.
* @property {Boolean} master If true, means the master key was used.
* @property {Parse.User} user If set, the user that made the request.
* @property {Parse.Query} query The query triggering the hook.
* @property {Array<Parse.Object>} results The results the query yielded.
* @property {String} ip The IP address of the client making the request.
* @property {Object} headers The original HTTP headers for the request.
* @property {String} triggerName The name of the trigger (`beforeSave`, `afterSave`, ...)
* @property {Object} log The current logger inside Parse Server.
*/
/**
* @interface Parse.Cloud.FunctionRequest
* @property {String} installationId If set, the installationId triggering the request.
* @property {Boolean} master If true, means the master key was used.
* @property {Parse.User} user If set, the user that made the request.
* @property {Object} params The params passed to the cloud function.
*/
/**
* @interface Parse.Cloud.JobRequest
* @property {Object} params The params passed to the background job.
* @property {function} message If message is called with a string argument, will update the current message to be stored in the job status.
*/