.js. You must define main(profile) and return a configuration object. To append to a list, use rules+, not the YAML modifier rules-end.
main(profile)
object
required
The current configuration object, which can be read and modified directly.
object
required
Return a configuration object or a Promise that resolves to one.If the function returns
undefined, an array, or a scalar, or if it throws an error, the current script fails and the configuration from before the script ran is preserved.main-sync.js
main-async.js
deepMerge(target, patch, isOverride)
object
required
The target object. It is modified in place and returned.
object
required
The content to merge.
boolean
default:"true"
When
true, enables the +key / key+ / key! modifiers.Patch keys
any
Objects merge recursively; arrays replace; scalars overwrite.
array
Insert at the beginning of the list (
isOverride = true).array
Append to the end of the list (
isOverride = true).object
Replace the entire field.
any
Literal field name.
deep-merge.js
Built-in APIs
yaml
(text: string) => any
YAML text -> value.
(value: any) => string
Value -> YAML text.
fetch(input, init?)
Only http:// is supported.
string | object
required
A URL, or an object containing
url.string
default:"GET"
HTTP method.
object
Request headers.
string | object
Request body; non-string values are passed through
JSON.stringify.boolean
Whether the status is 2xx.
number
Status code.
string
Status text.
string
Request URL.
object
Provides
get / has / toJSON.Promise<string>
Response body as text.
Promise<any>
Parsed JSON.
Promise<any>
Parsed YAML.
fetch-rules.js
console
Writes to a .log file in the script’s directory with the same base name as the main file. The log is reset before each execution.
function
Write a log entry at the corresponding level. Log content is redacted for Age-encrypted configurations.
Base64
(value: string) => string
UTF-8 -> Base64.
(value: string) => string
Base64 -> UTF-8.
function
Compatibility API for UTF-8 encoding or Base64 decoding.
Example
filter-proxies.js
