New package - jam:method - An easy way to create Meteor methods

Hmm that’s weird. I just tried to reproduce it but couldn’t.

I have a theory though. It’s kind of a long story but essentially I had unfortunate timing when I originally published the package – it happened to be during the Atmosphere outage on Oct 31. The Meteor team helped me resolve the issue and I republished the package which seemed to work correctly. Since you’re seeing this issue, I wonder if there is still something wonky.

@philippeoliveira do you have any ideas?

One thing you could do is remove Meteor’s local package db and reinstall Meteor (assuming you’re on Mac):

1. sudo rm /usr/local/bin/meteor
2. rm -rf ~/.meteor
3. curl https://install.meteor.com/ | sh

I have downloaded the source code under /packages folder and quickly implemented it with Zod. Your package seems SUPER.

1 Like

Awesome, thanks! Let me know if you have any ideas to improve it.

Just tried to install the package and got this:

13:10:32 in FamZ24 on  main [?] via ⬢ v16.16.0 using ☁️  default/ki-bot-395608 via 🅒 base took 2s 
➜ meteor add jam:method
/Users/jan-michaelpilgenroeder/.meteor/packages/meteor-tool/.2.14.0.9et9d9.ajq4o++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:218
      throw error;
      ^

Error: Found multiple packages matching name: jam:method
    at RemoteCatalog.getPackage (/tools/packaging/catalog/catalog-remote.js:602:13)
    at LayeredCatalog._returnFirst (/tools/packaging/catalog/catalog.js:190:32)
    at LayeredCatalog.getPackage (/tools/packaging/catalog/catalog.js:194:17)
    at /tools/cli/commands-packages.js:2207:59
    at Object.enterJob (/tools/utils/buildmessage.js:388:12)
    at /tools/cli/commands-packages.js:2197:20
    at Function.each (/Users/jan-michaelpilgenroeder/.meteor/packages/meteor-tool/.2.14.0.9et9d9.ajq4o++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/underscore/underscore-node-f-pre.js:1316:7)
    at /tools/cli/commands-packages.js:2196:7
    at Object.capture (/tools/utils/buildmessage.js:283:5)
    at Command.func (/tools/cli/commands-packages.js:2195:31)
    at /tools/cli/main.js:1534:15

Thanks for reporting. I think this can only be fixed by the Meteor team. I opened a new issue to ask for their help.

In the meantime, you can use the package locally by copying it from GitHub and adding it to a packages folder at the root of your project.

Alternatively, I believe if you clear Meteor’s cache on your machine and reinstall Meteor, it should fix it:

Hello,

Could you try running the commands Jam mentioned and let us know if everything goes smoothly afterwards?

Has the Meteor installation on your MacOS been recent or has it been there for some time?

Best Regards,

Philippe Oliveira

There’s was no /usr/local/bin/meteor
Step 2 and 3 did the trick, though.

1 Like

I just published an update that allows for validating without executing the method. :tada:

Here’s a quick look:

// define a method
export const create = createMethod({
  name: 'todos.create',
  schema: Todos.schema,
  async run({ text }) {
    // ... //
  }
});

// validate against the schema without executing the method
create.validate({...})

// validate against only the relevant part of the schema based on the data passed in without executing the method
create.validate.only({...})

I’ll demonstrate soon how I plan to use .validate.only in particular for form UX.

4 Likes

I’ve just published an update to make jam:method compatible with Meteor 3.0-rc.4, the latest release candidate. :tada:

If you like writing your methods isomorphically and are looking for a way to make your app feel instant for users, this section of the readme might be of interest to you.

2 Likes

Hey @jam

Would you be interested in doing a tutorial using your packages on the TWIM podcast?

Lmk.

2 Likes

Hey Alim, it’d be fun to collaborate with y’all. Will send you a DM to talk more about it.