npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@epicdm/webpack-plugin-parse-functions

v0.4.0

Published

Webpack Parse Function builder

Downloads

44

Readme

Overview

This is a Webpack plugin designed to make development on top of the Parse Platform more seamless.

Getting Started

How it works

If you're familiar with Next.js, you know that the routes are built out based on the file structure of the project. This follows a similar methodology.

The default file structure looks like this:

  • src
    • functions
      • <serviceName>
        • schema.json -- the schema of the Parse.Object-based service
        • <hookName>
          • 0.<hookName>.ts
          • config.ts -- the configuration object to be passed to Parse.Cloud.<hookName>(<className>, <handler>, <config>)
        • functions
          • <functionName>.ts - functions to be defined with Parse.Cloud.define('<functionName>', <function>)
        • jobs
          • <jobName>.ts - jobs to be defined with Parse.Cloud.job('<functionName>', <function>)
        • triggers
          • <triggerName>.ts - post-hook triggers that will conditionally run Parse.Cloud.run('<triggerName>', payload), where payload is the parameter of the running hook
      • ..<more services>...

The available hooks are:

  • beforeSave
  • afterSave
  • beforeDelete
  • afterDelete
  • afterCreate
  • afterUpdate
  • beforeCreate
  • beforeUpdate

These hooks targeted at cron jobs are defined and available to be run with Parse.Cloud.startJob('<ClassName>_<frequency>')

  • hourly -- e.g. Parse.Cloud.startJob('ActionItem_hourly')
  • daily
  • weekly
  • monthly
  • datetime

ActionTrigger

This is a special type of Parse.Object that is used to trigger cascading actions conditionally when a hook is run.

There are 4 conditions that must be met before an ActionTrigger will take effect:

  • ActionTrigger.active is true
  • ActionTrigger.objectClass matches the class of Parse.Object that is being run through the hook
  • object[ActionTrigger.property] -> ActionTrigger.condition -> ActionTrigger.value. For example:
  • ActionTrigger.handler is equal to an extant trigger handler function name (i.e. in the src/functions/<serviceName>/triggers/<someTriggerHandler>.ts)

If your project doesn't need to trigger cascading function calls, you won't need to worry about this.

How to Use

This is a normal Webpack plugin and can be used like so:

// webpack.config.js
const path = require('path');
const ParseFunctionsPlugin = require('../dist/main').default;

const config = {
  entry: './src/index.ts',
  output: {
    path: path.resolve(__dirname, 'dist'),
  },
  plugins: [
    new ParseFunctionsPlugin(),
  ],
  // ...and the rest
};

Plugin Options

{
  functionDirectory: 'src/functions', // the directory to watch & build Parse functions
  moduleAlias: '@@functions', // the alias name used for importing the built files
                              // from, e.g. `import initialize, { ClassNames } from '@@functions';`
}

The default option should be preferred, but there may be times where the project requires that you diverge from these naming conventions.

On Build

When the plugin runs, it will aggregate the files (according to the file structure above) and transpile them into modules in a .build folder that may then be accessed by importing members from the moduleAlias (default @@functions);

Built Exports

After building, the built modules can be accessed using the module alias (default: @@functions), and will export the following.

Constants

export enum ClassNames {
  [<ClassName>]: '<ClassName>'
}

export const ClassNamesList = Object.values(ClassNames);

export const TriggerHandlers: TriggerHandlersMap = {
  <ClassName>: [
    {
      label: "<triggerHandlerName>",
      value: "<triggerHandlerName>",
    },
  ],
};

export const Schemas: SchemaMap = {
  [<ClassName>]: { /* ...JSON object representation of Parse.Object<ClassName> schema */ }
}

Types

export type SchemaMap = {
  [prop in ClassNames]: ParseFunctionServiceSchema;
};

export type TriggerHandlerOption = {
  label: string;
  value: string;
};

export type TriggerHandlersMap = {
  [prop in ClassNames]: TriggerHandlerOption[];
};

Initializer

/* === INITIALIZER === */
const initialize = (Parse: ParseType) => {
  <serviceName>(Parse);
  /* ... more services here ... */
};

export default initialize;

TODO

  • [x] Create custom hook handlers for:
    • [x] beforeCreate -- fires before the initial creation of an object
    • [x] afterCreate -- fires after the initial creation of an object
    • [x] beforeUpdate -- fires before a previously created object is updated
    • [x] afterUpdate -- fires after a previously created object is updated
    • [x] hourly -- a cron job that fires hourly
    • [x] daily -- a cron job that fires daily
    • [x] weekly -- a cron job that fires weekly
    • [x] monthly -- a cron job that fires monthly
    • [x] datetime -- a cron job that fires on a specific datetime
  • [x] Make a processActionTriggers function to avoid duplicate code
  • [x] Rework functions, jobs, and triggers to export a factory function that takes a Parse instance as the first parameter, a configuration or context parameter, and returns a function
  • [ ] Make helper types for hooks, functions, jobs, and triggers
  • [x] Make export for trigger handler parameter schema