@trendhim/data-plans
TypeScript icon, indicating that this package has built-in type declarations

0.28.0 • Public • Published

Data Plans

Source of truth for Trendhim's data plans. Helps generate data-plans for mparticle, and typescript definitions for nodejs projects.

For more information about how mParticle uses data-plans to ensure data consistency, click here.

Folder structure

src
├── data-plans.ts             defines active data-plans
└── example-data-plan
    ├── event-type
    │   ├── base.ts           attribute definitions applied to all events of event-type
    │   ├── index.ts          defines active events of event-type
    │   └── example_event.ts  attribute definitions applied to example-event
    ├── base.ts               attribute definitions applied to all events
    ├── index.ts              exports properties matching the DataPlanExport interface mentioned below
    ├── user_attributes.ts    attribute definitions for user attributes (optional)
    ├── v1.ts                 event definition for data-plan version 1
    └── vX.ts                 event definition for data-plan version X (optional)

Creating a new data plan

Create a new directory in src with the name of the data-plan being the directory name.

Create src/<data-plan>/index.ts and ensure it exports the DataPlanExport interface. Add an import for your new data-plan in src/data-plans.ts, and to the default export.

Data plan events

Data plans support multiple versions of the same plan, and we intend to always introduce a new version, if we make a breaking change to a given data-plan. A breaking change can be, but is not limited to; removing attributes, changing attribute types, or adding new required attributes.

Create event

Add a new file to the relevant event-type-folder, and name it the same as your event. Ensure it imports and re-exports the base attributes of the event-type, as seen in the folder structure. Add an import for your new event in src/<data-plan>/<event-type>/index.ts, and re-export it accordingly.

Publish

mparticle

  1. Ensure you have configured your environment variables either directly, or through a .env-file. Needed variables: MPARTICLE_CLIENT_ID, MPARTICLE_CLIENT_SECRET and MPARTICLE_WORKSPACE_ID.
  2. Run npm run publish:data-plans

npm

  1. Bump the version in package.json
  2. Run npm publish --access public

Readme

Keywords

none

Package Sidebar

Install

npm i @trendhim/data-plans

Weekly Downloads

14

Version

0.28.0

License

none

Unpacked Size

57.6 kB

Total Files

3

Last publish

Collaborators

  • multiply