MCPcopy Index your code
hub / github.com/parse-community/parse-server / getStore

Function getStore

src/triggers.js:100–122  ·  view source on GitHub ↗
(category, name, applicationId)

Source from the content-addressed store, hash-verified

98};
99
100function getStore(category, name, applicationId) {
101 const invalidNameRegex = /['"`]/;
102 if (invalidNameRegex.test(name)) {
103 // Prevent a malicious user from injecting properties into the store
104 return createStore();
105 }
106
107 const path = name.split('.');
108 path.splice(-1); // remove last component
109 applicationId = applicationId || Parse.applicationId;
110 _triggerStore[applicationId] = _triggerStore[applicationId] || baseStore();
111 let store = _triggerStore[applicationId][category];
112 for (const component of path) {
113 if (!Object.prototype.hasOwnProperty.call(store, component)) {
114 return createStore();
115 }
116 store = store[component];
117 if (!store || Object.getPrototypeOf(store) !== null) {
118 return createStore();
119 }
120 }
121 return store;
122}
123
124function add(category, name, handler, applicationId) {
125 const lastComponent = name.split('.').splice(-1);

Callers 3

addFunction · 0.85
removeFunction · 0.85
getFunction · 0.85

Calls 2

createStoreFunction · 0.85
baseStoreFunction · 0.85

Tested by

no test coverage detected