Members
# constant CustomParser
It wasn't possible to pass raw filters to adapters with AdminJS
This solution allows you to pass custom filters to typeorm adapter modyfing list handler
In your custom list handler modify creating filters in this way:
// That makes `Filter` class to create proper filter object.
filters[propertyToFilterBy] = 1;
const filter = await new Filter(filters, resource).populate();
// This parser recognizes `custom` field and passes the value directly to typeorm
filter.filters[propertyToFilterBy].custom = In([1,2,3]);
# constant lowerCase
This function is used to map actual model name to it's prisma manager.
Ref: https://github.com/prisma/prisma/blob/ba74c81fdbc9e6405946fdc6f9d42d103d008dc2/packages/client/src/runtime/utils/common.ts#L452
# constant relativeFilePathResolver
resolve relative file path to absolute file path.
# constant validatePropertiesGlobally
Checks if all properties have uniq names
Methods
# buildFeature(options) → {FeatureType}
Higher Order Function which creates a feature
Parameters:
Name | Type | Description |
---|---|---|
options |
ResourceOptions
|
Example
const { buildFeature } = require('adminjs')
const feature = buildFeature({
// resource options goes here.
})
# mergeResourceOptions(oldOptions, newOptions) → {ResourceOptions}
Merges 2 ResourceOptions together. Used by features
- 'id', 'href', 'parent', 'sort' from
newOptions
overrideoldOptions
- 'listProperties', 'showProperties', 'editProperties', 'filterProperties' are joined and made unique
- all 'properties' from
newOptions
override properties fromoldOptions
- all 'actions' with their parameters from
newOptions
overrideoldOptions
except hooks and handler - which are chained.
Parameters:
Name | Type | Description |
---|---|---|
oldOptions |
ResourceOptions
|
|
newOptions |
ResourceOptions
|
# async sessionAuth()
Creates authentication logic for admin users
Type Definitions
object
# AuthOptions
Plugin definition for Hapi.js framework.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
authenticate |
function
|
<optional> |
Function takes email and password as argument. Should return a logged-in user object or null/false., If provided, the strategy is set to 'session'. |
strategy |
string
|
<optional> |
Auth strategy for Hapi routes. |
cookieName |
string
|
<optional> |
This is the name of the cookie if strategy is set to 'session'. |
cookiePassword |
string
|
<optional> |
Cookie password for 'session' strategy. |
isSecure |
boolean
|
If cookie should be accessible only via https, defaults to false |
|
{...} |
any
|
Cookie options: https://github.com/hapijs/cookie |
object
# PropertyCustom
Custom (PropertyOptions#custom) properties passed down to the component.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
filePathProperty |
string
|
||
fileProperty |
string
|
||
filesToDeleteProperty |
string
|
||
keyProperty |
string
|
||
fileNameProperty |
string
|
<optional> |
|
mimeTypeProperty |
string
|
<optional> |
|
bucketProperty |
string
|
<optional> |
|
defaultBucket |
string
|
||
mimeTypes |
Array.<(MimeType|string)>
|
<optional> |
|
maxSize |
number
|
<optional> |
|
provider |
string
|
||
multiple |
boolean
|