backend-manager 2.5.63 → 2.5.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[debug] [2023-03-24T23:10:48.343Z] ----------------------------------------------------------------------
|
|
2
|
+
[debug] [2023-03-24T23:10:48.344Z] Command: /Users/ian/.nvm/versions/node/v16.17.0/bin/node /Users/ian/.nvm/versions/node/v16.17.0/bin/firebase deploy
|
|
3
|
+
[debug] [2023-03-24T23:10:48.344Z] CLI Version: 11.8.0
|
|
4
|
+
[debug] [2023-03-24T23:10:48.344Z] Platform: darwin
|
|
5
|
+
[debug] [2023-03-24T23:10:48.345Z] Node Version: v16.17.0
|
|
6
|
+
[debug] [2023-03-24T23:10:48.346Z] Time: Fri Mar 24 2023 16:10:48 GMT-0700 (Pacific Daylight Time)
|
|
7
|
+
[debug] [2023-03-24T23:10:48.347Z] ----------------------------------------------------------------------
|
|
8
|
+
[debug]
|
|
9
|
+
[error]
|
|
10
|
+
[error] Error: Not in a Firebase app directory (could not locate firebase.json)
|
package/package.json
CHANGED
|
@@ -10,28 +10,20 @@ Module.prototype.main = function () {
|
|
|
10
10
|
const payload = self.payload;
|
|
11
11
|
|
|
12
12
|
return new Promise(async function(resolve, reject) {
|
|
13
|
+
payload.data.payload.path = `${payload.data.payload.path || ''}`;
|
|
14
|
+
payload.data.payload.options = payload.data.payload.options || {};
|
|
13
15
|
|
|
14
|
-
if (payload.user.roles.admin) {
|
|
15
|
-
|
|
16
|
-
payload.data.payload.path = `${payload.data.payload.path || ''}`;
|
|
17
|
-
payload.data.payload.options = payload.data.payload.options || {};
|
|
18
|
-
|
|
19
|
-
if (!payload.data.payload.path) {
|
|
20
|
-
return reject(assistant.errorManager(`<path> parameter required`, {code: 400, sentry: false, send: false, log: false}).error)
|
|
21
|
-
} else {
|
|
22
|
-
|
|
23
|
-
self.libraries.admin.database().ref(payload.data.payload.path)
|
|
24
|
-
.on('value', (snapshot) => {
|
|
25
|
-
const data = snapshot.val();
|
|
26
|
-
return resolve({data: data});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
} else {
|
|
16
|
+
if (!payload.user.roles.admin) {
|
|
32
17
|
return reject(assistant.errorManager(`Admin required.`, {code: 401, sentry: false, send: false, log: false}).error)
|
|
18
|
+
} else if (!payload.data.payload.path) {
|
|
19
|
+
return reject(assistant.errorManager(`<path> parameter required`, {code: 400, sentry: false, send: false, log: false}).error)
|
|
33
20
|
}
|
|
34
21
|
|
|
22
|
+
self.libraries.admin.database().ref(payload.data.payload.path)
|
|
23
|
+
.on('value', (snapshot) => {
|
|
24
|
+
const data = snapshot.val();
|
|
25
|
+
return resolve({data: data});
|
|
26
|
+
});
|
|
35
27
|
});
|
|
36
28
|
|
|
37
29
|
};
|
|
@@ -10,32 +10,24 @@ Module.prototype.main = function () {
|
|
|
10
10
|
const payload = self.payload;
|
|
11
11
|
|
|
12
12
|
return new Promise(async function(resolve, reject) {
|
|
13
|
+
payload.data.payload.path = `${payload.data.payload.path || ''}`;
|
|
14
|
+
payload.data.payload.document = payload.data.payload.document || {};
|
|
15
|
+
payload.data.payload.options = payload.data.payload.options || {};
|
|
13
16
|
|
|
14
17
|
if (payload.user.roles.admin) {
|
|
15
|
-
|
|
16
|
-
payload.data.payload.path = `${payload.data.payload.path || ''}`;
|
|
17
|
-
payload.data.payload.document = payload.data.payload.document || {};
|
|
18
|
-
payload.data.payload.options = payload.data.payload.options || {};
|
|
19
|
-
|
|
20
|
-
if (!payload.data.payload.path) {
|
|
21
|
-
return reject(assistant.errorManager(`<path> parameter required`, {code: 400, sentry: false, send: false, log: false}).error)
|
|
22
|
-
} else {
|
|
23
|
-
|
|
24
|
-
self.libraries.admin.database().ref(payload.data.payload.path)
|
|
25
|
-
.set(payload.data.payload.document)
|
|
26
|
-
.then(() => {
|
|
27
|
-
return resolve({data: payload.data.payload.document});
|
|
28
|
-
})
|
|
29
|
-
.catch((e) => {
|
|
30
|
-
return reject(assistant.errorManager(e, {code: 500, sentry: false, send: false, log: false}).error)
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
} else {
|
|
36
18
|
return reject(assistant.errorManager(`Admin required.`, {code: 401, sentry: false, send: false, log: false}).error)
|
|
19
|
+
} else if (!payload.data.payload.path) {
|
|
20
|
+
return reject(assistant.errorManager(`<path> parameter required`, {code: 400, sentry: false, send: false, log: false}).error);
|
|
37
21
|
}
|
|
38
22
|
|
|
23
|
+
self.libraries.admin.database().ref(payload.data.payload.path)
|
|
24
|
+
.set(payload.data.payload.document)
|
|
25
|
+
.then(() => {
|
|
26
|
+
return resolve({data: payload.data.payload.document});
|
|
27
|
+
})
|
|
28
|
+
.catch((e) => {
|
|
29
|
+
return reject(assistant.errorManager(e, {code: 500, sentry: false, send: false, log: false}).error)
|
|
30
|
+
});
|
|
39
31
|
});
|
|
40
32
|
|
|
41
33
|
};
|
|
@@ -220,18 +220,18 @@ Module.prototype.resolveCommand = function (command) {
|
|
|
220
220
|
|
|
221
221
|
command = command || '';
|
|
222
222
|
|
|
223
|
-
|
|
224
|
-
const
|
|
223
|
+
// Check local path
|
|
224
|
+
const resolvedPath = resolveApiPath(command);
|
|
225
225
|
|
|
226
226
|
// if (!command || command === 'error:error') {
|
|
227
|
-
if (!
|
|
228
|
-
self.assistant.log(`This command does not exist: ${originalCommand} => ${command} @ ${
|
|
227
|
+
if (!resolvedPath) {
|
|
228
|
+
self.assistant.log(`This command does not exist: ${originalCommand} => ${command} @ ${resolvedPath}`, {environment: 'production'})
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
return {
|
|
232
232
|
command: command,
|
|
233
233
|
path: resolvedPath,
|
|
234
|
-
exists: !!
|
|
234
|
+
exists: !!resolvedPath,
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -290,4 +290,27 @@ function _fixStatus(status) {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
function resolveBasePath(basePath, command) {
|
|
294
|
+
const sanitizedCommand = command.replace(/\.\.\//g, '').replace(/\:/, '/');
|
|
295
|
+
const resolvedPath = path.join(basePath, `${sanitizedCommand}.js`);
|
|
296
|
+
|
|
297
|
+
return resolvedPath;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
function resolveApiPath(command) {
|
|
301
|
+
const projectBasePath = path.join(process.cwd(), 'methods/api');
|
|
302
|
+
const localBasePath = './api/';
|
|
303
|
+
|
|
304
|
+
const projectPath = resolveBasePath(projectBasePath, command);
|
|
305
|
+
const localPath = path.join(__dirname, resolveBasePath(localBasePath, command));
|
|
306
|
+
|
|
307
|
+
if (jetpack.exists(projectPath)) {
|
|
308
|
+
return projectPath;
|
|
309
|
+
} else if (jetpack.exists(localPath)) {
|
|
310
|
+
return localPath;
|
|
311
|
+
} else {
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
|
|
293
316
|
module.exports = Module;
|