diff --git a/ast/builtins.go b/ast/builtins.go index 9ab00c5b18..51dbd30135 100644 --- a/ast/builtins.go +++ b/ast/builtins.go @@ -344,219 +344,283 @@ var MemberWithKey = &Builtin{ /** * Comparisons */ +var comparison = category("comparison") -// GreaterThan represents the ">" comparison operator. var GreaterThan = &Builtin{ - Name: "gt", - Infix: ">", + Name: "gt", + Infix: ">", + Categories: comparison, Decl: types.NewFunction( - types.Args(types.A, types.A), - types.B, + types.Args( + types.Named("x", types.A), + types.Named("y", types.A), + ), + types.Named("result", types.B).Description("true if `x` is greater than `y`; false otherwise"), ), } -// GreaterThanEq represents the ">=" comparison operator. var GreaterThanEq = &Builtin{ - Name: "gte", - Infix: ">=", + Name: "gte", + Infix: ">=", + Categories: comparison, Decl: types.NewFunction( - types.Args(types.A, types.A), - types.B, + types.Args( + types.Named("x", types.A), + types.Named("y", types.A), + ), + types.Named("result", types.B).Description("true if `x` is greater or equal to `y`; false otherwise"), ), } // LessThan represents the "<" comparison operator. var LessThan = &Builtin{ - Name: "lt", - Infix: "<", + Name: "lt", + Infix: "<", + Categories: comparison, Decl: types.NewFunction( - types.Args(types.A, types.A), - types.B, + types.Args( + types.Named("x", types.A), + types.Named("y", types.A), + ), + types.Named("result", types.B).Description("true if `x` is less than `y`; false otherwise"), ), } -// LessThanEq represents the "<=" comparison operator. var LessThanEq = &Builtin{ - Name: "lte", - Infix: "<=", + Name: "lte", + Infix: "<=", + Categories: comparison, Decl: types.NewFunction( - types.Args(types.A, types.A), - types.B, + types.Args( + types.Named("x", types.A), + types.Named("y", types.A), + ), + types.Named("result", types.B).Description("true if `x` is less than or equal to `y`; false otherwise"), ), } -// NotEqual represents the "!=" comparison operator. var NotEqual = &Builtin{ - Name: "neq", - Infix: "!=", + Name: "neq", + Infix: "!=", + Categories: comparison, Decl: types.NewFunction( - types.Args(types.A, types.A), - types.B, + types.Args( + types.Named("x", types.A), + types.Named("y", types.A), + ), + types.Named("result", types.B).Description("true if `x` is not equal to `y`; false otherwise"), ), } // Equal represents the "==" comparison operator. var Equal = &Builtin{ - Name: "equal", - Infix: "==", + Name: "equal", + Infix: "==", + Categories: comparison, Decl: types.NewFunction( - types.Args(types.A, types.A), - types.B, + types.Args( + types.Named("x", types.A), + types.Named("y", types.A), + ), + types.Named("result", types.B).Description("true if `x` is equal to `y`; false otherwise"), ), } /** * Arithmetic */ +var number = category("numbers") -// Plus adds two numbers together. var Plus = &Builtin{ - Name: "plus", - Infix: "+", - Decl: types.NewFunction( - types.Args(types.N, types.N), - types.N, - ), -} - -// Minus subtracts the second number from the first number or computes the diff -// between two sets. -var Minus = &Builtin{ - Name: "minus", - Infix: "-", + Name: "plus", + Infix: "+", + Description: "Plus adds two numbers together.", Decl: types.NewFunction( types.Args( - types.NewAny(types.N, types.NewSet(types.A)), - types.NewAny(types.N, types.NewSet(types.A)), + types.Named("x", types.N), + types.Named("y", types.N), ), - types.NewAny(types.N, types.NewSet(types.A)), + types.Named("z", types.N).Description("the sum of `x` and `y`"), ), + Categories: number, +} + +var Minus = &Builtin{ + Name: "minus", + Infix: "-", + Description: "Minus subtracts the second number from the first number or computes the difference between two sets.", + Decl: types.NewFunction( + types.Args( + types.Named("x", types.NewAny(types.N, types.NewSet(types.A))), + types.Named("y", types.NewAny(types.N, types.NewSet(types.A))), + ), + types.Named("z", types.NewAny(types.N, types.NewSet(types.A))).Description("the difference of `x` and `y`"), + ), + Categories: category("sets", "numbers"), } -// Multiply multiplies two numbers together. var Multiply = &Builtin{ - Name: "mul", - Infix: "*", + Name: "mul", + Infix: "*", + Description: "Multiplies two numbers.", Decl: types.NewFunction( - types.Args(types.N, types.N), - types.N, + types.Args( + types.Named("x", types.N), + types.Named("y", types.N), + ), + types.Named("z", types.N).Description("the product of `x` and `y`"), ), + Categories: number, } -// Divide divides the first number by the second number. var Divide = &Builtin{ - Name: "div", - Infix: "/", + Name: "div", + Infix: "/", + Description: "Divides the first number by the second number.", Decl: types.NewFunction( - types.Args(types.N, types.N), - types.N, + types.Args( + types.Named("x", types.N).Description("the dividend"), + types.Named("y", types.N).Description("the divisor"), + ), + types.Named("z", types.N).Description("the result of `x` divided by `y`"), ), + Categories: number, } -// Round rounds the number to the nearest integer. var Round = &Builtin{ - Name: "round", + Name: "round", + Description: "Rounds the number to the nearest integer.", Decl: types.NewFunction( - types.Args(types.N), - types.N, + types.Args( + types.Named("x", types.N).Description("the number to round"), + ), + types.Named("y", types.N).Description("the result of rounding `x`"), ), + Categories: number, } -// Ceil rounds the number up to the nearest integer. var Ceil = &Builtin{ - Name: "ceil", + Name: "ceil", + Description: "Rounds the number _up_ to the nearest integer.", Decl: types.NewFunction( - types.Args(types.N), - types.N, + types.Args( + types.Named("x", types.N).Description("the number to round"), + ), + types.Named("y", types.N).Description("the result of rounding `x` _up_"), ), + Categories: number, } -// Floor rounds the number down to the nearest integer. var Floor = &Builtin{ - Name: "floor", + Name: "floor", + Description: "Rounds the number _down_ to the nearest integer.", Decl: types.NewFunction( - types.Args(types.N), - types.N, + types.Args( + types.Named("x", types.N).Description("the number to round"), + ), + types.Named("y", types.N).Description("the result of rounding `x` _down_"), ), + Categories: number, } -// Abs returns the number without its sign. var Abs = &Builtin{ - Name: "abs", + Name: "abs", + Description: "Returns the number without its sign.", Decl: types.NewFunction( - types.Args(types.N), - types.N, + types.Args( + types.Named("x", types.N), + ), + types.Named("y", types.N).Description("the absolute value of `x`"), ), + Categories: number, } -// Rem returns the remainder for x%y for y != 0. var Rem = &Builtin{ - Name: "rem", - Infix: "%", + Name: "rem", + Infix: "%", + Description: "Returns the remainder for of `x` divided by `y`, for `y != 0`.", Decl: types.NewFunction( - types.Args(types.N, types.N), - types.N, + types.Args( + types.Named("x", types.N), + types.Named("y", types.N), + ), + types.Named("z", types.N).Description("the remainder"), ), + Categories: number, } /** * Bitwise */ -// BitsOr returns the bitwise "or" of two integers. var BitsOr = &Builtin{ - Name: "bits.or", + Name: "bits.or", + Description: "Returns the bitwise \"OR\" of two integers.", Decl: types.NewFunction( - types.Args(types.N, types.N), - types.N, + types.Args( + types.Named("x", types.N), + types.Named("y", types.N), + ), + types.Named("z", types.N), ), } -// BitsAnd returns the bitwise "and" of two integers. var BitsAnd = &Builtin{ - Name: "bits.and", + Name: "bits.and", + Description: "Returns the bitwise \"AND\" of two integers.", Decl: types.NewFunction( - types.Args(types.N, types.N), - types.N, + types.Args( + types.Named("x", types.N), + types.Named("y", types.N), + ), + types.Named("z", types.N), ), } -// BitsNegate returns the bitwise "negation" of an integer (i.e. flips each -// bit). var BitsNegate = &Builtin{ - Name: "bits.negate", + Name: "bits.negate", + Description: "Returns the bitwise negation (flip) of an integer.", Decl: types.NewFunction( - types.Args(types.N), - types.N, + types.Args( + types.Named("x", types.N), + ), + types.Named("z", types.N), ), } -// BitsXOr returns the bitwise "exclusive-or" of two integers. var BitsXOr = &Builtin{ - Name: "bits.xor", + Name: "bits.xor", + Description: "Returns the bitwise \"XOR\" (exclusive-or) of two integers.", Decl: types.NewFunction( - types.Args(types.N, types.N), - types.N, + types.Args( + types.Named("x", types.N), + types.Named("y", types.N), + ), + types.Named("z", types.N), ), } -// BitsShiftLeft returns a new integer with its bits shifted some value to the -// left. var BitsShiftLeft = &Builtin{ - Name: "bits.lsh", + Name: "bits.lsh", + Description: "Returns a new integer with its bits shifted `s` bits to the left.", Decl: types.NewFunction( - types.Args(types.N, types.N), - types.N, + types.Args( + types.Named("x", types.N), + types.Named("s", types.N), + ), + types.Named("z", types.N), ), } -// BitsShiftRight returns a new integer with its bits shifted some value to the -// right. var BitsShiftRight = &Builtin{ - Name: "bits.rsh", + Name: "bits.rsh", + Description: "Returns a new integer with its bits shifted `s` bits to the right.", Decl: types.NewFunction( - types.Args(types.N, types.N), - types.N, + types.Args( + types.Named("x", types.N), + types.Named("s", types.N), + ), + types.Named("z", types.N), ), } @@ -564,251 +628,303 @@ var BitsShiftRight = &Builtin{ * Sets */ -// And performs an intersection operation on sets. +var sets = category("sets") + var And = &Builtin{ - Name: "and", - Infix: "&", + Name: "and", + Infix: "&", + Description: "Returns the intersection of two sets.", Decl: types.NewFunction( types.Args( - types.NewSet(types.A), - types.NewSet(types.A), + types.Named("x", types.NewSet(types.A)), + types.Named("y", types.NewSet(types.A)), ), - types.NewSet(types.A), + types.Named("z", types.NewSet(types.A)).Description("the intersection of `x` and `y`"), ), + Categories: sets, } // Or performs a union operation on sets. var Or = &Builtin{ - Name: "or", - Infix: "|", + Name: "or", + Infix: "|", + Description: "Returns the union of two sets.", Decl: types.NewFunction( types.Args( - types.NewSet(types.A), - types.NewSet(types.A), + types.Named("x", types.NewSet(types.A)), + types.Named("y", types.NewSet(types.A)), ), - types.NewSet(types.A), + types.Named("z", types.NewSet(types.A)).Description("the union of `x` and `y`"), ), + Categories: sets, +} + +var Intersection = &Builtin{ + Name: "intersection", + Description: "Returns the intersection of the given input sets.", + Decl: types.NewFunction( + types.Args( + types.Named("xs", types.NewSet(types.NewSet(types.A))).Description("set of sets to intersect"), + ), + types.Named("y", types.NewSet(types.A)).Description("the intersection of all `xs` sets"), + ), + Categories: sets, +} + +var Union = &Builtin{ + Name: "union", + Description: "Returns the union of the given input sets.", + Decl: types.NewFunction( + types.Args( + types.Named("xs", types.NewSet(types.NewSet(types.A))).Description("set of sets to merge"), + ), + types.Named("y", types.NewSet(types.A)).Description("the union of all `xs` sets"), + ), + Categories: sets, } /** * Aggregates */ -// Count takes a collection or string and counts the number of elements in it. +var aggregates = category("aggregates") + var Count = &Builtin{ - Name: "count", + Name: "count", + Description: " Count takes a collection or string and returns the number of elements (or characters) in it.", Decl: types.NewFunction( types.Args( - types.NewAny( + types.Named("collection", types.NewAny( types.NewSet(types.A), types.NewArray(nil, types.A), types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), types.S, - ), + )).Description("the set/array/object/string to be counted"), ), - types.N, + types.Named("n", types.N).Description("the count of elements, key/val pairs, or characters, respectively."), ), + Categories: aggregates, } -// Sum takes an array or set of numbers and sums them. var Sum = &Builtin{ - Name: "sum", + Name: "sum", + Description: "Sums elements of an array or set of numbers.", Decl: types.NewFunction( types.Args( - types.NewAny( + types.Named("collection", types.NewAny( types.NewSet(types.N), types.NewArray(nil, types.N), - ), + )), ), - types.N, + types.Named("n", types.N).Description("the sum of all elements"), ), + Categories: aggregates, } -// Product takes an array or set of numbers and multiplies them. var Product = &Builtin{ - Name: "product", + Name: "product", + Description: "Muliplies elements of an array or set of numbers", Decl: types.NewFunction( types.Args( - types.NewAny( + types.Named("collection", types.NewAny( types.NewSet(types.N), types.NewArray(nil, types.N), - ), + )), ), - types.N, + types.Named("n", types.N).Description("the product of all elements"), ), + Categories: aggregates, } -// Max returns the maximum value in a collection. var Max = &Builtin{ - Name: "max", + Name: "max", + Description: "Returns the maximum value in a collection.", Decl: types.NewFunction( types.Args( - types.NewAny( + types.Named("collection", types.NewAny( types.NewSet(types.A), types.NewArray(nil, types.A), - ), + )), ), - types.A, + types.Named("n", types.A).Description("the maximum of all elements"), ), + Categories: aggregates, } -// Min returns the minimum value in a collection. var Min = &Builtin{ - Name: "min", + Name: "min", + Description: "Returns the minimum value in a collection.", Decl: types.NewFunction( types.Args( - types.NewAny( + types.Named("collection", types.NewAny( types.NewSet(types.A), types.NewArray(nil, types.A), - ), + )), ), - types.A, + types.Named("n", types.A).Description("the minimum of all elements"), ), + Categories: aggregates, +} + +/** + * Sorting + */ + +var Sort = &Builtin{ + Name: "sort", + Description: "Returns a sorted array.", + Decl: types.NewFunction( + types.Args( + types.Named("collection", types.NewAny( + types.NewArray(nil, types.A), + types.NewSet(types.A), + )).Description("the array or set to be sorted"), + ), + types.Named("n", types.NewArray(nil, types.A)).Description("the sorted array"), + ), + Categories: aggregates, } /** * Arrays */ -// ArrayConcat returns the result of concatenating two arrays together. var ArrayConcat = &Builtin{ - Name: "array.concat", + Name: "array.concat", + Description: "Concatenates two arrays.", Decl: types.NewFunction( types.Args( - types.NewArray(nil, types.A), - types.NewArray(nil, types.A), + types.Named("x", types.NewArray(nil, types.A)), + types.Named("y", types.NewArray(nil, types.A)), ), - types.NewArray(nil, types.A), + types.Named("z", types.NewArray(nil, types.A)).Description("the concatenation of `x` and `y`"), ), } -// ArraySlice returns a slice of a given array var ArraySlice = &Builtin{ - Name: "array.slice", + Name: "array.slice", + Description: "Returns a slice of a given array. If `start` is greater or equal than `stop`, `slice` is `[]`.", Decl: types.NewFunction( types.Args( - types.NewArray(nil, types.A), - types.NewNumber(), - types.NewNumber(), + types.Named("arr", types.NewArray(nil, types.A)).Description("the array to be sliced"), + types.Named("start", types.NewNumber()).Description("the start index of the returned slice; if less than zero, it's clamped to 0"), + types.Named("stop", types.NewNumber()).Description("the stop index of the returned slice; if larger than `count(arr)`, it's clamped to `count(arr)`"), ), - types.NewArray(nil, types.A), + types.Named("slice", types.NewArray(nil, types.A)).Description("the subslice of `array`, from `start` to `end`, including `arr[start]`, but excluding `arr[end]`"), ), -} +} // NOTE(sr): this function really needs examples -// ArrayReverse returns a given array, reversed var ArrayReverse = &Builtin{ - Name: "array.reverse", + Name: "array.reverse", + Description: "Returns the reverse of a given array.", Decl: types.NewFunction( types.Args( - types.NewArray(nil, types.A), + types.Named("arr", types.NewArray(nil, types.A)).Description("the array to be reversed"), ), - types.NewArray(nil, types.A), + types.Named("rev", types.NewArray(nil, types.A)).Description("an array containing the elements of `arr` in reverse order"), ), } /** * Conversions */ +var conversions = category("conversions") -// ToNumber takes a string, bool, or number value and converts it to a number. -// Strings are converted to numbers using strconv.Atoi. -// Boolean false is converted to 0 and boolean true is converted to 1. var ToNumber = &Builtin{ - Name: "to_number", + Name: "to_number", + Description: "Converts a string, bool, or number value to a number: Strings are converted to numbers using `strconv.Atoi`, Boolean `false` is converted to 0 and `true` is converted to 1.", Decl: types.NewFunction( types.Args( - types.NewAny( + types.Named("x", types.NewAny( types.N, types.S, types.B, types.NewNull(), - ), + )), ), - types.N, + types.Named("num", types.N), ), + Categories: conversions, } /** * Regular Expressions */ -// RegexMatch takes two strings and evaluates to true if the string in the second -// position matches the pattern in the first position. var RegexMatch = &Builtin{ - Name: "regex.match", + Name: "regex.match", + Description: "Matches a string against a regular expression.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("pattern", types.S).Description("regular expression"), + types.Named("value", types.S).Description("value to match against `pattern`"), ), - types.B, + types.Named("result", types.B), ), } -// RegexIsValid returns true if the regex pattern string is valid, otherwise false. var RegexIsValid = &Builtin{ - Name: "regex.is_valid", + Name: "regex.is_valid", + Description: "Checks if a string is a valid regular expression: the detailed syntax for patterns is defined by https://github.com/google/re2/wiki/Syntax.", Decl: types.NewFunction( types.Args( - types.S, + types.Named("pattern", types.S).Description("regular expression"), ), - types.B, + types.Named("result", types.B), ), } -// RegexFindAllStringSubmatch returns an array of all successive matches of the expression. -// It takes two strings and a number, the pattern, the value and number of matches to -// return, -1 means all matches. var RegexFindAllStringSubmatch = &Builtin{ - Name: "regex.find_all_string_submatch_n", + Name: "regex.find_all_string_submatch_n", + Description: "Returns all successive matches of the expression.", Decl: types.NewFunction( types.Args( - types.S, - types.S, - types.N, + types.Named("pattern", types.S).Description("regular expression"), + types.Named("value", types.S).Description("string to match"), + types.Named("number", types.N).Description("number of matches to return; `-1` means all matches"), ), - types.NewArray(nil, types.NewArray(nil, types.S)), + types.Named("output", types.NewArray(nil, types.NewArray(nil, types.S))), ), } -// RegexTemplateMatch takes two strings and evaluates to true if the string in the second -// position matches the pattern in the first position. var RegexTemplateMatch = &Builtin{ - Name: "regex.template_match", + Name: "regex.template_match", + Description: "Matches a string against a pattern, where there pattern may be glob-like", Decl: types.NewFunction( types.Args( - types.S, - types.S, - types.S, - types.S, + types.Named("template", types.S).Description("template expression containing `0..n` regular expressions"), + types.Named("value", types.S).Description("string to match"), + types.Named("delimiter_start", types.S).Description("start delimiter of the regular expression in `template`"), + types.Named("delimiter_end", types.S).Description("end delimiter of the regular expression in `template`"), ), - types.B, + types.Named("result", types.B), ), -} +} // TODO(sr): example:`regex.template_match("urn:foo:{.*}", "urn:foo:bar:baz", "{", "}")`` returns ``true``. -// RegexSplit splits the input string by the occurrences of the given pattern. var RegexSplit = &Builtin{ - Name: "regex.split", + Name: "regex.split", + Description: "Splits the input string by the occurrences of the given pattern.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("pattern", types.S).Description("regular expression"), + types.Named("value", types.S).Description("string to match"), ), - types.NewArray(nil, types.S), + types.Named("output", types.NewArray(nil, types.S)).Description("the parts obtained by splitting `value`"), ), } // RegexFind takes two strings and a number, the pattern, the value and number of match values to // return, -1 means all match values. var RegexFind = &Builtin{ - Name: "regex.find_n", + Name: "regex.find_n", + Description: "Returns the specified number of matches when matching the input against the pattern.", Decl: types.NewFunction( types.Args( - types.S, - types.S, - types.N, + types.Named("pattern", types.S).Description("regular expression"), + types.Named("value", types.S).Description("string to match"), + types.Named("number", types.N).Description("number of matches to return, if `-1`, returns all matches"), ), - types.NewArray(nil, types.S), + types.Named("output", types.NewArray(nil, types.S)).Description("collected matches"), ), } @@ -819,277 +935,300 @@ var RegexFind = &Builtin{ // - "[a-z]*" and [0-9]+" -> not true. var GlobsMatch = &Builtin{ Name: "regex.globs_match", + Description: `Checks if the intersection of two glob-style regular expressions matches a non-empty set of non-empty strings. +The set of regex symbols is limited for this builtin: only ` + "`.`, `*`, `+`, `[`, `-`, `]` and `\\` are treated as special symbols.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("glob1", types.S), + types.Named("glob2", types.S), ), - types.B, + types.Named("result", types.B), ), } /** * Strings */ +var stringsCat = category("strings") -// Concat joins an array of strings with an input string. var Concat = &Builtin{ - Name: "concat", + Name: "concat", + Description: "Joins a set or array of strings with a delimiter.", Decl: types.NewFunction( types.Args( - types.S, - types.NewAny( + types.Named("delimiter", types.S), + types.Named("collection", types.NewAny( types.NewSet(types.S), types.NewArray(nil, types.S), - ), + )).Description("strings to join"), ), - types.S, + types.Named("output", types.S), ), + Categories: stringsCat, } -// FormatInt returns the string representation of the number in the given base after converting it to an integer value. var FormatInt = &Builtin{ - Name: "format_int", + Name: "format_int", + Description: "Returns the string representation of the number in the given base after converting it to an integer value.", Decl: types.NewFunction( types.Args( - types.N, - types.N, + types.Named("number", types.N).Description("number to format"), + types.Named("base", types.N).Description("base of number representation to use"), ), - types.S, + types.Named("output", types.S).Description("formatted number"), ), + Categories: stringsCat, } -// IndexOf returns the index of a substring contained inside a string var IndexOf = &Builtin{ - Name: "indexof", + Name: "indexof", + Description: "Returns the index of a substring contained inside a string.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("haystack", types.S).Description("string to search in"), + types.Named("needle", types.S).Description("substring to look for"), ), - types.N, + types.Named("output", types.N).Description("index of first occurrence, `-1` if not found"), ), + Categories: stringsCat, } -// IndexOfN returns a list of all the indexes of a substring contained inside a string var IndexOfN = &Builtin{ - Name: "indexof_n", + Name: "indexof_n", + Description: "Returns a list of all the indexes of a substring contained inside a string.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("haystack", types.S).Description("string to search in"), + types.Named("needle", types.S).Description("substring to look for"), ), - types.NewArray(nil, types.N), + types.Named("output", types.NewArray(nil, types.N)).Description("all indices at which `needle` occurs in `haystack`, may be empty"), ), + Categories: stringsCat, } -// Substring returns the portion of a string for a given start index and a length. -// If the length is less than zero, then substring returns the remainder of the string. var Substring = &Builtin{ - Name: "substring", + Name: "substring", + Description: "Returns the portion of a string for a given `offset` and a `length`. If `length < 0`, `output` is the remainder of the string.", Decl: types.NewFunction( types.Args( - types.S, - types.N, - types.N, + types.Named("value", types.S), + types.Named("offset", types.N).Description("offset, must be positive"), + types.Named("length", types.N).Description("length of the substring starting from `offset`"), ), - types.S, + types.Named("output", types.S).Description("substring of `value` from `offset`, of length `length`"), ), + Categories: stringsCat, } -// Contains returns true if the search string is included in the base string var Contains = &Builtin{ - Name: "contains", + Name: "contains", + Description: "Returns `true` if the search string is included in the base string", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("haystack", types.S).Description("string to search in"), + types.Named("needle", types.S).Description("substring to look for"), ), - types.B, + types.Named("result", types.B).Description("result of the containment check"), ), + Categories: stringsCat, } -// StartsWith returns true if the search string begins with the base string var StartsWith = &Builtin{ - Name: "startswith", + Name: "startswith", + Description: "Returns true if the search string begins with the base string.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("base", types.S).Description("base string"), + types.Named("search", types.S).Description("search string"), ), - types.B, + types.Named("result", types.B).Description("result of the prefix check"), ), + Categories: stringsCat, } -// EndsWith returns true if the search string begins with the base string var EndsWith = &Builtin{ - Name: "endswith", + Name: "endswith", + Description: "Returns true if the search string begins with the base string.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("base", types.S).Description("base string"), + types.Named("search", types.S).Description("search string"), ), - types.B, + types.Named("result", types.B).Description("result of the suffix check"), ), + Categories: stringsCat, } -// Lower returns the input string but with all characters in lower-case var Lower = &Builtin{ - Name: "lower", + Name: "lower", + Description: "Returns the input string but with all characters in lower-case.", Decl: types.NewFunction( - types.Args(types.S), - types.S, + types.Args( + types.Named("x", types.S).Description("string that is converted to lower-case"), + ), + types.Named("y", types.S).Description("lower-case of x"), ), + Categories: stringsCat, } -// Upper returns the input string but with all characters in upper-case var Upper = &Builtin{ - Name: "upper", + Name: "upper", + Description: "Returns the input string but with all characters in upper-case.", Decl: types.NewFunction( - types.Args(types.S), - types.S, + types.Args( + types.Named("x", types.S).Description("string that is converted to upper-case"), + ), + types.Named("y", types.S).Description("upper-case of x"), ), + Categories: stringsCat, } -// Split returns an array containing elements of the input string split on a delimiter. var Split = &Builtin{ - Name: "split", + Name: "split", + Description: "Split returns an array containing elements of the input string split on a delimiter.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("x", types.S).Description("string that is split"), + types.Named("delimiter", types.S).Description("delimiter used for splitting"), ), - types.NewArray(nil, types.S), + types.Named("ys", types.NewArray(nil, types.S)).Description("splitted parts"), ), + Categories: stringsCat, } -// Replace returns the given string with all instances of the second argument replaced -// by the third. var Replace = &Builtin{ - Name: "replace", + Name: "replace", + Description: "Replace replaces all instances of a sub-string.", Decl: types.NewFunction( types.Args( - types.S, - types.S, - types.S, + types.Named("x", types.S).Description("string being processed"), + types.Named("old", types.S).Description("substring to replace"), + types.Named("new", types.S).Description("string to replace `old` with"), ), - types.S, + types.Named("y", types.S).Description("string with replaced substrings"), ), + Categories: stringsCat, } -// ReplaceN replaces a string from a list of old, new string pairs. -// Replacements are performed in the order they appear in the target string, without overlapping matches. -// The old string comparisons are done in argument order. var ReplaceN = &Builtin{ Name: "strings.replace_n", + Description: `Replaces a string from a list of old, new string pairs. +Replacements are performed in the order they appear in the target string, without overlapping matches. +The old string comparisons are done in argument order.`, Decl: types.NewFunction( types.Args( - types.NewObject( + types.Named("patterns", types.NewObject( nil, types.NewDynamicProperty( types.S, types.S)), - types.S, + ).Description("replacement pairs"), + types.Named("value", types.S).Description("string to replace substring matches in"), ), - types.S, + types.Named("output", types.S), ), } -// Trim returns the given string with all leading or trailing instances of the second -// argument removed. var Trim = &Builtin{ - Name: "trim", + Name: "trim", + Description: "Returns `value` with all leading or trailing instances of the `cutset` characters removed.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("value", types.S).Description("string to trim"), + types.Named("cutset", types.S).Description("string of characters that are cut off"), ), - types.S, + types.Named("output", types.S).Description("string trimmed of `cutset` characters"), ), + Categories: stringsCat, } -// TrimLeft returns the given string with all leading instances of second argument removed. var TrimLeft = &Builtin{ - Name: "trim_left", + Name: "trim_left", + Description: "Returns `value` with all leading instances of the `cutset` chartacters removed.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("value", types.S).Description("string to trim"), + types.Named("cutset", types.S).Description("string of characters that are cut off on the left"), ), - types.S, + types.Named("output", types.S).Description("string left-trimmed of `cutset` characters"), ), + Categories: stringsCat, } -// TrimPrefix returns the given string without the second argument prefix string. -// If the given string doesn't start with prefix, it is returned unchanged. var TrimPrefix = &Builtin{ - Name: "trim_prefix", + Name: "trim_prefix", + Description: "Returns `value` without the prefix. If `value` doesn't start with `prefix`, it is returned unchanged.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("value", types.S).Description("string to trim"), + types.Named("prefix", types.S).Description("prefix to cut off"), ), - types.S, + types.Named("output", types.S).Description("string with `prefix` cut off"), ), + Categories: stringsCat, } -// TrimRight returns the given string with all trailing instances of second argument removed. var TrimRight = &Builtin{ - Name: "trim_right", + Name: "trim_right", + Description: "Returns `value` with all trailing instances of the `cutset` chartacters removed.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("value", types.S).Description("string to trim"), + types.Named("cutset", types.S).Description("string of characters that are cut off on the right"), ), - types.S, + types.Named("output", types.S).Description("string right-trimmed of `cutset` characters"), ), + Categories: stringsCat, } -// TrimSuffix returns the given string without the second argument suffix string. -// If the given string doesn't end with suffix, it is returned unchanged. var TrimSuffix = &Builtin{ - Name: "trim_suffix", + Name: "trim_suffix", + Description: "Returns `value` without the suffix. If `value` doesn't end with `suffix`, it is returned unchanged.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("value", types.S).Description("string to trim"), + types.Named("suffix", types.S).Description("suffix to cut off"), ), - types.S, + types.Named("output", types.S).Description("string with `suffix` cut off"), ), + Categories: stringsCat, } -// TrimSpace return the given string with all leading and trailing white space removed. var TrimSpace = &Builtin{ - Name: "trim_space", + Name: "trim_space", + Description: "Return the given string with all leading and trailing white space removed.", Decl: types.NewFunction( types.Args( - types.S, + types.Named("value", types.S).Description("string to trim"), ), - types.S, + types.Named("output", types.S).Description("string leading and trailing white space cut off"), ), + Categories: stringsCat, } -// Sprintf returns the given string, formatted. var Sprintf = &Builtin{ - Name: "sprintf", + Name: "sprintf", + Description: "Returns the given string, formatted.", Decl: types.NewFunction( types.Args( - types.S, - types.NewArray(nil, types.A), + types.Named("format", types.S).Description("string with formatting verbs"), + types.Named("values", types.NewArray(nil, types.A)).Description("arguments to format into formatting verbs"), ), - types.S, + types.Named("output", types.S).Description("`format` formatted by the values in `values`"), ), + Categories: stringsCat, } -// StringReverse returns the given string, reversed. var StringReverse = &Builtin{ - Name: "strings.reverse", + Name: "strings.reverse", + Description: "Reverses a given string.", Decl: types.NewFunction( types.Args( - types.S, + types.Named("x", types.S), ), - types.S, + types.Named("y", types.S), ), + Categories: stringsCat, } /** @@ -1098,25 +1237,27 @@ var StringReverse = &Builtin{ // RandIntn returns a random number 0 - n var RandIntn = &Builtin{ - Name: "rand.intn", + Name: "rand.intn", + Description: "Returns a random integer between `0` and `n` (`n` exlusive). If `n` is `0`, then `y` is always `0`. For any given argument pair (`str`, `n`), the output will be consistent throughout a query evaluation.", Decl: types.NewFunction( types.Args( - types.S, - types.N, + types.Named("str", types.S), + types.Named("n", types.N), ), - types.N, + types.Named("y", types.N).Description("random integer in the range `[0, abs(n))`"), ), + Categories: number, } -// NumbersRange returns an array of numbers in the given inclusive range. var NumbersRange = &Builtin{ - Name: "numbers.range", + Name: "numbers.range", + Description: "Returns an array of numbers in the given (inclusive) range. If `a==b`, then `range == [a]`; if `a > b`, then `range` is in descending order.", Decl: types.NewFunction( types.Args( - types.N, - types.N, + types.Named("a", types.N), + types.Named("b", types.N), ), - types.NewArray(nil, types.N), + types.Named("range", types.NewArray(nil, types.N)).Description("the range between `a` and `b`"), ), } @@ -1124,27 +1265,34 @@ var NumbersRange = &Builtin{ * Units */ -// UnitsParse converts strings like 10G, 5K, 4M, 1500m and the like into a -// number. This number can be a non-integer, such as 1.5, 0.22, etc. +// UnitsParse var UnitsParse = &Builtin{ Name: "units.parse", + Description: `Converts strings like "10G", "5K", "4M", "1500m" and the like into a number. +This number can be a non-integer, such as 1.5, 0.22, etc. Supports standard metric decimal and +binary SI units (e.g., K, Ki, M, Mi, G, Gi etc.) m, K, M, G, T, P, and E are treated as decimal +units and Ki, Mi, Gi, Ti, Pi, and Ei are treated as binary units. + +Note that 'm' and 'M' are case-sensitive, to allow distinguishing between "milli" and "mega" units respectively. Other units are case-insensitive.`, Decl: types.NewFunction( types.Args( - types.S, + types.Named("x", types.S).Description("the unit to parse"), ), - types.N, + types.Named("y", types.N).Description("the parsed number"), ), } -// UnitsParseBytes converts strings like 10GB, 5K, 4mb, and the like into an -// integer number of bytes. var UnitsParseBytes = &Builtin{ Name: "units.parse_bytes", + Description: `Converts strings like "10GB", "5K", "4mb" into an integer number of bytes. +Supports standard byte units (e.g., KB, KiB, etc.) KB, MB, GB, and TB are treated as decimal +units and KiB, MiB, GiB, and TiB are treated as binary units. The bytes symbol (b/B) in the +unit is optional and omitting it wil give the same result (e.g. Mi and MiB).`, Decl: types.NewFunction( types.Args( - types.S, + types.Named("x", types.S).Description("the byte unit to parse"), ), - types.N, + types.Named("y", types.N).Description("the parsed number"), ), } @@ -1155,10 +1303,13 @@ var UnitsParseBytes = &Builtin{ // UUIDRFC4122 returns a version 4 UUID string. var UUIDRFC4122 = &Builtin{ - Name: "uuid.rfc4122", + Name: "uuid.rfc4122", + Description: "Returns a new UUIDv4.", Decl: types.NewFunction( - types.Args(types.S), - types.S, + types.Args( + types.Named("k", types.S), + ), + types.Named("output", types.S).Description("a version 4 UUID; for any given `k`, the output will be consistent throughout a query evaluation"), ), } @@ -1166,43 +1317,20 @@ var UUIDRFC4122 = &Builtin{ * JSON */ -// JSONMarshal serializes the input term. -var JSONMarshal = &Builtin{ - Name: "json.marshal", - Decl: types.NewFunction( - types.Args(types.A), - types.S, - ), -} +var objectCat = category("object") -// JSONUnmarshal deserializes the input string. -var JSONUnmarshal = &Builtin{ - Name: "json.unmarshal", - Decl: types.NewFunction( - types.Args(types.S), - types.A, - ), -} - -// JSONIsValid verifies the input string is a valid JSON document. -var JSONIsValid = &Builtin{ - Name: "json.is_valid", - Decl: types.NewFunction( - types.Args(types.S), - types.B, - ), -} - -// JSONFilter filters the JSON object var JSONFilter = &Builtin{ Name: "json.filter", + Description: "Filters the object. " + + "For example: `json.filter({\"a\": {\"b\": \"x\", \"c\": \"y\"}}, [\"a/b\"])` will result in `{\"a\": {\"b\": \"x\"}}`). " + + "Paths are not filtered in-order and are deduplicated before being evaluated.", Decl: types.NewFunction( types.Args( - types.NewObject( + types.Named("object", types.NewObject( nil, types.NewDynamicProperty(types.A, types.A), - ), - types.NewAny( + )), + types.Named("paths", types.NewAny( types.NewArray( nil, types.NewAny( @@ -1222,22 +1350,25 @@ var JSONFilter = &Builtin{ ), ), ), - ), + )).Description("JSON string paths"), ), - types.A, + types.Named("filtered", types.A).Description("remaining data from `object` with only keys specified in `paths`"), ), + Categories: objectCat, } -// JSONRemove removes paths in the JSON object var JSONRemove = &Builtin{ Name: "json.remove", + Description: "Removes paths from an object. " + + "For example: `json.remove({\"a\": {\"b\": \"x\", \"c\": \"y\"}}, [\"a/b\"])` will result in `{\"a\": {\"c\": \"y\"}}`. " + + "Paths are not removed in-order and are deduplicated before being evaluated.", Decl: types.NewFunction( types.Args( - types.NewObject( + types.Named("object", types.NewObject( nil, types.NewDynamicProperty(types.A, types.A), - ), - types.NewAny( + )), + types.Named("paths", types.NewAny( types.NewArray( nil, types.NewAny( @@ -1257,19 +1388,21 @@ var JSONRemove = &Builtin{ ), ), ), - ), + )).Description("JSON string paths"), ), - types.A, + types.Named("output", types.A).Description("result of removing all keys specified in `paths`"), ), + Categories: objectCat, } -// JSONPatch patches a JSON object according to RFC6902 var JSONPatch = &Builtin{ Name: "json.patch", + Description: "Patches an object according to RFC6902. " + + "For example: `json.patch({\"a\": {\"foo\": 1}}, [{\"op\": \"add\", \"path\": \"/a/bar\", \"value\": 2}])` results in `{\"a\": {\"foo\": 1, \"bar\": 2}`. The patches are applied atomically: if any of them fails, the result will be undefined.", Decl: types.NewFunction( types.Args( - types.A, - types.NewArray( + types.Named("object", types.A), // TODO(sr): types.A? + types.Named("patches", types.NewArray( nil, types.NewObject( []*types.StaticProperty{ @@ -1278,561 +1411,675 @@ var JSONPatch = &Builtin{ }, types.NewDynamicProperty(types.A, types.A), ), - ), + )), ), - types.A, + types.Named("output", types.A).Description("result obtained after consecutively applying all patch operations in `patches`"), ), + Categories: objectCat, } -// ObjectGet returns takes an object and returns a value under its key if -// present, otherwise it returns the default. var ObjectGet = &Builtin{ Name: "object.get", + Description: "Returns value of an object's key if present, otherwise a default. " + + "If the supplied `key` is an `array`, then `object.get` will search through a nested object or array using each key in turn. " + + "For example: `object.get({\"a\": [{ \"b\": true }]}, [\"a\", 0, \"b\"], false)` results in `true`.", Decl: types.NewFunction( types.Args( - types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), - types.A, - types.A, + types.Named("object", types.NewObject(nil, types.NewDynamicProperty(types.A, types.A))).Description("object to get `key` from"), + types.Named("key", types.A).Description("key to lookup in `object`"), + types.Named("default", types.A).Description("default to use when lookup fails"), ), - types.A, + types.Named("value", types.A).Description("`object[key]` if present, otherwise `default`"), ), } -// ObjectUnion creates a new object that is the asymmetric union of two objects var ObjectUnion = &Builtin{ Name: "object.union", + Description: "Creates a new object of the asymmetric union of two objects. " + + "For example: `object.union({\"a\": 1, \"b\": 2, \"c\": {\"d\": 3}}, {\"a\": 7, \"c\": {\"d\": 4, \"e\": 5}})` will result in `{\"a\": 7, \"b\": 2, \"c\": {\"d\": 4, \"e\": 5}}`.", Decl: types.NewFunction( types.Args( - types.NewObject( + types.Named("a", types.NewObject( nil, types.NewDynamicProperty(types.A, types.A), - ), - types.NewObject( + )), + types.Named("b", types.NewObject( nil, types.NewDynamicProperty(types.A, types.A), - ), + )), ), - types.A, - ), + types.Named("output", types.A).Description("a new object which is the result of an asymmetric recursive union of two objects where conflicts are resolved by choosing the key from the right-hand object `b`"), + ), // TODO(sr): types.A? ^^^^^^^ (also below) } -// ObjectUnionN creates a new object that is the asymmetric union of all objects merged from left to right var ObjectUnionN = &Builtin{ Name: "object.union_n", + Description: "Creates a new object that is the asymmetric union of all objects merged from left to right. " + + "For example: `object.union_n([{\"a\": 1}, {\"b\": 2}, {\"a\": 3}])` will result in `{\"b\": 2, \"a\": 3}`.", Decl: types.NewFunction( types.Args( - types.NewArray( + types.Named("objects", types.NewArray( nil, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), - ), + )), ), - types.A, + types.Named("output", types.A).Description("asymmetric recursive union of all objects in `objects`, merged from left to right, where conflicts are resolved by choosing the key from the right-hand object"), ), } -// ObjectRemove Removes specified keys from an object var ObjectRemove = &Builtin{ - Name: "object.remove", + Name: "object.remove", + Description: "Removes specified keys from an object.", Decl: types.NewFunction( types.Args( - types.NewObject( + types.Named("object", types.NewObject( nil, types.NewDynamicProperty(types.A, types.A), - ), - types.NewAny( + )).Description("object to remove keys from"), + types.Named("keys", types.NewAny( types.NewArray(nil, types.A), types.NewSet(types.A), types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), - ), + )).Description("keys to remove from x"), ), - types.A, + types.Named("output", types.A).Description("result of removing the specified `keys` from `object`"), ), } -// ObjectFilter filters the object by keeping only specified keys var ObjectFilter = &Builtin{ Name: "object.filter", + Description: "Filters the object by keeping only specified keys. " + + "For example: `object.filter({\"a\": {\"b\": \"x\", \"c\": \"y\"}, \"d\": \"z\"}, [\"a\"])` will result in `{\"a\": {\"b\": \"x\", \"c\": \"y\"}}`).", Decl: types.NewFunction( types.Args( - types.NewObject( + types.Named("object", types.NewObject( nil, types.NewDynamicProperty(types.A, types.A), - ), - types.NewAny( + )).Description("object to filter keys"), + types.Named("keys", types.NewAny( types.NewArray(nil, types.A), types.NewSet(types.A), types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), - ), + )), ), - types.A, + types.Named("filtered", types.A).Description("remaining data from `object` with only keys specified in `keys`"), ), } -// Base64Encode serializes the input string into base64 encoding. -var Base64Encode = &Builtin{ - Name: "base64.encode", - Decl: types.NewFunction( - types.Args(types.S), - types.S, - ), -} +/* + * Encoding + */ +var encoding = category("encoding") -// Base64Decode deserializes the base64 encoded input string. -var Base64Decode = &Builtin{ - Name: "base64.decode", - Decl: types.NewFunction( - types.Args(types.S), - types.S, - ), -} - -// Base64IsValid verifies the input string is base64 encoded. -var Base64IsValid = &Builtin{ - Name: "base64.is_valid", - Decl: types.NewFunction( - types.Args(types.S), - types.B, - ), -} - -// Base64UrlEncode serializes the input string into base64url encoding. -var Base64UrlEncode = &Builtin{ - Name: "base64url.encode", - Decl: types.NewFunction( - types.Args(types.S), - types.S, - ), -} - -// Base64UrlEncodeNoPad serializes the input string into base64url encoding without padding. -var Base64UrlEncodeNoPad = &Builtin{ - Name: "base64url.encode_no_pad", - Decl: types.NewFunction( - types.Args(types.S), - types.S, - ), -} - -// Base64UrlDecode deserializes the base64url encoded input string. -var Base64UrlDecode = &Builtin{ - Name: "base64url.decode", - Decl: types.NewFunction( - types.Args(types.S), - types.S, - ), -} - -// URLQueryDecode decodes a URL encoded input string. -var URLQueryDecode = &Builtin{ - Name: "urlquery.decode", - Decl: types.NewFunction( - types.Args(types.S), - types.S, - ), -} - -// URLQueryEncode encodes the input string into a URL encoded string. -var URLQueryEncode = &Builtin{ - Name: "urlquery.encode", - Decl: types.NewFunction( - types.Args(types.S), - types.S, - ), -} - -// URLQueryEncodeObject encodes the given JSON into a URL encoded query string. -var URLQueryEncodeObject = &Builtin{ - Name: "urlquery.encode_object", +var JSONMarshal = &Builtin{ + Name: "json.marshal", + Description: "Serializes the input term to JSON.", Decl: types.NewFunction( types.Args( - types.NewObject( + types.Named("x", types.A).Description("the term to serialize"), + ), + types.Named("y", types.S).Description("the JSON string representation of `x`"), + ), + Categories: encoding, +} + +var JSONUnmarshal = &Builtin{ + Name: "json.unmarshal", + Description: "Deserializes the input string.", + Decl: types.NewFunction( + types.Args( + types.Named("x", types.S).Description("a JSON string"), + ), + types.Named("y", types.A).Description("the term deseralized from `x`"), + ), + Categories: encoding, +} + +var JSONIsValid = &Builtin{ + Name: "json.is_valid", + Description: "Verifies the input string is a valid JSON document.", + Decl: types.NewFunction( + types.Args( + types.Named("x", types.S).Description("a JSON string"), + ), + types.Named("result", types.B).Description("`true` if `x` is valid JSON, `false` otherwise"), + ), + Categories: encoding, +} + +var Base64Encode = &Builtin{ + Name: "base64.encode", + Description: "Serializes the input string into base64 encoding.", + Decl: types.NewFunction( + types.Args( + types.Named("x", types.S), + ), + types.Named("y", types.S).Description("base64 serialization of `x`"), + ), + Categories: encoding, +} + +var Base64Decode = &Builtin{ + Name: "base64.decode", + Description: "Deserializes the base64 encoded input string.", + Decl: types.NewFunction( + types.Args( + types.Named("x", types.S), + ), + types.Named("y", types.S).Description("base64 deserialization of `x`"), + ), + Categories: encoding, +} + +var Base64IsValid = &Builtin{ + Name: "base64.is_valid", + Description: "Verifies the input string is base64 encoded.", + Decl: types.NewFunction( + types.Args( + types.Named("x", types.S), + ), + types.Named("result", types.B).Description("`true` if `x` is valid base64 encoded value, `false` otherwise"), + ), + Categories: encoding, +} + +var Base64UrlEncode = &Builtin{ + Name: "base64url.encode", + Description: "Serializes the input string into base64url encoding.", + Decl: types.NewFunction( + types.Args( + types.Named("x", types.S), + ), + types.Named("y", types.S).Description("base64url serialization of `x`"), + ), + Categories: encoding, +} + +var Base64UrlEncodeNoPad = &Builtin{ + Name: "base64url.encode_no_pad", + Description: "Serializes the input string into base64url encoding without padding.", + Decl: types.NewFunction( + types.Args( + types.Named("x", types.S), + ), + types.Named("y", types.S).Description("base64url serialization of `x`"), + ), + Categories: encoding, +} + +var Base64UrlDecode = &Builtin{ + Name: "base64url.decode", + Description: "Deserializes the base64url encoded input string.", + Decl: types.NewFunction( + types.Args( + types.Named("x", types.S), + ), + types.Named("y", types.S).Description("base64url deserialization of `x`"), + ), + Categories: encoding, +} + +var URLQueryDecode = &Builtin{ + Name: "urlquery.decode", + Description: "Decodes a URL-encoded input string.", + Decl: types.NewFunction( + types.Args( + types.Named("x", types.S), + ), + types.Named("y", types.S).Description("URL-encoding deserialization of `x`"), + ), + Categories: encoding, +} + +var URLQueryEncode = &Builtin{ + Name: "urlquery.encode", + Description: "Encodes the input string into a URL-encoded string.", + Decl: types.NewFunction( + types.Args( + types.Named("x", types.S), + ), + types.Named("y", types.S).Description("URL-encoding serialization of `x`"), + ), + Categories: encoding, +} + +var URLQueryEncodeObject = &Builtin{ + Name: "urlquery.encode_object", + Description: "Encodes the given object into a URL encoded query string.", + Decl: types.NewFunction( + types.Args( + types.Named("object", types.NewObject( nil, types.NewDynamicProperty( types.S, types.NewAny( types.S, types.NewArray(nil, types.S), - types.NewSet(types.S))))), - types.S, + types.NewSet(types.S)))))), + types.Named("y", types.S).Description("the URL-encoded serialization of `object`"), ), + Categories: encoding, } -// URLQueryDecodeObject decodes the given URL query string into an object. var URLQueryDecodeObject = &Builtin{ - Name: "urlquery.decode_object", + Name: "urlquery.decode_object", + Description: "Decodes the given URL query string into an object.", Decl: types.NewFunction( - types.Args(types.S), - types.NewObject(nil, types.NewDynamicProperty( + types.Args( + types.Named("x", types.S).Description("the query string"), + ), + types.Named("object", types.NewObject(nil, types.NewDynamicProperty( types.S, - types.NewArray(nil, types.S))), + types.NewArray(nil, types.S)))).Description("the resulting object"), ), + Categories: encoding, } -// YAMLMarshal serializes the input term. var YAMLMarshal = &Builtin{ - Name: "yaml.marshal", + Name: "yaml.marshal", + Description: "Serializes the input term to YAML.", Decl: types.NewFunction( - types.Args(types.A), - types.S, + types.Args( + types.Named("x", types.A).Description("the term to serialize"), + ), + types.Named("y", types.S).Description("the YAML string representation of `x`"), ), + Categories: encoding, } -// YAMLUnmarshal deserializes the input string. var YAMLUnmarshal = &Builtin{ - Name: "yaml.unmarshal", + Name: "yaml.unmarshal", + Description: "Deserializes the input string.", Decl: types.NewFunction( - types.Args(types.S), - types.A, + types.Args( + types.Named("x", types.S).Description("a YAML string"), + ), + types.Named("y", types.A).Description("the term deseralized from `x`"), ), + Categories: encoding, } // YAMLIsValid verifies the input string is a valid YAML document. var YAMLIsValid = &Builtin{ - Name: "yaml.is_valid", + Name: "yaml.is_valid", + Description: "Verifies the input string is a valid YAML document.", Decl: types.NewFunction( - types.Args(types.S), - types.B, + types.Args( + types.Named("x", types.S).Description("a YAML string"), + ), + types.Named("result", types.B).Description("`true` if `x` is valid YAML, `false` otherwise"), ), + Categories: encoding, } -// HexEncode serializes the input string into hex encoding. var HexEncode = &Builtin{ - Name: "hex.encode", + Name: "hex.encode", + Description: "Serializes the input string using hex-encoding.", Decl: types.NewFunction( - types.Args(types.S), - types.S, + types.Args( + types.Named("x", types.S), + ), + types.Named("y", types.S).Description("serialization of `x` using hex-encoding"), ), + Categories: encoding, } -// HexDecode deserializes the hex encoded input string. var HexDecode = &Builtin{ - Name: "hex.decode", + Name: "hex.decode", + Description: "Deserializes the hex-encoded input string.", Decl: types.NewFunction( - types.Args(types.S), - types.S, + types.Args( + types.Named("x", types.S).Description("a hex-encoded string"), + ), + types.Named("y", types.S).Description("deseralized from `x`"), ), + Categories: encoding, } /** * Tokens */ +var tokensCat = category("tokens") -// JWTDecode decodes a JSON Web Token and outputs it as an Object. var JWTDecode = &Builtin{ - Name: "io.jwt.decode", + Name: "io.jwt.decode", + Description: "Decodes a JSON Web Token and outputs it as an object.", Decl: types.NewFunction( - types.Args(types.S), - types.NewArray([]types.Type{ + types.Args( + types.Named("jwt", types.S).Description("JWT token to decode"), + ), + types.Named("output", types.NewArray([]types.Type{ types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), types.S, - }, nil), + }, nil)).Description("`[header, payload, sig]`, where `header` and `payload` are objects; `sig` is the hexadecimal representation of the signature on the token."), ), + Categories: tokensCat, } -// JWTVerifyRS256 verifies if a RS256 JWT signature is valid or not. var JWTVerifyRS256 = &Builtin{ - Name: "io.jwt.verify_rs256", + Name: "io.jwt.verify_rs256", + Description: "Verifies if a RS256 JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTVerifyRS384 verifies if a RS384 JWT signature is valid or not. var JWTVerifyRS384 = &Builtin{ - Name: "io.jwt.verify_rs384", + Name: "io.jwt.verify_rs384", + Description: "Verifies if a RS384 JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTVerifyRS512 verifies if a RS512 JWT signature is valid or not. var JWTVerifyRS512 = &Builtin{ - Name: "io.jwt.verify_rs512", + Name: "io.jwt.verify_rs512", + Description: "Verifies if a RS512 JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTVerifyPS256 verifies if a PS256 JWT signature is valid or not. var JWTVerifyPS256 = &Builtin{ - Name: "io.jwt.verify_ps256", + Name: "io.jwt.verify_ps256", + Description: "Verifies if a PS256 JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTVerifyPS384 verifies if a PS384 JWT signature is valid or not. var JWTVerifyPS384 = &Builtin{ - Name: "io.jwt.verify_ps384", + Name: "io.jwt.verify_ps384", + Description: "Verifies if a PS384 JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTVerifyPS512 verifies if a PS512 JWT signature is valid or not. var JWTVerifyPS512 = &Builtin{ - Name: "io.jwt.verify_ps512", + Name: "io.jwt.verify_ps512", + Description: "Verifies if a PS512 JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTVerifyES256 verifies if a ES256 JWT signature is valid or not. var JWTVerifyES256 = &Builtin{ - Name: "io.jwt.verify_es256", + Name: "io.jwt.verify_es256", + Description: "Verifies if a ES256 JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTVerifyES384 verifies if a ES384 JWT signature is valid or not. var JWTVerifyES384 = &Builtin{ - Name: "io.jwt.verify_es384", + Name: "io.jwt.verify_es384", + Description: "Verifies if a ES384 JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTVerifyES512 verifies if a ES512 JWT signature is valid or not. var JWTVerifyES512 = &Builtin{ - Name: "io.jwt.verify_es512", + Name: "io.jwt.verify_es512", + Description: "Verifies if a ES512 JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("certificate", types.S).Description("PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTVerifyHS256 verifies if a HS256 (secret) JWT signature is valid or not. var JWTVerifyHS256 = &Builtin{ - Name: "io.jwt.verify_hs256", + Name: "io.jwt.verify_hs256", + Description: "Verifies if a HS256 (secret) JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("secret", types.S).Description("plain text secret used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTVerifyHS384 verifies if a HS384 (secret) JWT signature is valid or not. var JWTVerifyHS384 = &Builtin{ - Name: "io.jwt.verify_hs384", + Name: "io.jwt.verify_hs384", + Description: "Verifies if a HS384 (secret) JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("secret", types.S).Description("plain text secret used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTVerifyHS512 verifies if a HS512 (secret) JWT signature is valid or not. var JWTVerifyHS512 = &Builtin{ - Name: "io.jwt.verify_hs512", + Name: "io.jwt.verify_hs512", + Description: "Verifies if a HS512 (secret) JWT signature is valid.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified"), + types.Named("secret", types.S).Description("plain text secret used to verify the signature"), ), - types.B, + types.Named("result", types.B).Description("`true` if the signature is valid, `false` otherwise"), ), + Categories: tokensCat, } -// JWTDecodeVerify verifies a JWT signature under parameterized constraints and decodes the claims if it is valid. var JWTDecodeVerify = &Builtin{ Name: "io.jwt.decode_verify", + Description: `Verifies a JWT signature under parameterized constraints and decodes the claims if it is valid. +Supports the following algorithms: HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512, PS256, PS384 and PS512.`, Decl: types.NewFunction( types.Args( - types.S, - types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)), + types.Named("jwt", types.S).Description("JWT token whose signature is to be verified and whose claims are to be checked"), + types.Named("constraints", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("claim verification constraints"), ), - types.NewArray([]types.Type{ + types.Named("output", types.NewArray([]types.Type{ types.B, types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), - }, nil), + }, nil)).Description("`[valid, header, payload]`: if the input token is verified and meets the requirements of `constraints` then `valid` is `true`; `header` and `payload` are objects containing the JOSE header and the JWT claim set; otherwise, `valid` is `false`, `header` and `payload` are `{}`"), ), + Categories: tokensCat, } -// JWTEncodeSignRaw encodes and optionally sign a JSON Web Token. -// Inputs are protected headers, payload, secret +var tokenSign = category("tokensign") + var JWTEncodeSignRaw = &Builtin{ - Name: "io.jwt.encode_sign_raw", + Name: "io.jwt.encode_sign_raw", + Description: "Encodes and optionally signs a JSON Web Token.", Decl: types.NewFunction( types.Args( - types.S, - types.S, - types.S, + types.Named("headers", types.S).Description("JWS Protected Header"), + types.Named("payload", types.S).Description("JWS Payload"), + types.Named("key", types.S).Description("JSON Web Key (RFC7517)"), ), - types.S, + types.Named("output", types.S).Description("signed JWT"), ), + Categories: tokenSign, } -// JWTEncodeSign encodes and optionally sign a JSON Web Token. -// Inputs are protected headers, payload, secret var JWTEncodeSign = &Builtin{ - Name: "io.jwt.encode_sign", + Name: "io.jwt.encode_sign", + Description: "Encodes and optionally signs a JSON Web Token. Inputs are taken as objects, not encoded strings (see `io.jwt.encode_sign_raw`).", Decl: types.NewFunction( types.Args( - types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)), - types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)), - types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)), + types.Named("headers", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("JWS Protected Header"), + types.Named("payload", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("JWS Payload"), + types.Named("key", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("JSON Web Key (RFC7517)"), ), - types.S, + types.Named("output", types.S).Description("signed JWT"), ), + Categories: tokenSign, } /** * Time */ -// NowNanos returns the current time since epoch in nanoseconds. var NowNanos = &Builtin{ - Name: "time.now_ns", + Name: "time.now_ns", + Description: "Returns the current time since epoch in nanoseconds.", Decl: types.NewFunction( nil, - types.N, + types.Named("now", types.N).Description("nanoseconds since epoch"), ), } -// ParseNanos returns the time in nanoseconds parsed from the string in the given format. var ParseNanos = &Builtin{ - Name: "time.parse_ns", + Name: "time.parse_ns", + Description: "Returns the time in nanoseconds parsed from the string in the given format. `undefined` if the result would be outside the valid time range that can fit within an `int64`.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("layout", types.S).Description("format used for parsing, see the [Go `time` package documentation](https://golang.org/pkg/time/#Parse) for more details"), + types.Named("value", types.S).Description("input to parse according to `layout`"), ), - types.N, + types.Named("ns", types.N).Description("`value` in nanoseconds since epoch"), ), } -// ParseRFC3339Nanos returns the time in nanoseconds parsed from the string in RFC3339 format. var ParseRFC3339Nanos = &Builtin{ - Name: "time.parse_rfc3339_ns", + Name: "time.parse_rfc3339_ns", + Description: "Returns the time in nanoseconds parsed from the string in RFC3339 format. `undefined` if the result would be outside the valid time range that can fit within an `int64`.", Decl: types.NewFunction( - types.Args(types.S), - types.N, + types.Args( + types.Named("value", types.S), + ), + types.Named("ns", types.N).Description("`value` in nanoseconds since epoch"), ), } -// ParseDurationNanos returns the duration in nanoseconds represented by a duration string. -// Duration string is similar to the Go time.ParseDuration string var ParseDurationNanos = &Builtin{ - Name: "time.parse_duration_ns", + Name: "time.parse_duration_ns", + Description: "Returns the duration in nanoseconds represented by a string.", Decl: types.NewFunction( - types.Args(types.S), - types.N, + types.Args( + types.Named("duration", types.S).Description("a duration like \"3m\"; seethe [Go `time` package documentation](https://golang.org/pkg/time/#ParseDuration) for more details"), + ), + types.Named("ns", types.N).Description("the `duration` in nanoseconds"), ), } -// Date returns the [year, month, day] for the nanoseconds since epoch. var Date = &Builtin{ - Name: "time.date", + Name: "time.date", + Description: "Returns the `[year, month, day]` for the nanoseconds since epoch.", Decl: types.NewFunction( types.Args( - types.NewAny( + types.Named("x", types.NewAny( types.N, types.NewArray([]types.Type{types.N, types.S}, nil), - ), + )).Description("a number representing the nanoseconds since the epoch (UTC); or a two-element array of the nanoseconds, and a timezone string"), ), - types.NewArray([]types.Type{types.N, types.N, types.N}, nil), + types.Named("date", types.NewArray([]types.Type{types.N, types.N, types.N}, nil)).Description("an array of `year`, `month` (1-12), and `day` (1-31)"), ), } -// Clock returns the [hour, minute, second] of the day for the nanoseconds since epoch. var Clock = &Builtin{ - Name: "time.clock", + Name: "time.clock", + Description: "Returns the `[hour, minute, second]` of the day for the nanoseconds since epoch.", Decl: types.NewFunction( types.Args( - types.NewAny( + types.Named("x", types.NewAny( types.N, types.NewArray([]types.Type{types.N, types.S}, nil), - ), + )).Description("a number representing the nanoseconds since the epoch (UTC); or a two-element array of the nanoseconds, and a timezone string"), ), - types.NewArray([]types.Type{types.N, types.N, types.N}, nil), + types.Named("output", types.NewArray([]types.Type{types.N, types.N, types.N}, nil)). + Description("the `hour`, `minute` (0-59), and `second` (0-59) representing the time of day for the nanoseconds since epoch in the supplied timezone (or UTC)"), ), } -// Weekday returns the day of the week (Monday, Tuesday, ...) for the nanoseconds since epoch. var Weekday = &Builtin{ - Name: "time.weekday", + Name: "time.weekday", + Description: "Returns the day of the week (Monday, Tuesday, ...) for the nanoseconds since epoch.", Decl: types.NewFunction( types.Args( - types.NewAny( + types.Named("x", types.NewAny( types.N, types.NewArray([]types.Type{types.N, types.S}, nil), - ), + )).Description("a number representing the nanoseconds since the epoch (UTC); or a two-element array of the nanoseconds, and a timezone string"), ), - types.S, + types.Named("day", types.S).Description("the weekday represented by `ns` nanoseconds since the epoch in the supplied timezone (or UTC)"), ), } -// AddDate returns the nanoseconds since epoch after adding years, months and days to nanoseconds. var AddDate = &Builtin{ - Name: "time.add_date", + Name: "time.add_date", + Description: "Returns the nanoseconds since epoch after adding years, months and days to nanoseconds. `undefined` if the result would be outside the valid time range that can fit within an `int64`.", Decl: types.NewFunction( types.Args( - types.N, - types.N, - types.N, - types.N, + types.Named("ns", types.N).Description("nanoseconds since the epoch"), + types.Named("years", types.N), + types.Named("months", types.N), + types.Named("days", types.N), ), - types.N, + types.Named("output", types.N).Description("nanoseconds since the epoch representing the input time, with years, months and days added"), ), } -// Diff returns the difference [years, months, days, hours, minutes, seconds] between two unix timestamps in nanoseconds var Diff = &Builtin{ - Name: "time.diff", + Name: "time.diff", + Description: "Returns the difference between two unix timestamps in nanoseconds (with optional timezone strings).", Decl: types.NewFunction( types.Args( - types.NewAny( + types.Named("ns1", types.NewAny( types.N, types.NewArray([]types.Type{types.N, types.S}, nil), - ), - types.NewAny( + )), + types.Named("ns2", types.NewAny( types.N, types.NewArray([]types.Type{types.N, types.S}, nil), - ), + )), ), - types.NewArray([]types.Type{types.N, types.N, types.N, types.N, types.N, types.N}, nil), + types.Named("output", types.NewArray([]types.Type{types.N, types.N, types.N, types.N, types.N, types.N}, nil)).Description("difference between `ns1` and `ns2` (in their supplied timezones, if supplied, or UTC) as array of numbers: `[years, months, days, hours, minutes, seconds]`"), ), } @@ -1840,161 +2087,169 @@ var Diff = &Builtin{ * Crypto. */ -// CryptoX509ParseCertificates returns one or more certificates from the given -// base64 encoded string containing DER encoded certificates that have been -// concatenated. var CryptoX509ParseCertificates = &Builtin{ - Name: "crypto.x509.parse_certificates", + Name: "crypto.x509.parse_certificates", + Description: "Returns one or more certificates from the given base64 encoded string containing DER encoded certificates that have been concatenated.", Decl: types.NewFunction( - types.Args(types.S), - types.NewArray(nil, types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))), + types.Args( + types.Named("certs", types.S).Description("base64 encoded DER or PEM data containing one or more certificates or a PEM string of one or more certificates"), + ), + types.Named("output", types.NewArray(nil, types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)))).Description("parsed X.509 certificates represented as objects"), ), } -// CryptoX509ParseAndVerifyCertificates returns one or more certificates from the given -// string containing PEM or base64 encoded DER certificates after verifying the supplied -// certificates form a complete certificate chain back to a trusted root. -// -// The first certificate is treated as the root and the last is treated as the leaf, -// with all others being treated as intermediates var CryptoX509ParseAndVerifyCertificates = &Builtin{ Name: "crypto.x509.parse_and_verify_certificates", + Description: `Returns one or more certificates from the given string containing PEM +or base64 encoded DER certificates after verifying the supplied certificates form a complete +certificate chain back to a trusted root. + +The first certificate is treated as the root and the last is treated as the leaf, +with all others being treated as intermediates.`, Decl: types.NewFunction( - types.Args(types.S), - types.NewArray([]types.Type{ + types.Args( + types.Named("certs", types.S).Description("base64 encoded DER or PEM data containing two or more certificates where the first is a root CA, the last is a leaf certificate, and all others are intermediate CAs"), + ), + types.Named("output", types.NewArray([]types.Type{ types.B, types.NewArray(nil, types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))), - }, nil), + }, nil)).Description("array of `[valid, certs]`: if the input certificate chain could be verified then `valid` is `true` and `certs` is an array of X.509 certificates represented as objects; if the input certificate chain could not be verified then `valid` is `false` and `certs` is `[]`"), ), } -// CryptoX509ParseCertificateRequest returns a PKCS #10 certificate signing -// request from the given PEM-encoded PKCS#10 certificate signing request. var CryptoX509ParseCertificateRequest = &Builtin{ - Name: "crypto.x509.parse_certificate_request", + Name: "crypto.x509.parse_certificate_request", + Description: "Returns a PKCS #10 certificate signing request from the given PEM-encoded PKCS#10 certificate signing request.", Decl: types.NewFunction( - types.Args(types.S), - types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)), + types.Args( + types.Named("csr", types.S).Description("base64 string containing either a PEM encoded or DER CSR or a string containing a PEM CSR"), + ), + types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("X.509 CSR represented as an object"), ), } -// CryptoX509ParseRSAPrivateKey returns a JWK for signing a JWT from the given -// PEM-encoded RSA private key. var CryptoX509ParseRSAPrivateKey = &Builtin{ - Name: "crypto.x509.parse_rsa_private_key", + Name: "crypto.x509.parse_rsa_private_key", + Description: "Returns a JWK for signing a JWT from the given PEM-encoded RSA private key.", Decl: types.NewFunction( - types.Args(types.S), - types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)), + types.Args( + types.Named("pem", types.S).Description("base64 string containing a PEM encoded RSA private key"), + ), + types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))).Description("JWK as an object"), ), } -// CryptoMd5 returns a string representing the input string hashed with the md5 function var CryptoMd5 = &Builtin{ - Name: "crypto.md5", + Name: "crypto.md5", + Description: "Returns a string representing the input string hashed with the MD5 function", Decl: types.NewFunction( - types.Args(types.S), - types.S, + types.Args( + types.Named("x", types.S), + ), + types.Named("y", types.S).Description("MD5-hash of `x`"), ), } -// CryptoSha1 returns a string representing the input string hashed with the sha1 function var CryptoSha1 = &Builtin{ - Name: "crypto.sha1", + Name: "crypto.sha1", + Description: "Returns a string representing the input string hashed with the SHA1 function", Decl: types.NewFunction( - types.Args(types.S), - types.S, + types.Args( + types.Named("x", types.S), + ), + types.Named("y", types.S).Description("SHA1-hash of `x`"), ), } -// CryptoSha256 returns a string representing the input string hashed with the sha256 function var CryptoSha256 = &Builtin{ - Name: "crypto.sha256", + Name: "crypto.sha256", + Description: "Returns a string representing the input string hashed with the SHA256 function", Decl: types.NewFunction( - types.Args(types.S), - types.S, + types.Args( + types.Named("x", types.S), + ), + types.Named("y", types.S).Description("SHA256-hash of `x`"), ), } -// CryptoHmacMd5 returns a string representing the MD-5 HMAC of the input message using the input key -// Inputs are message, key var CryptoHmacMd5 = &Builtin{ - Name: "crypto.hmac.md5", + Name: "crypto.hmac.md5", + Description: "Returns a string representing the MD5 HMAC of the input message using the input key.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("x", types.S).Description("input string"), + types.Named("key", types.S).Description("key to use"), ), - types.S, + types.Named("y", types.S).Description("MD5-HMAC of `x`"), ), } -// CryptoHmacSha1 returns a string representing the SHA-1 HMAC of the input message using the input key -// Inputs are message, key var CryptoHmacSha1 = &Builtin{ - Name: "crypto.hmac.sha1", + Name: "crypto.hmac.sha1", + Description: "Returns a string representing the SHA1 HMAC of the input message using the input key.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("x", types.S).Description("input string"), + types.Named("key", types.S).Description("key to use"), ), - types.S, + types.Named("y", types.S).Description("SHA1-HMAC of `x`"), ), } -// CryptoHmacSha256 returns a string representing the SHA-256 HMAC of the input message using the input key -// Inputs are message, key var CryptoHmacSha256 = &Builtin{ - Name: "crypto.hmac.sha256", + Name: "crypto.hmac.sha256", + Description: "Returns a string representing the SHA256 HMAC of the input message using the input key.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("x", types.S).Description("input string"), + types.Named("key", types.S).Description("key to use"), ), - types.S, + types.Named("y", types.S).Description("SHA256-HMAC of `x`"), ), } -// CryptoHmacSha512 returns a string representing the SHA-512 HMAC of the input message using the input key -// Inputs are message, key var CryptoHmacSha512 = &Builtin{ - Name: "crypto.hmac.sha512", + Name: "crypto.hmac.sha512", + Description: "Returns a string representing the SHA512 HMAC of the input message using the input key.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("x", types.S).Description("input string"), + types.Named("key", types.S).Description("key to use"), ), - types.S, + types.Named("y", types.S).Description("SHA512-HMAC of `x`"), ), } /** * Graphs. */ +var graphs = category("graph") -// WalkBuiltin generates [path, value] tuples for all nested documents -// (recursively). var WalkBuiltin = &Builtin{ - Name: "walk", - Relation: true, + Name: "walk", + Relation: true, + Description: "Generates `[path, value]` tuples for all nested documents of `x` (recursively). Queries can use `walk` to traverse documents nested under `x`.", Decl: types.NewFunction( - types.Args(types.A), - types.NewArray( + types.Args( + types.Named("x", types.A), + ), + types.Named("output", types.NewArray( []types.Type{ types.NewArray(nil, types.A), types.A, }, nil, - ), + )).Description("pairs of `path` and `value`: `path` is an array representing the pointer to `value` in `x`"), ), + Categories: graphs, } -// ReachableBuiltin computes the set of reachable nodes in the graph from a set -// of starting nodes. var ReachableBuiltin = &Builtin{ - Name: "graph.reachable", + Name: "graph.reachable", + Description: "Computes the set of reachable nodes in the graph from a set of starting nodes.", Decl: types.NewFunction( types.Args( - types.NewObject( + types.Named("graph", types.NewObject( nil, types.NewDynamicProperty( types.A, @@ -2002,19 +2257,19 @@ var ReachableBuiltin = &Builtin{ types.NewSet(types.A), types.NewArray(nil, types.A)), )), - types.NewAny(types.NewSet(types.A), types.NewArray(nil, types.A)), + ).Description("object containing a set or array of neighboring vertices"), + types.Named("initial", types.NewAny(types.NewSet(types.A), types.NewArray(nil, types.A))).Description("set or array of root vertices"), ), - types.NewSet(types.A), + types.Named("output", types.NewSet(types.A)).Description("set of vertices reachable from the `initial` vertices in the directed `graph`"), ), } -// ReachablePathsBuiltin computes the set of reachable paths in the graph from a set -// of starting nodes. var ReachablePathsBuiltin = &Builtin{ - Name: "graph.reachable_paths", + Name: "graph.reachable_paths", + Description: "Computes the set of reachable paths in the graph from a set of starting nodes.", Decl: types.NewFunction( types.Args( - types.NewObject( + types.Named("graph", types.NewObject( nil, types.NewDynamicProperty( types.A, @@ -2022,109 +2277,100 @@ var ReachablePathsBuiltin = &Builtin{ types.NewSet(types.A), types.NewArray(nil, types.A)), )), - types.NewAny(types.NewSet(types.A), types.NewArray(nil, types.A)), + ).Description("object containing a set or array of root vertices"), + types.Named("initial", types.NewAny(types.NewSet(types.A), types.NewArray(nil, types.A))).Description("initial paths"), // TODO(sr): copied. is that correct? ), - types.NewSet(types.NewArray(nil, types.A)), - ), -} - -/** - * Sorting - */ - -// Sort returns a sorted array. -var Sort = &Builtin{ - Name: "sort", - Decl: types.NewFunction( - types.Args( - types.NewAny( - types.NewArray(nil, types.A), - types.NewSet(types.A), - ), - ), - types.NewArray(nil, types.A), + types.Named("output", types.NewSet(types.NewArray(nil, types.A))).Description("paths reachable from the `initial` vertices in the directed `graph`"), ), } /** * Type */ +var typesCat = category("types") -// IsNumber returns true if the input value is a number var IsNumber = &Builtin{ - Name: "is_number", + Name: "is_number", + Description: "Returns `true` if the input value is a number.", Decl: types.NewFunction( types.Args( - types.A, + types.Named("x", types.A), ), - types.B, + types.Named("result", types.B).Description("`true` if `x` is a number, `false` otherwise."), ), + Categories: typesCat, } -// IsString returns true if the input value is a string. var IsString = &Builtin{ - Name: "is_string", + Name: "is_string", + Description: "Returns `true` if the input value is a string.", Decl: types.NewFunction( types.Args( - types.A, + types.Named("x", types.A), ), - types.B, + types.Named("result", types.B).Description("`true` if `x` is a string, `false` otherwise."), ), + Categories: typesCat, } -// IsBoolean returns true if the input value is a boolean. var IsBoolean = &Builtin{ - Name: "is_boolean", + Name: "is_boolean", + Description: "Returns `true` if the input value is a boolean.", Decl: types.NewFunction( types.Args( - types.A, + types.Named("x", types.A), ), - types.B, + types.Named("result", types.B).Description("`true` if `x` is an boolean, `false` otherwise."), ), + Categories: typesCat, } -// IsArray returns true if the input value is an array. var IsArray = &Builtin{ - Name: "is_array", + Name: "is_array", + Description: "Returns `true` if the input value is an array.", Decl: types.NewFunction( types.Args( - types.A, + types.Named("x", types.A), ), - types.B, + types.Named("result", types.B).Description("`true` if `x` is an array, `false` otherwise."), ), + Categories: typesCat, } -// IsSet returns true if the input value is a set. var IsSet = &Builtin{ - Name: "is_set", + Name: "is_set", + Description: "Returns `true` if the input value is a set.", Decl: types.NewFunction( types.Args( - types.A, + types.Named("x", types.A), ), - types.B, + types.Named("result", types.B).Description("`true` if `x` is a set, `false` otherwise."), ), + Categories: typesCat, } -// IsObject returns true if the input value is an object. var IsObject = &Builtin{ - Name: "is_object", + Name: "is_object", + Description: "Returns true if the input value is an object", Decl: types.NewFunction( types.Args( - types.A, + types.Named("x", types.A), ), - types.B, + types.Named("result", types.B).Description("`true` if `x` is an object, `false` otherwise."), ), + Categories: typesCat, } -// IsNull returns true if the input value is null. var IsNull = &Builtin{ - Name: "is_null", + Name: "is_null", + Description: "Returns `true` if the input value is null.", Decl: types.NewFunction( types.Args( - types.A, + types.Named("x", types.A), ), - types.B, + types.Named("result", types.B).Description("`true` if `x` is null, `false` otherwise."), ), + Categories: typesCat, } /** @@ -2148,14 +2394,14 @@ var TypeNameBuiltin = &Builtin{ * HTTP Request */ -// HTTPSend returns a HTTP response to the given HTTP request. var HTTPSend = &Builtin{ - Name: "http.send", + Name: "http.send", + Description: "Returns a HTTP response to the given HTTP request.", Decl: types.NewFunction( types.Args( - types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)), + types.Named("request", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))), ), - types.NewObject(nil, types.NewDynamicProperty(types.A, types.A)), + types.Named("response", types.NewObject(nil, types.NewDynamicProperty(types.A, types.A))), ), } @@ -2163,34 +2409,37 @@ var HTTPSend = &Builtin{ * Rego */ -// RegoParseModule parses the input Rego file and returns a JSON representation -// of the AST. var RegoParseModule = &Builtin{ - Name: "rego.parse_module", + Name: "rego.parse_module", + Description: "Parses the input Rego string and returns an object representation of the AST.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("filename", types.S).Description("file name to attach to AST nodes' locations"), + types.Named("rego", types.S).Description("Rego module"), ), - types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)), // TODO(tsandall): import AST schema + types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))), // TODO(tsandall): import AST schema ), } -// RegoMetadataChain returns the chain of metadata for the active rule var RegoMetadataChain = &Builtin{ Name: "rego.metadata.chain", + Description: `Returns the chain of metadata for the active rule. +Ordered starting at the active rule, going outward to the most distant node in its package ancestry. +A chain entry is a JSON document with two members: "path", an array representing the path of the node; and "annotations", a JSON document containing the annotations declared for the node. +The first entry in the chain always points to the active rule, even if it has no declared annotations (in which case the "annotations" member is not present).`, Decl: types.NewFunction( types.Args(), - types.NewArray(nil, types.A), + types.Named("chain", types.NewArray(nil, types.A)).Description("each array entry represents a node in the path ancestry (chain) of the active rule that also has declared annotations"), ), } // RegoMetadataRule returns the metadata for the active rule var RegoMetadataRule = &Builtin{ - Name: "rego.metadata.rule", + Name: "rego.metadata.rule", + Description: "Returns annotations declared for the active rule and using the _rule_ scope.", Decl: types.NewFunction( types.Args(), - types.A, + types.Named("output", types.A).Description("\"rule\" scope annotations for this rule; empty object if no annotations exist"), ), } @@ -2198,147 +2447,131 @@ var RegoMetadataRule = &Builtin{ * OPA */ -// OPARuntime returns an object containing OPA runtime information such as the -// configuration that OPA was booted with. var OPARuntime = &Builtin{ - Name: "opa.runtime", + Name: "opa.runtime", + Description: "Returns an object that describes the runtime environment where OPA is deployed.", Decl: types.NewFunction( nil, - types.NewObject(nil, types.NewDynamicProperty(types.S, types.A)), + types.Named("output", types.NewObject(nil, types.NewDynamicProperty(types.S, types.A))). + Description("includes a `config` key if OPA was started with a configuration file; an `env` key containing the environment variables that the OPA process was started with; includes `version` and `commit` keys containing the version and build commit of OPA."), ), } /** * Trace */ +var tracing = category("tracing") -// Trace prints a note that is included in the query explanation. var Trace = &Builtin{ - Name: "trace", + Name: "trace", + Description: "Emits `note` as a `Note` event in the query explanation. Query explanations show the exact expressions evaluated by OPA during policy execution. For example, `trace(\"Hello There!\")` includes `Note \"Hello There!\"` in the query explanation. To include variables in the message, use `sprintf`. For example, `person := \"Bob\"; trace(sprintf(\"Hello There! %v\", [person]))` will emit `Note \"Hello There! Bob\"` inside of the explanation.", Decl: types.NewFunction( types.Args( - types.S, + types.Named("note", types.S).Description("the note to include"), ), - types.B, - ), -} - -/** - * Set - */ - -// Intersection returns the intersection of the given input sets -var Intersection = &Builtin{ - Name: "intersection", - Decl: types.NewFunction( - types.Args( - types.NewSet(types.NewSet(types.A)), - ), - types.NewSet(types.A), - ), -} - -// Union returns the union of the given input sets -var Union = &Builtin{ - Name: "union", - Decl: types.NewFunction( - types.Args( - types.NewSet(types.NewSet(types.A)), - ), - types.NewSet(types.A), + types.Named("result", types.B).Description("always `true`"), ), + Categories: tracing, } /** * Glob */ -// GlobMatch - not to be confused with regex.globs_match - parses and matches strings against the glob notation. var GlobMatch = &Builtin{ - Name: "glob.match", + Name: "glob.match", + Description: "Parses and matches strings against the glob notation. Not to be confused with `regex.globs_match`.", Decl: types.NewFunction( types.Args( - types.S, - types.NewArray(nil, types.S), - types.S, + types.Named("pattern", types.S), + types.Named("delimiters", types.NewArray(nil, types.S)).Description("glob pattern delimiters, e.g. `[\".\", \":\"]`, defaults to `[\".\"]` if unset."), + types.Named("match", types.S), ), - types.B, + types.Named("result", types.B).Description("true if `match` can be found in `pattern` which is separated by `delimiters`"), ), } -// GlobQuoteMeta returns a string which represents a version of the pattern where all asterisks have been escaped. +// GlobQuoteMeta var GlobQuoteMeta = &Builtin{ - Name: "glob.quote_meta", + Name: "glob.quote_meta", + Description: "Returns a string which represents a version of the pattern where all asterisks have been escaped.", Decl: types.NewFunction( types.Args( - types.S, + types.Named("pattern", types.S), ), - types.S, + types.Named("output", types.S).Description("the escaped string of `pattern`"), ), + // TODO(sr): example for this was: Calling ``glob.quote_meta("*.github.com", output)`` returns ``\\*.github.com`` as ``output``. } /** * Networking */ -// NetCIDRIntersects checks if a cidr intersects with another cidr and returns true or false var NetCIDRIntersects = &Builtin{ - Name: "net.cidr_intersects", + Name: "net.cidr_intersects", + Description: "Checks if a CIDR intersects with another CIDR (e.g. `192.168.0.0/16` overlaps with `192.168.1.0/24`). Supports both IPv4 and IPv6 notations.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("cidr1", types.S), + types.Named("cidr2", types.S), ), - types.B, + types.Named("result", types.B), ), } -// NetCIDRExpand returns a set of hosts inside the specified cidr. var NetCIDRExpand = &Builtin{ - Name: "net.cidr_expand", + Name: "net.cidr_expand", + Description: "Expands CIDR to set of hosts (e.g., `net.cidr_expand(\"192.168.0.0/30\")` generates 4 hosts: `{\"192.168.0.0\", \"192.168.0.1\", \"192.168.0.2\", \"192.168.0.3\"}`).", Decl: types.NewFunction( types.Args( - types.S, + types.Named("cidr", types.S), ), - types.NewSet(types.S), + types.Named("hosts", types.NewSet(types.S)).Description("set of IP addresses the CIDR `cidr` expands to"), ), } -// NetCIDRContains checks if a cidr or ip is contained within another cidr and returns true or false var NetCIDRContains = &Builtin{ - Name: "net.cidr_contains", + Name: "net.cidr_contains", + Description: "Checks if a CIDR or IP is contained within another CIDR. `output` is `true` if `cidr_or_ip` (e.g. `127.0.0.64/26` or `127.0.0.1`) is contained within `cidr` (e.g. `127.0.0.1/24`) and `false` otherwise. Supports both IPv4 and IPv6 notations.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("cidr", types.S), + types.Named("cidr_or_ip", types.S), ), - types.B, + types.Named("result", types.B), ), } -// NetCIDRContainsMatches checks if collections of cidrs or ips are contained within another collection of cidrs and returns matches. var NetCIDRContainsMatches = &Builtin{ Name: "net.cidr_contains_matches", + Description: "Checks if collections of cidrs or ips are contained within another collection of cidrs and returns matches. " + + "This function is similar to `net.cidr_contains` except it allows callers to pass collections of CIDRs or IPs as arguments and returns the matches (as opposed to a boolean result indicating a match between two CIDRs/IPs).", Decl: types.NewFunction( - types.Args(netCidrContainsMatchesOperandType, netCidrContainsMatchesOperandType), - types.NewSet(types.NewArray([]types.Type{types.A, types.A}, nil)), + types.Args( + types.Named("cidrs", netCidrContainsMatchesOperandType), + types.Named("cidrs_or_ips", netCidrContainsMatchesOperandType), + ), + types.Named("output", types.NewSet(types.NewArray([]types.Type{types.A, types.A}, nil))).Description("tuples identifying matches where `cidrs_or_ips` are contained within `cidrs`"), ), } -// NetCIDRMerge merges IP addresses and subnets into the smallest possible list of CIDRs. var NetCIDRMerge = &Builtin{ Name: "net.cidr_merge", + Description: "Merges IP addresses and subnets into the smallest possible list of CIDRs (e.g., `net.cidr_merge([\"192.0.128.0/24\", \"192.0.129.0/24\"])` generates `{\"192.0.128.0/23\"}`." + + `This function merges adjacent subnets where possible, those contained within others and also removes any duplicates. +Supports both IPv4 and IPv6 notations. IPv6 inputs need a prefix length (e.g. "/128").`, Decl: types.NewFunction( - types.Args(netCidrMergeOperandType), - types.NewSet(types.S), + types.Args( + types.Named("addrs", types.NewAny( + types.NewArray(nil, types.NewAny(types.S)), + types.NewSet(types.S), + )).Description("CIDRs or IP addresses"), + ), + types.Named("output", types.NewSet(types.S)).Description("smallest possible set of CIDRs obtained after merging the provided list of IP addresses and subnets in `addrs`"), ), } -var netCidrMergeOperandType = types.NewAny( - types.NewArray(nil, types.NewAny(types.S)), - types.NewSet(types.S), -) - var netCidrContainsMatchesOperandType = types.NewAny( types.S, types.NewArray(nil, types.NewAny( @@ -2358,14 +2591,14 @@ var netCidrContainsMatchesOperandType = types.NewAny( )), ) -// NetLookupIPAddr returns the set of IP addresses (as strings, both v4 and v6) -// that the passed-in name (string) resolves to using the standard name resolution -// mechanisms available. var NetLookupIPAddr = &Builtin{ - Name: "net.lookup_ip_addr", + Name: "net.lookup_ip_addr", + Description: "Returns the set of IP addresses (both v4 and v6) that the passed-in `name` resolves to using the standard name resolution mechanisms available.", Decl: types.NewFunction( - types.Args(types.S), - types.NewSet(types.S), + types.Args( + types.Named("name", types.S).Description("domain name to resolve"), + ), + types.Named("addrs", types.NewSet(types.S)).Description("IP addresses (v4 and v6) that `name` resolves to"), ), } @@ -2373,29 +2606,26 @@ var NetLookupIPAddr = &Builtin{ * Semantic Versions */ -// SemVerIsValid validiates a the term is a valid SemVer as a string, returns -// false for all other input var SemVerIsValid = &Builtin{ - Name: "semver.is_valid", + Name: "semver.is_valid", + Description: "Validates that the input is a valid SemVer string.", Decl: types.NewFunction( types.Args( - types.A, + types.Named("vsn", types.A), ), - types.B, + types.Named("result", types.B).Description("`true` if `vsn` is a valid SemVer; `false` otherwise"), ), } -// SemVerCompare compares valid SemVer formatted version strings. Given two -// version strings, if A < B returns -1, if A > B returns 1. If A == B, returns -// 0 var SemVerCompare = &Builtin{ - Name: "semver.compare", + Name: "semver.compare", + Description: "Compares valid SemVer formatted version strings.", Decl: types.NewFunction( types.Args( - types.S, - types.S, + types.Named("a", types.S), + types.Named("b", types.S), ), - types.N, + types.Named("result", types.N).Description("`-1` if `a < b`; `1` if `b > a`; `0` if `a == b`"), ), } @@ -2554,13 +2784,25 @@ var Any = &Builtin{ // Builtin represents a built-in function supported by OPA. Every built-in // function is uniquely identified by a name. type Builtin struct { - Name string `json:"name"` // Unique name of built-in function, e.g., (arg1,arg2,...,argN) + Name string `json:"name"` // Unique name of built-in function, e.g., (arg1,arg2,...,argN) + Description string `json:"description,omitempty"` // Description of what the built-in function does. + + // Categories of the built-in function. Omitted for namespaced + // built-ins, i.e. "array.concat" is taken to be of the "array" category. + // "minus" for example, is part of two categories: numbers and sets. (NOTE(sr): aspirational) + Categories []string `json:"categories,omitempty"` + Decl *types.Function `json:"decl"` // Built-in function type declaration. Infix string `json:"infix,omitempty"` // Unique name of infix operator. Default should be unset. Relation bool `json:"relation,omitempty"` // Indicates if the built-in acts as a relation. deprecated bool // Indicates if the built-in has been deprecated. } +// category is a helper for specifying a Builtin's Categories +func category(cs ...string) []string { + return cs +} + // IsDeprecated returns true if the Builtin function is deprecated and will be removed in a future release. func (b *Builtin) IsDeprecated() bool { return b.deprecated diff --git a/ast/capabilities.go b/ast/capabilities.go index 02fc3c277b..40a949d304 100644 --- a/ast/capabilities.go +++ b/ast/capabilities.go @@ -49,7 +49,8 @@ func CapabilitiesForThisVersion() *Capabilities { f.WasmABIVersions = append(f.WasmABIVersions, WasmABIVersion{Version: vers[0], Minor: vers[1]}) } - f.Builtins = append(f.Builtins, Builtins...) + f.Builtins = make([]*Builtin, len(Builtins)) + copy(f.Builtins, Builtins) sort.Slice(f.Builtins, func(i, j int) bool { return f.Builtins[i].Name < f.Builtins[j].Name }) diff --git a/ast/check.go b/ast/check.go index 43f5ad2c7d..fd35d017aa 100644 --- a/ast/check.go +++ b/ast/check.go @@ -314,17 +314,19 @@ func (tc *typeChecker) checkExprBuiltin(env *TypeEnv, expr *Expr) *Error { } fargs := ftpe.FuncArgs() + namedFargs := ftpe.NamedFuncArgs() if ftpe.Result() != nil { fargs.Args = append(fargs.Args, ftpe.Result()) + namedFargs.Args = append(namedFargs.Args, ftpe.NamedResult()) } if len(args) > len(fargs.Args) && fargs.Variadic == nil { - return newArgError(expr.Location, name, "too many arguments", pre, fargs) + return newArgError(expr.Location, name, "too many arguments", pre, namedFargs) } if len(args) < len(ftpe.FuncArgs().Args) { - return newArgError(expr.Location, name, "too few arguments", pre, fargs) + return newArgError(expr.Location, name, "too few arguments", pre, namedFargs) } for i := range args { @@ -333,7 +335,7 @@ func (tc *typeChecker) checkExprBuiltin(env *TypeEnv, expr *Expr) *Error { for i := range args { post[i] = env.Get(args[i]) } - return newArgError(expr.Location, name, "invalid argument(s)", post, fargs) + return newArgError(expr.Location, name, "invalid argument(s)", post, namedFargs) } } @@ -380,7 +382,7 @@ func (tc *typeChecker) checkExprWith(env *TypeEnv, expr *Expr, i int) *Error { switch v := valueType.(type) { case *types.Function: // ...by function if !unifies(targetType, valueType) { - return newArgError(expr.With[i].Loc(), target.Value.(Ref), "arity mismatch", v.Args(), t.FuncArgs()) + return newArgError(expr.With[i].Loc(), target.Value.(Ref), "arity mismatch", v.Args(), t.NamedFuncArgs()) } default: // ... by value, nothing to check } diff --git a/ast/compile.go b/ast/compile.go index df4695331d..42b1736d03 100644 --- a/ast/compile.go +++ b/ast/compile.go @@ -901,7 +901,7 @@ func arityMismatchError(env *TypeEnv, f Ref, expr *Expr, exp, act int) *Error { for i, op := range expr.Operands() { have[i] = env.Get(op) } - return newArgError(expr.Loc(), f, "arity mismatch", have, want.FuncArgs()) + return newArgError(expr.Loc(), f, "arity mismatch", have, want.NamedFuncArgs()) } if act != 1 { return NewError(TypeErr, expr.Loc(), "function %v has arity %d, got %d arguments", f, exp, act) diff --git a/ast/compile_test.go b/ast/compile_test.go index d00dfffb9c..10aabb8b9f 100644 --- a/ast/compile_test.go +++ b/ast/compile_test.go @@ -4541,7 +4541,7 @@ func TestCompilerMockFunction(t *testing.T) { http_send(_, _) = { "body": "nope" } p { true with http.send as http_send } `, - err: "rego_type_error: http.send: arity mismatch\n\thave: (any, any)\n\twant: (object[string: any])", + err: "rego_type_error: http.send: arity mismatch\n\thave: (any, any)\n\twant: (request: object[string: any])", }, { note: "invalid ref: arity mismatch (in call)", @@ -4549,14 +4549,14 @@ func TestCompilerMockFunction(t *testing.T) { http_send(_, _) = { "body": "nope" } p { http.send({}) with http.send as http_send } `, - err: "rego_type_error: http.send: arity mismatch\n\thave: (any, any)\n\twant: (object[string: any])", + err: "rego_type_error: http.send: arity mismatch\n\thave: (any, any)\n\twant: (request: object[string: any])", }, { note: "invalid ref: value another built-in with different type", module: `package test p { true with http.send as net.lookup_ip_addr } `, - err: "rego_type_error: http.send: arity mismatch\n\thave: (string)\n\twant: (object[string: any])", + err: "rego_type_error: http.send: arity mismatch\n\thave: (string)\n\twant: (request: object[string: any])", }, { note: "ref: value another built-in with compatible type", @@ -6462,7 +6462,7 @@ func TestQueryCompiler(t *testing.T) { q: `startswith("x")`, pkg: "", imports: nil, - expected: fmt.Errorf("1 error occurred: 1:1: rego_type_error: startswith: arity mismatch\n\thave: (string)\n\twant: (string, string)"), + expected: fmt.Errorf("1 error occurred: 1:1: rego_type_error: startswith: arity mismatch\n\thave: (string)\n\twant: (base: string, search: string)"), }, { note: "built-in function arity mismatch (arity 0)", @@ -6476,7 +6476,7 @@ func TestQueryCompiler(t *testing.T) { q: "count(sum())", pkg: "", imports: nil, - expected: fmt.Errorf("1 error occurred: 1:7: rego_type_error: sum: arity mismatch\n\thave: (???)\n\twant: (any)"), + expected: fmt.Errorf("1 error occurred: 1:7: rego_type_error: sum: arity mismatch\n\thave: (???)\n\twant: (collection: any)"), }, { note: "check types", diff --git a/build/check-working-copy.sh b/build/check-working-copy.sh index 85bb7cd6e2..d5faec5dfd 100755 --- a/build/check-working-copy.sh +++ b/build/check-working-copy.sh @@ -4,6 +4,7 @@ EXCEPTIONS=( "internal/compiler/wasm/opa/opa.go" "internal/compiler/wasm/opa/opa.wasm" "internal/compiler/wasm/opa/callgraph.csv" + "builtin_metadata.json" ) STATUS=$(git status --porcelain) diff --git a/builtin_metadata.json b/builtin_metadata.json new file mode 100644 index 0000000000..a61778f33a --- /dev/null +++ b/builtin_metadata.json @@ -0,0 +1,12816 @@ +{ + "_categories": { + "aggregates": [ + "count", + "max", + "min", + "product", + "sort", + "sum" + ], + "array": [ + "array.concat", + "array.reverse", + "array.slice" + ], + "bits": [ + "bits.and", + "bits.lsh", + "bits.negate", + "bits.or", + "bits.rsh", + "bits.xor" + ], + "comparison": [ + "equal", + "gt", + "gte", + "lt", + "lte", + "neq" + ], + "conversions": [ + "to_number" + ], + "crypto": [ + "crypto.hmac.md5", + "crypto.hmac.sha1", + "crypto.hmac.sha256", + "crypto.hmac.sha512", + "crypto.md5", + "crypto.sha1", + "crypto.sha256", + "crypto.x509.parse_and_verify_certificates", + "crypto.x509.parse_certificate_request", + "crypto.x509.parse_certificates", + "crypto.x509.parse_rsa_private_key" + ], + "encoding": [ + "base64.decode", + "base64.encode", + "base64.is_valid", + "base64url.decode", + "base64url.encode", + "base64url.encode_no_pad", + "hex.decode", + "hex.encode", + "json.is_valid", + "json.marshal", + "json.unmarshal", + "urlquery.decode", + "urlquery.decode_object", + "urlquery.encode", + "urlquery.encode_object", + "yaml.is_valid", + "yaml.marshal", + "yaml.unmarshal" + ], + "glob": [ + "glob.match", + "glob.quote_meta" + ], + "graph": [ + "graph.reachable", + "graph.reachable_paths", + "walk" + ], + "http": [ + "http.send" + ], + "internal": [ + "internal.member_2", + "internal.member_3", + "internal.print" + ], + "net": [ + "net.cidr_contains", + "net.cidr_contains_matches", + "net.cidr_expand", + "net.cidr_intersects", + "net.cidr_merge", + "net.cidr_overlap", + "net.lookup_ip_addr" + ], + "numbers": [ + "abs", + "ceil", + "div", + "floor", + "minus", + "mul", + "numbers.range", + "plus", + "rand.intn", + "rem", + "round" + ], + "object": [ + "json.filter", + "json.patch", + "json.remove", + "object.filter", + "object.get", + "object.remove", + "object.union", + "object.union_n" + ], + "opa": [ + "opa.runtime" + ], + "regex": [ + "regex.find_all_string_submatch_n", + "regex.find_n", + "regex.globs_match", + "regex.is_valid", + "regex.match", + "regex.split", + "regex.template_match" + ], + "rego": [ + "rego.metadata.chain", + "rego.metadata.rule", + "rego.parse_module" + ], + "semver": [ + "semver.compare", + "semver.is_valid" + ], + "sets": [ + "and", + "intersection", + "minus", + "or", + "union" + ], + "strings": [ + "concat", + "contains", + "endswith", + "format_int", + "indexof", + "indexof_n", + "lower", + "replace", + "split", + "sprintf", + "startswith", + "strings.replace_n", + "strings.reverse", + "substring", + "trim", + "trim_left", + "trim_prefix", + "trim_right", + "trim_space", + "trim_suffix", + "upper" + ], + "time": [ + "time.add_date", + "time.clock", + "time.date", + "time.diff", + "time.now_ns", + "time.parse_duration_ns", + "time.parse_ns", + "time.parse_rfc3339_ns", + "time.weekday" + ], + "tokens": [ + "io.jwt.decode", + "io.jwt.decode_verify", + "io.jwt.verify_es256", + "io.jwt.verify_es384", + "io.jwt.verify_es512", + "io.jwt.verify_hs256", + "io.jwt.verify_hs384", + "io.jwt.verify_hs512", + "io.jwt.verify_ps256", + "io.jwt.verify_ps384", + "io.jwt.verify_ps512", + "io.jwt.verify_rs256", + "io.jwt.verify_rs384", + "io.jwt.verify_rs512" + ], + "tokensign": [ + "io.jwt.encode_sign", + "io.jwt.encode_sign_raw" + ], + "tracing": [ + "trace" + ], + "types": [ + "is_array", + "is_boolean", + "is_null", + "is_number", + "is_object", + "is_set", + "is_string" + ], + "units": [ + "units.parse", + "units.parse_bytes" + ], + "uuid": [ + "uuid.rfc4122" + ] + }, + "abs": { + "args": [ + { + "description": "", + "name": "x", + "type": "number" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the number without its sign.", + "introduced": "v0.17.0", + "result": { + "description": "the absolute value of `x`", + "name": "y", + "type": "number" + }, + "wasm": true + }, + "all": { + "args": [ + { + "type": "any\u003carray[any], set[any]\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "boolean" + }, + "wasm": true + }, + "and": { + "args": [ + { + "description": "", + "name": "x", + "type": "set[any]" + }, + { + "description": "", + "name": "y", + "type": "set[any]" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the intersection of two sets.", + "infix": "\u0026", + "introduced": "v0.17.0", + "result": { + "description": "the intersection of `x` and `y`", + "name": "z", + "type": "set[any]" + }, + "wasm": true + }, + "any": { + "args": [ + { + "type": "any\u003carray[any], set[any]\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "boolean" + }, + "wasm": true + }, + "array.concat": { + "args": [ + { + "description": "", + "name": "x", + "type": "array[any]" + }, + { + "description": "", + "name": "y", + "type": "array[any]" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Concatenates two arrays.", + "introduced": "v0.17.0", + "result": { + "description": "the concatenation of `x` and `y`", + "name": "z", + "type": "array[any]" + }, + "wasm": true + }, + "array.reverse": { + "args": [ + { + "description": "the array to be reversed", + "name": "arr", + "type": "array[any]" + } + ], + "available": [ + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the reverse of a given array.", + "introduced": "v0.36.0", + "result": { + "description": "an array containing the elements of `arr` in reverse order", + "name": "rev", + "type": "array[any]" + }, + "wasm": true + }, + "array.slice": { + "args": [ + { + "description": "the array to be sliced", + "name": "arr", + "type": "array[any]" + }, + { + "description": "the start index of the returned slice; if less than zero, it's clamped to 0", + "name": "start", + "type": "number" + }, + { + "description": "the stop index of the returned slice; if larger than `count(arr)`, it's clamped to `count(arr)`", + "name": "stop", + "type": "number" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a slice of a given array. If `start` is greater or equal than `stop`, `slice` is `[]`.", + "introduced": "v0.17.0", + "result": { + "description": "the subslice of `array`, from `start` to `end`, including `arr[start]`, but excluding `arr[end]`", + "name": "slice", + "type": "array[any]" + }, + "wasm": true + }, + "assign": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "infix": ":=", + "introduced": "v0.17.0", + "result": { + "type": "boolean" + }, + "wasm": false + }, + "base64.decode": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Deserializes the base64 encoded input string.", + "introduced": "v0.17.0", + "result": { + "description": "base64 deserialization of `x`", + "name": "y", + "type": "string" + }, + "wasm": true + }, + "base64.encode": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Serializes the input string into base64 encoding.", + "introduced": "v0.17.0", + "result": { + "description": "base64 serialization of `x`", + "name": "y", + "type": "string" + }, + "wasm": true + }, + "base64.is_valid": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies the input string is base64 encoded.", + "introduced": "v0.24.0", + "result": { + "description": "`true` if `x` is valid base64 encoded value, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "base64url.decode": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Deserializes the base64url encoded input string.", + "introduced": "v0.17.0", + "result": { + "description": "base64url deserialization of `x`", + "name": "y", + "type": "string" + }, + "wasm": true + }, + "base64url.encode": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Serializes the input string into base64url encoding.", + "introduced": "v0.17.0", + "result": { + "description": "base64url serialization of `x`", + "name": "y", + "type": "string" + }, + "wasm": true + }, + "base64url.encode_no_pad": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Serializes the input string into base64url encoding without padding.", + "introduced": "v0.25.0-rc2", + "result": { + "description": "base64url serialization of `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "bits.and": { + "args": [ + { + "description": "", + "name": "x", + "type": "number" + }, + { + "description": "", + "name": "y", + "type": "number" + } + ], + "available": [ + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the bitwise \"AND\" of two integers.", + "introduced": "v0.18.0", + "result": { + "name": "z", + "type": "number" + }, + "wasm": true + }, + "bits.lsh": { + "args": [ + { + "description": "", + "name": "x", + "type": "number" + }, + { + "description": "", + "name": "s", + "type": "number" + } + ], + "available": [ + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a new integer with its bits shifted `s` bits to the left.", + "introduced": "v0.18.0", + "result": { + "name": "z", + "type": "number" + }, + "wasm": true + }, + "bits.negate": { + "args": [ + { + "description": "", + "name": "x", + "type": "number" + } + ], + "available": [ + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the bitwise negation (flip) of an integer.", + "introduced": "v0.18.0", + "result": { + "name": "z", + "type": "number" + }, + "wasm": true + }, + "bits.or": { + "args": [ + { + "description": "", + "name": "x", + "type": "number" + }, + { + "description": "", + "name": "y", + "type": "number" + } + ], + "available": [ + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the bitwise \"OR\" of two integers.", + "introduced": "v0.18.0", + "result": { + "name": "z", + "type": "number" + }, + "wasm": true + }, + "bits.rsh": { + "args": [ + { + "description": "", + "name": "x", + "type": "number" + }, + { + "description": "", + "name": "s", + "type": "number" + } + ], + "available": [ + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a new integer with its bits shifted `s` bits to the right.", + "introduced": "v0.18.0", + "result": { + "name": "z", + "type": "number" + }, + "wasm": true + }, + "bits.xor": { + "args": [ + { + "description": "", + "name": "x", + "type": "number" + }, + { + "description": "", + "name": "y", + "type": "number" + } + ], + "available": [ + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the bitwise \"XOR\" (exclusive-or) of two integers.", + "introduced": "v0.18.0", + "result": { + "name": "z", + "type": "number" + }, + "wasm": true + }, + "cast_array": { + "args": [ + { + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "array[any]" + }, + "wasm": false + }, + "cast_boolean": { + "args": [ + { + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "boolean" + }, + "wasm": false + }, + "cast_null": { + "args": [ + { + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "null" + }, + "wasm": false + }, + "cast_object": { + "args": [ + { + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "object[any: any]" + }, + "wasm": false + }, + "cast_set": { + "args": [ + { + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "set[any]" + }, + "wasm": false + }, + "cast_string": { + "args": [ + { + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "string" + }, + "wasm": false + }, + "ceil": { + "args": [ + { + "description": "the number to round", + "name": "x", + "type": "number" + } + ], + "available": [ + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Rounds the number _up_ to the nearest integer.", + "introduced": "v0.26.0", + "result": { + "description": "the result of rounding `x` _up_", + "name": "y", + "type": "number" + }, + "wasm": true + }, + "concat": { + "args": [ + { + "description": "", + "name": "delimiter", + "type": "string" + }, + { + "description": "strings to join", + "name": "collection", + "type": "any\u003carray[string], set[string]\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Joins a set or array of strings with a delimiter.", + "introduced": "v0.17.0", + "result": { + "name": "output", + "type": "string" + }, + "wasm": true + }, + "contains": { + "args": [ + { + "description": "string to search in", + "name": "haystack", + "type": "string" + }, + { + "description": "substring to look for", + "name": "needle", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `true` if the search string is included in the base string", + "introduced": "v0.17.0", + "result": { + "description": "result of the containment check", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "count": { + "args": [ + { + "description": "the set/array/object/string to be counted", + "name": "collection", + "type": "any\u003cstring, array[any], object[any: any], set[any]\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": " Count takes a collection or string and returns the number of elements (or characters) in it.", + "introduced": "v0.17.0", + "result": { + "description": "the count of elements, key/val pairs, or characters, respectively.", + "name": "n", + "type": "number" + }, + "wasm": true + }, + "crypto.hmac.md5": { + "args": [ + { + "description": "input string", + "name": "x", + "type": "string" + }, + { + "description": "key to use", + "name": "key", + "type": "string" + } + ], + "available": [ + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a string representing the MD5 HMAC of the input message using the input key.", + "introduced": "v0.36.0", + "result": { + "description": "MD5-HMAC of `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "crypto.hmac.sha1": { + "args": [ + { + "description": "input string", + "name": "x", + "type": "string" + }, + { + "description": "key to use", + "name": "key", + "type": "string" + } + ], + "available": [ + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a string representing the SHA1 HMAC of the input message using the input key.", + "introduced": "v0.36.0", + "result": { + "description": "SHA1-HMAC of `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "crypto.hmac.sha256": { + "args": [ + { + "description": "input string", + "name": "x", + "type": "string" + }, + { + "description": "key to use", + "name": "key", + "type": "string" + } + ], + "available": [ + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a string representing the SHA256 HMAC of the input message using the input key.", + "introduced": "v0.36.0", + "result": { + "description": "SHA256-HMAC of `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "crypto.hmac.sha512": { + "args": [ + { + "description": "input string", + "name": "x", + "type": "string" + }, + { + "description": "key to use", + "name": "key", + "type": "string" + } + ], + "available": [ + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a string representing the SHA512 HMAC of the input message using the input key.", + "introduced": "v0.36.0", + "result": { + "description": "SHA512-HMAC of `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "crypto.md5": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a string representing the input string hashed with the MD5 function", + "introduced": "v0.17.0", + "result": { + "description": "MD5-hash of `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "crypto.sha1": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a string representing the input string hashed with the SHA1 function", + "introduced": "v0.17.0", + "result": { + "description": "SHA1-hash of `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "crypto.sha256": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a string representing the input string hashed with the SHA256 function", + "introduced": "v0.17.0", + "result": { + "description": "SHA256-hash of `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "crypto.x509.parse_and_verify_certificates": { + "args": [ + { + "description": "base64 encoded DER or PEM data containing two or more certificates where the first is a root CA, the last is a leaf certificate, and all others are intermediate CAs", + "name": "certs", + "type": "string" + } + ], + "available": [ + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns one or more certificates from the given string containing PEM\nor base64 encoded DER certificates after verifying the supplied certificates form a complete\ncertificate chain back to a trusted root.\n\nThe first certificate is treated as the root and the last is treated as the leaf,\nwith all others being treated as intermediates.", + "introduced": "v0.31.0", + "result": { + "description": "array of `[valid, certs]`: if the input certificate chain could be verified then `valid` is `true` and `certs` is an array of X.509 certificates represented as objects; if the input certificate chain could not be verified then `valid` is `false` and `certs` is `[]`", + "name": "output", + "type": "array\u003cboolean, array[object[string: any]]\u003e" + }, + "wasm": false + }, + "crypto.x509.parse_certificate_request": { + "args": [ + { + "description": "base64 string containing either a PEM encoded or DER CSR or a string containing a PEM CSR", + "name": "csr", + "type": "string" + } + ], + "available": [ + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a PKCS #10 certificate signing request from the given PEM-encoded PKCS#10 certificate signing request.", + "introduced": "v0.21.0", + "result": { + "description": "X.509 CSR represented as an object", + "name": "output", + "type": "object[string: any]" + }, + "wasm": false + }, + "crypto.x509.parse_certificates": { + "args": [ + { + "description": "base64 encoded DER or PEM data containing one or more certificates or a PEM string of one or more certificates", + "name": "certs", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns one or more certificates from the given base64 encoded string containing DER encoded certificates that have been concatenated.", + "introduced": "v0.17.0", + "result": { + "description": "parsed X.509 certificates represented as objects", + "name": "output", + "type": "array[object[string: any]]" + }, + "wasm": false + }, + "crypto.x509.parse_rsa_private_key": { + "args": [ + { + "description": "base64 string containing a PEM encoded RSA private key", + "name": "pem", + "type": "string" + } + ], + "available": [ + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a JWK for signing a JWT from the given PEM-encoded RSA private key.", + "introduced": "v0.33.0", + "result": { + "description": "JWK as an object", + "name": "output", + "type": "object[string: any]" + }, + "wasm": false + }, + "div": { + "args": [ + { + "description": "the dividend", + "name": "x", + "type": "number" + }, + { + "description": "the divisor", + "name": "y", + "type": "number" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Divides the first number by the second number.", + "infix": "/", + "introduced": "v0.17.0", + "result": { + "description": "the result of `x` divided by `y`", + "name": "z", + "type": "number" + }, + "wasm": true + }, + "endswith": { + "args": [ + { + "description": "base string", + "name": "base", + "type": "string" + }, + { + "description": "search string", + "name": "search", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns true if the search string begins with the base string.", + "introduced": "v0.17.0", + "result": { + "description": "result of the suffix check", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "eq": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "infix": "=", + "introduced": "v0.17.0", + "result": { + "type": "boolean" + }, + "wasm": false + }, + "equal": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + }, + { + "description": "", + "name": "y", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "infix": "==", + "introduced": "v0.17.0", + "result": { + "description": "true if `x` is equal to `y`; false otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "floor": { + "args": [ + { + "description": "the number to round", + "name": "x", + "type": "number" + } + ], + "available": [ + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Rounds the number _down_ to the nearest integer.", + "introduced": "v0.26.0", + "result": { + "description": "the result of rounding `x` _down_", + "name": "y", + "type": "number" + }, + "wasm": true + }, + "format_int": { + "args": [ + { + "description": "number to format", + "name": "number", + "type": "number" + }, + { + "description": "base of number representation to use", + "name": "base", + "type": "number" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the string representation of the number in the given base after converting it to an integer value.", + "introduced": "v0.17.0", + "result": { + "description": "formatted number", + "name": "output", + "type": "string" + }, + "wasm": true + }, + "glob.match": { + "args": [ + { + "description": "", + "name": "pattern", + "type": "string" + }, + { + "description": "glob pattern delimiters, e.g. `[\".\", \":\"]`, defaults to `[\".\"]` if unset.", + "name": "delimiters", + "type": "array[string]" + }, + { + "description": "", + "name": "match", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Parses and matches strings against the glob notation. Not to be confused with `regex.globs_match`.", + "introduced": "v0.17.0", + "result": { + "description": "true if `match` can be found in `pattern` which is separated by `delimiters`", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "glob.quote_meta": { + "args": [ + { + "description": "", + "name": "pattern", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a string which represents a version of the pattern where all asterisks have been escaped.", + "introduced": "v0.17.0", + "result": { + "description": "the escaped string of `pattern`", + "name": "output", + "type": "string" + }, + "wasm": false + }, + "graph.reachable": { + "args": [ + { + "description": "object containing a set or array of neighboring vertices", + "name": "graph", + "type": "object[any: any\u003carray[any], set[any]\u003e]" + }, + { + "description": "set or array of root vertices", + "name": "initial", + "type": "any\u003carray[any], set[any]\u003e" + } + ], + "available": [ + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Computes the set of reachable nodes in the graph from a set of starting nodes.", + "introduced": "v0.20.0", + "result": { + "description": "set of vertices reachable from the `initial` vertices in the directed `graph`", + "name": "output", + "type": "set[any]" + }, + "wasm": true + }, + "graph.reachable_paths": { + "args": [ + { + "description": "object containing a set or array of root vertices", + "name": "graph", + "type": "object[any: any\u003carray[any], set[any]\u003e]" + }, + { + "description": "initial paths", + "name": "initial", + "type": "any\u003carray[any], set[any]\u003e" + } + ], + "available": [ + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Computes the set of reachable paths in the graph from a set of starting nodes.", + "introduced": "v0.37.0", + "result": { + "description": "paths reachable from the `initial` vertices in the directed `graph`", + "name": "output", + "type": "set[array[any]]" + }, + "wasm": false + }, + "gt": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + }, + { + "description": "", + "name": "y", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "infix": "\u003e", + "introduced": "v0.17.0", + "result": { + "description": "true if `x` is greater than `y`; false otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "gte": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + }, + { + "description": "", + "name": "y", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "infix": "\u003e=", + "introduced": "v0.17.0", + "result": { + "description": "true if `x` is greater or equal to `y`; false otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "hex.decode": { + "args": [ + { + "description": "a hex-encoded string", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Deserializes the hex-encoded input string.", + "introduced": "v0.25.0-rc2", + "result": { + "description": "deseralized from `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "hex.encode": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Serializes the input string using hex-encoding.", + "introduced": "v0.25.0-rc2", + "result": { + "description": "serialization of `x` using hex-encoding", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "http.send": { + "args": [ + { + "description": "", + "name": "request", + "type": "object[string: any]" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a HTTP response to the given HTTP request.", + "introduced": "v0.17.0", + "result": { + "name": "response", + "type": "object[any: any]" + }, + "wasm": false + }, + "indexof": { + "args": [ + { + "description": "string to search in", + "name": "haystack", + "type": "string" + }, + { + "description": "substring to look for", + "name": "needle", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the index of a substring contained inside a string.", + "introduced": "v0.17.0", + "result": { + "description": "index of first occurrence, `-1` if not found", + "name": "output", + "type": "number" + }, + "wasm": true + }, + "indexof_n": { + "args": [ + { + "description": "string to search in", + "name": "haystack", + "type": "string" + }, + { + "description": "substring to look for", + "name": "needle", + "type": "string" + } + ], + "available": [ + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a list of all the indexes of a substring contained inside a string.", + "introduced": "v0.37.0", + "result": { + "description": "all indices at which `needle` occurs in `haystack`, may be empty", + "name": "output", + "type": "array[number]" + }, + "wasm": false + }, + "internal.member_2": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + } + ], + "available": [ + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "infix": "in", + "introduced": "v0.34.0", + "result": { + "type": "boolean" + }, + "wasm": true + }, + "internal.member_3": { + "args": [ + { + "type": "any" + }, + { + "type": "any" + }, + { + "type": "any" + } + ], + "available": [ + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "infix": "in", + "introduced": "v0.34.0", + "result": { + "type": "boolean" + }, + "wasm": true + }, + "internal.print": { + "args": [ + { + "type": "array[set[any]]" + } + ], + "available": [ + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.34.0", + "result": {}, + "wasm": false + }, + "intersection": { + "args": [ + { + "description": "set of sets to intersect", + "name": "xs", + "type": "set[set[any]]" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the intersection of the given input sets.", + "introduced": "v0.17.0", + "result": { + "description": "the intersection of all `xs` sets", + "name": "y", + "type": "set[any]" + }, + "wasm": true + }, + "io.jwt.decode": { + "args": [ + { + "description": "JWT token to decode", + "name": "jwt", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Decodes a JSON Web Token and outputs it as an object.", + "introduced": "v0.17.0", + "result": { + "description": "`[header, payload, sig]`, where `header` and `payload` are objects; `sig` is the hexadecimal representation of the signature on the token.", + "name": "output", + "type": "array\u003cobject[any: any], object[any: any], string\u003e" + }, + "wasm": false + }, + "io.jwt.decode_verify": { + "args": [ + { + "description": "JWT token whose signature is to be verified and whose claims are to be checked", + "name": "jwt", + "type": "string" + }, + { + "description": "claim verification constraints", + "name": "constraints", + "type": "object[string: any]" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies a JWT signature under parameterized constraints and decodes the claims if it is valid.\nSupports the following algorithms: HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512, PS256, PS384 and PS512.", + "introduced": "v0.17.0", + "result": { + "description": "`[valid, header, payload]`: if the input token is verified and meets the requirements of `constraints` then `valid` is `true`; `header` and `payload` are objects containing the JOSE header and the JWT claim set; otherwise, `valid` is `false`, `header` and `payload` are `{}`", + "name": "output", + "type": "array\u003cboolean, object[any: any], object[any: any]\u003e" + }, + "wasm": false + }, + "io.jwt.encode_sign": { + "args": [ + { + "description": "JWS Protected Header", + "name": "headers", + "type": "object[string: any]" + }, + { + "description": "JWS Payload", + "name": "payload", + "type": "object[string: any]" + }, + { + "description": "JSON Web Key (RFC7517)", + "name": "key", + "type": "object[string: any]" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Encodes and optionally signs a JSON Web Token. Inputs are taken as objects, not encoded strings (see `io.jwt.encode_sign_raw`).", + "introduced": "v0.17.0", + "result": { + "description": "signed JWT", + "name": "output", + "type": "string" + }, + "wasm": false + }, + "io.jwt.encode_sign_raw": { + "args": [ + { + "description": "JWS Protected Header", + "name": "headers", + "type": "string" + }, + { + "description": "JWS Payload", + "name": "payload", + "type": "string" + }, + { + "description": "JSON Web Key (RFC7517)", + "name": "key", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Encodes and optionally signs a JSON Web Token.", + "introduced": "v0.17.0", + "result": { + "description": "signed JWT", + "name": "output", + "type": "string" + }, + "wasm": false + }, + "io.jwt.verify_es256": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature", + "name": "certificate", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a ES256 JWT signature is valid.", + "introduced": "v0.17.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "io.jwt.verify_es384": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature", + "name": "certificate", + "type": "string" + } + ], + "available": [ + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a ES384 JWT signature is valid.", + "introduced": "v0.20.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "io.jwt.verify_es512": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature", + "name": "certificate", + "type": "string" + } + ], + "available": [ + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a ES512 JWT signature is valid.", + "introduced": "v0.20.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "io.jwt.verify_hs256": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "plain text secret used to verify the signature", + "name": "secret", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a HS256 (secret) JWT signature is valid.", + "introduced": "v0.17.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "io.jwt.verify_hs384": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "plain text secret used to verify the signature", + "name": "secret", + "type": "string" + } + ], + "available": [ + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a HS384 (secret) JWT signature is valid.", + "introduced": "v0.20.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "io.jwt.verify_hs512": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "plain text secret used to verify the signature", + "name": "secret", + "type": "string" + } + ], + "available": [ + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a HS512 (secret) JWT signature is valid.", + "introduced": "v0.20.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "io.jwt.verify_ps256": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature", + "name": "certificate", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a PS256 JWT signature is valid.", + "introduced": "v0.17.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "io.jwt.verify_ps384": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature", + "name": "certificate", + "type": "string" + } + ], + "available": [ + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a PS384 JWT signature is valid.", + "introduced": "v0.20.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "io.jwt.verify_ps512": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature", + "name": "certificate", + "type": "string" + } + ], + "available": [ + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a PS512 JWT signature is valid.", + "introduced": "v0.20.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "io.jwt.verify_rs256": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature", + "name": "certificate", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a RS256 JWT signature is valid.", + "introduced": "v0.17.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "io.jwt.verify_rs384": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature", + "name": "certificate", + "type": "string" + } + ], + "available": [ + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a RS384 JWT signature is valid.", + "introduced": "v0.20.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "io.jwt.verify_rs512": { + "args": [ + { + "description": "JWT token whose signature is to be verified", + "name": "jwt", + "type": "string" + }, + { + "description": "PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature", + "name": "certificate", + "type": "string" + } + ], + "available": [ + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies if a RS512 JWT signature is valid.", + "introduced": "v0.20.0", + "result": { + "description": "`true` if the signature is valid, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "is_array": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `true` if the input value is an array.", + "introduced": "v0.17.0", + "result": { + "description": "`true` if `x` is an array, `false` otherwise.", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "is_boolean": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `true` if the input value is a boolean.", + "introduced": "v0.17.0", + "result": { + "description": "`true` if `x` is an boolean, `false` otherwise.", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "is_null": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `true` if the input value is null.", + "introduced": "v0.17.0", + "result": { + "description": "`true` if `x` is null, `false` otherwise.", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "is_number": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `true` if the input value is a number.", + "introduced": "v0.17.0", + "result": { + "description": "`true` if `x` is a number, `false` otherwise.", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "is_object": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns true if the input value is an object", + "introduced": "v0.17.0", + "result": { + "description": "`true` if `x` is an object, `false` otherwise.", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "is_set": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `true` if the input value is a set.", + "introduced": "v0.17.0", + "result": { + "description": "`true` if `x` is a set, `false` otherwise.", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "is_string": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `true` if the input value is a string.", + "introduced": "v0.17.0", + "result": { + "description": "`true` if `x` is a string, `false` otherwise.", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "json.filter": { + "args": [ + { + "description": "", + "name": "object", + "type": "object[any: any]" + }, + { + "description": "JSON string paths", + "name": "paths", + "type": "any\u003carray[any\u003cstring, array[any]\u003e], set[any\u003cstring, array[any]\u003e]\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Filters the object. For example: `json.filter({\"a\": {\"b\": \"x\", \"c\": \"y\"}}, [\"a/b\"])` will result in `{\"a\": {\"b\": \"x\"}}`). Paths are not filtered in-order and are deduplicated before being evaluated.", + "introduced": "v0.17.0", + "result": { + "description": "remaining data from `object` with only keys specified in `paths`", + "name": "filtered", + "type": "any" + }, + "wasm": true + }, + "json.is_valid": { + "args": [ + { + "description": "a JSON string", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies the input string is a valid JSON document.", + "introduced": "v0.25.0-rc1", + "result": { + "description": "`true` if `x` is valid JSON, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "json.marshal": { + "args": [ + { + "description": "the term to serialize", + "name": "x", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Serializes the input term to JSON.", + "introduced": "v0.17.0", + "result": { + "description": "the JSON string representation of `x`", + "name": "y", + "type": "string" + }, + "wasm": true + }, + "json.patch": { + "args": [ + { + "description": "", + "name": "object", + "type": "any" + }, + { + "description": "", + "name": "patches", + "type": "array[object\u003cop: string, path: any\u003e[any: any]]" + } + ], + "available": [ + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Patches an object according to RFC6902. For example: `json.patch({\"a\": {\"foo\": 1}}, [{\"op\": \"add\", \"path\": \"/a/bar\", \"value\": 2}])` results in `{\"a\": {\"foo\": 1, \"bar\": 2}`. The patches are applied atomically: if any of them fails, the result will be undefined.", + "introduced": "v0.25.0", + "result": { + "description": "result obtained after consecutively applying all patch operations in `patches`", + "name": "output", + "type": "any" + }, + "wasm": false + }, + "json.remove": { + "args": [ + { + "description": "", + "name": "object", + "type": "object[any: any]" + }, + { + "description": "JSON string paths", + "name": "paths", + "type": "any\u003carray[any\u003cstring, array[any]\u003e], set[any\u003cstring, array[any]\u003e]\u003e" + } + ], + "available": [ + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Removes paths from an object. For example: `json.remove({\"a\": {\"b\": \"x\", \"c\": \"y\"}}, [\"a/b\"])` will result in `{\"a\": {\"c\": \"y\"}}`. Paths are not removed in-order and are deduplicated before being evaluated.", + "introduced": "v0.18.0", + "result": { + "description": "result of removing all keys specified in `paths`", + "name": "output", + "type": "any" + }, + "wasm": true + }, + "json.unmarshal": { + "args": [ + { + "description": "a JSON string", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Deserializes the input string.", + "introduced": "v0.17.0", + "result": { + "description": "the term deseralized from `x`", + "name": "y", + "type": "any" + }, + "wasm": true + }, + "lower": { + "args": [ + { + "description": "string that is converted to lower-case", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the input string but with all characters in lower-case.", + "introduced": "v0.17.0", + "result": { + "description": "lower-case of x", + "name": "y", + "type": "string" + }, + "wasm": true + }, + "lt": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + }, + { + "description": "", + "name": "y", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "infix": "\u003c", + "introduced": "v0.17.0", + "result": { + "description": "true if `x` is less than `y`; false otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "lte": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + }, + { + "description": "", + "name": "y", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "infix": "\u003c=", + "introduced": "v0.17.0", + "result": { + "description": "true if `x` is less than or equal to `y`; false otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "max": { + "args": [ + { + "description": "", + "name": "collection", + "type": "any\u003carray[any], set[any]\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the maximum value in a collection.", + "introduced": "v0.17.0", + "result": { + "description": "the maximum of all elements", + "name": "n", + "type": "any" + }, + "wasm": true + }, + "min": { + "args": [ + { + "description": "", + "name": "collection", + "type": "any\u003carray[any], set[any]\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the minimum value in a collection.", + "introduced": "v0.17.0", + "result": { + "description": "the minimum of all elements", + "name": "n", + "type": "any" + }, + "wasm": true + }, + "minus": { + "args": [ + { + "description": "", + "name": "x", + "type": "any\u003cnumber, set[any]\u003e" + }, + { + "description": "", + "name": "y", + "type": "any\u003cnumber, set[any]\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Minus subtracts the second number from the first number or computes the difference between two sets.", + "infix": "-", + "introduced": "v0.17.0", + "result": { + "description": "the difference of `x` and `y`", + "name": "z", + "type": "any\u003cnumber, set[any]\u003e" + }, + "wasm": true + }, + "mul": { + "args": [ + { + "description": "", + "name": "x", + "type": "number" + }, + { + "description": "", + "name": "y", + "type": "number" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Multiplies two numbers.", + "infix": "*", + "introduced": "v0.17.0", + "result": { + "description": "the product of `x` and `y`", + "name": "z", + "type": "number" + }, + "wasm": true + }, + "neq": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + }, + { + "description": "", + "name": "y", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "infix": "!=", + "introduced": "v0.17.0", + "result": { + "description": "true if `x` is not equal to `y`; false otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "net.cidr_contains": { + "args": [ + { + "description": "", + "name": "cidr", + "type": "string" + }, + { + "description": "", + "name": "cidr_or_ip", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Checks if a CIDR or IP is contained within another CIDR. `output` is `true` if `cidr_or_ip` (e.g. `127.0.0.64/26` or `127.0.0.1`) is contained within `cidr` (e.g. `127.0.0.1/24`) and `false` otherwise. Supports both IPv4 and IPv6 notations.", + "introduced": "v0.17.0", + "result": { + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "net.cidr_contains_matches": { + "args": [ + { + "description": "", + "name": "cidrs", + "type": "any\u003cstring, array[any\u003cstring, array[any]\u003e], object[string: any\u003cstring, array[any]\u003e], set[any\u003cstring, array[any]\u003e]\u003e" + }, + { + "description": "", + "name": "cidrs_or_ips", + "type": "any\u003cstring, array[any\u003cstring, array[any]\u003e], object[string: any\u003cstring, array[any]\u003e], set[any\u003cstring, array[any]\u003e]\u003e" + } + ], + "available": [ + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Checks if collections of cidrs or ips are contained within another collection of cidrs and returns matches. This function is similar to `net.cidr_contains` except it allows callers to pass collections of CIDRs or IPs as arguments and returns the matches (as opposed to a boolean result indicating a match between two CIDRs/IPs).", + "introduced": "v0.19.0-rc1", + "result": { + "description": "tuples identifying matches where `cidrs_or_ips` are contained within `cidrs`", + "name": "output", + "type": "set[array\u003cany, any\u003e]" + }, + "wasm": false + }, + "net.cidr_expand": { + "args": [ + { + "description": "", + "name": "cidr", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Expands CIDR to set of hosts (e.g., `net.cidr_expand(\"192.168.0.0/30\")` generates 4 hosts: `{\"192.168.0.0\", \"192.168.0.1\", \"192.168.0.2\", \"192.168.0.3\"}`).", + "introduced": "v0.17.0", + "result": { + "description": "set of IP addresses the CIDR `cidr` expands to", + "name": "hosts", + "type": "set[string]" + }, + "wasm": false + }, + "net.cidr_intersects": { + "args": [ + { + "description": "", + "name": "cidr1", + "type": "string" + }, + { + "description": "", + "name": "cidr2", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Checks if a CIDR intersects with another CIDR (e.g. `192.168.0.0/16` overlaps with `192.168.1.0/24`). Supports both IPv4 and IPv6 notations.", + "introduced": "v0.17.0", + "result": { + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "net.cidr_merge": { + "args": [ + { + "description": "CIDRs or IP addresses", + "name": "addrs", + "type": "any\u003carray[any\u003cstring\u003e], set[string]\u003e" + } + ], + "available": [ + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Merges IP addresses and subnets into the smallest possible list of CIDRs (e.g., `net.cidr_merge([\"192.0.128.0/24\", \"192.0.129.0/24\"])` generates `{\"192.0.128.0/23\"}`.This function merges adjacent subnets where possible, those contained within others and also removes any duplicates.\nSupports both IPv4 and IPv6 notations. IPv6 inputs need a prefix length (e.g. \"/128\").", + "introduced": "v0.24.0", + "result": { + "description": "smallest possible set of CIDRs obtained after merging the provided list of IP addresses and subnets in `addrs`", + "name": "output", + "type": "set[string]" + }, + "wasm": false + }, + "net.cidr_overlap": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "boolean" + }, + "wasm": true + }, + "net.lookup_ip_addr": { + "args": [ + { + "description": "domain name to resolve", + "name": "name", + "type": "string" + } + ], + "available": [ + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the set of IP addresses (both v4 and v6) that the passed-in `name` resolves to using the standard name resolution mechanisms available.", + "introduced": "v0.35.0", + "result": { + "description": "IP addresses (v4 and v6) that `name` resolves to", + "name": "addrs", + "type": "set[string]" + }, + "wasm": false + }, + "numbers.range": { + "args": [ + { + "description": "", + "name": "a", + "type": "number" + }, + { + "description": "", + "name": "b", + "type": "number" + } + ], + "available": [ + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns an array of numbers in the given (inclusive) range. If `a==b`, then `range == [a]`; if `a \u003e b`, then `range` is in descending order.", + "introduced": "v0.22.0", + "result": { + "description": "the range between `a` and `b`", + "name": "range", + "type": "array[number]" + }, + "wasm": true + }, + "object.filter": { + "args": [ + { + "description": "object to filter keys", + "name": "object", + "type": "object[any: any]" + }, + { + "description": "", + "name": "keys", + "type": "any\u003carray[any], object[any: any], set[any]\u003e" + } + ], + "available": [ + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Filters the object by keeping only specified keys. For example: `object.filter({\"a\": {\"b\": \"x\", \"c\": \"y\"}, \"d\": \"z\"}, [\"a\"])` will result in `{\"a\": {\"b\": \"x\", \"c\": \"y\"}}`).", + "introduced": "v0.17.2", + "result": { + "description": "remaining data from `object` with only keys specified in `keys`", + "name": "filtered", + "type": "any" + }, + "wasm": true + }, + "object.get": { + "args": [ + { + "description": "object to get `key` from", + "name": "object", + "type": "object[any: any]" + }, + { + "description": "key to lookup in `object`", + "name": "key", + "type": "any" + }, + { + "description": "default to use when lookup fails", + "name": "default", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns value of an object's key if present, otherwise a default. If the supplied `key` is an `array`, then `object.get` will search through a nested object or array using each key in turn. For example: `object.get({\"a\": [{ \"b\": true }]}, [\"a\", 0, \"b\"], false)` results in `true`.", + "introduced": "v0.17.0", + "result": { + "description": "`object[key]` if present, otherwise `default`", + "name": "value", + "type": "any" + }, + "wasm": true + }, + "object.remove": { + "args": [ + { + "description": "object to remove keys from", + "name": "object", + "type": "object[any: any]" + }, + { + "description": "keys to remove from x", + "name": "keys", + "type": "any\u003carray[any], object[any: any], set[any]\u003e" + } + ], + "available": [ + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Removes specified keys from an object.", + "introduced": "v0.17.2", + "result": { + "description": "result of removing the specified `keys` from `object`", + "name": "output", + "type": "any" + }, + "wasm": true + }, + "object.union": { + "args": [ + { + "description": "", + "name": "a", + "type": "object[any: any]" + }, + { + "description": "", + "name": "b", + "type": "object[any: any]" + } + ], + "available": [ + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Creates a new object of the asymmetric union of two objects. For example: `object.union({\"a\": 1, \"b\": 2, \"c\": {\"d\": 3}}, {\"a\": 7, \"c\": {\"d\": 4, \"e\": 5}})` will result in `{\"a\": 7, \"b\": 2, \"c\": {\"d\": 4, \"e\": 5}}`.", + "introduced": "v0.17.2", + "result": { + "description": "a new object which is the result of an asymmetric recursive union of two objects where conflicts are resolved by choosing the key from the right-hand object `b`", + "name": "output", + "type": "any" + }, + "wasm": true + }, + "object.union_n": { + "args": [ + { + "description": "", + "name": "objects", + "type": "array[object[any: any]]" + } + ], + "available": [ + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Creates a new object that is the asymmetric union of all objects merged from left to right. For example: `object.union_n([{\"a\": 1}, {\"b\": 2}, {\"a\": 3}])` will result in `{\"b\": 2, \"a\": 3}`.", + "introduced": "v0.37.0", + "result": { + "description": "asymmetric recursive union of all objects in `objects`, merged from left to right, where conflicts are resolved by choosing the key from the right-hand object", + "name": "output", + "type": "any" + }, + "wasm": false + }, + "opa.runtime": { + "args": [], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns an object that describes the runtime environment where OPA is deployed.", + "introduced": "v0.17.0", + "result": { + "description": "includes a `config` key if OPA was started with a configuration file; an `env` key containing the environment variables that the OPA process was started with; includes `version` and `commit` keys containing the version and build commit of OPA.", + "name": "output", + "type": "object[string: any]" + }, + "wasm": false + }, + "or": { + "args": [ + { + "description": "", + "name": "x", + "type": "set[any]" + }, + { + "description": "", + "name": "y", + "type": "set[any]" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the union of two sets.", + "infix": "|", + "introduced": "v0.17.0", + "result": { + "description": "the union of `x` and `y`", + "name": "z", + "type": "set[any]" + }, + "wasm": true + }, + "plus": { + "args": [ + { + "description": "", + "name": "x", + "type": "number" + }, + { + "description": "", + "name": "y", + "type": "number" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Plus adds two numbers together.", + "infix": "+", + "introduced": "v0.17.0", + "result": { + "description": "the sum of `x` and `y`", + "name": "z", + "type": "number" + }, + "wasm": true + }, + "print": { + "args": [], + "available": [ + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.34.0", + "result": {}, + "wasm": false + }, + "product": { + "args": [ + { + "description": "", + "name": "collection", + "type": "any\u003carray[number], set[number]\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Muliplies elements of an array or set of numbers", + "introduced": "v0.17.0", + "result": { + "description": "the product of all elements", + "name": "n", + "type": "number" + }, + "wasm": true + }, + "rand.intn": { + "args": [ + { + "description": "", + "name": "str", + "type": "string" + }, + { + "description": "", + "name": "n", + "type": "number" + } + ], + "available": [ + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a random integer between `0` and `n` (`n` exlusive). If `n` is `0`, then `y` is always `0`. For any given argument pair (`str`, `n`), the output will be consistent throughout a query evaluation.", + "introduced": "v0.31.0", + "result": { + "description": "random integer in the range `[0, abs(n))`", + "name": "y", + "type": "number" + }, + "wasm": false + }, + "re_match": { + "args": [ + { + "type": "string" + }, + { + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "boolean" + }, + "wasm": true + }, + "regex.find_all_string_submatch_n": { + "args": [ + { + "description": "regular expression", + "name": "pattern", + "type": "string" + }, + { + "description": "string to match", + "name": "value", + "type": "string" + }, + { + "description": "number of matches to return; `-1` means all matches", + "name": "number", + "type": "number" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns all successive matches of the expression.", + "introduced": "v0.17.0", + "result": { + "name": "output", + "type": "array[array[string]]" + }, + "wasm": true + }, + "regex.find_n": { + "args": [ + { + "description": "regular expression", + "name": "pattern", + "type": "string" + }, + { + "description": "string to match", + "name": "value", + "type": "string" + }, + { + "description": "number of matches to return, if `-1`, returns all matches", + "name": "number", + "type": "number" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the specified number of matches when matching the input against the pattern.", + "introduced": "v0.17.0", + "result": { + "description": "collected matches", + "name": "output", + "type": "array[string]" + }, + "wasm": false + }, + "regex.globs_match": { + "args": [ + { + "description": "", + "name": "glob1", + "type": "string" + }, + { + "description": "", + "name": "glob2", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Checks if the intersection of two glob-style regular expressions matches a non-empty set of non-empty strings.\nThe set of regex symbols is limited for this builtin: only `.`, `*`, `+`, `[`, `-`, `]` and `\\` are treated as special symbols.", + "introduced": "v0.17.0", + "result": { + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "regex.is_valid": { + "args": [ + { + "description": "regular expression", + "name": "pattern", + "type": "string" + } + ], + "available": [ + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Checks if a string is a valid regular expression: the detailed syntax for patterns is defined by https://github.com/google/re2/wiki/Syntax.", + "introduced": "v0.23.0", + "result": { + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "regex.match": { + "args": [ + { + "description": "regular expression", + "name": "pattern", + "type": "string" + }, + { + "description": "value to match against `pattern`", + "name": "value", + "type": "string" + } + ], + "available": [ + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Matches a string against a regular expression.", + "introduced": "v0.23.0", + "result": { + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "regex.split": { + "args": [ + { + "description": "regular expression", + "name": "pattern", + "type": "string" + }, + { + "description": "string to match", + "name": "value", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Splits the input string by the occurrences of the given pattern.", + "introduced": "v0.17.0", + "result": { + "description": "the parts obtained by splitting `value`", + "name": "output", + "type": "array[string]" + }, + "wasm": false + }, + "regex.template_match": { + "args": [ + { + "description": "template expression containing `0..n` regular expressions", + "name": "template", + "type": "string" + }, + { + "description": "string to match", + "name": "value", + "type": "string" + }, + { + "description": "start delimiter of the regular expression in `template`", + "name": "delimiter_start", + "type": "string" + }, + { + "description": "end delimiter of the regular expression in `template`", + "name": "delimiter_end", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Matches a string against a pattern, where there pattern may be glob-like", + "introduced": "v0.17.0", + "result": { + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "rego.metadata.chain": { + "args": [], + "available": [ + "v0.40.0", + "edge" + ], + "description": "Returns the chain of metadata for the active rule.\nOrdered starting at the active rule, going outward to the most distant node in its package ancestry.\nA chain entry is a JSON document with two members: \"path\", an array representing the path of the node; and \"annotations\", a JSON document containing the annotations declared for the node.\nThe first entry in the chain always points to the active rule, even if it has no declared annotations (in which case the \"annotations\" member is not present).", + "introduced": "v0.40.0", + "result": { + "description": "each array entry represents a node in the path ancestry (chain) of the active rule that also has declared annotations", + "name": "chain", + "type": "array[any]" + }, + "wasm": false + }, + "rego.metadata.rule": { + "args": [], + "available": [ + "v0.40.0", + "edge" + ], + "description": "Returns annotations declared for the active rule and using the _rule_ scope.", + "introduced": "v0.40.0", + "result": { + "description": "\"rule\" scope annotations for this rule; empty object if no annotations exist", + "name": "output", + "type": "any" + }, + "wasm": false + }, + "rego.parse_module": { + "args": [ + { + "description": "file name to attach to AST nodes' locations", + "name": "filename", + "type": "string" + }, + { + "description": "Rego module", + "name": "rego", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Parses the input Rego string and returns an object representation of the AST.", + "introduced": "v0.17.0", + "result": { + "name": "output", + "type": "object[string: any]" + }, + "wasm": false + }, + "rem": { + "args": [ + { + "description": "", + "name": "x", + "type": "number" + }, + { + "description": "", + "name": "y", + "type": "number" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the remainder for of `x` divided by `y`, for `y != 0`.", + "infix": "%", + "introduced": "v0.17.0", + "result": { + "description": "the remainder", + "name": "z", + "type": "number" + }, + "wasm": true + }, + "replace": { + "args": [ + { + "description": "string being processed", + "name": "x", + "type": "string" + }, + { + "description": "substring to replace", + "name": "old", + "type": "string" + }, + { + "description": "string to replace `old` with", + "name": "new", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Replace replaces all instances of a sub-string.", + "introduced": "v0.17.0", + "result": { + "description": "string with replaced substrings", + "name": "y", + "type": "string" + }, + "wasm": true + }, + "round": { + "args": [ + { + "description": "the number to round", + "name": "x", + "type": "number" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Rounds the number to the nearest integer.", + "introduced": "v0.17.0", + "result": { + "description": "the result of rounding `x`", + "name": "y", + "type": "number" + }, + "wasm": true + }, + "semver.compare": { + "args": [ + { + "description": "", + "name": "a", + "type": "string" + }, + { + "description": "", + "name": "b", + "type": "string" + } + ], + "available": [ + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Compares valid SemVer formatted version strings.", + "introduced": "v0.22.0", + "result": { + "description": "`-1` if `a \u003c b`; `1` if `b \u003e a`; `0` if `a == b`", + "name": "result", + "type": "number" + }, + "wasm": false + }, + "semver.is_valid": { + "args": [ + { + "description": "", + "name": "vsn", + "type": "any" + } + ], + "available": [ + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Validates that the input is a valid SemVer string.", + "introduced": "v0.22.0", + "result": { + "description": "`true` if `vsn` is a valid SemVer; `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "set_diff": { + "args": [ + { + "type": "set[any]" + }, + { + "type": "set[any]" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "set[any]" + }, + "wasm": true + }, + "sort": { + "args": [ + { + "description": "the array or set to be sorted", + "name": "collection", + "type": "any\u003carray[any], set[any]\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a sorted array.", + "introduced": "v0.17.0", + "result": { + "description": "the sorted array", + "name": "n", + "type": "array[any]" + }, + "wasm": true + }, + "split": { + "args": [ + { + "description": "string that is split", + "name": "x", + "type": "string" + }, + { + "description": "delimiter used for splitting", + "name": "delimiter", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Split returns an array containing elements of the input string split on a delimiter.", + "introduced": "v0.17.0", + "result": { + "description": "splitted parts", + "name": "ys", + "type": "array[string]" + }, + "wasm": true + }, + "sprintf": { + "args": [ + { + "description": "string with formatting verbs", + "name": "format", + "type": "string" + }, + { + "description": "arguments to format into formatting verbs", + "name": "values", + "type": "array[any]" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the given string, formatted.", + "introduced": "v0.17.0", + "result": { + "description": "`format` formatted by the values in `values`", + "name": "output", + "type": "string" + }, + "wasm": false + }, + "startswith": { + "args": [ + { + "description": "base string", + "name": "base", + "type": "string" + }, + { + "description": "search string", + "name": "search", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns true if the search string begins with the base string.", + "introduced": "v0.17.0", + "result": { + "description": "result of the prefix check", + "name": "result", + "type": "boolean" + }, + "wasm": true + }, + "strings.replace_n": { + "args": [ + { + "description": "replacement pairs", + "name": "patterns", + "type": "object[string: string]" + }, + { + "description": "string to replace substring matches in", + "name": "value", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Replaces a string from a list of old, new string pairs.\nReplacements are performed in the order they appear in the target string, without overlapping matches.\nThe old string comparisons are done in argument order.", + "introduced": "v0.17.0", + "result": { + "name": "output", + "type": "string" + }, + "wasm": true + }, + "strings.reverse": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Reverses a given string.", + "introduced": "v0.36.0", + "result": { + "name": "y", + "type": "string" + }, + "wasm": true + }, + "substring": { + "args": [ + { + "description": "", + "name": "value", + "type": "string" + }, + { + "description": "offset, must be positive", + "name": "offset", + "type": "number" + }, + { + "description": "length of the substring starting from `offset`", + "name": "length", + "type": "number" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the portion of a string for a given `offset` and a `length`. If `length \u003c 0`, `output` is the remainder of the string.", + "introduced": "v0.17.0", + "result": { + "description": "substring of `value` from `offset`, of length `length`", + "name": "output", + "type": "string" + }, + "wasm": true + }, + "sum": { + "args": [ + { + "description": "", + "name": "collection", + "type": "any\u003carray[number], set[number]\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Sums elements of an array or set of numbers.", + "introduced": "v0.17.0", + "result": { + "description": "the sum of all elements", + "name": "n", + "type": "number" + }, + "wasm": true + }, + "time.add_date": { + "args": [ + { + "description": "nanoseconds since the epoch", + "name": "ns", + "type": "number" + }, + { + "description": "", + "name": "years", + "type": "number" + }, + { + "description": "", + "name": "months", + "type": "number" + }, + { + "description": "", + "name": "days", + "type": "number" + } + ], + "available": [ + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the nanoseconds since epoch after adding years, months and days to nanoseconds. `undefined` if the result would be outside the valid time range that can fit within an `int64`.", + "introduced": "v0.19.0", + "result": { + "description": "nanoseconds since the epoch representing the input time, with years, months and days added", + "name": "output", + "type": "number" + }, + "wasm": false + }, + "time.clock": { + "args": [ + { + "description": "a number representing the nanoseconds since the epoch (UTC); or a two-element array of the nanoseconds, and a timezone string", + "name": "x", + "type": "any\u003cnumber, array\u003cnumber, string\u003e\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the `[hour, minute, second]` of the day for the nanoseconds since epoch.", + "introduced": "v0.17.0", + "result": { + "description": "the `hour`, `minute` (0-59), and `second` (0-59) representing the time of day for the nanoseconds since epoch in the supplied timezone (or UTC)", + "name": "output", + "type": "array\u003cnumber, number, number\u003e" + }, + "wasm": false + }, + "time.date": { + "args": [ + { + "description": "a number representing the nanoseconds since the epoch (UTC); or a two-element array of the nanoseconds, and a timezone string", + "name": "x", + "type": "any\u003cnumber, array\u003cnumber, string\u003e\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the `[year, month, day]` for the nanoseconds since epoch.", + "introduced": "v0.17.0", + "result": { + "description": "an array of `year`, `month` (1-12), and `day` (1-31)", + "name": "date", + "type": "array\u003cnumber, number, number\u003e" + }, + "wasm": false + }, + "time.diff": { + "args": [ + { + "description": "", + "name": "ns1", + "type": "any\u003cnumber, array\u003cnumber, string\u003e\u003e" + }, + { + "description": "", + "name": "ns2", + "type": "any\u003cnumber, array\u003cnumber, string\u003e\u003e" + } + ], + "available": [ + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the difference between two unix timestamps in nanoseconds (with optional timezone strings).", + "introduced": "v0.28.0", + "result": { + "description": "difference between `ns1` and `ns2` (in their supplied timezones, if supplied, or UTC) as array of numbers: `[years, months, days, hours, minutes, seconds]`", + "name": "output", + "type": "array\u003cnumber, number, number, number, number, number\u003e" + }, + "wasm": false + }, + "time.now_ns": { + "args": [], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the current time since epoch in nanoseconds.", + "introduced": "v0.17.0", + "result": { + "description": "nanoseconds since epoch", + "name": "now", + "type": "number" + }, + "wasm": false + }, + "time.parse_duration_ns": { + "args": [ + { + "description": "a duration like \"3m\"; seethe [Go `time` package documentation](https://golang.org/pkg/time/#ParseDuration) for more details", + "name": "duration", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the duration in nanoseconds represented by a string.", + "introduced": "v0.17.0", + "result": { + "description": "the `duration` in nanoseconds", + "name": "ns", + "type": "number" + }, + "wasm": false + }, + "time.parse_ns": { + "args": [ + { + "description": "format used for parsing, see the [Go `time` package documentation](https://golang.org/pkg/time/#Parse) for more details", + "name": "layout", + "type": "string" + }, + { + "description": "input to parse according to `layout`", + "name": "value", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the time in nanoseconds parsed from the string in the given format. `undefined` if the result would be outside the valid time range that can fit within an `int64`.", + "introduced": "v0.17.0", + "result": { + "description": "`value` in nanoseconds since epoch", + "name": "ns", + "type": "number" + }, + "wasm": false + }, + "time.parse_rfc3339_ns": { + "args": [ + { + "description": "", + "name": "value", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the time in nanoseconds parsed from the string in RFC3339 format. `undefined` if the result would be outside the valid time range that can fit within an `int64`.", + "introduced": "v0.17.0", + "result": { + "description": "`value` in nanoseconds since epoch", + "name": "ns", + "type": "number" + }, + "wasm": false + }, + "time.weekday": { + "args": [ + { + "description": "a number representing the nanoseconds since the epoch (UTC); or a two-element array of the nanoseconds, and a timezone string", + "name": "x", + "type": "any\u003cnumber, array\u003cnumber, string\u003e\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the day of the week (Monday, Tuesday, ...) for the nanoseconds since epoch.", + "introduced": "v0.17.0", + "result": { + "description": "the weekday represented by `ns` nanoseconds since the epoch in the supplied timezone (or UTC)", + "name": "day", + "type": "string" + }, + "wasm": false + }, + "to_number": { + "args": [ + { + "description": "", + "name": "x", + "type": "any\u003cnull, boolean, number, string\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Converts a string, bool, or number value to a number: Strings are converted to numbers using `strconv.Atoi`, Boolean `false` is converted to 0 and `true` is converted to 1.", + "introduced": "v0.17.0", + "result": { + "name": "num", + "type": "number" + }, + "wasm": true + }, + "trace": { + "args": [ + { + "description": "the note to include", + "name": "note", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Emits `note` as a `Note` event in the query explanation. Query explanations show the exact expressions evaluated by OPA during policy execution. For example, `trace(\"Hello There!\")` includes `Note \"Hello There!\"` in the query explanation. To include variables in the message, use `sprintf`. For example, `person := \"Bob\"; trace(sprintf(\"Hello There! %v\", [person]))` will emit `Note \"Hello There! Bob\"` inside of the explanation.", + "introduced": "v0.17.0", + "result": { + "description": "always `true`", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "trim": { + "args": [ + { + "description": "string to trim", + "name": "value", + "type": "string" + }, + { + "description": "string of characters that are cut off", + "name": "cutset", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `value` with all leading or trailing instances of the `cutset` characters removed.", + "introduced": "v0.17.0", + "result": { + "description": "string trimmed of `cutset` characters", + "name": "output", + "type": "string" + }, + "wasm": true + }, + "trim_left": { + "args": [ + { + "description": "string to trim", + "name": "value", + "type": "string" + }, + { + "description": "string of characters that are cut off on the left", + "name": "cutset", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `value` with all leading instances of the `cutset` chartacters removed.", + "introduced": "v0.17.0", + "result": { + "description": "string left-trimmed of `cutset` characters", + "name": "output", + "type": "string" + }, + "wasm": true + }, + "trim_prefix": { + "args": [ + { + "description": "string to trim", + "name": "value", + "type": "string" + }, + { + "description": "prefix to cut off", + "name": "prefix", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `value` without the prefix. If `value` doesn't start with `prefix`, it is returned unchanged.", + "introduced": "v0.17.0", + "result": { + "description": "string with `prefix` cut off", + "name": "output", + "type": "string" + }, + "wasm": true + }, + "trim_right": { + "args": [ + { + "description": "string to trim", + "name": "value", + "type": "string" + }, + { + "description": "string of characters that are cut off on the right", + "name": "cutset", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `value` with all trailing instances of the `cutset` chartacters removed.", + "introduced": "v0.17.0", + "result": { + "description": "string right-trimmed of `cutset` characters", + "name": "output", + "type": "string" + }, + "wasm": true + }, + "trim_space": { + "args": [ + { + "description": "string to trim", + "name": "value", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Return the given string with all leading and trailing white space removed.", + "introduced": "v0.17.0", + "result": { + "description": "string leading and trailing white space cut off", + "name": "output", + "type": "string" + }, + "wasm": true + }, + "trim_suffix": { + "args": [ + { + "description": "string to trim", + "name": "value", + "type": "string" + }, + { + "description": "suffix to cut off", + "name": "suffix", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns `value` without the suffix. If `value` doesn't end with `suffix`, it is returned unchanged.", + "introduced": "v0.17.0", + "result": { + "description": "string with `suffix` cut off", + "name": "output", + "type": "string" + }, + "wasm": true + }, + "type_name": { + "args": [ + { + "type": "any\u003cany\u003e" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "introduced": "v0.17.0", + "result": { + "type": "string" + }, + "wasm": true + }, + "union": { + "args": [ + { + "description": "set of sets to merge", + "name": "xs", + "type": "set[set[any]]" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the union of the given input sets.", + "introduced": "v0.17.0", + "result": { + "description": "the union of all `xs` sets", + "name": "y", + "type": "set[any]" + }, + "wasm": true + }, + "units.parse": { + "args": [ + { + "description": "the unit to parse", + "name": "x", + "type": "string" + } + ], + "available": [ + "edge" + ], + "description": "Converts strings like \"10G\", \"5K\", \"4M\", \"1500m\" and the like into a number.\nThis number can be a non-integer, such as 1.5, 0.22, etc. Supports standard metric decimal and\nbinary SI units (e.g., K, Ki, M, Mi, G, Gi etc.) m, K, M, G, T, P, and E are treated as decimal\nunits and Ki, Mi, Gi, Ti, Pi, and Ei are treated as binary units.\n\nNote that 'm' and 'M' are case-sensitive, to allow distinguishing between \"milli\" and \"mega\" units respectively. Other units are case-insensitive.", + "introduced": "edge", + "result": { + "description": "the parsed number", + "name": "y", + "type": "number" + }, + "wasm": false + }, + "units.parse_bytes": { + "args": [ + { + "description": "the byte unit to parse", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Converts strings like \"10GB\", \"5K\", \"4mb\" into an integer number of bytes.\nSupports standard byte units (e.g., KB, KiB, etc.) KB, MB, GB, and TB are treated as decimal\nunits and KiB, MiB, GiB, and TiB are treated as binary units. The bytes symbol (b/B) in the\nunit is optional and omitting it wil give the same result (e.g. Mi and MiB).", + "introduced": "v0.17.0", + "result": { + "description": "the parsed number", + "name": "y", + "type": "number" + }, + "wasm": false + }, + "upper": { + "args": [ + { + "description": "string that is converted to upper-case", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns the input string but with all characters in upper-case.", + "introduced": "v0.17.0", + "result": { + "description": "upper-case of x", + "name": "y", + "type": "string" + }, + "wasm": true + }, + "urlquery.decode": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Decodes a URL-encoded input string.", + "introduced": "v0.17.0", + "result": { + "description": "URL-encoding deserialization of `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "urlquery.decode_object": { + "args": [ + { + "description": "the query string", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Decodes the given URL query string into an object.", + "introduced": "v0.24.0", + "result": { + "description": "the resulting object", + "name": "object", + "type": "object[string: array[string]]" + }, + "wasm": false + }, + "urlquery.encode": { + "args": [ + { + "description": "", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Encodes the input string into a URL-encoded string.", + "introduced": "v0.17.0", + "result": { + "description": "URL-encoding serialization of `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "urlquery.encode_object": { + "args": [ + { + "description": "", + "name": "object", + "type": "object[string: any\u003cstring, array[string], set[string]\u003e]" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Encodes the given object into a URL encoded query string.", + "introduced": "v0.17.0", + "result": { + "description": "the URL-encoded serialization of `object`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "uuid.rfc4122": { + "args": [ + { + "description": "", + "name": "k", + "type": "string" + } + ], + "available": [ + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Returns a new UUIDv4.", + "introduced": "v0.20.0", + "result": { + "description": "a version 4 UUID; for any given `k`, the output will be consistent throughout a query evaluation", + "name": "output", + "type": "string" + }, + "wasm": false + }, + "walk": { + "args": [ + { + "description": "", + "name": "x", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Generates `[path, value]` tuples for all nested documents of `x` (recursively). Queries can use `walk` to traverse documents nested under `x`.", + "introduced": "v0.17.0", + "relation": true, + "result": { + "description": "pairs of `path` and `value`: `path` is an array representing the pointer to `value` in `x`", + "name": "output", + "type": "array\u003carray[any], any\u003e" + }, + "wasm": true + }, + "yaml.is_valid": { + "args": [ + { + "description": "a YAML string", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Verifies the input string is a valid YAML document.", + "introduced": "v0.25.0-rc1", + "result": { + "description": "`true` if `x` is valid YAML, `false` otherwise", + "name": "result", + "type": "boolean" + }, + "wasm": false + }, + "yaml.marshal": { + "args": [ + { + "description": "the term to serialize", + "name": "x", + "type": "any" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Serializes the input term to YAML.", + "introduced": "v0.17.0", + "result": { + "description": "the YAML string representation of `x`", + "name": "y", + "type": "string" + }, + "wasm": false + }, + "yaml.unmarshal": { + "args": [ + { + "description": "a YAML string", + "name": "x", + "type": "string" + } + ], + "available": [ + "v0.17.0", + "v0.17.1", + "v0.17.2", + "v0.17.3", + "v0.18.0", + "v0.19.0-rc1", + "v0.19.0", + "v0.19.1", + "v0.19.2", + "v0.20.0", + "v0.20.1", + "v0.20.2", + "v0.20.3", + "v0.20.4", + "v0.20.5", + "v0.21.0", + "v0.21.1", + "v0.22.0", + "v0.23.0", + "v0.23.1", + "v0.23.2", + "v0.24.0", + "v0.25.0-rc1", + "v0.25.0-rc2", + "v0.25.0-rc3", + "v0.25.0-rc4", + "v0.25.0", + "v0.25.1", + "v0.25.2", + "v0.26.0", + "v0.27.0", + "v0.27.1", + "v0.28.0", + "v0.29.0", + "v0.29.1", + "v0.29.2", + "v0.29.3", + "v0.29.4", + "v0.30.0", + "v0.30.1", + "v0.30.2", + "v0.31.0", + "v0.32.0", + "v0.32.1", + "v0.33.0", + "v0.33.1", + "v0.34.0", + "v0.34.1", + "v0.34.2", + "v0.35.0", + "v0.36.0", + "v0.36.1", + "v0.37.0", + "v0.37.1", + "v0.37.2", + "v0.38.0", + "v0.38.1", + "v0.39.0", + "v0.40.0", + "edge" + ], + "description": "Deserializes the input string.", + "introduced": "v0.17.0", + "result": { + "description": "the term deseralized from `x`", + "name": "y", + "type": "any" + }, + "wasm": false + } +} diff --git a/docs/Makefile b/docs/Makefile index 740e7a6f0d..5deb333416 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -8,7 +8,8 @@ DEPLOY_PRIME_URL ?= "http://localhost:8888" .PHONY: clean clean: - rm -rf ${CURDIR}/website/data/releases.yaml + rm -f $(CURDIR)/website/data/releases.yaml + rm -f $(CURDIR)/website/data/builtin_metadata.json rm -rf $(CURDIR)/website/generated rm -rf $(CURDIR)/website/public rm -rf $(CURDIR)/website/resources @@ -19,11 +20,15 @@ generate-cli-docs: $(CURDIR)/../build/gen-cli-docs.sh "$(CURDIR)/content" .PHONY: generate -generate: generate-cli-docs +generate: generate-cli-docs copy-builtin-metadata $(CURDIR)/website/scripts/load-docs.sh +.PHONY: copy-builtin-metadata +copy-builtin-metadata: + cp -v $(CURDIR)/../builtin_metadata.json $(CURDIR)/website/data/builtin_metadata.json + .PHONY: dev-generate -dev-generate: generate-cli-docs +dev-generate: generate-cli-docs copy-builtin-metadata DEV=true $(CURDIR)/website/scripts/load-docs.sh # The website has some npm dependencies saved in ./website/node_modules @@ -53,7 +58,7 @@ serve-remote: production-build cd $(CURDIR)/.. && netlify deploy .PHONY: dev-build -dev-build: clean dev-generate hugo-production-build live-blocks-inject +dev-build: clean dev-generate copy-builtin-metadata hugo-production-build live-blocks-inject ###################################################### # diff --git a/docs/content/contrib-adding-builtin-functions.md b/docs/content/contrib-adding-builtin-functions.md index 2d4ee755f4..2679fc7cd8 100644 --- a/docs/content/contrib-adding-builtin-functions.md +++ b/docs/content/contrib-adding-builtin-functions.md @@ -32,16 +32,17 @@ The following example adds a simple built-in function, `repeat(string, int)`, th In `ast/builtins.go`, we declare the structure of our built-in function with a `Builtin` struct instance: ```go -// Repeat returns, as a string, the given string repeated the given number of times. var Repeat = &Builtin{ - Name: "repeat", // The name of the function - Decl: types.NewFunction( - types.Args( // The built-in takes two arguments, where .. - types.S, // .. the first is a string, and .. - types.N, // .. the second is a number. - ), - types.S, // The return type is a string. - ), + Name: "repeat", // The name of the function + Description: "Returns, as a string, the given string repeated the given number of times.", + Decl: types.NewFunction( + types.Args( // The built-in takes two arguments, where .. + types.Named("str", types.S).Description("string to repeat"), // named string argument + types.Named("count", types.N).Description("how often to repeat `str`"), // named number argument + ), + types.Named("output", types.S).Description("the repetitions"), // The return type is a string. + ), + Categories: category("strings"), // the category the built-in belongs to } ``` @@ -142,24 +143,16 @@ The above test cases can be run separate from all other tests through: `go test See [test/cases/testdata/helloworld](https://github.com/open-policy-agent/opa/blob/main/test/cases/testdata/helloworld) for a more detailed example of how to implement tests for your built-in functions. -> Note: We can manually test our new built-in function by [building](../contrib-development#getting-started) -> and running the `eval` command. E.g.: `$./opa__ eval 'repeat("Foo", 3)'` +{{< info >}} +Note: We can manually test our new built-in function by [building](../contrib-development#getting-started) +and running the `eval` command. E.g.: `$./opa__ eval 'repeat("Foo", 3)'` +{{< /info >}} ### Document -All built-in functions must be documented in `docs/content/policy-reference.md` under an appropriate subsection. +All built-in functions will automatically be documented in `docs/content/policy-reference.md` under an appropriate subsection. -For this example, we add an entry for our new function under the `Strings` section: - -```markdown -### Strings - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -... -| ``output := repeat(string, count)`` | ``output`` is ``string`` repeated ``count``times | ``SDK-dependent`` | -... -``` +For this example, we'll get an entry for our new function under the `Strings` section. ### Add a capability diff --git a/docs/content/policy-reference.md b/docs/content/policy-reference.md index b2ecbac03c..5c18967a41 100644 --- a/docs/content/policy-reference.md +++ b/docs/content/policy-reference.md @@ -282,73 +282,13 @@ The built-in functions for the language provide basic operations to manipulate scalar values (e.g. numbers and strings), and aggregate functions that summarize complex types. -### Comparison +{{< builtin-table comparison >}} +{{< builtin-table numbers >}} +{{< builtin-table aggregates >}} +{{< builtin-table cat=array id=arrays-2 title=arrays >}} +{{< builtin-table cat=sets id=sets-2 >}} -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``x == y`` | ``x`` is equal to ``y`` | ✅ | -| ``x != y`` | ``x`` is not equal to ``y`` | ✅ | -| ``x < y`` | ``x`` is less than ``y`` | ✅ | -| ``x <= y`` | ``x`` is less than or equal to ``y`` | ✅ | -| ``x > y`` | ``x`` is greater than ``y`` | ✅ | -| ``x >= y`` | ``x`` is greater than or equal to ``y`` | ✅ | - -### Numbers - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``z := x + y`` | ``z`` is the sum of ``x`` and ``y`` | ✅ | -| ``z := x - y`` | ``z`` is the difference of ``x`` and ``y`` | ✅ | -| ``z := x * y`` | ``z`` is the product of ``x`` and ``y`` | ✅ | -| ``z := x / y`` | ``z`` is the quotient of ``x`` and ``y`` | ✅ | -| ``z := x % y`` | ``z`` is the remainder from the division of ``x`` and ``y`` | ✅ | -| ``output := round(x)`` | ``output`` is ``x`` rounded to the nearest integer | ✅ | -| ``output := ceil(x)`` | ``output`` is ``x`` rounded up to the nearest integer | ✅ | -| ``output := floor(x)`` | ``output`` is ``x`` rounded down the nearest integer | ✅ | -| ``output := abs(x)`` | ``output`` is the absolute value of ``x`` | ✅ | -| ``output := numbers.range(a, b)`` | ``output`` is the range of integer numbers between ``a`` and ``b`` (inclusive). If ``a`` == ``b`` then ``output`` == ``[a]``. If ``a`` < ``b`` the range is in ascending order. If ``a`` > ``b`` the range is in descending order. | ✅ | - ``output := rand.intn(str, n)`` | ``output`` is a ``number`` in the range [0, abs(``n``)). If ``n`` is 0, then ``output`` is 0. For any given (``str``, ``n``) pair the output will be consistent throughout a query evaluation. | SDK-dependent | - -### Aggregates - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := count(collection_or_string)`` | ``output`` is the length of the object, array, set, or string provided as input | ✅ | -| ``output := sum(array_or_set)`` | ``output`` is the sum of the numbers in ``array_or_set`` | ✅ | -| ``output := product(array_or_set)`` | ``output`` is the product of the numbers in ``array_or_set`` | ✅ | -| ``output := max(array_or_set)`` | ``output`` is the maximum value in ``array_or_set`` | ✅ | -| ``output := min(array_or_set)`` | ``output`` is the minimum value in ``array_or_set`` | ✅ | -| ``output := sort(array_or_set)`` | ``output`` is the sorted ``array`` containing elements from ``array_or_set``. | ✅ | - -### Arrays -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := array.concat(array, array)`` | ``output`` is the result of concatenating the two input arrays together. | ✅ | -| ``output := array.reverse(array)`` | ``output`` is the result of reversing the order of the elements in ``array``. | ✅ | - ``output := array.slice(array, startIndex, stopIndex)`` | ``output`` is the part of the ``array`` from ``startIndex`` to ``stopIndex`` including the first but excluding the last. If `startIndex >= stopIndex` then `output == []`. If both `startIndex` and `stopIndex` are less than zero, `output == []`. Otherwise, `startIndex` and `stopIndex` are clamped to 0 and `count(array)` respectively. | ✅ | - -### Sets - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``s3 := s1 & s2`` | ``s3`` is the intersection of ``s1`` and ``s2``. | ✅ | -| s3 := s1 | s2 | ``s3`` is the union of ``s1`` and ``s2``. | ✅ | -| ``s3 := s1 - s2`` | ``s3`` is the difference between ``s1`` and ``s2``, i.e., the elements in ``s1`` that are not in ``s2`` | ✅ | -| ``output := intersection(set[set])`` | ``output`` is the intersection of the sets in the input set | ✅ | -| ``output := union(set[set])`` | ``output`` is the union of the sets in the input set | ✅ | - -### Objects - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| `value := object.get(object, key, default)` | `value` is the value stored by the `object` at `key`. If no value is found, `default` is returned. If the supplied `key` is an `array`, then `object.get` will search through a nested object or array using each key in turn. For example: `object.get({"a": [{ "b": true }]}, ["a", 0, "b"], false)` results in `true` | ✅ | -| `output := object.remove(object, keys)` | `output` is a new object which is the result of removing the specified `keys` from `object`. `keys` must be either an array, object, or set of keys. | ✅ | -| `output := object.union(objectA, objectB)` | `output` is a new object which is the result of an asymmetric recursive union of two objects where conflicts are resolved by choosing the key from the right-hand object (`objectB`). For example: `object.union({"a": 1, "b": 2, "c": {"d": 3}}, {"a": 7, "c": {"d": 4, "e": 5}})` will result in `{"a": 7, "b": 2, "c": {"d": 4, "e": 5}}` | ✅ | -| `output := object.union_n(array)` | `output` is a new object which is the result of an asymmetric recursive union of all objects in `array`, merged from left to right, where conflicts are resolved by choosing the key from the right-hand object. For example: `object.union_n([{"a": 1}, {"b": 2}, {"a": 3}])` will result in `{"b": 2, "a": 3}` | ``SDK-dependent`` | -| `filtered := object.filter(object, keys)` | `filtered` is a new object with the remaining data from `object` with only keys specified in `keys` which is an array, object, or set of keys. For example: `object.filter({"a": {"b": "x", "c": "y"}, "d": "z"}, ["a"])` will result in `{"a": {"b": "x", "c": "y"}}`). | ✅ | -| `filtered := json.filter(object, paths)` | `filtered` is the remaining data from `object` with only keys specified in `paths` which is an array or set of JSON string paths. For example: `json.filter({"a": {"b": "x", "c": "y"}}, ["a/b"])` will result in `{"a": {"b": "x"}}`). Paths are not filtered in-order and are deduplicated before being evaluated. | ✅ | -| `output := json.remove(object, paths)` | `output` is a new object which is the result of removing all keys specified in `paths` which is an array or set of JSON string paths. For example: `json.remove({"a": {"b": "x", "c": "y"}}, ["a/b"])` will result in `{"a": {"c": "y"}}`. Paths are not removed in-order and are deduplicated before being evaluated. | ✅ | -| `output := json.patch(object, patches)` | `output` is a the object obtained after consecutively applying all [JSON Patch](https://tools.ietf.org/html/rfc6902) operations in the array `patches`. For example: `json.patch({"a": {"foo": 1}}, [{"op": "add", "path": "/a/bar", "value": 2}])` results in `{"a": {"foo": 1, "bar": 2}`. The patches are applied atomically: if any of them fails, the result will be undefined. | ``SDK-dependent`` | +{{< builtin-table cat=object title=objects >}} * When `keys` are provided as an object only the top level keys on the object will be used, values are ignored. For example: `object.remove({"a": {"b": {"c": 2}}, "x": 123}, {"a": 1}) == {"x": 123}` regardless of the value @@ -370,48 +310,10 @@ complex types. the path `a/b/c` can be passed in as `["a", "b", "c"]`. -### Strings +{{< builtin-table strings >}} +{{< builtin-table regex >}} -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := concat(delimiter, array_or_set)`` | ``output`` is the result of joining together the elements of ``array_or_set`` with the string ``delimiter`` | ✅ | -| ``contains(string, search)`` | true if ``string`` contains ``search`` | ✅ | -| ``endswith(string, search)`` | true if ``string`` ends with ``search`` | ✅ | -| ``output := format_int(number, base)`` | ``output`` is string representation of ``number`` in the given ``base`` | ✅ | -| ``output := indexof(string, search)`` | ``output`` is the index inside ``string`` where ``search`` first occurs, or -1 if ``search`` does not exist | ✅ | -| ``output := indexof_n(string, search)`` | ``output`` is ``array[number]`` representing the indexes inside ``string`` where ``search`` occurs | ``SDK-dependent`` | -| ``output := lower(string)`` | ``output`` is ``string`` after converting to lower case | ✅ | -| ``output := replace(string, old, new)`` | ``output`` is a ``string`` representing ``string`` with all instances of ``old`` replaced by ``new`` | ✅ | -| ``output := strings.reverse(string)`` | ``output`` is ``string`` reversed | ✅ | -| ``output := strings.replace_n(patterns, string)`` | ``patterns`` is an object with old, new string key value pairs (e.g. ``{"old1": "new1", "old2": "new2", ...}``). ``output`` is a ``string`` with all old strings inside ``patterns`` replaced by the new strings | ✅ | -| ``output := split(string, delimiter)`` | ``output`` is ``array[string]`` representing elements of ``string`` separated by ``delimiter`` | ✅ | -| ``output := sprintf(string, values)`` | ``output`` is a ``string`` representing ``string`` formatted by the values in the ``array`` ``values``. | ``SDK-dependent`` | -| ``startswith(string, search)`` | true if ``string`` begins with ``search`` | ✅ | -| ``output := substring(string, start, length)`` | ``output`` is the portion of ``string`` from index ``start`` and having a length of ``length``. If ``length`` is less than zero, ``length`` is the remainder of the ``string``. If ``start`` is greater than the length of the string, ``output`` is empty. It is invalid to pass a negative offset to this function. | ✅ | -| ``output := trim(string, cutset)`` | ``output`` is a ``string`` representing ``string`` with all leading and trailing instances of the characters in ``cutset`` removed. | ✅ | -| ``output := trim_left(string, cutset)`` | ``output`` is a ``string`` representing ``string`` with all leading instances of the characters in ``cutset`` removed. | ✅ | -| ``output := trim_prefix(string, prefix)`` | ``output`` is a ``string`` representing ``string`` with leading instance of ``prefix`` removed. If ``string`` doesn't start with prefix, ``string`` is returned unchanged.| ✅ | -| ``output := trim_right(string, cutset)`` | ``output`` is a ``string`` representing ``string`` with all trailing instances of the characters in ``cutset`` removed. | ✅ | -| ``output := trim_suffix(string, suffix)`` | ``output`` is a ``string`` representing ``string`` with trailing instance of ``suffix`` removed. If ``string`` doesn't end with suffix, ``string`` is returned unchanged.| ✅ | -| ``output := trim_space(string)`` | ``output`` is a ``string`` representing ``string`` with all leading and trailing white space removed.| ✅ | -| ``output := upper(string)`` | ``output`` is ``string`` after converting to upper case | ✅ | - -### Regex -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := regex.match(pattern, value)`` | ``output`` is a ``boolean`` that indicates if ``value`` matches the regex ``pattern``. | ✅ | -| ``output := regex.is_valid(pattern)`` | ``output`` is a ``boolean`` that indicates if ``pattern`` is a valid regex pattern. The detailed syntax for regex patterns is defined by https://github.com/google/re2/wiki/Syntax. | ✅ | -| ``output := regex.split(pattern, string)`` | ``output`` is ``array[string]`` representing elements of ``string`` separated by ``pattern`` | ``SDK-dependent`` | -| ``regex.globs_match(glob1, glob2)`` | true if the intersection of regex-style globs ``glob1`` and ``glob2`` matches a non-empty set of non-empty strings. The set of regex symbols is limited for this builtin: only ``.``, ``*``, ``+``, ``[``, ``-``, ``]`` and ``\`` are treated as special symbols. | ``SDK-dependent`` | -| ``output := regex.template_match(pattern, string, delimiter_start, delimiter_end)`` | ``output`` is true if ``string`` matches ``pattern``. ``pattern`` is a string containing ``0..n`` regular expressions delimited by ``delimiter_start`` and ``delimiter_end``. Example ``regex.template_match("urn:foo:{.*}", "urn:foo:bar:baz", "{", "}")`` returns ``true``. | ``SDK-dependent`` | -| ``output := regex.find_n(pattern, string, number)`` | ``output`` is an ``array[string]`` with the ``number`` of values matching the ``pattern``. A ``number`` of ``-1`` means all matches. | ``SDK-dependent`` | -| ``output := regex.find_all_string_submatch_n(pattern, string, number)`` | ``output`` is an ``array[array[string]]`` with the outer `array` including a ``number`` of matches which match the ``pattern``. A ``number`` of ``-1`` means all matches. | ✅ | - -### Glob -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := glob.match(pattern, delimiters, match)`` | ``output`` is true if ``match`` can be found in ``pattern`` which is separated by ``delimiters``. For valid patterns, check the table below. Argument ``delimiters`` is an array of single-characters (e.g. `[".", ":"]`). If ``delimiters`` is empty, it defaults to ``["."]``. | ✅ | -| ``output := glob.quote_meta(pattern)`` | ``output`` is the escaped string of ``pattern``. Calling ``glob.quote_meta("*.github.com", output)`` returns ``\\*.github.com`` as ``output``. | ``SDK-dependent`` | +{{< builtin-table glob >}} The following table shows examples of how ``glob.match`` works: @@ -438,66 +340,13 @@ The following table shows examples of how ``glob.match`` works: | ``output := glob.match("{cat,bat,[fr]at}", [], "rat")`` | ``true`` | A glob with pattern-alternatives matchers. | | ``output := glob.match("{cat,bat,[fr]at}", [], "at")`` | ``false`` | A glob with pattern-alternatives matchers. | -### Bitwise +{{< builtin-table cat=bits title=bitwise >}} +{{< builtin-table conversions >}} +{{< builtin-table units >}} +{{< builtin-table types >}} +{{< builtin-table encoding >}} -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``z := bits.or(x, y)`` | ``z`` is the bitwise or of integers ``x`` and ``y`` | ✅ | -| ``z := bits.and(x, y)`` | ``z`` is the bitwise and of integers ``x`` and ``y`` | ✅ | -| ``z := bits.negate(x)`` | ``z`` is the bitwise negation (flip) of integer ``x`` | ✅ | -| ``z := bits.xor(x, y)`` | ``z`` is the bitwise exclusive-or of integers ``x`` and ``y`` | ✅ | -| ``z := bits.lsh(x, s)`` | ``z`` is the bitshift of integer ``x`` by ``s`` bits to the left | ✅ | -| ``z := bits.rsh(x, s)`` | ``z`` is the bitshift of integer ``x`` by ``s`` bits to the right | ✅ | - -### Conversions - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := to_number(x)`` | ``output`` is ``x`` converted to a number. `null` is converted to zero, `true` and `false` are converted to one and zero (respectively), `string` values are interpreted as base 10, and `numbers` are a no-op. Other types are not supported. | ✅ | - -### Units - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := units.parse(x)`` | ``output`` is ``x`` converted to a number with support for standard metric decimal and binary SI units (e.g., K, Ki, M, Mi, G, Gi etc.) m, K, M, G, T, P, and E are treated as decimal units and Ki, Mi, Gi, Ti, Pi, and Ei are treated as binary units. Note that 'm' and 'M' are case-sensitive, to allow distinguishing between "milli" and "mega" units respectively. Other units are case-insensitive. | ``SDK-dependent`` | -| ``output := units.parse_bytes(x)`` | ``output`` is ``x`` converted to a number with support for standard byte units (e.g., KB, KiB, etc.) KB, MB, GB, and TB are treated as decimal units and KiB, MiB, GiB, and TiB are treated as binary units. The bytes symbol (b/B) in the unit is optional and omitting it wil give the same result (e.g. Mi and MiB) | ``SDK-dependent`` | - -### Types - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := is_number(x)`` | ``output`` is ``true`` if ``x`` is a number; otherwise undefined| ✅ | -| ``output := is_string(x)`` | ``output`` is ``true`` if ``x`` is a string; otherwise undefined | ✅ | -| ``output := is_boolean(x)`` | ``output`` is ``true`` if ``x`` is a boolean; otherwise undefined | ✅ | -| ``output := is_array(x)`` | ``output`` is ``true`` if ``x`` is an array; otherwise undefined | ✅ | -| ``output := is_set(x)`` | ``output`` is ``true`` if ``x`` is a set; otherwise undefined | ✅ | -| ``output := is_object(x)`` | ``output`` is ``true`` if ``x`` is an object; otherwise undefined | ✅ | -| ``output := is_null(x)`` | ``output`` is ``true`` if ``x`` is null; otherwise undefined | ✅ | -| ``output := type_name(x)`` | ``output`` is the type of ``x`` (e.g. ``"number"``, ``"boolean"``, ...) | ✅ | - -### Encoding - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := base64.encode(x)`` | ``output`` is ``x`` serialized to a base64 encoded string | ✅ | -| ``output := base64.decode(string)`` | ``output`` is ``x`` deserialized from a base64 encoding string | ✅ | -| ``output := base64url.encode(x)`` | ``output`` is ``x`` serialized to a base64url encoded string | ✅ | -| ``output := base64url.encode_no_pad(x)`` | ``output`` is ``x`` serialized to a base64url encoded string without padding | ``SDK-dependent`` | -| ``output := base64url.decode(string)`` | ``output`` is ``string`` deserialized from a base64url encoded string with or without padding | ✅ | -| ``output := urlquery.encode(string)`` | ``output`` is URL query parameter encoded ``string`` | ``SDK-dependent`` | -| ``output := urlquery.encode_object(object)`` | ``output`` is URL query parameter encoded ``object`` | ``SDK-dependent`` | -| ``output := urlquery.decode(string)`` | ``output`` is URL query parameter decoded ``string`` | ``SDK-dependent`` | -| ``output := urlquery.decode_object(string)`` | ``output`` is URL query parameter decoded ``string`` represented as an ``object`` | ``SDK-dependent`` | -| ``output := json.marshal(x)`` | ``output`` is ``x`` serialized to a JSON string | ✅ | -| ``output := json.unmarshal(string)`` | ``output`` is ``string`` deserialized to a term from a JSON encoded string | ✅ | -| ``output := json.is_valid(string)`` | ``output`` is a ``boolean`` that indicated whether ``string`` is a valid JSON document | ✅ | -| ``output := yaml.marshal(x)`` | ``output`` is ``x`` serialized to a YAML string | ``SDK-dependent`` | -| ``output := yaml.unmarshal(string)`` | ``output`` is ``string`` deserialized to a term from YAML encoded string | ``SDK-dependent`` | -| ``output := yaml.is_valid(string)`` | ``output`` is a ``boolean`` that indicated whether ``string`` is a valid YAML document that can be decoded by `yaml.unmarshal` | ``SDK-dependent`` | -| ``output := hex.encode(x)`` | ``output`` is ``x`` serialized to a hex encoded string | ``SDK-dependent`` | -| ``output := hex.decode(string)`` | ``output`` is a ``string`` deserialized from a hex encoded string | ``SDK-dependent`` | - -### Token Signing +{{< builtin-table cat=tokensign title="Token Signing" >}} OPA provides two builtins that implement JSON Web Signature [RFC7515](https://tools.ietf.org/html/rfc7515) functionality. @@ -509,10 +358,12 @@ OPA provides two builtins that implement JSON Web Signature [RFC7515](https://to ``io.jwt.encode_sign()`` takes three Rego Objects as parameters and returns their JWS Compact Serialization. This builtin should be used by those that want to use rego objects for signing during policy evaluation. -> Note that with `io.jwt.encode_sign` the Rego objects are serialized to JSON with standard formatting applied -> whereas the `io.jwt.encode_sign_raw` built-in will **not** affect whitespace of the strings passed in. -> This will mean that the final encoded token may have different string values, but the decoded and parsed -> JSON will match. +{{< info >}} +Note that with `io.jwt.encode_sign` the Rego objects are serialized to JSON with standard formatting applied +whereas the `io.jwt.encode_sign_raw` built-in will **not** affect whitespace of the strings passed in. +This will mean that the final encoded token may have different string values, but the decoded and parsed +JSON will match. +{{< /info >}} The following algorithms are supported: @@ -529,15 +380,11 @@ The following algorithms are supported: RS384 "RS384" // RSASSA-PKCS-v1.5 using SHA-384 RS512 "RS512" // RSASSA-PKCS-v1.5 using SHA-512 -
-| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := io.jwt.encode_sign_raw(headers, payload, key)`` | ``headers``, ``payload`` and ``key`` as strings that represent the JWS Protected Header, JWS Payload and JSON Web Key ([RFC7517](https://tools.ietf.org/html/rfc7517)) respectively.| ``SDK-dependent`` | -| ``output := io.jwt.encode_sign(headers, payload, key)`` | ``headers``, ``payload`` and ``key`` are JSON objects that represent the JWS Protected Header, JWS Payload and JSON Web Key ([RFC7517](https://tools.ietf.org/html/rfc7517)) respectively.| ``SDK-dependent`` | - -> Note that the key's provided should be base64 encoded (without padding) as per the specification ([RFC7517](https://tools.ietf.org/html/rfc7517)). -> This differs from the plain text secrets provided with the algorithm specific verify built-ins described below. +{{< info >}} +Note that the key's provided should be base64 encoded (without padding) as per the specification ([RFC7517](https://tools.ietf.org/html/rfc7517)). +This differs from the plain text secrets provided with the algorithm specific verify built-ins described below. +{{< /info >}} #### Token Signing Examples @@ -628,27 +475,12 @@ io.jwt.encode_sign_raw( ```live:jwt/raw:output ``` -### Token Verification +{{< builtin-table cat=tokens title="Token Verification" >}} -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := io.jwt.verify_rs256(string, certificate)`` | ``output`` is ``true`` if the RS256 signature of the input token is valid. ``certificate`` is the PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the RS256 signature| ``SDK-dependent`` | -| ``output := io.jwt.verify_rs384(string, certificate)`` | ``output`` is ``true`` if the RS384 signature of the input token is valid. ``certificate`` is the PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the RS384 signature| ``SDK-dependent`` | -| ``output := io.jwt.verify_rs512(string, certificate)`` | ``output`` is ``true`` if the RS512 signature of the input token is valid. ``certificate`` is the PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the RS512 signature| ``SDK-dependent`` | -| ``output := io.jwt.verify_ps256(string, certificate)`` | ``output`` is ``true`` if the PS256 signature of the input token is valid. ``certificate`` is the PEM encoded certificate, PEM encoded public key or the JWK key (set) used to verify the PS256 signature| ``SDK-dependent`` | -| ``output := io.jwt.verify_ps384(string, certificate)`` | ``output`` is ``true`` if the PS384 signature of the input token is valid. ``certificate`` is the PEM encoded certificate, PEM encoded public key or the JWK key (set) used to verify the PS384 signature| ``SDK-dependent`` | -| ``output := io.jwt.verify_ps512(string, certificate)`` | ``output`` is ``true`` if the PS512 signature of the input token is valid. ``certificate`` is the PEM encoded certificate, PEM encoded public key or the JWK key (set) used to verify the PS512 signature| ``SDK-dependent`` | -| ``output := io.jwt.verify_es256(string, certificate)`` | ``output`` is ``true`` if the ES256 signature of the input token is valid. ``certificate`` is the PEM encoded certificate, PEM encoded public key or the JWK key (set) used to verify the ES256 signature| ``SDK-dependent`` | -| ``output := io.jwt.verify_es384(string, certificate)`` | ``output`` is ``true`` if the ES384 signature of the input token is valid. ``certificate`` is the PEM encoded certificate, PEM encoded public key or the JWK key (set) used to verify the ES384 signature| ``SDK-dependent`` | -| ``output := io.jwt.verify_es512(string, certificate)`` | ``output`` is ``true`` if the ES512 signature of the input token is valid. ``certificate`` is the PEM encoded certificate, PEM encoded public key or the JWK key (set) used to verify the ES512 signature| ``SDK-dependent`` | -| ``output := io.jwt.verify_hs256(string, secret)`` | ``output`` is ``true`` if the Secret signature of the input token is valid. ``secret`` is a plain text secret used to verify the HS256 signature| ``SDK-dependent`` | -| ``output := io.jwt.verify_hs384(string, secret)`` | ``output`` is ``true`` if the Secret signature of the input token is valid. ``secret`` is a plain text secret used to verify the HS384 signature| ``SDK-dependent`` | -| ``output := io.jwt.verify_hs512(string, secret)`` | ``output`` is ``true`` if the Secret signature of the input token is valid. ``secret`` is a plain text secret used to verify the HS512 signature| ``SDK-dependent`` | -| ``output := io.jwt.decode(string)`` | ``output`` is of the form ``[header, payload, sig]``. ``header`` and ``payload`` are ``object``. ``sig`` is the hexadecimal representation of the signature on the token. | ``SDK-dependent`` | -| ``output := io.jwt.decode_verify(string, constraints)`` | ``output`` is of the form ``[valid, header, payload]``. If the input token verifies and meets the requirements of ``constraints`` then ``valid`` is ``true`` and ``header`` and ``payload`` are objects containing the JOSE header and the JWT claim set. Otherwise, ``valid`` is ``false`` and ``header`` and ``payload`` are ``{}``. Supports the following algorithms: HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512, PS256, PS384 and PS512. | ``SDK-dependent`` | - -> Note that the `io.jwt.verify_XX` built-in methods verify **only** the signature. They **do not** provide any validation for the JWT -> payload and any claims specified. The `io.jwt.decode_verify` built-in will verify the payload and **all** standard claims. +{{< info >}} +Note that the `io.jwt.verify_XX` built-in methods verify **only** the signature. They **do not** provide any validation for the JWT +payload and any claims specified. The `io.jwt.decode_verify` built-in will verify the payload and **all** standard claims. +{{< /info >}} The input `string` is a JSON Web Token encoded with JWS Compact Serialization. JWE and JWS JSON Serialization are not supported. If nested signing was used, the ``header``, ``payload`` and ``signature`` will represent the most deeply nested token. @@ -800,22 +632,12 @@ result_valid_hs256 := io.jwt.verify_hs256(result_hs256, "foo") > `io.jwt.encode_sign_raw` does not change the whitespace of the strings passed > in. The decoded and parsed JSON values are still the same. -### Time +{{< builtin-table time >}} -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := time.now_ns()`` | ``output`` is a ``number`` representing the current time since epoch in nanoseconds. | ``SDK-dependent`` | -| ``output := time.parse_ns(layout, value)`` | ``output`` is a ``number`` representing the time ``value`` in nanoseconds since epoch; or ``undefined`` if outside the valid time range that can fit within an ``int64``. See the [Go `time` package documentation](https://golang.org/pkg/time/#Parse) for more details on ``layout``. | ``SDK-dependent`` | -| ``output := time.parse_rfc3339_ns(value)`` | ``output`` is a ``number`` representing the time ``value`` in nanoseconds since epoch; or ``undefined`` if outside the valid time range that can fit within an ``int64``. | ``SDK-dependent`` | -| ``output := time.parse_duration_ns(duration)`` | ``output`` is a ``number`` representing the duration ``duration`` in nanoseconds. See the [Go `time` package documentation](https://golang.org/pkg/time/#ParseDuration) for more details on ``duration``. | ``SDK-dependent`` | -| ``output := time.date(ns)``
``output := time.date([ns, tz])``
| ``output`` is of the form ``[year, month, day]``, which includes the ``year``, ``month`` (0-12), and ``day`` (0-31) as ``number``s representing the date from the nanoseconds since epoch (``ns``) in the timezone (``tz``), if supplied, or as UTC.| ``SDK-dependent`` | -| ``output := time.clock(ns)``
``output := time.clock([ns, tz])``
| ``output`` is of the form ``[hour, minute, second]``, which outputs the ``hour``, ``minute`` (0-59), and ``second`` (0-59) as ``number``s representing the time of day for the nanoseconds since epoch (``ns``) in the timezone (``tz``), if supplied, or as UTC. | ``SDK-dependent`` | -| ``day := time.weekday(ns)``
``day := time.weekday([ns, tz])``
| outputs the ``day`` as ``string`` representing the day of the week for the nanoseconds since epoch (``ns``) in the timezone (``tz``), if supplied, or as UTC. | ``SDK-dependent`` | -| ``output := time.add_date(ns, years, months, days)`` | ``output`` is a ``number`` representing the time since epoch in nanoseconds after adding the ``years``, ``months`` and ``days`` to ``ns``; or ``undefined`` if outside the valid time range that can fit within an ``int64``. See the [Go `time` package documentation](https://golang.org/pkg/time/#Time.AddDate) for more details on ``add_date``. | ``SDK-dependent`` | -| ``output := time.diff(ns1, ns2)``
``output := time.diff([ns1, tz1], [ns2, tz2])``
| ``output`` is of the form ``[year(s), month(s), day(s), hour(s), minute(s), second(s)]``, which outputs ``year(s)``, ``month(s)`` (0-11), ``day(s)`` (0-30), ``hour(s)``(0-23), ``minute(s)``(0-59) and ``second(s)``(0-59) as ``number``s representing the difference between the the two timestamps in nanoseconds since epoch (``ns1`` and ``ns2``), in the timezones (``tz1`` and ``tz2``, respectively), if supplied, or as UTC. | ``SDK-dependent`` | - -> Multiple calls to the `time.now_ns` built-in function within a single policy +{{< info >}} +Multiple calls to the `time.now_ns` built-in function within a single policy evaluation query will always return the same value. +{{< /info >}} Timezones can be specified as @@ -823,31 +645,11 @@ Timezones can be specified as * "UTC" or "", which are equivalent to not passing a timezone (i.e. will return as UTC) * "Local", which will use the local timezone. -Note that the opa executable will need access to the timezone files in the environment it is running in (see the [Go time.LoadLocation()](https://golang.org/pkg/time/#LoadLocation) documentation for more information). +Note that the opa executable will need access to the timezone files in the environment it is running in (see the [Go `time.LoadLocation()`](https://pkg.go.dev/time#LoadLocation) documentation for more information). -### Cryptography +{{< builtin-table cat=crypto title=Cryptography >}} -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := crypto.x509.parse_certificates(certs)`` | ``certs`` is base64 encoded DER or PEM data containing one or more certificates or a PEM string of one or more certificates. ``output`` is an array of X.509 certificates represented as JSON objects. | ``SDK-dependent`` | -| ``output := crypto.x509.parse_and_verify_certificates(certs)`` | ``certs`` is base64 encoded DER or PEM data containing two or more certificates where the first is a root CA, the last is a leaf certificate, and all others are intermediate CAs. ``output`` is of the form ``[valid, certs]``. If the input certificate chain could be verified then ``valid`` is ``true`` and ``certs`` is an array of X.509 certificates represented as JSON objects. If the input certificate chain could not be verified then ``valid`` is ``false`` and ``certs`` is ``[]``. | ``SDK-dependent`` | -| ``output := crypto.x509.parse_certificate_request(csr)`` | ``csr`` is a base64 string containing either a PEM encoded or DER CSR or a string containing a PEM CSR.``output`` is an X.509 CSR represented as a JSON object. | ``SDK-dependent`` | -| ``output := crypto.x509.parse_rsa_private_key(pem)`` | ``pem`` is a base64 string containing a PEM encoded RSA private key.``output`` is a JWK as a JSON object. | ``SDK-dependent`` | -| ``output := crypto.md5(string)`` | ``output`` is ``string`` md5 hashed. | ``SDK-dependent`` | -| ``output := crypto.sha1(string)`` | ``output`` is ``string`` sha1 hashed. | ``SDK-dependent`` | -| ``output := crypto.sha256(string)`` | ``output`` is ``string`` sha256 hashed. | ``SDK-dependent`` | -| ``output := crypto.hmac.md5(string, key)`` | ``output`` is HMAC-MD5 of ``string`` using ``key`` | ``SDK-dependent`` | -| ``output := crypto.hmac.sha1(string, key)`` | ``output`` is HMAC-SHA-1 of ``string`` using ``key`` | ``SDK-dependent`` | -| ``output := crypto.hmac.sha256(string, key)`` | ``output`` is HMAC-SHA-256 of ``string`` using ``key`` | ``SDK-dependent`` | -| ``output := crypto.hmac.sha512(string, key)`` | ``output`` is HMAC-SHA-512 of ``string`` using ``key`` | ``SDK-dependent`` | - -### Graphs - -| Built-in | Description | Wasm Support | -| ------- |-------------|--------------| -| ``walk(x, [path, value])`` | ``walk`` is a relation that produces ``path`` and ``value`` pairs for documents under ``x``. ``path`` is ``array`` representing a pointer to ``value`` in ``x``. Queries can use ``walk`` to traverse documents nested under ``x`` (recursively). | ✅ | -| ``output := graph.reachable(graph, initial)`` | ``output`` is the set of vertices [reachable](https://en.wikipedia.org/wiki/Reachability) from the ``initial`` vertices in the directed ``graph``. ``initial`` is a set or array of vertices, and ``graph`` is an object containing a set or array of neighboring vertices. | ✅ | -| ``output := graph.reachable_paths(graph, initial)`` | ``output`` is the set of arrays of paths reachable from the ``initial`` vertices in the directed ``graph``. ``initial`` is a set or array of paths, and ``graph`` is an object containing a set or array of root vertices. | `SDK-dependent` | +{{< builtin-table cat=graph title=Graphs >}} A common class of recursive rules can be reduced to a graph reachability problem, so `graph.reachable` is useful for more than just graph analysis. @@ -904,11 +706,7 @@ all_paths[entity_name] ```live:graph/reachable_paths/example:output ``` -### HTTP - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``response := http.send(request)`` | ``http.send`` executes an HTTP `request` and returns a `response`. | ``SDK-dependent`` | +{{< builtin-table cat=http title=HTTP >}} {{< danger >}} This built-in function **must not** be used for effecting changes in @@ -1007,16 +805,7 @@ The table below shows examples of calling `http.send`: | Environment variables containing TLS material | ``http.send({"method": "get", "url": "https://127.0.0.1:65360", "tls_ca_cert_env_variable": "CLIENT_CA_ENV", "tls_client_cert_env_variable": "CLIENT_CERT_ENV", "tls_client_key_env_variable": "CLIENT_KEY_ENV"})`` | | Unix Socket URL Format| ``http.send({"method": "get", "url": "unix://localhost/?socket=%F2path%F2file.socket"})`` | -### Net - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``net.lookup_ip_addr(name)`` | `output` is a set of IP addresses (both v4 and v6, strings) that the domain name resolves to using standard name resolution, [see the notes below](#notes-on-name-resolution-netlookup_ip_addr). | ``SDK-dependent`` | -| ``net.cidr_contains(cidr, cidr_or_ip)`` | `output` is `true` if `cidr_or_ip` (e.g. `127.0.0.64/26` or `127.0.0.1`) is contained within `cidr` (e.g. `127.0.0.1/24`) and false otherwise. Supports both IPv4 and IPv6 notations.| ✅ | -| ``output := net.cidr_contains_matches(cidrs, cidrs_or_ips)`` | `output` is a `set` of tuples identifying matches where `cidrs_or_ips` are contained within `cidrs`. This function is similar to `net.cidr_contains` except it allows callers to pass collections of CIDRs or IPs as arguments and returns the matches (as opposed to a boolean result indicating a match between two CIDRs/IPs.) See below for examples. | ``SDK-dependent`` | -| ``net.cidr_intersects(cidr1, cidr2)`` | `output` is `true` if `cidr1` (e.g. `192.168.0.0/16`) overlaps with `cidr2` (e.g. `192.168.1.0/24`) and false otherwise. Supports both IPv4 and IPv6 notations.| ✅ | -| ``net.cidr_expand(cidr)`` | `output` is the set of hosts in `cidr` (e.g., `net.cidr_expand("192.168.0.0/30")` generates 4 hosts: `{"192.168.0.0", "192.168.0.1", "192.168.0.2", "192.168.0.3"}` | ``SDK-dependent`` | -| ``net.cidr_merge(cidrs_or_ips)`` | `output` is the smallest possible set of CIDRs obtained after merging the provided list of IP addresses and subnets in `cidrs_or_ips` (e.g., `net.cidr_merge(["192.0.128.0/24", "192.0.129.0/24"])` generates `{"192.0.128.0/23"}`. This function merges adjacent subnets where possible, those contained within others and also removes any duplicates. Supports both IPv4 and IPv6 notations. IPv6 inputs need a prefix length (e.g. "/128"). | ``SDK-dependent`` | +{{< builtin-table net >}} #### Notes on Name Resolution (`net.lookup_ip_addr`) @@ -1079,26 +868,10 @@ net.cidr_contains_matches({["1.1.0.0/16", "foo"], "1.1.2.0/24"}, {"x": "1.1.1.12 ```live:netcidrcontainsmatches/sets_and_objects:output:merge_down ``` -### UUID +{{< builtin-table cat=uuid title=UUID >}} +{{< builtin-table cat=semver title="Semantic Versions" >}} -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := uuid.rfc4122(str)`` | ``output`` is ``string`` representing a version 4 uuid. For any given str the output will be consistent throughout a query evaluation. | ``SDK-dependent`` | - -### Semantic Versions - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := semver.is_valid(str)`` | ``output`` is a ``boolean``. ``true`` means the input is a valid SemVer string (e.g. "1.0.0"). ``false`` is returned for invalid version strings and non-string input. | ``SDK-dependent`` | -| ``output := semver.compare(str, str)`` | ``output`` is a ``number``. ``-1`` means the version in the first operand is less than the second. ``1`` means the version in the first operand is greater than the second. ``0`` means the versions are equal. Only valid SemVer strings are accepted e.g. ``1.2.3`` or ``0.1.0`` | ``SDK-dependent`` | - -### Rego - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := rego.parse_module(filename, string)`` | ``rego.parse_module`` parses the input ``string`` as a Rego module and returns the AST as a JSON object ``output``. | ``SDK-dependent`` | -| ``output := rego.metadata.chain()`` | Each entry in the ``output`` array represents a node in the path ancestry (chain) of the active rule that also has declared [annotations](../annotations).``output`` is ordered starting at the active rule, going outward to the most distant node in its package ancestry. A chain entry is a JSON document with two members: ``path``, an array representing the path of the node; and ``annotations``, a JSON document containing the annotations declared for the node. The first entry in the chain always points to the active rule, even if it has no declared annotations (in which case the ``annotations`` member is not present). | ✅ | -| ``output := rego.metadata.rule()`` | Returns a JSON object ``output`` containing the set of [annotations](../annotations) declared for the active rule and using the `rule` [scope](../annotations#scope). If no annotations are declared, an empty object is returned. | ✅ | +{{< builtin-table rego >}} #### Example @@ -1220,17 +993,18 @@ merge_annot(chain, name) = val { } else = null ``` -### OPA +{{< builtin-table cat=opa title=OPA >}} -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``output := opa.runtime()`` | ``opa.runtime`` returns a JSON object ``output`` that describes the runtime environment where OPA is deployed. **Caution**: Policies that depend on the output of ``opa.runtime`` may return different answers depending on how OPA was started. If possible, prefer using an explicit `input` or `data` value instead of `opa.runtime`. The ``output`` of ``opa.runtime`` will include a ``"config"`` key if OPA was started with a configuration file. The ``output`` of ``opa.runtime`` will include a ``"env"`` key containing the environment variables that the OPA process was started with. The ``output`` of ``opa.runtime`` will include ``"version"`` and ``"commit"`` keys containing the semantic version and build commit of OPA. | ``SDK-dependent`` | +{{< danger >}} +Policies that depend on the output of `opa.runtime` may return different answers depending on how OPA was started. +If possible, prefer using an explicit `input` or `data` value instead of `opa.runtime`. +{{< /danger >}} ### Debugging -| Built-in | Description | Wasm Support | +| Built-in | Description | Details | | ------- |-------------|---------------| -| ``print(...)`` | ``print`` is used to output the values of variables for debugging purposes. ``print`` calls have no affect on the result of queries or rules. All variables passed to `print` must be assigned inside of the query or rule. If any of the `print` arguments are undefined, their values are represented as `` in the output stream. Because policies can be invoked via different interfaces (e.g., CLI, HTTP API, etc.) the exact output format differs. See the table below for details. | ``SDK-dependent`` | +| ``print(...)`` | ``print`` is used to output the values of variables for debugging purposes. ``print`` calls have no affect on the result of queries or rules. All variables passed to `print` must be assigned inside of the query or rule. If any of the `print` arguments are undefined, their values are represented as `` in the output stream. Because policies can be invoked via different interfaces (e.g., CLI, HTTP API, etc.) the exact output format differs. See the table below for details. | {{< builtin-tags internal.print >}} | API | Output | Memo --- | --- | --- @@ -1240,11 +1014,7 @@ API | Output | Memo `opa run -s` (server) | `stderr` | Specify `--log-level=info` (default) or higher. Output is sent to the log stream. Use `--log-format=text` for pretty output. Go (library) | `io.Writer` | [https://pkg.go.dev/github.com/open-policy-agent/opa/rego#example-Rego-Print_statements](https://pkg.go.dev/github.com/open-policy-agent/opa/rego#example-Rego-Print_statements) -### Tracing - -| Built-in | Description | Wasm Support | -| ------- |-------------|---------------| -| ``trace(string)`` | ``trace`` emits ``string`` as a ``Note`` event in the query explanation. Query explanations show the exact expressions evaluated by OPA during policy execution. For example, ``trace("Hello There!")`` includes ``Note "Hello There!"`` in the query explanation. To include variables in the message, use ``sprintf``. For example, ``person := "Bob"; trace(sprintf("Hello There! %v", [person]))`` will emit ``Note "Hello There! Bob"`` inside of the explanation. | ``SDK-dependent`` | +{{< builtin-table tracing >}} By default, explanations are disabled. The following table summarizes how you can enable tracing: diff --git a/docs/website/.gitignore b/docs/website/.gitignore index 8344f3cb54..9b37253b89 100644 --- a/docs/website/.gitignore +++ b/docs/website/.gitignore @@ -4,4 +4,5 @@ resources/ # Documentation versions generated/* -data/releases.yaml \ No newline at end of file +data/releases.yaml +data/builtin_metadata.json \ No newline at end of file diff --git a/docs/website/assets/sass/custom.sass b/docs/website/assets/sass/custom.sass index 278dc62f21..558c9ff323 100644 --- a/docs/website/assets/sass/custom.sass +++ b/docs/website/assets/sass/custom.sass @@ -65,3 +65,23 @@ +touch width: 100% + +div.bi-args + display: grid + grid-template-columns: min-content min-content auto + margin-bottom: 1rem + + .name + grid-column-start: 1 + + .type + grid-column-start: 2 + white-space: nowrap + + .desc + grid-column-start: 3 + margin-left: 1rem + +table.bi-cat + code + white-space: nowrap \ No newline at end of file diff --git a/docs/website/layouts/shortcodes/builtin-table.html b/docs/website/layouts/shortcodes/builtin-table.html new file mode 100644 index 0000000000..5598da3ce1 --- /dev/null +++ b/docs/website/layouts/shortcodes/builtin-table.html @@ -0,0 +1,100 @@ + +{{- $cat := .Get 0 }} +{{ if .IsNamedParams }}{{- $cat = .Get "cat" }}{{- end }} +{{- $id := $cat }} +{{- $title := $cat }} +{{- if .Get "id" }}{{ $id = .Get "id" }}{{ end }} +{{- if .Get "title" }}{{ $title = .Get "title" }}{{ end }} + +{{- $version := index (split $.Page.File.Path "/") 1 -}} +{{- if (eq $version "latest") -}} +{{- $version = index site.Data.releases 1 -}} +{{- end -}} + +

{{ $title | title }}

+ + + {{- range $name := index site.Data.builtin_metadata._categories $cat }} + {{- $anchor := anchorize (printf "builtin-%s-%s" $cat $name) }} + {{- $bi := index site.Data.builtin_metadata $name }} + {{- if in $bi.available $version }} + + + + + + {{- end }} + {{- end }} + +
+ + {{- if isset $bi "infix" }} + + {{ index (index $bi.args 0) "name" }} {{ $bi.infix }} {{ index (index $bi.args 1) "name" }} + + {{- else }} + {{ $name }} + {{- end }} + + +

+ {{- if isset $bi "infix" }} + + {{ $bi.result.name }} := {{ index (index $bi.args 0) "name" }} {{ $bi.infix }} {{ index (index $bi.args 1) "name" }} + + {{- else if isset $bi "relation" }} + + {{ $name }}( + {{- range $index, $element := $bi.args -}} + {{- if gt $index 0 -}}, {{ end -}} + {{- $element.name -}} + {{- end -}} + , {{ $bi.result.name -}} + ) + + {{- else }} + + {{ $bi.result.name }} := {{ $name }}( + {{- range $index, $element := $bi.args -}} + {{- if gt $index 0 -}}, {{ end -}} + {{- $element.name -}} + {{- end -}} + ) + + {{- end }} +

+

{{ $bi.description | markdownify }}

+ +
+ {{- range $element := $bi.args }} +
{{ $element.name }}
+
({{ $element.type }})
+
{{ $element.description | markdownify }}
+ {{- end }} +
+ + Returns: +
+
{{ $bi.result.name }}
+
({{ $bi.result.type }})
+
{{ $bi.result.description | markdownify }}
+ +
+
+ {{- if eq $bi.introduced $version }} + New + {{- end }} + {{- if and (ne $bi.introduced "v0.17.0") (ne $bi.introduced "edge") }} + + {{ $bi.introduced }} + + {{- else if eq $bi.introduced "edge" }} + {{ $bi.introduced }} + {{- end }} + {{- if index $bi "wasm" -}} + Wasm + {{- else -}} + SDK-dependent + {{- end -}} +
+
\ No newline at end of file diff --git a/docs/website/layouts/shortcodes/builtin-tags.html b/docs/website/layouts/shortcodes/builtin-tags.html new file mode 100644 index 0000000000..95ff727c58 --- /dev/null +++ b/docs/website/layouts/shortcodes/builtin-tags.html @@ -0,0 +1,25 @@ +{{- $name := .Get 0 -}} +{{- $metadata := index site.Data.builtin_metadata $name }} + +{{- $version := index (split $.Page.File.Path "/") 1 -}} +{{- if (eq $version "latest") -}} +{{- $version = index site.Data.releases 1 -}} +{{- end -}} + +
+ {{- if eq $metadata.introduced $version }} + New + {{- end }} + {{- if and (ne $metadata.introduced "v0.17.0") (ne $metadata.introduced "edge") }} + + {{ $metadata.introduced }} + + {{- else if eq $metadata.introduced "edge" }} + {{ $metadata.introduced }} + {{- end }} + {{- if index $metadata "wasm" -}} + Wasm + {{- else -}} + SDK-dependent + {{- end -}} +
\ No newline at end of file diff --git a/internal/cmd/genbuiltinmetadata/main.go b/internal/cmd/genbuiltinmetadata/main.go new file mode 100644 index 0000000000..26b56241a5 --- /dev/null +++ b/internal/cmd/genbuiltinmetadata/main.go @@ -0,0 +1,158 @@ +// Copyright 2022 The OPA Authors. All rights reserved. +// Use of this source code is governed by an Apache2 +// license that can be found in the LICENSE file. + +package main + +import ( + "encoding/json" + "log" + "os" + "strings" + + "github.com/open-policy-agent/opa/ast" + "github.com/open-policy-agent/opa/internal/compiler/wasm" + "github.com/open-policy-agent/opa/types" +) + +func main() { + f := ast.CapabilitiesForThisVersion() + sorted := append(sortedCaps(), versionedCaps{version: "edge", caps: f}) + + mdata := make(map[string]interface{}) + categories := make(map[string][]string) + + for _, bi := range f.Builtins { + latest := getLatest(bi.Name, sorted) + for _, cat := range builtinCategories(latest) { + categories[cat] = append(categories[cat], bi.Name) + } + + argTypes := make([]map[string]interface{}, len(latest.Decl.FuncArgs().Args)) + + for i, typ := range latest.Decl.NamedFuncArgs().Args { + if n, ok := typ.(*types.NamedType); ok { + argTypes[i] = map[string]interface{}{ + "name": n.Name, + "description": n.Descr, + "type": n.Type.String(), + } + } else { + argTypes[i] = map[string]interface{}{ + "type": typ.String(), + } + } + } + res := map[string]interface{}{} + resType := latest.Decl.NamedResult() + if n, ok := resType.(*types.NamedType); ok { + res["name"] = n.Name + if n.Descr != "" { + res["description"] = n.Descr + } + res["type"] = n.Type.String() + } else if resType != nil { + res["type"] = resType.String() + } + versions := getVersions(bi.Name, sorted) + md := map[string]interface{}{ + "introduced": versions[0], + "available": versions, + "wasm": getWasm(bi.Name), + "args": argTypes, + "result": res, + } + if latest.Relation { + md["relation"] = true + } + if latest.Infix != "" { + md["infix"] = latest.Infix + } + if latest.Description != "" { + md["description"] = latest.Description + } + mdata[bi.Name] = md + } + + mdata["_categories"] = categories + + md, err := os.Create(os.Args[1]) // metadata + if err != nil { + panic(err) + } + + enc := json.NewEncoder(md) + enc.SetIndent("", " ") + + if err := enc.Encode(mdata); err != nil { + panic(err) + } + + if err := md.Close(); err != nil { + panic(err) + } +} + +func getVersions(bi string, sorted []versionedCaps) []string { + vers := []string{} + for i := range sorted { + for j := range sorted[i].caps.Builtins { + if sorted[i].caps.Builtins[j].Name == bi { + vers = append(vers, sorted[i].version) + } + } + } + return vers +} + +func getLatest(bi string, sorted []versionedCaps) *ast.Builtin { + for i := len(sorted) - 1; i >= 0; i++ { + for j := range sorted[i].caps.Builtins { + if sorted[i].caps.Builtins[j].Name == bi { + return sorted[i].caps.Builtins[j] + } + } + } + panic("unreachable") +} + +func getWasm(bi string) bool { + return wasm.IsWasmEnabled(bi) +} + +type versionedCaps struct { + version string + caps *ast.Capabilities +} + +func sortedCaps() []versionedCaps { + vers, err := ast.LoadCapabilitiesVersions() + if err != nil { + panic(err) + } + sorted := make([]versionedCaps, len(vers)) + for i, v := range vers { + caps, err := ast.LoadCapabilitiesVersion(v) + if err != nil { + panic(err) + } + sorted[i] = versionedCaps{ + version: v, + caps: caps, + } + } + return sorted +} + +func builtinCategories(b *ast.Builtin) []string { + if len(b.Categories) > 0 { + return b.Categories + } + if s := strings.Split(b.Name, "."); len(s) > 1 { + return []string{s[0]} + } + if !b.IsDeprecated() { + log.Printf("WARN: not categorized: %s", b.Name) + } + return nil +} diff --git a/internal/cmd/genopacapabilities/main.go b/internal/cmd/genopacapabilities/main.go index a6afd217f8..3d52cb4a5a 100644 --- a/internal/cmd/genopacapabilities/main.go +++ b/internal/cmd/genopacapabilities/main.go @@ -9,10 +9,10 @@ import ( "os" "github.com/open-policy-agent/opa/ast" + "github.com/open-policy-agent/opa/types" ) func main() { - f := ast.CapabilitiesForThisVersion() fd, err := os.Create(os.Args[1]) @@ -23,6 +23,18 @@ func main() { enc := json.NewEncoder(fd) enc.SetIndent("", " ") + for i, bi := range f.Builtins { + // NOTE(sr): This ensures that there are no type names and descriptions in capabilities.json + fargs := bi.Decl.FuncArgs() + if fargs.Variadic != nil { + f.Builtins[i].Decl = types.NewVariadicFunction(fargs.Args, fargs.Variadic, bi.Decl.Result()) + } else { + f.Builtins[i].Decl = types.NewFunction(fargs.Args, bi.Decl.Result()) + } + f.Builtins[i].Categories = nil + f.Builtins[i].Description = "" + } + if err := enc.Encode(f); err != nil { panic(err) } diff --git a/internal/compiler/wasm/wasm.go b/internal/compiler/wasm/wasm.go index c6f2cecb90..07d5429396 100644 --- a/internal/compiler/wasm/wasm.go +++ b/internal/compiler/wasm/wasm.go @@ -184,6 +184,11 @@ var builtinsUsingRE2 = [...]string{ builtinsFunctions[ast.GlobMatch.Name], } +func IsWasmEnabled(bi string) bool { + _, ok := builtinsFunctions[bi] + return ok +} + type externalFunc struct { ID int32 Decl *opatypes.Function diff --git a/internal/presentation/presentation_test.go b/internal/presentation/presentation_test.go index c28832a8c4..1acbd7f1b3 100644 --- a/internal/presentation/presentation_test.go +++ b/internal/presentation/presentation_test.go @@ -14,13 +14,12 @@ import ( "strings" "testing" - "github.com/open-policy-agent/opa/util" - "github.com/open-policy-agent/opa/ast" "github.com/open-policy-agent/opa/loader" "github.com/open-policy-agent/opa/rego" "github.com/open-policy-agent/opa/storage" "github.com/open-policy-agent/opa/storage/inmem" + "github.com/open-policy-agent/opa/util" "github.com/open-policy-agent/opa/util/test" ) @@ -198,6 +197,8 @@ func TestOutputJSONErrorStructuredAstErr(t *testing.T) { "want": { "args": [ { + "description": "the set/array/object/string to be counted", + "name": "collection", "of": [ { "type": "string" @@ -229,6 +230,8 @@ func TestOutputJSONErrorStructuredAstErr(t *testing.T) { "type": "any" }, { + "description": "the count of elements, key/val pairs, or characters, respectively.", + "name": "n", "type": "number" } ] diff --git a/main.go b/main.go index a96fd0e881..5bf80fe4cb 100644 --- a/main.go +++ b/main.go @@ -18,8 +18,9 @@ func main() { } } -// Capabilities file generation: +// Capabilities + built-in metadata file generation: //go:generate build/gen-run-go.sh internal/cmd/genopacapabilities/main.go capabilities.json +//go:generate build/gen-run-go.sh internal/cmd/genbuiltinmetadata/main.go builtin_metadata.json // WASM base binary generation: //go:generate build/gen-run-go.sh internal/cmd/genopawasm/main.go -o internal/compiler/wasm/opa/opa.go internal/compiler/wasm/opa/opa.wasm internal/compiler/wasm/opa/callgraph.csv diff --git a/types/types.go b/types/types.go index 9b5cc66c45..cd7138245c 100644 --- a/types/types.go +++ b/types/types.go @@ -48,6 +48,42 @@ func NewNull() Null { return Null{} } +type NamedType struct { + Name, Descr string + Type Type +} + +func (n *NamedType) typeMarker() string { return n.Type.typeMarker() } +func (n *NamedType) String() string { return n.Name + ": " + n.Type.String() } +func (n *NamedType) MarshalJSON() ([]byte, error) { + var obj map[string]interface{} + switch x := n.Type.(type) { + case interface{ toMap() map[string]interface{} }: + obj = x.toMap() + default: + obj = map[string]interface{}{ + "type": n.Type.typeMarker(), + } + } + obj["name"] = n.Name + if n.Descr != "" { + obj["description"] = n.Descr + } + return json.Marshal(obj) +} + +func (n *NamedType) Description(d string) *NamedType { + n.Descr = d + return n +} + +func Named(name string, t Type) *NamedType { + return &NamedType{ + Type: t, + Name: name, + } +} + // MarshalJSON returns the JSON encoding of t. func (t Null) MarshalJSON() ([]byte, error) { return json.Marshal(map[string]interface{}{ @@ -55,6 +91,15 @@ func (t Null) MarshalJSON() ([]byte, error) { }) } +func unwrap(t Type) Type { + switch t := t.(type) { + case *NamedType: + return t.Type + default: + return t + } +} + func (t Null) String() string { return typeNull } @@ -100,7 +145,7 @@ func (t String) MarshalJSON() ([]byte, error) { }) } -func (t String) String() string { +func (String) String() string { return typeString } @@ -142,6 +187,10 @@ func NewArray(static []Type, dynamic Type) *Array { // MarshalJSON returns the JSON encoding of t. func (t *Array) MarshalJSON() ([]byte, error) { + return json.Marshal(t.toMap()) +} + +func (t *Array) toMap() map[string]interface{} { repr := map[string]interface{}{ "type": t.typeMarker(), } @@ -151,7 +200,7 @@ func (t *Array) MarshalJSON() ([]byte, error) { if t.dynamic != nil { repr["dynamic"] = t.dynamic } - return json.Marshal(repr) + return repr } func (t *Array) String() string { @@ -207,13 +256,17 @@ func NewSet(of Type) *Set { // MarshalJSON returns the JSON encoding of t. func (t *Set) MarshalJSON() ([]byte, error) { + return json.Marshal(t.toMap()) +} + +func (t *Set) toMap() map[string]interface{} { repr := map[string]interface{}{ "type": t.typeMarker(), } if t.of != nil { repr["of"] = t.of } - return json.Marshal(repr) + return repr } func (t *Set) String() string { @@ -332,6 +385,10 @@ func (t *Object) Keys() []interface{} { // MarshalJSON returns the JSON encoding of t. func (t *Object) MarshalJSON() ([]byte, error) { + return json.Marshal(t.toMap()) +} + +func (t *Object) toMap() map[string]interface{} { repr := map[string]interface{}{ "type": t.typeMarker(), } @@ -341,7 +398,7 @@ func (t *Object) MarshalJSON() ([]byte, error) { if t.dynamic != nil { repr["dynamic"] = t.dynamic } - return json.Marshal(repr) + return repr } // Select returns the type of the named property. @@ -395,13 +452,17 @@ func (t Any) Contains(other Type) bool { // MarshalJSON returns the JSON encoding of t. func (t Any) MarshalJSON() ([]byte, error) { - data := map[string]interface{}{ + return json.Marshal(t.toMap()) +} + +func (t Any) toMap() map[string]interface{} { + repr := map[string]interface{}{ "type": t.typeMarker(), } if len(t) != 0 { - data["of"] = []Type(t) + repr["of"] = []Type(t) } - return json.Marshal(data) + return repr } // Merge return a new Any type that is the superset of t and other. @@ -487,8 +548,7 @@ func Arity(x Type) int { return len(f.FuncArgs().Args) } -// NewFunction returns a new Function object where xs[:len(xs)-1] are arguments -// and xs[len(xs)-1] is the result type. +// NewFunction returns a new Function object of the given argument and result types. func NewFunction(args []Type, result Type) *Function { return &Function{ args: args, @@ -512,19 +572,34 @@ func NewVariadicFunction(args []Type, varargs Type, result Type) *Function { // FuncArgs returns the function's arguments. func (t *Function) FuncArgs() FuncArgs { - return FuncArgs{Args: t.Args(), Variadic: t.variadic} + return FuncArgs{Args: t.Args(), Variadic: unwrap(t.variadic)} +} + +// NamedFuncArgs returns the function's arguments, with a name and +// description if available. +func (t *Function) NamedFuncArgs() FuncArgs { + args := make([]Type, len(t.args)) + copy(args, t.args) + return FuncArgs{Args: args, Variadic: t.variadic} } // Args returns the function's arguments as a slice, ignoring variadic arguments. // Deprecated: Use FuncArgs instead. func (t *Function) Args() []Type { cpy := make([]Type, len(t.args)) - copy(cpy, t.args) + for i := range t.args { + cpy[i] = unwrap(t.args[i]) + } return cpy } // Result returns the function's result type. func (t *Function) Result() Type { + return unwrap(t.result) +} + +// Result returns the function's result type, without stripping name and description. +func (t *Function) NamedResult() Type { return t.result } @@ -566,12 +641,13 @@ func (t *Function) UnmarshalJSON(bs []byte) error { return nil } -// Union returns a new function represnting the union of t and other. Functions +// Union returns a new function representing the union of t and other. Functions // must have the same arity to be unioned. func (t *Function) Union(other *Function) *Function { if other == nil { return t - } else if t == nil { + } + if t == nil { return other } @@ -618,6 +694,7 @@ func (a FuncArgs) String() string { return "(" + strings.Join(buf, ", ") + ")" } +// Arg returns the nth argument's type. func (a FuncArgs) Arg(x int) Type { if x < len(a.Args) { return a.Args[x] @@ -627,6 +704,7 @@ func (a FuncArgs) Arg(x int) Type { // Compare returns -1, 0, 1 based on comparison between a and b. func Compare(a, b Type) int { + a, b = unwrap(a), unwrap(b) x := typeOrder(a) y := typeOrder(b) if x > y { @@ -731,7 +809,7 @@ func Compare(a, b Type) int { // Contains returns true if a is a superset or equal to b. func Contains(a, b Type) bool { - if any, ok := a.(Any); ok { + if any, ok := unwrap(a).(Any); ok { return any.Contains(b) } return Compare(a, b) == 0 @@ -740,6 +818,7 @@ func Contains(a, b Type) bool { // Or returns a type that represents the union of a and b. If one type is a // superset of the other, the superset is returned unchanged. func Or(a, b Type) Type { + a, b = unwrap(a), unwrap(b) if a == nil { return b } else if b == nil { @@ -768,7 +847,7 @@ func Or(a, b Type) Type { // Select returns a property or item of a. func Select(a Type, x interface{}) Type { - switch a := a.(type) { + switch a := unwrap(a).(type) { case *Array: n, ok := x.(json.Number) if !ok { @@ -811,7 +890,7 @@ func Select(a Type, x interface{}) Type { // keys are always number types, for objects the keys are always string types, // and for sets the keys are always the type of the set element. func Keys(a Type) Type { - switch a := a.(type) { + switch a := unwrap(a).(type) { case *Array: return N case *Object: @@ -841,7 +920,7 @@ func Keys(a Type) Type { // Values returns the type of values that can be enumerated for a. func Values(a Type) Type { - switch a := a.(type) { + switch a := unwrap(a).(type) { case *Array: var tpe Type for i := range a.static { @@ -874,7 +953,7 @@ func Values(a Type) Type { // Nil returns true if a's type is unknown. func Nil(a Type) bool { - switch a := a.(type) { + switch a := unwrap(a).(type) { case nil: return true case *Function: @@ -969,7 +1048,7 @@ func typeSliceCompare(a, b []Type) int { } func typeOrder(x Type) int { - switch x.(type) { + switch unwrap(x).(type) { case Null: return 0 case Boolean: