From ca7bcb1a8f6b92d32bc477a7cc89fba3d167c3cc Mon Sep 17 00:00:00 2001 From: Brian McGonagill Date: Tue, 24 Jun 2025 13:16:42 -0500 Subject: [PATCH 1/3] working on tasks for meteor 3 update --- client/MyTasks/myTasksForm.js | 2 +- imports/api/tasks.js | 30 ++++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/client/MyTasks/myTasksForm.js b/client/MyTasks/myTasksForm.js index 05ce454..6f4e6e3 100644 --- a/client/MyTasks/myTasksForm.js +++ b/client/MyTasks/myTasksForm.js @@ -47,7 +47,7 @@ Template.myTasksForm.events({ } } - console.log("Date Error: " + taskDateErr + " - Name Error: " + taskNameErr); + // console.log("Date Error: " + taskDateErr + " - Name Error: " + taskNameErr); if (taskDateErr == false && taskNameErr == false) { const addTask = async() => { let result = await Meteor.callAsync("add.task", taskNameArray, "self", "selfId", taskDateArray, actDate); diff --git a/imports/api/tasks.js b/imports/api/tasks.js index eb49df3..7bb2037 100644 --- a/imports/api/tasks.js +++ b/imports/api/tasks.js @@ -25,6 +25,7 @@ Meteor.methods({ } let username; + let usInfo; if (assignedTo == "self") { const uInfo = async() => { @@ -34,21 +35,29 @@ Meteor.methods({ } else { username = userInfo.profile.fullname; assignedToId = this.userId; + let usInf = { "username": username, "assignedToId": assignedToId }; + console.log("setting username = " + username +", and id = " + assignedToId); + return usInf; } } - uInfo(); + usInfo = uInfo(); + console.dir(usInfo); } else { username = assignedTo; + usInfo = { "username": assignedTo, "assignedToId": assignedToId }; + console.log("Set username = " + assignedTo); } - for (i=0; i < taskDateArr.length; i++) { - for (j=0; j < taskNameArr.length; j++) { + console.log("assignedToId = " + usInfo.assignedToId); + + for (let i=0; i < taskDateArr.length; i++) { + for (let j=0; j < taskNameArr.length; j++) { TaskItems.insertAsync({ taskName: taskNameArr[j].id, taskDate: taskDateArr[i], actualDate: actDate[i], - assignedTo: username, - assignedToId: assignedToId, + assignedTo: usInfo.username, + assignedToId: usInfo.assignedToId, isComplete: false, completedOn: null, assignedOn: new Date(), @@ -56,6 +65,7 @@ Meteor.methods({ }); } } + return; }, 'add.mytask' (taskName, assignedTo, assignedToId, taskDate, actDate) { check(taskName, String); @@ -67,6 +77,7 @@ Meteor.methods({ } let username; + let usInfo; if (assignedTo == "self") { const uInfo = async() => { @@ -76,19 +87,22 @@ Meteor.methods({ } else { username = userInfo.profile.fullname; assignedToId = this.userId; + let usinf = { username: username, assignedToId: assignedToId }; + return usinf; } } - uInfo(); + usInfo = uInfo(); } else { username = assignedTo; + usInfo = { username: assignedTo, assignedToId: assignedToId }; } return TaskItems.insertAsync({ taskName: taskName, taskDate: taskDate, actualDate: actDate, - assignedTo: username, - assignedToId: assignedToId, + assignedTo: usInfo.username, + assignedToId: usInfo.assignedToId, isComplete: false, completedOn: null, assignedOn: new Date(), From febb36d75f115f4de2641be44ced2a6d18ae6453 Mon Sep 17 00:00:00 2001 From: Brian McGonagill Date: Tue, 22 Jul 2025 08:34:24 -0500 Subject: [PATCH 2/3] Fixing add task calls for async await --- client/AdminMgmt/Tasks/taskForm.html | 4 +- client/AdminMgmt/Tasks/taskForm.js | 1 - client/MyTasks/myTasksForm.js | 42 +- imports/api/tasks.js | 107 +-- package-lock.json | 953 ++++++++++++++++----------- 5 files changed, 623 insertions(+), 484 deletions(-) diff --git a/client/AdminMgmt/Tasks/taskForm.html b/client/AdminMgmt/Tasks/taskForm.html index 596451c..dc520fb 100644 --- a/client/AdminMgmt/Tasks/taskForm.html +++ b/client/AdminMgmt/Tasks/taskForm.html @@ -3,7 +3,7 @@
-
+
-
+
diff --git a/client/AdminMgmt/Tasks/taskForm.js b/client/AdminMgmt/Tasks/taskForm.js index c5a6a0f..2ff956e 100644 --- a/client/AdminMgmt/Tasks/taskForm.js +++ b/client/AdminMgmt/Tasks/taskForm.js @@ -69,7 +69,6 @@ Template.taskForm.events({ let taskDateErr = false; let userInfo; let actDate = []; - // console.dir(taskNameArr); if (taskNameArr == null || taskNameArr == []) { taskNameErr = true; diff --git a/client/MyTasks/myTasksForm.js b/client/MyTasks/myTasksForm.js index 6f4e6e3..d0ce6db 100644 --- a/client/MyTasks/myTasksForm.js +++ b/client/MyTasks/myTasksForm.js @@ -33,36 +33,26 @@ Template.myTasksForm.events({ let taskDateArray = Session.get("taskDateArr"); let actDate = []; + console.dir(taskNameArray); + console.dir(taskDateArray); + if (taskNameArray == null || taskNameArray == [] || taskNameArray == "") { taskNameErr = true; } if (taskDateArray == null || taskDateArray == []|| taskDateArray == "") { taskDateErr = true; - } else { - for (let i = 0; i < taskDateArray.length; i++) { - // console.log(taskDateArray[i]); - let actDateTask = new Date(taskDateArray[i]); - actDate.push(actDateTask); - } } // console.log("Date Error: " + taskDateErr + " - Name Error: " + taskNameErr); if (taskDateErr == false && taskNameErr == false) { - const addTask = async() => { - let result = await Meteor.callAsync("add.task", taskNameArray, "self", "selfId", taskDateArray, actDate); - if (!result) { - console.log(" ERROR adding task for self: "); - showSnackbar("Error adding task for self!", "red"); - } else { - console.log(" SUCCESS adding task for self."); - Session.set("taskDateArr", []); - $("#myTaskName").val(""); - $("#myTaskDate").val(""); - showSnackbar("Added Tasks Successfully!", "green"); + for (const task of taskNameArray) { + for (const date of taskDateArray) { + let actDate = new Date(date); + + addTask(task.id, date, actDate); } } - addTask(); } else { showSnackbar("Error! Both Task & Date are Required!", "red"); } @@ -93,4 +83,18 @@ Template.myTasksForm.events({ taskDateArr.push(taskDate); Session.set("taskDateArr", taskDateArr); }, -}); \ No newline at end of file +}); + +const addTask = async(task, date, actDate) => { + let result = await Meteor.callAsync("add.myTask", task, date, actDate); + if (!result) { + console.log(" ERROR adding task for self: "); + showSnackbar("Error adding task for self!", "red"); + } else { + console.log(" SUCCESS adding task for self."); + // Session.set("taskDateArr", []); + // $("#myTaskName").val(""); + // $("#myTaskDate").val(""); + showSnackbar("Added Tasks Successfully!", "green"); + } +} \ No newline at end of file diff --git a/imports/api/tasks.js b/imports/api/tasks.js index 7bb2037..1fece81 100644 --- a/imports/api/tasks.js +++ b/imports/api/tasks.js @@ -13,7 +13,7 @@ TaskItems.allow({ }); Meteor.methods({ - 'add.task' (taskNameArr, assignedTo, assignedToId, taskDateArr, actDate) { + async 'add.task' (taskNameArr, assignedTo, assignedToId, taskDateArr, actDate) { check(taskNameArr, [Object]); check(assignedTo, String); check(taskDateArr, [String]); @@ -23,41 +23,15 @@ Meteor.methods({ if (!this.userId) { throw new Meteor.Error('You are not allowed to add tasks. Make sure you are logged in with valid user credentials.'); } - - let username; - let usInfo; - - if (assignedTo == "self") { - const uInfo = async() => { - let userInfo = await Meteor.users.findOneAsync({ _id: this.userId }); - if (!userInfo) { - console.log("No matching user info found.") - } else { - username = userInfo.profile.fullname; - assignedToId = this.userId; - let usInf = { "username": username, "assignedToId": assignedToId }; - console.log("setting username = " + username +", and id = " + assignedToId); - return usInf; - } - } - usInfo = uInfo(); - console.dir(usInfo); - } else { - username = assignedTo; - usInfo = { "username": assignedTo, "assignedToId": assignedToId }; - console.log("Set username = " + assignedTo); - } - - console.log("assignedToId = " + usInfo.assignedToId); - + for (let i=0; i < taskDateArr.length; i++) { for (let j=0; j < taskNameArr.length; j++) { - TaskItems.insertAsync({ + await TaskItems.insertAsync({ taskName: taskNameArr[j].id, taskDate: taskDateArr[i], actualDate: actDate[i], - assignedTo: usInfo.username, - assignedToId: usInfo.assignedToId, + assignedTo: assignedTo, + assignedToId: assignedToId, isComplete: false, completedOn: null, assignedOn: new Date(), @@ -65,9 +39,8 @@ Meteor.methods({ }); } } - return; }, - 'add.mytask' (taskName, assignedTo, assignedToId, taskDate, actDate) { + async 'add.myTask' (taskName, taskDate, actDate) { check(taskName, String); check(taskDate, String); check(actDate, Date); @@ -76,40 +49,28 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to add tasks. Make sure you are logged in with valid user credentials.'); } - let username; - let usInfo; - - if (assignedTo == "self") { - const uInfo = async() => { - let userInfo = await Meteor.users.findOneAsync({ _id: this.userId }); - if (!userInfo) { - console.log("No matching user info found.") - } else { - username = userInfo.profile.fullname; - assignedToId = this.userId; - let usinf = { username: username, assignedToId: assignedToId }; - return usinf; - } - } - usInfo = uInfo(); + let userInfo = await Meteor.users.findOneAsync({ _id: this.userId }); + if (!userInfo) { + console.log("No matching user info found.") } else { - username = assignedTo; - usInfo = { username: assignedTo, assignedToId: assignedToId }; + try { + return await TaskItems.insertAsync({ + taskName: taskName, + taskDate: taskDate, + actualDate: actDate, + assignedTo: userInfo.profile.fullname, + assignedToId: this.userId, + isComplete: false, + completedOn: null, + assignedOn: new Date(), + assignedBy: this.userId, + }); + } catch(error) { + console.log(" ERROR adding tasksL " + error.message); + } } - - return TaskItems.insertAsync({ - taskName: taskName, - taskDate: taskDate, - actualDate: actDate, - assignedTo: usInfo.username, - assignedToId: usInfo.assignedToId, - isComplete: false, - completedOn: null, - assignedOn: new Date(), - assignedBy: this.userId, - }); }, - 'edit.task' (taskId, taskName, assignedTo, taskDate) { + async 'edit.task' (taskId, taskName, assignedTo, taskDate) { check(taskId, String); check(taskName, String); check(assignedTo, String); @@ -119,7 +80,7 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to edit tasks. Make sure you are logged in with valid user credentials.'); } - return TaskItems.updateAsync({ _id: taskId }, { + return await TaskItems.updateAsync({ _id: taskId }, { $set: { taskName: taskName, taskDate: taskDate, @@ -129,23 +90,23 @@ Meteor.methods({ } }); }, - 'delete.task' (taskId) { + async 'delete.task' (taskId) { check(taskId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to delete tasks. Make sure you are logged in with valid user credentials.'); } - return TaskItems.removeAsync({ _id: taskId }); + return await TaskItems.removeAsync({ _id: taskId }); }, - 'markTask.complete' (taskId) { + async 'markTask.complete' (taskId) { check(taskId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to mark tasks complete. Make sure you are logged in with valid user credentials.'); } - return TaskItems.updateAsync({ _id: taskId }, { + return await TaskItems.updateAsync({ _id: taskId }, { $set: { isComplete: true, completedOn: new Date(), @@ -153,14 +114,14 @@ Meteor.methods({ } }); }, - 'markTask.notComplete' (taskId) { + async 'markTask.notComplete' (taskId) { check(taskId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to mark tasks not complete. Make sure you are logged in with valid user credentials.'); } - return TaskItems.updateAsync({ _id: taskId }, { + return await TaskItems.updateAsync({ _id: taskId }, { $set: { isComplete: false, markedUncomplteOn: new Date(), @@ -168,7 +129,7 @@ Meteor.methods({ } }); }, - 'clean.Tasks' (timeFrame) { + async 'clean.Tasks' (timeFrame) { check(timeFrame, String); if (!this.userId) { @@ -202,6 +163,6 @@ Meteor.methods({ break; } - return TaskItems.removeAsync({ actualDate: { $lt: new Date((new Date()) - upToDate )}}); + return await TaskItems.removeAsync({ actualDate: { $lt: new Date((new Date()) - upToDate )}}); } }); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index f2a6116..0d65189 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,12 +16,10 @@ } }, "node_modules/@babel/runtime": { - "version": "7.15.4", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.4.tgz", - "integrity": "sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw==", - "dependencies": { - "regenerator-runtime": "^0.13.4" - }, + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.6.tgz", + "integrity": "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q==", + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -29,22 +27,26 @@ "node_modules/addressparser": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/addressparser/-/addressparser-1.0.1.tgz", - "integrity": "sha512-aQX7AISOMM7HFE0iZ3+YnD07oIeJqWGVnJ+ZIKaBZAk03ftmVYVqsGas/rbXKR21n4D/hKCSHypvcyOkds/xzg==" + "integrity": "sha512-aQX7AISOMM7HFE0iZ3+YnD07oIeJqWGVnJ+ZIKaBZAk03ftmVYVqsGas/rbXKR21n4D/hKCSHypvcyOkds/xzg==", + "license": "MIT" }, "node_modules/array-indexofobject": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/array-indexofobject/-/array-indexofobject-0.0.1.tgz", - "integrity": "sha512-tpdPBIBm4TMNxSp8O3pZgC7mF4+wn9SmJlhE+7bi5so6x39PvzUqChQMbv93R5ilYGZ1HV+Neki4IH/i+87AoQ==" + "integrity": "sha512-tpdPBIBm4TMNxSp8O3pZgC7mF4+wn9SmJlhE+7bi5so6x39PvzUqChQMbv93R5ilYGZ1HV+Neki4IH/i+87AoQ==", + "license": "MIT" }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" }, "node_modules/feedparser": { "version": "2.2.10", "resolved": "https://registry.npmjs.org/feedparser/-/feedparser-2.2.10.tgz", "integrity": "sha512-WoAOooa61V8/xuKMi2pEtK86qQ3ZH/M72EEGdqlOTxxb3m6ve1NPvZcmPFs3wEDfcBbFLId2GqZ4YjsYi+h1xA==", + "license": "MIT", "dependencies": { "addressparser": "^1.0.1", "array-indexofobject": "~0.0.1", @@ -66,50 +68,57 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" }, "node_modules/jquery": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", - "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", + "license": "MIT" }, "node_modules/lodash.assign": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", - "integrity": "sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==" + "integrity": "sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==", + "license": "MIT" }, "node_modules/lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", - "deprecated": "This package is deprecated. Use the optional chaining (?.) operator instead." + "deprecated": "This package is deprecated. Use the optional chaining (?.) operator instead.", + "license": "MIT" }, "node_modules/lodash.has": { "version": "4.5.2", "resolved": "https://registry.npmjs.org/lodash.has/-/lodash.has-4.5.2.tgz", - "integrity": "sha512-rnYUdIo6xRCJnQmbVFEwcxF144erlD+M3YcJUVesflU9paQaE8p+fJDcIQrlMYbxoANFL+AB9hZrzSBBk5PL+g==" + "integrity": "sha512-rnYUdIo6xRCJnQmbVFEwcxF144erlD+M3YcJUVesflU9paQaE8p+fJDcIQrlMYbxoANFL+AB9hZrzSBBk5PL+g==", + "license": "MIT" }, "node_modules/lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", - "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==" + "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", + "license": "MIT" }, "node_modules/meteor-node-stubs": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/meteor-node-stubs/-/meteor-node-stubs-1.2.5.tgz", - "integrity": "sha512-FLlOFZx3KnZ5s3yPCK+x58DyX9ewN+oQ12LcpwBXMLtzJ/YyprMQVivd6KIrahZbKJrNenPNUGuDS37WUFg+Mw==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/meteor-node-stubs/-/meteor-node-stubs-1.2.19.tgz", + "integrity": "sha512-lryhEAPp7aysrC0j3XU1yTs92ktPQQhzQzLVz3OGQEZjL//iLhvJyeYNSvV01XJn6fXUXe48agossxniJkzYOQ==", "bundleDependencies": [ + "@meteorjs/crypto-browserify", "assert", "browserify-zlib", "buffer", "console-browserify", "constants-browserify", - "crypto-browserify", "domain-browser", "events", "https-browserify", @@ -128,64 +137,167 @@ "util", "vm-browserify" ], + "license": "MIT", "dependencies": { - "assert": "^2.0.0", + "@meteorjs/crypto-browserify": "^3.12.1", + "assert": "^2.1.0", "browserify-zlib": "^0.2.0", "buffer": "^5.7.1", "console-browserify": "^1.2.0", "constants-browserify": "^1.0.0", - "crypto-browserify": "^3.12.0", - "domain-browser": "^4.22.0", - "elliptic": "^6.5.4", + "domain-browser": "^4.23.0", "events": "^3.3.0", "https-browserify": "^1.0.0", "os-browserify": "^0.3.0", - "path-browserify": "^1.0.0", + "path-browserify": "^1.0.1", "process": "^0.11.10", "punycode": "^1.4.1", "querystring-es3": "^0.2.1", - "readable-stream": "^3.6.0", + "readable-stream": "^3.6.2", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", "string_decoder": "^1.3.0", "timers-browserify": "^2.0.12", "tty-browserify": "0.0.1", - "url": "^0.11.0", - "util": "^0.12.4", + "url": "^0.11.4", + "util": "^0.12.5", "vm-browserify": "^1.1.2" } }, + "node_modules/meteor-node-stubs/node_modules/@meteorjs/browserify-sign": { + "version": "4.2.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "bn.js": "^5.2.1", + "brorand": "^1.1.0", + "browserify-rsa": "^4.1.0", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "hash-base": "~3.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1", + "parse-asn1": "^5.1.7", + "readable-stream": "^2.3.8", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/meteor-node-stubs/node_modules/@meteorjs/browserify-sign/node_modules/readable-stream": { + "version": "2.3.8", + "inBundle": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/meteor-node-stubs/node_modules/@meteorjs/browserify-sign/node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/meteor-node-stubs/node_modules/@meteorjs/browserify-sign/node_modules/string_decoder": { + "version": "1.1.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/meteor-node-stubs/node_modules/@meteorjs/browserify-sign/node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/meteor-node-stubs/node_modules/@meteorjs/create-ecdh": { + "version": "4.0.5", + "inBundle": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/meteor-node-stubs/node_modules/@meteorjs/create-ecdh/node_modules/bn.js": { + "version": "4.12.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/meteor-node-stubs/node_modules/@meteorjs/crypto-browserify": { + "version": "3.12.4", + "inBundle": true, + "license": "MIT", + "dependencies": { + "@meteorjs/browserify-sign": "^4.2.3", + "@meteorjs/create-ecdh": "^4.0.4", + "browserify-cipher": "^1.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "diffie-hellman": "^5.0.3", + "hash-base": "~3.0.4", + "inherits": "^2.0.4", + "pbkdf2": "^3.1.2", + "public-encrypt": "^4.0.3", + "randombytes": "^2.1.0", + "randomfill": "^1.0.4" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/meteor-node-stubs/node_modules/asn1.js": { - "version": "5.4.1", + "version": "4.10.1", "inBundle": true, "license": "MIT", "dependencies": { "bn.js": "^4.0.0", "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" + "minimalistic-assert": "^1.0.0" } }, "node_modules/meteor-node-stubs/node_modules/asn1.js/node_modules/bn.js": { - "version": "4.12.0", + "version": "4.12.2", "inBundle": true, "license": "MIT" }, "node_modules/meteor-node-stubs/node_modules/assert": { - "version": "2.0.0", + "version": "2.1.0", "inBundle": true, "license": "MIT", "dependencies": { - "es6-object-assign": "^1.1.0", - "is-nan": "^1.2.1", - "object-is": "^1.0.1", - "util": "^0.12.0" + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" } }, "node_modules/meteor-node-stubs/node_modules/available-typed-arrays": { - "version": "1.0.4", + "version": "1.0.7", "inBundle": true, "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -213,7 +325,7 @@ "license": "MIT" }, "node_modules/meteor-node-stubs/node_modules/bn.js": { - "version": "5.2.0", + "version": "5.2.2", "inBundle": true, "license": "MIT" }, @@ -257,28 +369,16 @@ } }, "node_modules/meteor-node-stubs/node_modules/browserify-rsa": { - "version": "4.1.0", + "version": "4.1.1", "inBundle": true, "license": "MIT", "dependencies": { - "bn.js": "^5.0.0", - "randombytes": "^2.0.1" - } - }, - "node_modules/meteor-node-stubs/node_modules/browserify-sign": { - "version": "4.2.1", - "inBundle": true, - "license": "ISC", - "dependencies": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" + "bn.js": "^5.2.1", + "randombytes": "^2.1.0", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" } }, "node_modules/meteor-node-stubs/node_modules/browserify-zlib": { @@ -323,24 +423,59 @@ "license": "MIT" }, "node_modules/meteor-node-stubs/node_modules/call-bind": { + "version": "1.0.8", + "inBundle": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/meteor-node-stubs/node_modules/call-bind-apply-helpers": { "version": "1.0.2", "inBundle": true, "license": "MIT", "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/meteor-node-stubs/node_modules/call-bound": { + "version": "1.0.4", + "inBundle": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/meteor-node-stubs/node_modules/cipher-base": { - "version": "1.0.4", + "version": "1.0.6", "inBundle": true, "license": "MIT", "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" } }, "node_modules/meteor-node-stubs/node_modules/console-browserify": { @@ -352,17 +487,8 @@ "inBundle": true, "license": "MIT" }, - "node_modules/meteor-node-stubs/node_modules/create-ecdh": { - "version": "4.0.4", - "inBundle": true, - "license": "MIT", - "dependencies": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.3" - } - }, - "node_modules/meteor-node-stubs/node_modules/create-ecdh/node_modules/bn.js": { - "version": "4.12.0", + "node_modules/meteor-node-stubs/node_modules/core-util-is": { + "version": "1.0.3", "inBundle": true, "license": "MIT" }, @@ -391,40 +517,40 @@ "sha.js": "^2.4.8" } }, - "node_modules/meteor-node-stubs/node_modules/crypto-browserify": { - "version": "3.12.0", + "node_modules/meteor-node-stubs/node_modules/define-data-property": { + "version": "1.1.4", "inBundle": true, "license": "MIT", "dependencies": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - }, - "engines": { - "node": "*" - } - }, - "node_modules/meteor-node-stubs/node_modules/define-properties": { - "version": "1.1.3", - "inBundle": true, - "license": "MIT", - "dependencies": { - "object-keys": "^1.0.12" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/meteor-node-stubs/node_modules/define-properties": { + "version": "1.2.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/meteor-node-stubs/node_modules/des.js": { - "version": "1.0.1", + "version": "1.1.0", "inBundle": true, "license": "MIT", "dependencies": { @@ -443,14 +569,14 @@ } }, "node_modules/meteor-node-stubs/node_modules/diffie-hellman/node_modules/bn.js": { - "version": "4.12.0", + "version": "4.12.2", "inBundle": true, "license": "MIT" }, "node_modules/meteor-node-stubs/node_modules/domain-browser": { - "version": "4.22.0", + "version": "4.23.0", "inBundle": true, - "license": "MIT", + "license": "Artistic-2.0", "engines": { "node": ">=10" }, @@ -458,75 +584,46 @@ "url": "https://bevry.me/fund" } }, - "node_modules/meteor-node-stubs/node_modules/elliptic": { - "version": "6.5.4", + "node_modules/meteor-node-stubs/node_modules/dunder-proto": { + "version": "1.0.1", "inBundle": true, "license": "MIT", "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/meteor-node-stubs/node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "inBundle": true, - "license": "MIT" - }, - "node_modules/meteor-node-stubs/node_modules/es-abstract": { - "version": "1.18.3", - "inBundle": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "is-callable": "^1.2.3", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.3", - "is-string": "^1.0.6", - "object-inspect": "^1.10.3", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" }, "engines": { "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/meteor-node-stubs/node_modules/es-to-primitive": { - "version": "1.2.1", + "node_modules/meteor-node-stubs/node_modules/es-define-property": { + "version": "1.0.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/meteor-node-stubs/node_modules/es-errors": { + "version": "1.3.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/meteor-node-stubs/node_modules/es-object-atoms": { + "version": "1.1.1", "inBundle": true, "license": "MIT", "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" + "es-errors": "^1.3.0" }, "engines": { "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/meteor-node-stubs/node_modules/es6-object-assign": { - "version": "1.1.0", - "inBundle": true, - "license": "MIT" - }, "node_modules/meteor-node-stubs/node_modules/events": { "version": "3.3.0", "inBundle": true, @@ -544,50 +641,65 @@ "safe-buffer": "^5.1.1" } }, - "node_modules/meteor-node-stubs/node_modules/foreach": { - "version": "2.0.5", - "inBundle": true, - "license": "MIT" - }, - "node_modules/meteor-node-stubs/node_modules/function-bind": { - "version": "1.1.1", - "inBundle": true, - "license": "MIT" - }, - "node_modules/meteor-node-stubs/node_modules/get-intrinsic": { - "version": "1.1.1", + "node_modules/meteor-node-stubs/node_modules/for-each": { + "version": "0.3.5", "inBundle": true, "license": "MIT", "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/meteor-node-stubs/node_modules/has": { - "version": "1.0.3", + "node_modules/meteor-node-stubs/node_modules/function-bind": { + "version": "1.1.2", + "inBundle": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/meteor-node-stubs/node_modules/get-intrinsic": { + "version": "1.3.0", "inBundle": true, "license": "MIT", "dependencies": { - "function-bind": "^1.1.1" + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" }, "engines": { - "node": ">= 0.4.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/meteor-node-stubs/node_modules/has-bigints": { + "node_modules/meteor-node-stubs/node_modules/get-proto": { "version": "1.0.1", "inBundle": true, "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" } }, - "node_modules/meteor-node-stubs/node_modules/has-symbols": { - "version": "1.0.2", + "node_modules/meteor-node-stubs/node_modules/gopd": { + "version": "1.2.0", "inBundle": true, "license": "MIT", "engines": { @@ -597,17 +709,52 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/meteor-node-stubs/node_modules/has-property-descriptors": { + "version": "1.0.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/meteor-node-stubs/node_modules/has-symbols": { + "version": "1.1.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/meteor-node-stubs/node_modules/has-tostringtag": { + "version": "1.0.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/meteor-node-stubs/node_modules/hash-base": { - "version": "3.1.0", + "version": "3.0.5", "inBundle": true, "license": "MIT", "dependencies": { "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" + "safe-buffer": "^5.2.1" }, "engines": { - "node": ">=4" + "node": ">= 0.10" } }, "node_modules/meteor-node-stubs/node_modules/hash.js": { @@ -619,6 +766,17 @@ "minimalistic-assert": "^1.0.1" } }, + "node_modules/meteor-node-stubs/node_modules/hasown": { + "version": "2.0.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/meteor-node-stubs/node_modules/hmac-drbg": { "version": "1.0.1", "inBundle": true, @@ -659,33 +817,12 @@ "license": "ISC" }, "node_modules/meteor-node-stubs/node_modules/is-arguments": { - "version": "1.1.0", + "version": "1.2.0", "inBundle": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/meteor-node-stubs/node_modules/is-bigint": { - "version": "1.0.2", - "inBundle": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/meteor-node-stubs/node_modules/is-boolean-object": { - "version": "1.1.1", - "inBundle": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2" + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -695,18 +832,7 @@ } }, "node_modules/meteor-node-stubs/node_modules/is-callable": { - "version": "1.2.3", - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/meteor-node-stubs/node_modules/is-date-object": { - "version": "1.0.4", + "version": "1.2.7", "inBundle": true, "license": "MIT", "engines": { @@ -717,9 +843,15 @@ } }, "node_modules/meteor-node-stubs/node_modules/is-generator-function": { - "version": "1.0.9", + "version": "1.1.0", "inBundle": true, "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "get-proto": "^1.0.0", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, "engines": { "node": ">= 0.4" }, @@ -742,60 +874,15 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/meteor-node-stubs/node_modules/is-negative-zero": { - "version": "2.0.1", - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/meteor-node-stubs/node_modules/is-number-object": { - "version": "1.0.5", - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/meteor-node-stubs/node_modules/is-regex": { - "version": "1.1.3", + "version": "1.2.1", "inBundle": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/meteor-node-stubs/node_modules/is-string": { - "version": "1.0.6", - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/meteor-node-stubs/node_modules/is-symbol": { - "version": "1.0.4", - "inBundle": true, - "license": "MIT", - "dependencies": { - "has-symbols": "^1.0.2" + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" }, "engines": { "node": ">= 0.4" @@ -805,15 +892,11 @@ } }, "node_modules/meteor-node-stubs/node_modules/is-typed-array": { - "version": "1.1.5", + "version": "1.1.15", "inBundle": true, "license": "MIT", "dependencies": { - "available-typed-arrays": "^1.0.2", - "call-bind": "^1.0.2", - "es-abstract": "^1.18.0-next.2", - "foreach": "^2.0.5", - "has-symbols": "^1.0.1" + "which-typed-array": "^1.1.16" }, "engines": { "node": ">= 0.4" @@ -822,6 +905,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/meteor-node-stubs/node_modules/isarray": { + "version": "1.0.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/meteor-node-stubs/node_modules/math-intrinsics": { + "version": "1.1.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/meteor-node-stubs/node_modules/md5.js": { "version": "1.3.5", "inBundle": true, @@ -845,7 +941,7 @@ } }, "node_modules/meteor-node-stubs/node_modules/miller-rabin/node_modules/bn.js": { - "version": "4.12.0", + "version": "4.12.2", "inBundle": true, "license": "MIT" }, @@ -860,20 +956,23 @@ "license": "MIT" }, "node_modules/meteor-node-stubs/node_modules/object-inspect": { - "version": "1.10.3", + "version": "1.13.4", "inBundle": true, "license": "MIT", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/meteor-node-stubs/node_modules/object-is": { - "version": "1.1.5", + "version": "1.1.6", "inBundle": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1" }, "engines": { "node": ">= 0.4" @@ -891,13 +990,15 @@ } }, "node_modules/meteor-node-stubs/node_modules/object.assign": { - "version": "4.1.2", + "version": "4.1.7", "inBundle": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", "object-keys": "^1.1.1" }, "engines": { @@ -918,15 +1019,19 @@ "license": "(MIT AND Zlib)" }, "node_modules/meteor-node-stubs/node_modules/parse-asn1": { - "version": "5.1.6", + "version": "5.1.7", "inBundle": true, "license": "ISC", "dependencies": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" + "asn1.js": "^4.10.1", + "browserify-aes": "^1.2.0", + "evp_bytestokey": "^1.0.3", + "hash-base": "~3.0", + "pbkdf2": "^3.1.2", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" } }, "node_modules/meteor-node-stubs/node_modules/path-browserify": { @@ -949,6 +1054,14 @@ "node": ">=0.12" } }, + "node_modules/meteor-node-stubs/node_modules/possible-typed-array-names": { + "version": "1.1.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/meteor-node-stubs/node_modules/process": { "version": "0.11.10", "inBundle": true, @@ -957,6 +1070,11 @@ "node": ">= 0.6.0" } }, + "node_modules/meteor-node-stubs/node_modules/process-nextick-args": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT" + }, "node_modules/meteor-node-stubs/node_modules/public-encrypt": { "version": "4.0.3", "inBundle": true, @@ -971,7 +1089,7 @@ } }, "node_modules/meteor-node-stubs/node_modules/public-encrypt/node_modules/bn.js": { - "version": "4.12.0", + "version": "4.12.2", "inBundle": true, "license": "MIT" }, @@ -980,11 +1098,18 @@ "inBundle": true, "license": "MIT" }, - "node_modules/meteor-node-stubs/node_modules/querystring": { - "version": "0.2.0", + "node_modules/meteor-node-stubs/node_modules/qs": { + "version": "6.14.0", "inBundle": true, + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, "engines": { - "node": ">=0.4.x" + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/meteor-node-stubs/node_modules/querystring-es3": { @@ -1012,7 +1137,7 @@ } }, "node_modules/meteor-node-stubs/node_modules/readable-stream": { - "version": "3.6.0", + "version": "3.6.2", "inBundle": true, "license": "MIT", "dependencies": { @@ -1052,10 +1177,37 @@ "inBundle": true, "license": "MIT" }, - "node_modules/meteor-node-stubs/node_modules/safer-buffer": { - "version": "2.1.2", + "node_modules/meteor-node-stubs/node_modules/safe-regex-test": { + "version": "1.1.0", "inBundle": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/meteor-node-stubs/node_modules/set-function-length": { + "version": "1.2.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } }, "node_modules/meteor-node-stubs/node_modules/setimmediate": { "version": "1.0.5", @@ -1074,6 +1226,74 @@ "sha.js": "bin.js" } }, + "node_modules/meteor-node-stubs/node_modules/side-channel": { + "version": "1.1.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/meteor-node-stubs/node_modules/side-channel-list": { + "version": "1.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/meteor-node-stubs/node_modules/side-channel-map": { + "version": "1.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/meteor-node-stubs/node_modules/side-channel-weakmap": { + "version": "1.0.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/meteor-node-stubs/node_modules/stream-browserify": { "version": "3.0.0", "inBundle": true, @@ -1102,30 +1322,6 @@ "safe-buffer": "~5.2.0" } }, - "node_modules/meteor-node-stubs/node_modules/string.prototype.trimend": { - "version": "1.0.4", - "inBundle": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/meteor-node-stubs/node_modules/string.prototype.trimstart": { - "version": "1.0.4", - "inBundle": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/meteor-node-stubs/node_modules/timers-browserify": { "version": "2.0.12", "inBundle": true, @@ -1142,36 +1338,20 @@ "inBundle": true, "license": "MIT" }, - "node_modules/meteor-node-stubs/node_modules/unbox-primitive": { - "version": "1.0.1", - "inBundle": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", - "which-boxed-primitive": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/meteor-node-stubs/node_modules/url": { - "version": "0.11.0", + "version": "0.11.4", "inBundle": true, "license": "MIT", "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" + "punycode": "^1.4.1", + "qs": "^6.12.3" + }, + "engines": { + "node": ">= 0.4" } }, - "node_modules/meteor-node-stubs/node_modules/url/node_modules/punycode": { - "version": "1.3.2", - "inBundle": true, - "license": "MIT" - }, "node_modules/meteor-node-stubs/node_modules/util": { - "version": "0.12.4", + "version": "0.12.5", "inBundle": true, "license": "MIT", "dependencies": { @@ -1179,7 +1359,6 @@ "is-arguments": "^1.0.4", "is-generator-function": "^1.0.7", "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", "which-typed-array": "^1.1.2" } }, @@ -1193,33 +1372,18 @@ "inBundle": true, "license": "MIT" }, - "node_modules/meteor-node-stubs/node_modules/which-boxed-primitive": { - "version": "1.0.2", - "inBundle": true, - "license": "MIT", - "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/meteor-node-stubs/node_modules/which-typed-array": { - "version": "1.1.4", + "version": "1.1.19", "inBundle": true, "license": "MIT", "dependencies": { - "available-typed-arrays": "^1.0.2", - "call-bind": "^1.0.0", - "es-abstract": "^1.18.0-next.1", - "foreach": "^2.0.5", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.1", - "is-typed-array": "^1.1.3" + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -1237,9 +1401,10 @@ } }, "node_modules/moment": { - "version": "2.29.4", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", + "license": "MIT", "engines": { "node": "*" } @@ -1248,6 +1413,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "license": "MIT", "engines": { "node": ">=4" } @@ -1256,6 +1422,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-3.0.3.tgz", "integrity": "sha512-dOal67//nohNgYWb+nWmg5dkFdIwDm8EpeGYMekPMrngV3637lqnX0lbUcCtgibHTz6SEz7DAIjKvKDFYCnO1A==", + "license": "ISC", "dependencies": { "uuid": "8.3.2" }, @@ -1267,6 +1434,7 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -1285,12 +1453,14 @@ "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" }, "node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -1301,15 +1471,11 @@ "util-deprecate": "~1.0.1" } }, - "node_modules/regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==" - }, "node_modules/rss-url-parser": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/rss-url-parser/-/rss-url-parser-3.0.0.tgz", "integrity": "sha512-x39bDQDe1BwpiVwPrjg52ILbTMZc5h7oDPE7FRLa/sgYar7BrNRBTU/msxgokacPZN1rawXmK1rtBU5N7Gsn4A==", + "license": "MIT", "dependencies": { "feedparser": "^2.2.10", "node-fetch": "^2.6.7" @@ -1322,17 +1488,20 @@ "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" }, "node_modules/sax": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", - "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==" + "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==", + "license": "ISC" }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", "dependencies": { "safe-buffer": "~5.1.0" } @@ -1340,22 +1509,26 @@ "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" }, "node_modules/typeahead-standalone": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/typeahead-standalone/-/typeahead-standalone-5.2.0.tgz", - "integrity": "sha512-9GTbCO7XhwimgolmxzuPklftoIa2NEGXBI30n9f5kQZOptvTeJ9ublhNYy4W00RN1D5gSHM5n4dI5vOojr51hg==" + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/typeahead-standalone/-/typeahead-standalone-5.4.0.tgz", + "integrity": "sha512-aKm/POm1SXb9kPBCZLne+evPOrZtVPtZ8K63EsPhKda77Ax+CaZpxnc+Ahr5Ba4T6BdKMdCiGxBUePF2Sw1Fpw==", + "license": "MIT" }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" }, "node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } @@ -1363,12 +1536,14 @@ "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" From 706c5dc3ef65f3ea8b6a2a61bc7d351bbc861907 Mon Sep 17 00:00:00 2001 From: Brian McGonagill Date: Tue, 22 Jul 2025 13:50:49 -0500 Subject: [PATCH 3/3] Updates for async and await - still --- client/AdminMgmt/ListMgmt/listMgmtForm.js | 6 +- imports/api/listItems.js | 119 +++++++++++----------- imports/api/lists.js | 24 ++--- imports/api/mScripts.js | 4 +- imports/api/menu.js | 36 +++---- imports/api/menuItems.js | 20 ++-- imports/api/menuProdLinks.js | 8 +- imports/api/products.js | 34 +++---- imports/api/recipeItems.js | 12 +-- imports/api/recipes.js | 12 +-- imports/api/shopList.js | 12 +-- imports/api/stores.js | 12 +-- imports/api/systemConfig.js | 12 +-- imports/api/updateInfo.js | 8 +- imports/api/userConfig.js | 8 +- imports/api/userConfigOptions.js | 4 +- imports/api/userLast.js | 53 +++++----- server/methods.js | 69 ++++++------- 18 files changed, 220 insertions(+), 233 deletions(-) diff --git a/client/AdminMgmt/ListMgmt/listMgmtForm.js b/client/AdminMgmt/ListMgmt/listMgmtForm.js index 509a4c6..75a01c3 100644 --- a/client/AdminMgmt/ListMgmt/listMgmtForm.js +++ b/client/AdminMgmt/ListMgmt/listMgmtForm.js @@ -71,9 +71,8 @@ Template.listMgmtForm.events({ const addList = async(listName, shared) => { let result = await Meteor.callAsync('add.list', listName, shared); if (!result) { - // console.log(" ERROR adding list name: "); + console.log("Nothing returned from method call add.list"); } else { - // console.log(" SUCCESS adding list name."); $("#listNameInp").val(""); $("#isShared").prop("checked", false); } @@ -82,9 +81,8 @@ const addList = async(listName, shared) => { const editList = async(listId, listName, shared) => { let result = await Meteor.callAsync('edit.list', listId, listName, shared); if (!result) { - // console.log(" ERROR editing list name: " + err); + // console.log("Nothing returned from method call edit.list"); } else { - // console.log(" SUCCESS editing list name."); $("#listNameInp").val(""); $("#isShared").prop("checked", false); Session.set("listNameEditMode", false); diff --git a/imports/api/listItems.js b/imports/api/listItems.js index 7f3ff0c..eb66875 100644 --- a/imports/api/listItems.js +++ b/imports/api/listItems.js @@ -14,7 +14,7 @@ ListItems.allow({ }); Meteor.methods({ - 'add.listItem' (itemName, listId) { + async 'add.listItem' (itemName, listId) { check(itemName, String); check(listId, String); @@ -25,50 +25,45 @@ Meteor.methods({ let iname = itemName.charAt(0).toUpperCase() + itemName.slice(1); // look up the item from the Products collection - const prodIsIn = async() => { - let prodInfo = await Products.findOneAsync({ prodName: iname }); - try { - if (!prodInfo) { - // add product info first - const addProd = async() => { - let added = await Meteor.callAsync("add.product", itemName, [""]); - if (!added) { - console.log(" ERROR adding item to products: " + err); - } else { - // console.log(" SUCCESS adding item to Products."); - - return ListItems.insertAsync({ - itemName: iname, - listId: listId, - prodId: result, - addedBy: this.userId, - itemStore: "", - itemOrdered: false, - itemReceived: false, - dateAddedToList: new Date(), - }); - } - } + + let prodInfo = await Products.findOneAsync({ prodName: iname }); + try { + if (!prodInfo) { + // add product info first + let added = await Meteor.callAsync("add.product", itemName, [""]); + if (!added) { + console.log(" ERROR adding item to products: " + err); } else { - return ListItems.insertAsync({ + // console.log(" SUCCESS adding item to Products."); + + return await ListItems.insertAsync({ itemName: iname, listId: listId, - prodId: prodInfo._id, + prodId: result, addedBy: this.userId, - itemStore: prodInfo.prodStore, + itemStore: "", itemOrdered: false, itemReceived: false, dateAddedToList: new Date(), }); } - } catch(error) { - console.log(" ERROR adding new product and item: " + error); + } else { + return await ListItems.insertAsync({ + itemName: iname, + listId: listId, + prodId: prodInfo._id, + addedBy: this.userId, + itemStore: prodInfo.prodStore, + itemOrdered: false, + itemReceived: false, + dateAddedToList: new Date(), + }); } + } catch(error) { + console.log(" ERROR adding new product and item: " + error); } - let prodIn = prodIsIn(); - return prodIn; }, - 'add.itemsFromMenuItem' (itemIds, listId) { + async 'add.itemsFromMenuItem' (itemIds, listId) { check(itemIds, [String]); check(listId, String); @@ -80,67 +75,71 @@ Meteor.methods({ for (i=0; i < itemIds.length; i++) { // let's check and make sure the product isn't already on the list - let onList = ListItems.find({ listId: listId, prodId: itemIds[i] }).count(); - console.log("Number On List: " + onList); + let onList = await ListItems.find({ listId: listId, prodId: itemIds[i] }).count(); + // console.log("Number On List: " + onList); if (onList == 0) { // now pull the product - let prodInfo = Products.findOne({ _id: itemIds[i] }); - ListItems.insertAsync({ - itemName: prodInfo.prodName, - listId: listId, - prodId: prodInfo._id, - addedBy: this.userId, - itemStore: prodInfo.prodStore, - itemOrdered: false, - itemReceived: false, - dateAddedToList: new Date(), - }); + let prodInfo = await Products.findOneAsync({ _id: itemIds[i] }); + if (!prodInfo) { + console.log("Unable to load product info."); + } else { + ListItems.insertAsync({ + itemName: prodInfo.prodName, + listId: listId, + prodId: prodInfo._id, + addedBy: this.userId, + itemStore: prodInfo.prodStore, + itemOrdered: false, + itemReceived: false, + dateAddedToList: new Date(), + }); + } } else { // product exists on list, move on to next console.log("Product Exists on Selected List."); } } }, - 'setOrdered.listItem' (itemId) { + async 'setOrdered.listItem' (itemId) { check(itemId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to set items as ordered. Make sure you are logged in with valid user credentials.'); } - return ListItems.updateAsync({ _id: itemId }, { + return await ListItems.updateAsync({ _id: itemId }, { $set: { itemOrdered: true, dateOrdered: new Date(), } }); }, - 'setAllOrdered.listItem' (shopListId) { + async 'setAllOrdered.listItem' (shopListId) { // set all items that are not already set as ordered, or set as received to ordered on this list }, - 'setNotOrdered.listItem' (itemId) { + async 'setNotOrdered.listItem' (itemId) { check(itemId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to set items as not ordered. Make sure you are logged in with valid user credentials.'); } - return ListItems.updateAsync({ _id: itemId }, { + return await ListItems.updateAsync({ _id: itemId }, { $set: { itemOrdered: false, dateUnOrdered: new Date(), } }); }, - 'setReceived.listItem' (itemId) { + async 'setReceived.listItem' (itemId) { check(itemId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to set items as received. Make sure you are logged in with valid user credentials.'); } - return ListItems.updateAsync({ _id: itemId }, { + return await ListItems.updateAsync({ _id: itemId }, { $set: { itemReceived: true, dateReceived: new Date(), @@ -148,25 +147,25 @@ Meteor.methods({ }); }, - 'setNotReceived.listItem' (shopListId) { + async 'setNotReceived.listItem' (shopListId) { check(itemId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to set items as not received. Make sure you are logged in with valid user credentials.'); } - return ListItems.updateAsync({ _id: itemId }, { + return await ListItems.updateAsync({ _id: itemId }, { $set: { itemReceived: false, dateNotReceived: new Date(), } }); }, - 'setAllReceived.listItem' () { + async 'setAllReceived.listItem' () { // set all items that are not already listed as received to received on this list }, - 'edit.listItem' (itemId, itemName) { + async 'edit.listItem' (itemId, itemName) { check(itemId, String); check(itemName, String); @@ -174,19 +173,19 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to add items. Make sure you are logged in with valid user credentials.'); } - return ListItems.updateAsync({ _id: itemId }, { + return await ListItems.updateAsync({ _id: itemId }, { $set: { itemName: itemName, } }); }, - 'delete.listItem' (itemId) { + async 'delete.listItem' (itemId) { check(itemId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to delete list items. Make sure you are logged in with valid user credentials.'); } - return ListItems.removeAsync({ _id: itemId }); + return await ListItems.removeAsync({ _id: itemId }); } }); diff --git a/imports/api/lists.js b/imports/api/lists.js index 037e73e..65f2f5d 100644 --- a/imports/api/lists.js +++ b/imports/api/lists.js @@ -12,7 +12,7 @@ Lists.allow({ }); Meteor.methods({ - 'add.list' (listName, isShared) { + async 'add.list' (listName, isShared) { check(listName, String); check(isShared, Boolean); @@ -20,14 +20,14 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to add lists. Make sure you are logged in with valid user credentials.'); } - return Lists.insertAsync({ + return await Lists.insertAsync({ listName: listName, listShared: isShared, listOwner: this.userId, listComplete: false, }); }, - 'edit.list' (listId, listName, isShared) { + async 'edit.list' (listId, listName, isShared) { check(listId, String); check(listName, String); check(isShared, Boolean); @@ -36,55 +36,55 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to edit lists. Make sure you are logged in with valid user credentials.'); } - return Lists.updateAsync({ _id: listId }, { + return await Lists.updateAsync({ _id: listId }, { $set: { listName: listName, listShared: isShared, } }); }, - 'delete.list' (listId) { + async 'delete.list' (listId) { check(listId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to delete lists. Make sure you are logged in with valid user credentials.'); } - return Lists.removeAsync({ _id: listId }); + return await Lists.removeAsync({ _id: listId }); }, - 'mark.complete' (listId) { + async 'mark.complete' (listId) { check(listId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to mark lists complete. Make sure you are logged in with valid user credentials.'); } - return Lists.updateAsync({ _id: listId }, { + return await Lists.updateAsync({ _id: listId }, { $set: { listComplete: true, completedOn: new Date() } }); }, - 'mark.incomplete' (listId) { + async 'mark.incomplete' (listId) { check(listId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to restore completed lists. Make sure you are logged in with valid user credentials.'); } - return Lists.updateAsync({ _id: listId }, { + return await Lists.updateAsync({ _id: listId }, { $set: { listComplete: false, completedOn: new Date() } }); }, - 'clean.Lists' () { + async 'clean.Lists' () { if (!this.userId) { throw new Meteor.Error('You are not allowed to clean up old lists. Make sure you are logged in with valid user credentials.'); } - return Lists.removeAsync({ listComplete: true }); + return await Lists.removeAsync({ listComplete: true }); }, }); \ No newline at end of file diff --git a/imports/api/mScripts.js b/imports/api/mScripts.js index 710c530..67c1685 100644 --- a/imports/api/mScripts.js +++ b/imports/api/mScripts.js @@ -12,10 +12,10 @@ MScripts.allow({ }); Meteor.methods({ - 'set.ScriptRun' (scriptName) { + async 'set.ScriptRun' (scriptName) { check(scriptName, String); - MScripts.insertAsync({ + return await MScripts.insertAsync({ scriptName: scriptName, hasRun: true, runOn: new Date(), diff --git a/imports/api/menu.js b/imports/api/menu.js index 7ea3be2..cf3b8eb 100644 --- a/imports/api/menu.js +++ b/imports/api/menu.js @@ -15,20 +15,20 @@ Menus.allow({ }); Meteor.methods({ - 'add.menu' (menuName) { + async 'add.menu' (menuName) { check(menuName, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to add menus. Make sure you are logged in with valid user credentials.'); } - return Menus.insertAsync({ + return await Menus.insertAsync({ menuName: menuName, menuOwner: this.userId, menuComplete: false, }); }, - 'edit.menu' (menuId, menuName) { + async 'edit.menu' (menuId, menuName) { check(menuId, String); check(menuName, String); @@ -36,48 +36,48 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to edit menus. Make sure you are logged in with valid user credentials.'); } - return Menus.updateAsync({ _id: menuId }, { + return await Menus.updateAsync({ _id: menuId }, { $set: { menuName: menuName, } }); }, - 'delete.menu' (menuId) { + async 'delete.menu' (menuId) { check(menuId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to delete menus. Make sure you are logged in with valid user credentials.'); } - return Menus.removeAsync({ _id: menuId }); + return await Menus.removeAsync({ _id: menuId }); }, - 'markMenu.complete' (menuId) { + async 'markMenu.complete' (menuId) { check(menuId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to mark menus complete. Make sure you are logged in with valid user credentials.'); } - return Menus.updateAsync({ _id: menuId }, { + return await Menus.updateAsync({ _id: menuId }, { $set: { menuComplete: true, } }); }, - 'markMenu.notComplete' (menuId) { + async 'markMenu.notComplete' (menuId) { check(menuId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to mark menus not complete. Make sure you are logged in with valid user credentials.'); } - return Menus.updateAsync({ _id: menuId }, { + return await Menus.updateAsync({ _id: menuId }, { $set: { menuComplete: false, } }); }, - 'clean.Menus' () { + async 'clean.Menus' () { if (!this.userId) { throw new Meteor.Error('You are not allowed to clean up old Menus. Make sure you are logged in with valid user credentials.'); } @@ -114,10 +114,10 @@ Meteor.methods({ // finally we'll cycle through the ids and remove the items we collected up. for (let l = 0; l < removeMenuIds.length; l++) { - Menus.removeAsync({ _id: removeMenuIds[l] }); + await Menus.removeAsync({ _id: removeMenuIds[l] }); } }, - 'addto.Menu' (menuId, menuItem, menuItemId, dateSrv, isLinked) { + async 'addto.Menu' (menuId, menuItem, menuItemId, dateSrv, isLinked) { check(menuId, String); check(menuItem, String); check(menuItemId, String); @@ -130,7 +130,7 @@ Meteor.methods({ let serveDateActual = new Date(dateSrv); - return Menus.updateAsync({ _id: menuId }, { + return await Menus.updateAsync({ _id: menuId }, { $addToSet: { menuItems: { @@ -143,7 +143,7 @@ Meteor.methods({ } }); }, - 'link.inMenu' (menuItemId, isLinked) { + async 'link.inMenu' (menuItemId, isLinked) { check(menuItemId, String); check(isLinked, Boolean); @@ -151,13 +151,13 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to link menu items to products. Make sure you are logged in with valid user credentials.'); } - return Menus.updateAsync({ 'menuItems.menuItemId': menuItemId }, { + return await Menus.updateAsync({ 'menuItems.menuItemId': menuItemId }, { $set: { "menuItems.$.isLinked": isLinked } }); }, - 'delete.itemFromMenu' (itemIds) { + async 'delete.itemFromMenu' (itemIds) { check(itemIds, String); if (!this.userId) { @@ -167,7 +167,7 @@ Meteor.methods({ let ids = itemIds.split('_'); console.log("item ids: " + ids[0] + " and " + ids[1]); - return Menus.updateAsync({ _id: ids[0] }, { + return await Menus.updateAsync({ _id: ids[0] }, { $pull: { menuItems: { menuItemId: ids[1], diff --git a/imports/api/menuItems.js b/imports/api/menuItems.js index 69f47fe..232d510 100644 --- a/imports/api/menuItems.js +++ b/imports/api/menuItems.js @@ -12,21 +12,21 @@ MenuItems.allow({ }); Meteor.methods({ - 'add.menuItem' (itemName) { + async 'add.menuItem' (itemName) { check(itemName, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to add items. Make sure you are logged in with valid user credentials.'); } - return MenuItems.insertAsync({ + return await MenuItems.insertAsync({ itemName: itemName, addedBy: this.userId, dateAddedtoMenu: new Date(), isLinked: false, }); }, - 'update.menuItemLinked' (itemId, isLinked) { + async 'update.menuItemLinked' (itemId, isLinked) { check(itemId, String); check(isLinked, Boolean); @@ -34,13 +34,13 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to set this menu item as linked to products. Make sure you are logged in with valid user credentials.'); } - return MenuItems.updateAsync({ _id: itemId }, { + return await MenuItems.updateAsync({ _id: itemId }, { $set: { isLinked: isLinked, } }); }, - 'edit.madeItem' (itemId, itemName) { + async 'edit.madeItem' (itemId, itemName) { check(itemId, String); check(itemName, String); @@ -48,22 +48,22 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to edit menu items. Make sure you are logged in with valid user credentials.'); } - return MenuItems.updateAsync({ _id: itemId }, { + return await MenuItems.updateAsync({ _id: itemId }, { $set: { itemName: itemName, } }); }, - 'delete.menuItem' (itemId) { + async 'delete.menuItem' (itemId) { check(itemId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to delete menu items. Make sure you are logged in with valid user credentials.'); } - return MenuItems.removeAsync({ _id: itemId }); + return await MenuItems.removeAsync({ _id: itemId }); }, - 'shiftDate' (itemId, momentAddDay) { + async 'shiftDate' (itemId, momentAddDay) { check(itemId, String); check(momentAddDay, String); @@ -71,7 +71,7 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to shift menu item dates. Make sure you are logged in with valid user credentials.'); } - return MenuItems.updateAsync({ _id: itemId }, { + return await MenuItems.updateAsync({ _id: itemId }, { $set: { serveDate: momentAddDay, } diff --git a/imports/api/menuProdLinks.js b/imports/api/menuProdLinks.js index 0a9b2de..9cfe22a 100644 --- a/imports/api/menuProdLinks.js +++ b/imports/api/menuProdLinks.js @@ -13,7 +13,7 @@ MenuProdLinks.allow({ }); Meteor.methods({ - 'add.menuProdLinks' (menuItemId, menuItemName, prodNameArray) { + async 'add.menuProdLinks' (menuItemId, menuItemName, prodNameArray) { check(menuItemId, String); check(menuItemName, String); check(prodNameArray, [Object]); @@ -34,7 +34,7 @@ Meteor.methods({ } }); } else { - return MenuProdLinks.insertAsync({ + return await MenuProdLinks.insertAsync({ menuItemId: menuItemId, menuItemName: menuItemName, products: prodNameArray, @@ -43,7 +43,7 @@ Meteor.methods({ }); } }, - 'update.menuPordLInks' (menuItemId, menuItemName, prodNameArray) { + async 'update.menuPordLInks' (menuItemId, menuItemName, prodNameArray) { check(menuItemId, String); check(menuItemName, String); check(prodNameArray, [Object]); @@ -52,7 +52,7 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to add menu and product links. Make sure you are logged in with valid user credentials.'); }; - return MenuProdLinks.updateAsync({ menuItemId: menuItemId }, { + return await MenuProdLinks.updateAsync({ menuItemId: menuItemId }, { $set: { products: prodNameArray, dateUpdated: Date(), diff --git a/imports/api/products.js b/imports/api/products.js index 3eafefa..b8d5056 100644 --- a/imports/api/products.js +++ b/imports/api/products.js @@ -12,7 +12,7 @@ Products.allow({ }); Meteor.methods({ - 'add.product' (prodName, prodStore) { + async 'add.product' (prodName, prodStore) { check(prodName, String); check(prodStore, [String]); @@ -24,24 +24,20 @@ Meteor.methods({ // first does this product already exist? - const productIsIn = async() => { - let prodExists = await Products.findOneAsync({ prodName: pname }); - try { - if (!prodExists) { - return Products.insertAsync({ - prodName: pname, - prodOwner: this.userId, - prodStore: prodStore, - }); - } - } catch(error) { - console.log(" ERROR adding Pdocut: " + error); + let prodExists = await Products.findOneAsync({ prodName: pname }); + try { + if (!prodExists) { + return await Products.insertAsync({ + prodName: pname, + prodOwner: this.userId, + prodStore: prodStore, + }); } + } catch(error) { + console.log(" ERROR adding Pdocut: " + error); } - let prodIn = productIsIn(); - return prodIn; }, - 'edit.product' (prodId, prodName, prodStore) { + async 'edit.product' (prodId, prodName, prodStore) { check(prodId, String); check(prodName, String); check(prodStore, [String]); @@ -52,20 +48,20 @@ Meteor.methods({ let pname = prodName.charAt(0).toUpperCase() + prodName.slice(1); - return Products.updateAsync({ _id: prodId }, { + return await Products.updateAsync({ _id: prodId }, { $set: { prodName: pname, prodStore: prodStore, } }); }, - 'delete.product' (prodId) { + async 'delete.product' (prodId) { check(prodId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to delete products. Make sure you are logged in with valid user credentials.'); } - return Products.removeAsync({ _id: prodId }); + return await Products.removeAsync({ _id: prodId }); } }); diff --git a/imports/api/recipeItems.js b/imports/api/recipeItems.js index b19a0ea..42b374f 100644 --- a/imports/api/recipeItems.js +++ b/imports/api/recipeItems.js @@ -12,7 +12,7 @@ RecipeItems.allow({ }); Meteor.methods({ - 'add.recipeItem' (recipeId, recipeItemType, recipeItem) { + async 'add.recipeItem' (recipeId, recipeItemType, recipeItem) { check(recipeId, String); check(recipeItemType, String); check(recipeItem, String); @@ -21,13 +21,13 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to add recipe items. Make sure you are logged in with valid user credentials.'); } - return RecipeItems.insertAsync({ + return await RecipeItems.insertAsync({ recipeId: recipeId, recipeItemType: recipeItemType, recipeItem: recipeItem, }); }, - 'edit.recipeItem' (recipeItemId, recipeId, recipeItemType, recipeItem) { + async 'edit.recipeItem' (recipeItemId, recipeId, recipeItemType, recipeItem) { check(recipeItemId, String); check(recipeId, String); check(recipeItemType, String); @@ -37,7 +37,7 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to edit recipe items. Make sure you are logged in with valid user credentials.'); } - return RecipeItems.updateAsync({ _id: recipeItemId }, { + return await RecipeItems.updateAsync({ _id: recipeItemId }, { $set: { recipeId: recipeId, recipeItemType: recipeItemType, @@ -45,13 +45,13 @@ Meteor.methods({ } }); }, - 'delete.recipeItem' (recipeItemId) { + async 'delete.recipeItem' (recipeItemId) { check(recipeItemId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to delete recipe items. Make sure you are logged in with valid user credentials.'); } - return RecipeItems.removeAsync({ _id: recipeItemId }); + return await RecipeItems.removeAsync({ _id: recipeItemId }); } }); \ No newline at end of file diff --git a/imports/api/recipes.js b/imports/api/recipes.js index d1edbe3..008bb51 100644 --- a/imports/api/recipes.js +++ b/imports/api/recipes.js @@ -12,20 +12,20 @@ Recipes.allow({ }); Meteor.methods({ - 'add.recipe' (recipeName) { + async 'add.recipe' (recipeName) { check(recipeName, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to add recipes. Make sure you are logged in with valid user credentials.'); } - return Recipes.insertAsync({ + return await Recipes.insertAsync({ recipeName: recipeName, addedBy: this.userId, addedOn: new Date(), }); }, - 'edit.recipe' (recipeId, recipeName) { + async 'edit.recipe' (recipeId, recipeName) { check(recipeId, String); check(recipeName, String); @@ -33,7 +33,7 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to add recipes. Make sure you are logged in with valid user credentials.'); } - return Recipes.updateAsync({ _id: recipeId }, { + return await Recipes.updateAsync({ _id: recipeId }, { $set: { recipeName: recipeName, updatedOn: new Date(), @@ -41,13 +41,13 @@ Meteor.methods({ } }); }, - 'delete.recipe' (recipeId) { + async 'delete.recipe' (recipeId) { check(recipeId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to delete recipes. Make sure you are logged in with valid user credentials.'); } - return Recipes.removeAsync({ _id: recipeId }); + return await Recipes.removeAsync({ _id: recipeId }); } }); \ No newline at end of file diff --git a/imports/api/shopList.js b/imports/api/shopList.js index b013d50..637e740 100644 --- a/imports/api/shopList.js +++ b/imports/api/shopList.js @@ -12,19 +12,19 @@ ShopLists.allow({ }); Meteor.methods({ - 'add.shopList' (shopName) { + async 'add.shopList' (shopName) { check(shopName, Sring); if (!this.userId) { throw new Meteor.Error('You are not allowed to add shopping lists. Make sure you are logged in with valid user credentials.'); } - return ShopLists.insert({ + return await ShopLists.insert({ shopName: shopName, shopOwner: this.userId, }); }, - 'edit.shopList' (shopId, shopName) { + async 'edit.shopList' (shopId, shopName) { check(shopId, String); check(shopName, String); @@ -32,19 +32,19 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to edit shopping lists. Make sure you are logged in with valid user credentials.'); } - return ShopLists.update({ _id: shopId }, { + return await ShopLists.update({ _id: shopId }, { $set: { shopName: shopName, } }); }, - 'delete.shopList' (shopId) { + async 'delete.shopList' (shopId) { check(shopId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to delete shopping lists. Make sure you are logged in with valid user credentials.'); } - return ShopLists.remove({ _id: shopId }); + return await ShopLists.remove({ _id: shopId }); }, }); \ No newline at end of file diff --git a/imports/api/stores.js b/imports/api/stores.js index b0fbec9..c97b381 100644 --- a/imports/api/stores.js +++ b/imports/api/stores.js @@ -12,19 +12,19 @@ Stores.allow({ }); Meteor.methods({ - 'add.store' (storeName) { + async 'add.store' (storeName) { check(storeName, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to add stores. Make sure you are logged in with valid user credentials.'); } - return Stores.insertAsync({ + return await Stores.insertAsync({ storeName: storeName, owner: this.userId, }); }, - 'edit.store' (storeId, storeName) { + async 'edit.store' (storeId, storeName) { check(storeId, String); check(storeName, String); @@ -32,19 +32,19 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to edit stores. Make sure you are logged in with valid user credentials.'); } - return Stores.updateAsync({ _id: storeId }, { + return await Stores.updateAsync({ _id: storeId }, { $set: { storeName: storeName, } }); }, - 'delete.store' (storeId) { + async 'delete.store' (storeId) { check(storeId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to delete stores. Make sure you are logged in with valid user credentials.'); } - return Stores.removeAsync({ _id: storeId }); + return await Stores.removeAsync({ _id: storeId }); }, }); \ No newline at end of file diff --git a/imports/api/systemConfig.js b/imports/api/systemConfig.js index 7188ebd..a278007 100644 --- a/imports/api/systemConfig.js +++ b/imports/api/systemConfig.js @@ -12,7 +12,7 @@ SysConfig.allow({ }); Meteor.methods({ - 'add.noSysAdminReg' (admReg, genReg) { + async 'add.noSysAdminReg' (admReg, genReg) { check(admReg, Boolean); check(genReg, Boolean); @@ -24,7 +24,7 @@ Meteor.methods({ let curr = await SysConfig.findOneAsync({}); if (!curr) { try { - return SysConfig.insertAsync({ + return await SysConfig.insertAsync({ SysAdminReg: admReg, dateAdded: new Date(), allowReg: genReg, @@ -52,7 +52,7 @@ Meteor.methods({ } currConfig(); }, - 'edit.noSysAdminReg' (configId, canReg, genReg) { + async 'edit.noSysAdminReg' (configId, canReg, genReg) { check(canReg, Boolean); check(configId, String); check(genReg, Boolean); @@ -61,7 +61,7 @@ Meteor.methods({ throw new Meteor.Error('Not able to change registration setting. Make sure you are logged in with valid system administrator credentials.'); } - return SysConfig.updateAsync({ _id: configId }, { + return await SysConfig.updateAsync({ _id: configId }, { $set: { SysAdminReg: canReg, allowReg: genReg, @@ -69,7 +69,7 @@ Meteor.methods({ } }); }, - 'allow.updateInfo' (allowUpdate) { + async 'allow.updateInfo' (allowUpdate) { check(allowUpdate, Boolean); if (!this.userId) { @@ -80,7 +80,7 @@ Meteor.methods({ let configId = curr._id; - return SysConfig.updateAsync({ _id: configId }, { + return await SysConfig.updateAsync({ _id: configId }, { $set: { allowUpdates: allowUpdate, } diff --git a/imports/api/updateInfo.js b/imports/api/updateInfo.js index 4fd9faa..34f222b 100644 --- a/imports/api/updateInfo.js +++ b/imports/api/updateInfo.js @@ -12,24 +12,24 @@ UpdateInfo.allow({ }); Meteor.methods({ - 'add.updateInfo' (updateObject) { + async 'add.updateInfo' (updateObject) { check(updateObject, Object); - return UpdateInfo.insertAsync({ + return await UpdateInfo.insertAsync({ title: updateObject.title, description: updateObject.description, dateRelease: updateObject.date, releaseLink: updateObject.link }); }, - 'markUpdate.read' (updateId) { + async 'markUpdate.read' (updateId) { check(updateId, String); if (!this.userId) { throw new Meteor.Error('You are not allowed to mark updates as read. Make sure you are logged in with valid user credentials.'); } - return UpdateInfo.updateAsync({ _id: updateId }, { + return await UpdateInfo.updateAsync({ _id: updateId }, { $set: { viewed: true } diff --git a/imports/api/userConfig.js b/imports/api/userConfig.js index a1d0614..ac6ab2e 100644 --- a/imports/api/userConfig.js +++ b/imports/api/userConfig.js @@ -16,27 +16,27 @@ UserConfig.allow({ }); Meteor.methods({ - 'add.darkModePref' (pref) { + async 'add.darkModePref' (pref) { check(pref, String); if (!this.userId) { throw new Meteor.Error('Not able to change theme setting. Make sure you are logged in with valid system administrator credentials.'); } - return UserConfig.insertAsync({ + return await UserConfig.insertAsync({ user: this.userId, darkMode: pref, dateAdded: Date() }); }, - 'update.darkModePref' (pref) { + async 'update.darkModePref' (pref) { check(pref, String); if (!this.userId) { throw new Meteor.Error('Not able to change theme setting. Make sure you are logged in with valid system administrator credentials.'); } - return UserConfig.updateAsync({ user: this.userId }, { + return await UserConfig.updateAsync({ user: this.userId }, { $set: { darkMode: pref, dateUpdate: Date() diff --git a/imports/api/userConfigOptions.js b/imports/api/userConfigOptions.js index c6290a2..09c9207 100644 --- a/imports/api/userConfigOptions.js +++ b/imports/api/userConfigOptions.js @@ -12,10 +12,10 @@ UserConfigOptions.allow({ }); Meteor.methods({ - 'change.userPass' (usersId, password) { + async 'change.userPass' (usersId, password) { check(usersId, String); check(password, String); - return Accounts.setPasswordAsync(usersId, password); + return await Accounts.setPasswordAsync(usersId, password); }, }); \ No newline at end of file diff --git a/imports/api/userLast.js b/imports/api/userLast.js index dbeb078..33e156b 100644 --- a/imports/api/userLast.js +++ b/imports/api/userLast.js @@ -12,7 +12,7 @@ UserLast.allow({ }); Meteor.methods({ - 'add.userLast' (view, viewId) { + async 'add.userLast' (view, viewId) { check(view, String); check(viewId, String); @@ -22,36 +22,33 @@ Meteor.methods({ // first let's find out if there's an entry for this user and view, and if so // we'll just edit that entry with updated information - const getUserLast = async() => { - let userListInfo = await UserLast.findOneAsync({ userId: this.userId, view: view }); - if (!userListInfo) { - console.log("Adding new user last item."); - return UserLast.insertAsync({ - userId: this.userId, - view: view, - viewId: viewId, - dateAdded: Date(), - }); + let userListInfo = await UserLast.findOneAsync({ userId: this.userId, view: view }); + if (!userListInfo) { + console.log("Adding new user last item."); + return await UserLast.insertAsync({ + userId: this.userId, + view: view, + viewId: viewId, + dateAdded: Date(), + }); + } else { + console.log("Editing existing user last itme."); + // entry exists, call the edit function instead + let result = await Meteor.callAsync('edit.userLast', view, viewId); + if (!result) { + try { + console.log("Issue editing existing entry in userLast. Check the logs."); + } catch(error) { + console.log(" ERROR adding userLast item: " + error); + console.log(error.message); + console.log(error.stack); + } } else { - console.log("Editing existing user last itme."); - // entry exists, call the edit function instead - let result = await Meteor.callAsync('edit.userLast', view, viewId); - if (!result) { - try { - console.log("Issue editing existing entry in userLast. Check the logs."); - } catch(error) { - console.log(" ERROR adding userLast item: " + error); - console.log(error.message); - console.log(error.stack); - } - } else { - return true; - } + return true; } } - return getUserLast(); }, - 'edit.userLast' (view, viewId) { + async 'edit.userLast' (view, viewId) { check(view, String); check(viewId, String); @@ -60,7 +57,7 @@ Meteor.methods({ } console.log("Edit in progress."); - return UserLast.updateAsync({ view: view, userId: this.userId }, { + return await UserLast.updateAsync({ view: view, userId: this.userId }, { $set: { viewId: viewId, dateLastUpdate: Date(), diff --git a/server/methods.js b/server/methods.js index 742a93e..d634eed 100644 --- a/server/methods.js +++ b/server/methods.js @@ -6,66 +6,63 @@ import { SysConfig } from '../imports/api/systemConfig'; import { Roles } from 'meteor/roles'; Meteor.methods({ - 'addToRole' (role) { - const getUserInfo = async() => { - try { - let countOfUsers = await Meteor.users.find().countAsync(); - const user = await Meteor.userAsync(); - if (user) { - let userId = user._id; - if (countOfUsers > 1) { - Roles.addUsersToRolesAsync(userId, role); - const result = await Meteor.callAsync('add.darkModePref', "light"); - if (!result) { - console.log(" ERROR: can't set user dark mode preference: " + err); - } else { - // console.log(" SUCCESSFULLY set user dark mode preference."); - } - } else if (countOfUsers == 1) { - Roles.addUsersToRolesAsync(userId, "systemadmin"); - const result = await Meteor.callAsync('add.darkModePref', "light"); - if (!result) { - console.log(" ERROR: can't set user dark mode preference: " + err); - } else { - console.log(" SUCCESSFULLY set user dark mode preference."); - } + async 'addToRole' (role) { + try { + let countOfUsers = await Meteor.users.find().countAsync(); + const user = await Meteor.userAsync(); + if (user) { + let userId = user._id; + if (countOfUsers > 1) { + await Roles.addUsersToRolesAsync(userId, role); + const result = await Meteor.callAsync('add.darkModePref', "light"); + if (!result) { + console.log(" ERROR: can't set user dark mode preference: " + err); } else { - console.log("The count of users didn't seem to work when adding a new user."); + // console.log(" SUCCESSFULLY set user dark mode preference."); + } + } else if (countOfUsers == 1) { + await Roles.addUsersToRolesAsync(userId, "systemadmin"); + const result = await Meteor.callAsync('add.darkModePref', "light"); + if (!result) { + console.log(" ERROR: can't set user dark mode preference: " + err); + } else { + console.log(" SUCCESSFULLY set user dark mode preference."); } } else { - console.log(" ---- No user info found.") + console.log("The count of users didn't seem to work when adding a new user."); } - } catch(error) { - console.log(" ERROR getting user info on server: " + error); + } else { + console.log(" ---- No user info found.") } + } catch(error) { + console.log(" ERROR getting user info on server: " + error); } - getUserInfo(); }, - 'edit.userPass' (userId, newPassword) { + async 'edit.userPass' (userId, newPassword) { check(userId, String); check(newPassword, String); - return Accounts.setPasswordAsync(userId, newPassword); + return await Accounts.setPasswordAsync(userId, newPassword); }, - 'delete.userFromSys' (userId) { + async 'delete.userFromSys' (userId) { check(userId, String); - return Meteor.users.removeAsync({ _id: userId }); + return await Meteor.users.removeAsync({ _id: userId }); }, - 'update.userEmail' (userId, email) { + async 'update.userEmail' (userId, email) { check(userId, String); check(email, String); - return Meteor.users.updateAsync({ _id: userId }, { + return await Meteor.users.updateAsync({ _id: userId }, { $set: { 'emails.0.address': email, } }); }, - 'edit.userRole' (userId, role) { + async 'edit.userRole' (userId, role) { check(userId, String); check(role, String); - return Roles.setUserRolesAsync(userId, role); + return await Roles.setUserRolesAsync(userId, role); }, });