(object, className)
| 186 | } |
| 187 | |
| 188 | export function toJSONwithObjects(object, className) { |
| 189 | if (!object || !object.toJSON) { |
| 190 | return {}; |
| 191 | } |
| 192 | const toJSON = object.toJSON(); |
| 193 | const stateController = Parse.CoreManager.getObjectStateController(); |
| 194 | const [pending] = stateController.getPendingOps(object._getStateIdentifier()); |
| 195 | for (const key in pending) { |
| 196 | const val = object.get(key); |
| 197 | if (!val || !val._toFullJSON) { |
| 198 | toJSON[key] = val; |
| 199 | continue; |
| 200 | } |
| 201 | toJSON[key] = val._toFullJSON(); |
| 202 | } |
| 203 | // Preserve original object's className if no override className is provided |
| 204 | if (className) { |
| 205 | toJSON.className = className; |
| 206 | } else if (object.className && !toJSON.className) { |
| 207 | toJSON.className = object.className; |
| 208 | } |
| 209 | return toJSON; |
| 210 | } |
| 211 | |
| 212 | export function getTrigger(className, triggerType, applicationId) { |
| 213 | if (!applicationId) { |
no test coverage detected