An open API service indexing awesome lists of open source software.

https://github.com/stackpress/incept

App Generator
https://github.com/stackpress/incept

Last synced: 9 months ago
JSON representation

App Generator

Awesome Lists containing this project

README

          

# Incept

Incept is a content management framework.

## Usage

See [Example](https://github.com/stackpress/incept/tree/main/example)
for use case.

## Model Spec

The following attributes can be applied to model types in an idea file.

```js
model User @icon("user") @label("User" "Users") {}
```



Attribute
Description
Attributes
Example




@icon(string)
An icon representation of a model. Uses font awesome names.
 
@icon("user")


@template(string)
Used to describe each row in a model
 
@template("User {{name}}")


@label(string string)
A friendly name that represents the model
 
@label("User" "Users")


@active

A flag that represents the active field. Active fields are
changed when deleting or restoring a row, as an alternative to
actually deleting the row in the database.

 
 


@default(string|number|boolean)

The default value applied when creating a row if no value
was provided.

 

@default(1)

@default("user")

@default(true)

@default("now()")

@default("nanoid()")

@default("nanoid(10)")

@default("cuid()")

@default("cuid(10)")



@generated

A flag that represents that the value of this column is
generated, bypassing the need to be validated

 
 


@id

A flag that represents the models identifier. If multiple ids
then the combination will be used to determine each rows
uniqueness.

 
 


@searchable

A flag deonoting this column is searchable and will be
considered in a search field for example. Also used to know
which columns need to be optimized in the database.

 
 


@sortable

A flag deonoting this column is sortable. Also used to know
which columns need to be optimized in the database.

 
 


@label(string)

A label that will be shown to represent this column instead of
the actual column name.

 
@label("Name")


@min(number)

The minimum number value that will be accepted. This is also a
consideration when determining the database type.

 
@min(10)


@max(number)

The maximum number value that will be accepted. This is also a
consideration when determining the database type.

 
@max(100)


@step(number)

The incremental amount value that will be used when changing
the columns value. This is also a consideration when determining
the database type.

 

@step(1)

@step(0.01)



@relation(config)
Maps columns in the model that is related to another model.

local: string

foreign: string

name?: string


@relation({ local "userId" foreign "id" })

@relation({ name "memberships" local "ownerId" foreign "id" })

@relation({ name "connections" local "memberId" foreign "id" })



@unique

A flag that ensures no duplicate value can be added to the model

 
 


@updated

A flag that will automatically update the timestamp whenever
a row is changed.

 
 

## Validation Spec

The following validation attributes can be applied to model columns in an idea file.

```js
name String @is.required @is.cgt(10)
```



Attribute
Description
Example




@is.required
Validates that a value must be given before being inserted.
 


@is.notempty

Validates that a value is something as opposed to an empty string.

 


@is.eq(string|number)

Validates that the value is explicitly equal to the given argument


@is.eq(10)

@is.eq("foobar")



@is.ne(string|number)

Validates that the value is explicitly not equal to the given argument


@is.neq(10)

@is.neq("foobar")



@is.option(string|number[])
Validates that the value is one of the given options
@is.option([ 1 2 "foo" 3 "bar" ])


@is.regex(string)

Validates that the value matches the given regular expression

@is.regex("[a-z]$")


@is.date
Validates that the value is a date
 


@is.future
Validates that the value is a future date
 


@is.past
Validates that the value is a past date
 


@is.present
Validates that the value is the present date
 


@is.gt(number)
Validate that the value is greater than the given number
@is.gt(10)


@is.ge(number)

Validate that the value is greater than or equal to the given number

@is.ge(10)


@is.lt(number)
Validate that the value is less than the given number
@is.lt(10)


@is.le(number)

Validate that the value is less than or equal to the given number

@is.le(10)


@is.ceq(number)

Validate that the character count of the value
is equal to the given number

@is.ceq(10)


@is.cgt(number)

Validate that the character count of the value is greater
than or equal to the given number

@is.cle(10)


@is.cge(number)

Validate that the character count of the value is
less than the given number

@is.cge(10)


@is.clt(number)

Validate that the character count of the value is
less than or equal to the given number

@is.clt(10)


@is.cle(number)

Validate that the character count of the value is less
than or equal to the given number

@is.cle(10)


@is.weq(number)

Validate that the word count of the value is
equal to the given number

@is.weq(10)


@is.wgt(number)

Validate that the word count of the value is greater
than or equal to the given number

@is.wle(10)


@is.wge(number)

Validate that the word count of the value is less
than the given number

@is.wge(10)


@is.wlt(number)

Validate that the word count of the value is less than
or equal to the given number

@is.wlt(10)


@is.wle(number)

Validate that the word count of the value is less than
or equal to the given number

@is.wle(10)


@is.cc
Validates that the value is a credit card
 


@is.color
Validates that the value is a color value (color name or hex)
 


@is.email
Validates that the value is an email
 


@is.hex
Validates that the value is a hexidecimal
 


@is.price
Validates that the value is a price number (ie. 2 decimal numbers)
 


@is.url
Validates that the value is a URL
 


@is.boolean
Validates that the value is a boolean
 


@is.number
Validates that the value is a number format
 


@is.float
Validates that the value is a float format
 


@is.integer
Validates that the value is an integer format
 


@is.object
Validates that the value is an object
 

## Field Spec

The following fields can be applied to model columns in an idea file.

```js
name String @field.text
```



Attribute
Description
Attributes
Example




@field.color
Use a color field to represent this column in a form
 
 


@field.checkbox(attributes?)
Use a checkbox to represent this column in a form

label: string

check: boolean

circle: boolean

square: boolean

rounded: boolean

blue: boolean

orange: boolean


@field.checkbox

@field.checkbox({ label "Enabled" circle true })



@field.country(attributes?)
Use a country dropdown to represent this column in a form
placeholder: string

@field.country

@field.country({ placeholder "Select Country" })



@field.currency(attributes?)
Use a currency dropdown to represent this column in a form
placeholder: string

@field.currency

@field.currency({ placeholder "Select Currency" })



@field.date
Use a date field to represent this column in a form
 
 


@field.datetime
Use a date time field to represent this column in a form
 
 


@field.editor(attributes?)
Use a code editor to represent this column in a form

lang: html|md|css|js|ts

numbers: boolean


@field.editor

@field.editor({ lang "html" numbers true })



@field.file
Use a file input to represent this column in a form
 
 


@field.filelist
Use a file list fieldset to represent this column in a form
 
 


@field.input
Use an input field to represent this column in a form
 
 


@field.markdown(attributes?)
Use a markdown editor to represent this column in a form
numbers: boolean

@field.markdown

@field.markdown({ numbers true })



@field.mask(attributes)
Use an input mask to represent this column in a form
mask: string

@field.mask

@field.mask({ mask "999-999-999" })



@field.metadata
Use a key value fieldset to represent this column in a form
 
 


@field.number(attributes?)
Uses a number field to represent this column in a form

min: number

max: number

step: number

separator: string

decimal: string

absolute: boolean


@field.number

@field.number({ min 0 max 10 step 0.01 separator "," decimal "." absolute true })



@field.password
Uses a password field to represent this column in a form
 
 


@field.range(attributes?)
Uses a range field to represent this column in a form

min: number

max: number

step: number

width: number


@field.range

@field.range({ min 0 max 10 step 0.01 width 100 })



@field.rating(attributes?)
Uses a rating field to represent this column in a form
max: number

@field.rating

@field.rating({ max 5 })



@field.select(attributes?)
Uses a select dropdown to represent this column in a form
placeholder: string

@field.select

@field.select({ placeholder "Select Country" })



@field.slug

Uses an input field that transforms the value
into a slug to represent this column in a form

 
 


@field.switch(attributes?)
Uses a switch toggle to represent this column in a form

rounded: boolean

onoff: boolean

yesno: boolean

checkex: boolean

sunmoon: boolean

ridge: boolean

smooth: boolean

blue: boolean

orange: boolean

green: boolean


@field.switch

@field.switch({ label "Enabled" yesno true })



@field.textarea(attributes?)
Uses a textarea field to represent this column in a form
rows: number

@field.textarea

@field.textarea({ rows 10 })



@field.taglist
Uses a tag field to represent this column in a form
 
 


@field.textlist
Uses a text list fieldset to represent this column in a form
 
 


@field.time
Uses a time field to represent this column in a form
 
 


@field.wysiwyg(attributes?)
Uses a WYSIWYG to represent this column in a form

history: boolean

font: boolean

size: boolean

format: boolean

paragraph: boolean

blockquote: boolean

style: boolean

color: boolean

highlight: boolean

text: boolean

remove: boolean

indent: boolean

align: boolean

rule: boolean

list: boolean

lineheight: boolean

table: boolean

link: boolean

image: boolean

video: boolean

audio: boolean

fullscreen: boolean

showblocks: boolean

code: boolean

dir: boolean


@field.wysiwyg

@field.wysiwyg({ font true size true format true })


## Filter Spec

The following filter fields can be applied to model columns in an idea file.

```js
name String @field.text
```



Attribute
Description
Attributes
Example




@filter.color
Use a color field to represent this column in a filter form
 
 


@filter.checkbox(attributes?)
Use a checkbox to represent this column in a filter form

label: string

check: boolean

circle: boolean

square: boolean

rounded: boolean

blue: boolean

orange: boolean


@filter.checkbox

@filter.checkbox({ label "Enabled" circle true })



@filter.country(attributes?)
Use a country dropdown to represent this column in a filter form
placeholder: string

@filter.select

@filter.select({ placeholder "Select Country" })



@filter.currency(attributes?)
Use a currency dropdown to represent this column in a filter form
placeholder: string

@filter.currency

@filter.currency({ placeholder "Select Currency" })



@filter.date
Use a date field to represent this column in a filter form
 
 


@filter.datetime
Use a date time field to represent this column in a filter form
 
 


@filter.file
Use a file input to represent this column in a filter form
 
 


@filter.input
Use an input field to represent this column in a filter form
 
 


@filter.mask(attributes)
Use an input mask to represent this column in a filter form
mask: string

@filter.mask

@filter.mask({ mask "999-999-999" })



@filter.number(attributes?)
Uses a number field to represent this column in a filter form

min: number

max: number

step: number

separator: string

decimal: string

absolute: boolean


@filter.number

@filter.number({ min 0 max 10 step 0.01 separator "," decimal "." absolute true })



@filter.password
Uses a password field to represent this column in a filter form
 
 


@filter.range(attributes?)
Uses a range field to represent this column in a filter form

min: number

max: number

step: number

width: number


@filter.range

@filter.range({ min 0 max 10 step 0.01 width 100 })



@filter.rating(attributes?)
Uses a rating field to represent this column in a filter form
max: number

@filter.rating

@filter.rating({ max 5 })



@filter.select(attributes?)
Uses a select dropdown to represent this column in a filter form
placeholder: string

@filter.select

@filter.select({ placeholder "Select Country" })



@filter.slug

Uses an input field that transforms the value into a slug to
represent this column in a filter form

 
 


@filter.switch(attributes?)
Uses a switch toggle to represent this column in a filter form

rounded: boolean

onoff: boolean

yesno: boolean

checkex: boolean

sunmoon: boolean

ridge: boolean

smooth: boolean

blue: boolean

orange: boolean

green: boolean


@filter.switch

@filter.switch({ label "Enabled" yesno true })



@filter.time
Uses a time field to represent this column in a filter form
 
 

### Spans



Attribute
Description
Attributes
Example




@span.date

Use a pair of date fields as a span to represent
this column in a filter form

 
 


@span.datetime

Use a pair of date time fields as a span to represent
this column in a filter form

 
 


@span.input

Use a pair of input fields as a span to represent
this column in a filter form

 
 


@span.number(attributes?)

Use a pair of number fields as a span to represent
this column in a filter form


min: number

max: number

step: number

separator: string

decimal: string

absolute: boolean


@span.number

@span.number({ min 0 max 10 step 0.01 separator "," decimal "." absolute true })



@span.range(attributes?)
Use a range field as a span to represent this column in a filter form

min: number

max: number

step: number

width: number


@span.range

@span.range({ min 0 max 10 step 0.01 width 100 })



@span.rating(attributes?)

Use a pair of rating fields as a span to represent
this column in a filter form

max: number

@span.rating

@span.rating({ max 5 })



@span.select(attributes?)
Use a pair of select dropdowns as a span to represent this column in a filter form
placeholder: string

@span.select

@span.select({ placeholder "Select Country" })



@span.time

Use a pair of time fields as a span to represent this
column in a filter form