Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
castor-load-custom
Advanced tools
Create, transform, compute new fields and more ... see castor-load
You can create new fields in each document, by tweaking the ad hoc JSON configuration file (the one located besides the data directory you give to castor, or the one you give in parameters).
All the settings concerning custom fields are put in customFields
key in that configuration file.
If you want ot create a fields.title
key in your documents, add:
"customFields": {
"title" : {
"path" : "content.json.Ti"
}
}
The path
key points to a location inside the original document,
using the dot notation.
There are many options (keys like path
) you can use, see
Options.
Note: the generated fields are truncated at 250 characters (if they are of string type).
Maybe your fields are multivalued, for example, if you load csv
files.
For example, in a Keywords
columns, you have such values:
Dashboard; Nodejs; Github
Web; Dashboard; Statistics
The direct way, is to point to content.json.keywords
, but that will
distinguish the Dashboard
from the first row to the one from the second row.
Moreover, they will be bound to other keywords on the same row.
The solution is to add a custom field in the JSON configuration file:
"customFields" : {
"Keywords" : {
"path" : "content.json.Keywords",
"separator" : ";"
}
},
TODO
Dotted notation to a field within the original document.
Required (with the exception of compute
)
Ex:
"customFields" : {
"doi" : {
"path" : "content.json.doi"
}
}
Label (in UTF-8, without any constraint): the name of the field to display in pages of the application. Optional
Ex:
"customFields" : {
"doi" : {
"label" : "Document Object Identifier"
}
}
Values can be multiform:
[{ "lang" : "XX", "$t": "The label" }]
{ "en" : "Hello", "fr": "Bonjour" }
Default value, used when the field has no value (for example
when the path
is not present in the document). Optional
Ex:
"customFields" : {
"title" : {
"default" : "No title given"
}
}
When the already computed field is an array, and that glue
is set,
each value of the array is joined in a string, using glue
between
every value. Optional
Apply any stringjs chain to the field's value. Optional
Ex:
"customFields" : {
"slug" : {
"path" : "content.json.title"
"transform" : "slugify()"
}
}
Apply any stringjs chain to the field's value, then add the result to the fulltext index of the document. Optional
Ex:
"customFields" : {
"title" : {
"path" : "content.json.title"
"textizer" : "toString()"
}
}
Ex:
"customFields" : {
"Keywords" : {
"path" : "content.json.Kw"
"textizer" : "ensureRight(' ')"
}
}
Note: for fulltext search to work, you have to enable it in mongodb.
For that, add to your mongodb.conf
(maybe located in /etc/mongodb.conf
):
setParameter=textSearchEnabled=true
Split the fields' value into an array, depending on the separator. Optional
Ex:
"customFields" : {
"Keywords" : {
"path" : "content.json.Keywords",
"separator" : ";"
}
},
Transtype the custom field value, in order to be used with another
type than string by compute
, or used by a filter... (values: boolean
, string
, text
, number
, date
).
Optional
Ex:
"customFields" : {
"Year" : {
"path" : "content.json.Py",
"type" : "number"
}
},
Mask (or pattern) used to validate the variable. Optional
Values depend on type
:
text
and string
date
Compute a funex expression, on
the already generated customFields
.
You can access to the customFields.Year
simply using Year
.
Ex:
"customFields" : {
"Authors" : {
"path" : "content.json.Af",
"separator" : ";"
}
"AuthorNb" : {
"compute" : "Authors.length"
}
},
Set it to true to indicate that this custom field should appear whenever the theme needs to display custom fields. Optional (default value: false)
Ex:
"customFields" : {
"Authors" : {
"path" : "content.json.Af"
"visible" : true
}
"authors" : {
"path" : "content.json.Af"
"separator" : ";"
}
},
FAQs
custom loader for castor
The npm package castor-load-custom receives a total of 0 weekly downloads. As such, castor-load-custom popularity was classified as not popular.
We found that castor-load-custom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.