Issues
I’ve looked into how https://github.com/TurtleTower/Moralis-CloudCode-Boilerplate-Typescript works but I find the following problems when using its techniques to implement my own solution:
-
Declaring
Moralis
as a constant externally throws errors when it is used as a type or namespace. This is important since Cloud Code provides a number of modules without needing to define them in the script.
-
Lots of functions expected to work with Cloud Code either don’t work (such as
Moralis.Cloud.units
,Moralis.web3ByChain
,Moralis.settings
) or have incorrect definitions (Moralis.Cloud.define
,Moralis.Units.Token
). For tokens, the workaround was not to change the declarations but instead hunt for the source code and paste it directly. -
It’s not feasible to include our own source code unless we use
webpack
manually to create a bundled JS file. Without webpack, TS files can’t be treated as modules, in which case the internalncc_webpack
functionality ofmoralis-admin-cli
bundles them appropriately.
I’m looking for
-
A proper setup for TS and Moralis Cloud Code that assumes all the modules implicitly available are not known to the IDE.
This can be similar to howMocha
is implicitly included in tests, such as those in Hardhat templates. -
A proper extensive class reference in JS, which I could not find without directly referring to the source code itself, and hopefully correct type declarations in TS. These can be the basis for a class reference as well.
Spec
Moralis: [email protected]
Server: 0.0.334
IDE: VS Code 1.63.2 production