Fixed some types not being found and some errors Identified by typescript

This commit is contained in:
Thaum Rystra
2024-03-26 16:37:03 +02:00
parent a3ea5e1408
commit 1614e655c5
12 changed files with 2054 additions and 605 deletions

View File

@@ -12,6 +12,7 @@
"nearley",
"ngraph",
"ostrio",
"snackbars",
"uncomputed",
"walkdown"
]

View File

@@ -1,7 +1,7 @@
import { slice } from 'lodash';
import PER_CREATURE_LOG_LIMIT from '/imports/api/creature/log/CreatureLogs';
import { PER_CREATURE_LOG_LIMIT } from '/imports/api/creature/log/CreatureLogs';
export default function verifyArchiveSafety({ meta, creature, properties, experiences, logs }) {
export default function verifyArchiveSafety({ creature, properties, experiences, logs }) {
const creatureId = creature._id;
// Check lengths of arrays

View File

@@ -1,4 +1,4 @@
import { getFilter } from "/imports/api/parenting/parentingFunctions";
import { getFilter } from '/imports/api/parenting/parentingFunctions';
export default function getSlotFillFilter({ slot, libraryIds }) {

View File

@@ -7,7 +7,7 @@ import CreatureVariables from '/imports/api/creature/creatures/CreatureVariables
import computeCreature from '/imports/api/engine/computeCreature';
import { loadCreature } from '/imports/api/engine/loadCreatures';
import EngineActions, { EngineAction } from '/imports/api/engine/action/EngineActions';
import { applyAction } from '/imports/api/engine/action/functions/applyAction';
import applyAction from '/imports/api/engine/action/functions/applyAction';
import { LogContent, Removal, Update } from '/imports/api/engine/action/tasks/TaskResult';
import inputProvider from '/imports/api/engine/action/functions/inputProviderForTests.testFn';

View File

@@ -6,7 +6,7 @@ import CreatureVariables from '/imports/api/creature/creatures/CreatureVariables
import computeCreature from '/imports/api/engine/computeCreature';
import { loadCreature } from '/imports/api/engine/loadCreatures';
import EngineActions, { EngineAction } from '/imports/api/engine/action/EngineActions';
import { applyAction } from '/imports/api/engine/action/functions/applyAction';
import applyAction from '/imports/api/engine/action/functions/applyAction';
import { LogContent, Mutation, Removal, Update } from '/imports/api/engine/action/tasks/TaskResult';
import inputProvider from '/imports/api/engine/action/functions/inputProviderForTests.testFn';
/**

View File

@@ -1,7 +1,6 @@
import EngineActions, { EngineAction, ActionSchema } from '/imports/api/engine/action/EngineActions';
import { EngineAction } from '/imports/api/engine/action/EngineActions';
import { getSingleProperty } from '/imports/api/engine/loadCreatures';
import applyTask from '/imports/api/engine/action/tasks/applyTask'
import { isEmpty } from 'lodash';
import InputProvider from '/imports/api/engine/action/functions/InputProvider';
// TODO create a function to get the effective value of a property,
@@ -11,7 +10,7 @@ import InputProvider from '/imports/api/engine/action/functions/InputProvider';
// This is run once as a simulation on the client awaiting all the various inputs or step through
// clicks from the user, then it is run as part of the runAction method, where it is expected to
// complete instantly on the client, and sent to the server as a method call
export async function applyAction(action: EngineAction, userInput: InputProvider, options?: {
export default async function applyAction(action: EngineAction, userInput: InputProvider, options?: {
simulate?: boolean, stepThrough?: boolean
}) {
const { simulate, stepThrough } = options || {};
@@ -29,15 +28,3 @@ export async function applyAction(action: EngineAction, userInput: InputProvider
}, userInput);
return { action, userInput };
}
function writeChangedAction(original: EngineAction, changed: EngineAction) {
const $set = {};
for (const key of ActionSchema.objectKeys()) {
if (!EJSON.equals(original[key], changed[key])) {
$set[key] = changed[key];
}
}
if (!isEmpty($set) && original._id) {
return EngineActions.updateAsync(original._id, { $set });
}
}

View File

@@ -1,5 +1,14 @@
import { EngineAction } from '/imports/api/engine/action/EngineActions';
import { isEmpty } from 'lodash'
import EngineActions, { EngineAction, ActionSchema } from '/imports/api/engine/action/EngineActions';
export async function writeChangedAction(originalAction: EngineAction, action: EngineAction) {
console.warn('writeChangedAction not implemented.');
export default async function writeChangedAction(original: EngineAction, changed: EngineAction) {
const $set = {};
for (const key of ActionSchema.objectKeys()) {
if (!EJSON.equals(original[key], changed[key])) {
$set[key] = changed[key];
}
}
if (!isEmpty($set) && original._id) {
return EngineActions.updateAsync(original._id, { $set });
}
}

View File

@@ -3,9 +3,8 @@ import SimpleSchema from 'simpl-schema';
import EngineActions from '/imports/api/engine/action/EngineActions';
import { assertEditPermission } from '/imports/api/sharing/sharingPermissions';
import { getCreature } from '/imports/api/engine/loadCreatures';
import { EJSON } from 'meteor/ejson';
import { applyAction } from '/imports/api/engine/action/functions/applyAction';
import { writeChangedAction } from '../functions/writeChangedAction';
import applyAction from '/imports/api/engine/action/functions/applyAction';
import writeChangedAction from '../functions/writeChangedAction';
export const runAction = new ValidatedMethod({
name: 'actions.runAction',

View File

@@ -110,6 +110,8 @@ import { snackbar } from '/imports/client/ui/components/snackbars/SnackbarQueue'
import { archiveSchema } from '/imports/api/creature/archive/ArchiveCreatureFiles';
import migrateArchive from '/imports/migrations/archive/migrateArchive';
// TODO Mark files that don't have versions.${version}.meta.pipePath set as broken links
export default {
components: {
ArchiveFileCard,

2601
app/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,7 @@
"run": "meteor",
"debug": "meteor --inspect",
"bundle-viz": "meteor --extra-packages bundle-visualizer --production",
"lint": "eslint .",
"test": "meteor test --driver-package meteortesting:mocha --port 3001",
"test:coverage": "COVERAGE=1 COVERAGE_OUT_LCOVONLY=1 COVERAGE_OUT_REMAP=1 COVERAGE_APP_FOLDER=$PWD/ meteor test --once --driver-package meteortesting:mocha",
"test:watch:coverage": "COVERAGE=1 COVERAGE_OUT_LCOVONLY=1 COVERAGE_OUT_REMAP=1 COVERAGE_APP_FOLDER=$PWD/ TEST_WATCH=1 meteor test --driver-package meteortesting:mocha",
@@ -26,7 +27,6 @@
"@babel/runtime": "^7.23.9",
"@chenfengyuan/vue-countdown": "^1.1.5",
"@tozd/vue-observer-utils": "^0.5.0",
"@types/meteor": "^2.9.8",
"alea": "^1.0.1",
"bcrypt": "^5.1.1",
"chroma-js": "^2.4.2",
@@ -70,6 +70,8 @@
"devDependencies": {
"@types/chai": "^4.3.11",
"@types/lodash": "^4.14.202",
"@types/meteor": "^2.9.8",
"@types/meteor-mdg-validated-method": "^1.2.10",
"@types/mocha": "^10.0.6",
"@types/simpl-schema": "^1.12.7",
"@typescript-eslint/eslint-plugin": "^5.62.0",

View File

@@ -27,7 +27,6 @@
]
},
"resolveJsonModule": true,
"types": ["node", "mocha"],
"esModuleInterop": true,
},
"vueCompilerOptions": {
@@ -41,7 +40,8 @@
],
"typeAcquisition": {
"include": [
"meteor"
"meteor",
"node_modules/@types/meteor/globals/*"
]
}
}