1.4.3 • Published 1 year ago

@hapify/generator v1.4.3

Weekly downloads
14
License
MIT
Repository
-
Last release
1 year ago

Hapify Generator

Description

This package allows you to generate code using Hapify models and Hapify or JavaScript code templates.

Usage

import { Generator } from '@hapify/generator';

const templates = [
    {
    	path: '/path/to/{snake}',
    	engine: 'hpf',
    	input: 'one',
        content: 'Camel case is <<Model camel>>.',
    }
];
const models = [
    {
        id: 'bdc6c58e-ec49-9193-6b29-6c75518bc3ad',
        name: 'Place bookmark',
        notes: 'A user can only list its own bookmarks',
        fields: [
            {
                name: '_id',
                notes: null,
                type: 'string',
                subtype: null,
                value: null,
                primary: true,
                unique: false,
                label: false,
                nullable: false,
                multiple: false,
                embedded: false,
                searchable: false,
                sortable: false,
                hidden: false,
                internal: true,
                restricted: false,
                ownership: false
            }
        ],
        accesses: {
            create: 'auth',
            read: 'owner',
            update: 'admin',
            remove: 'owner',
            search: 'owner',
            count: 'owner'
        }
    }
];

// Get path & content
Generator.run(templates, models)
    .then(results => {
        // [{ path: '/path/to/place_bookmark', content: 'Camel case is placeBookmark' }]
    });

// Get path only
const path = Generator.path('/path/to/{camel}', models[0]); // '/path/to/placeBookmark'

More

For more information about this module, please refer to the online documentation.

1.4.3

1 year ago

1.4.2

2 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.3.0

3 years ago

1.0.0

3 years ago

0.8.0

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.11

3 years ago

0.5.10

3 years ago

0.5.8

3 years ago

0.5.7

3 years ago

0.5.9

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.4

4 years ago