Page Not Found | Bento
-
+
diff --git a/CNAME b/CNAME
deleted file mode 100644
index 40282392c..000000000
--- a/CNAME
+++ /dev/null
@@ -1 +0,0 @@
-bento.dev
\ No newline at end of file
diff --git a/assets/js/b8cb9144.ce1d95d0.js b/assets/js/b8cb9144.cebe9f90.js
similarity index 76%
rename from assets/js/b8cb9144.ce1d95d0.js
rename to assets/js/b8cb9144.cebe9f90.js
index fdd889c72..4813db714 100644
--- a/assets/js/b8cb9144.ce1d95d0.js
+++ b/assets/js/b8cb9144.cebe9f90.js
@@ -1 +1 @@
-"use strict";(self.webpackChunkbento=self.webpackChunkbento||[]).push([[4561],{5968:function(e,n,s){s.r(n),s.d(n,{assets:function(){return o},contentTitle:function(){return t},default:function(){return h},frontMatter:function(){return i},metadata:function(){return l},toc:function(){return d}});var a=s(5893),r=s(1151);s(4866),s(5162);const i={title:"Bloblang Methods",sidebar_label:"Methods",description:"A list of Bloblang methods"},t=void 0,l={id:"guides/bloblang/methods",title:"Bloblang Methods",description:"A list of Bloblang methods",source:"@site/docs/guides/bloblang/methods.md",sourceDirName:"guides/bloblang",slug:"/guides/bloblang/methods",permalink:"/bento/docs/guides/bloblang/methods",draft:!1,unlisted:!1,editUrl:"https://github.com/warpstreamlabs/bento/edit/main/website/docs/guides/bloblang/methods.md",tags:[],version:"current",frontMatter:{title:"Bloblang Methods",sidebar_label:"Methods",description:"A list of Bloblang methods"},sidebar:"docs",previous:{title:"Functions",permalink:"/bento/docs/guides/bloblang/functions"},next:{title:"Arithmetic",permalink:"/bento/docs/guides/bloblang/arithmetic"}},o={},d=[{value:"General",id:"general",level:2},{value:"apply",id:"apply",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Examples",id:"examples",level:4},{value:"catch",id:"catch",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Examples",id:"examples-1",level:4},{value:"exists",id:"exists",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Examples",id:"examples-2",level:4},{value:"from",id:"from",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"from_all",id:"from_all",level:3},{value:"Examples",id:"examples-4",level:4},{value:"or",id:"or",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Examples",id:"examples-5",level:4},{value:"String Manipulation",id:"string-manipulation",level:2},{value:"capitalize",id:"capitalize",level:3},{value:"Examples",id:"examples-6",level:4},{value:"compare_argon2",id:"compare_argon2",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Examples",id:"examples-7",level:4},{value:"compare_bcrypt",id:"compare_bcrypt",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Examples",id:"examples-8",level:4},{value:"contains",id:"contains",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Examples",id:"examples-9",level:4},{value:"escape_html",id:"escape_html",level:3},{value:"Examples",id:"examples-10",level:4},{value:"escape_url_query",id:"escape_url_query",level:3},{value:"Examples",id:"examples-11",level:4},{value:"filepath_join",id:"filepath_join",level:3},{value:"Examples",id:"examples-12",level:4},{value:"filepath_split",id:"filepath_split",level:3},{value:"Examples",id:"examples-13",level:4},{value:"format",id:"format",level:3},{value:"Examples",id:"examples-14",level:4},{value:"has_prefix",id:"has_prefix",level:3},{value:"Parameters",id:"parameters-8",level:4},{value:"Examples",id:"examples-15",level:4},{value:"has_suffix",id:"has_suffix",level:3},{value:"Parameters",id:"parameters-9",level:4},{value:"Examples",id:"examples-16",level:4},{value:"index_of",id:"index_of",level:3},{value:"Parameters",id:"parameters-10",level:4},{value:"Examples",id:"examples-17",level:4},{value:"length",id:"length",level:3},{value:"Examples",id:"examples-18",level:4},{value:"lowercase",id:"lowercase",level:3},{value:"Examples",id:"examples-19",level:4},{value:"quote",id:"quote",level:3},{value:"Examples",id:"examples-20",level:4},{value:"replace_all",id:"replace_all",level:3},{value:"Parameters",id:"parameters-11",level:4},{value:"Examples",id:"examples-21",level:4},{value:"replace_all_many",id:"replace_all_many",level:3},{value:"Parameters",id:"parameters-12",level:4},{value:"Examples",id:"examples-22",level:4},{value:"reverse",id:"reverse",level:3},{value:"Examples",id:"examples-23",level:4},{value:"slice",id:"slice",level:3},{value:"Parameters",id:"parameters-13",level:4},{value:"Examples",id:"examples-24",level:4},{value:"slug",id:"slug",level:3},{value:"Parameters",id:"parameters-14",level:4},{value:"Examples",id:"examples-25",level:4},{value:"split",id:"split",level:3},{value:"Parameters",id:"parameters-15",level:4},{value:"Examples",id:"examples-26",level:4},{value:"strip_html",id:"strip_html",level:3},{value:"Parameters",id:"parameters-16",level:4},{value:"Examples",id:"examples-27",level:4},{value:"trim",id:"trim",level:3},{value:"Parameters",id:"parameters-17",level:4},{value:"Examples",id:"examples-28",level:4},{value:"trim_prefix",id:"trim_prefix",level:3},{value:"Parameters",id:"parameters-18",level:4},{value:"Examples",id:"examples-29",level:4},{value:"trim_suffix",id:"trim_suffix",level:3},{value:"Parameters",id:"parameters-19",level:4},{value:"Examples",id:"examples-30",level:4},{value:"unescape_html",id:"unescape_html",level:3},{value:"Examples",id:"examples-31",level:4},{value:"unescape_url_query",id:"unescape_url_query",level:3},{value:"Examples",id:"examples-32",level:4},{value:"unquote",id:"unquote",level:3},{value:"Examples",id:"examples-33",level:4},{value:"uppercase",id:"uppercase",level:3},{value:"Examples",id:"examples-34",level:4},{value:"Regular Expressions",id:"regular-expressions",level:2},{value:"re_find_all",id:"re_find_all",level:3},{value:"Parameters",id:"parameters-20",level:4},{value:"Examples",id:"examples-35",level:4},{value:"re_find_all_object",id:"re_find_all_object",level:3},{value:"Parameters",id:"parameters-21",level:4},{value:"Examples",id:"examples-36",level:4},{value:"re_find_all_submatch",id:"re_find_all_submatch",level:3},{value:"Parameters",id:"parameters-22",level:4},{value:"Examples",id:"examples-37",level:4},{value:"re_find_object",id:"re_find_object",level:3},{value:"Parameters",id:"parameters-23",level:4},{value:"Examples",id:"examples-38",level:4},{value:"re_match",id:"re_match",level:3},{value:"Parameters",id:"parameters-24",level:4},{value:"Examples",id:"examples-39",level:4},{value:"re_replace_all",id:"re_replace_all",level:3},{value:"Parameters",id:"parameters-25",level:4},{value:"Examples",id:"examples-40",level:4},{value:"Number Manipulation",id:"number-manipulation",level:2},{value:"abs",id:"abs",level:3},{value:"Examples",id:"examples-41",level:4},{value:"ceil",id:"ceil",level:3},{value:"Examples",id:"examples-42",level:4},{value:"float32",id:"float32",level:3},{value:"Examples",id:"examples-43",level:4},{value:"float64",id:"float64",level:3},{value:"Examples",id:"examples-44",level:4},{value:"floor",id:"floor",level:3},{value:"Examples",id:"examples-45",level:4},{value:"int16",id:"int16",level:3},{value:"Examples",id:"examples-46",level:4},{value:"int32",id:"int32",level:3},{value:"Examples",id:"examples-47",level:4},{value:"int64",id:"int64",level:3},{value:"Examples",id:"examples-48",level:4},{value:"int8",id:"int8",level:3},{value:"Examples",id:"examples-49",level:4},{value:"log",id:"log",level:3},{value:"Examples",id:"examples-50",level:4},{value:"log10",id:"log10",level:3},{value:"Examples",id:"examples-51",level:4},{value:"max",id:"max",level:3},{value:"Examples",id:"examples-52",level:4},{value:"min",id:"min",level:3},{value:"Examples",id:"examples-53",level:4},{value:"round",id:"round",level:3},{value:"Examples",id:"examples-54",level:4},{value:"uint16",id:"uint16",level:3},{value:"Examples",id:"examples-55",level:4},{value:"uint32",id:"uint32",level:3},{value:"Examples",id:"examples-56",level:4},{value:"uint64",id:"uint64",level:3},{value:"Examples",id:"examples-57",level:4},{value:"uint8",id:"uint8",level:3},{value:"Examples",id:"examples-58",level:4},{value:"Timestamp Manipulation",id:"timestamp-manipulation",level:2},{value:"parse_duration",id:"parse_duration",level:3},{value:"Examples",id:"examples-59",level:4},{value:"parse_duration_iso8601",id:"parse_duration_iso8601",level:3},{value:"Examples",id:"examples-60",level:4},{value:"ts_add_iso8601",id:"ts_add_iso8601",level:3},{value:"Parameters",id:"parameters-26",level:4},{value:"ts_format",id:"ts_format",level:3},{value:"Parameters",id:"parameters-27",level:4},{value:"Examples",id:"examples-61",level:4},{value:"ts_parse",id:"ts_parse",level:3},{value:"Parameters",id:"parameters-28",level:4},{value:"Examples",id:"examples-62",level:4},{value:"ts_round",id:"ts_round",level:3},{value:"Parameters",id:"parameters-29",level:4},{value:"Examples",id:"examples-63",level:4},{value:"ts_strftime",id:"ts_strftime",level:3},{value:"Parameters",id:"parameters-30",level:4},{value:"Examples",id:"examples-64",level:4},{value:"ts_strptime",id:"ts_strptime",level:3},{value:"Parameters",id:"parameters-31",level:4},{value:"Examples",id:"examples-65",level:4},{value:"ts_sub",id:"ts_sub",level:3},{value:"Parameters",id:"parameters-32",level:4},{value:"Examples",id:"examples-66",level:4},{value:"ts_sub_iso8601",id:"ts_sub_iso8601",level:3},{value:"Parameters",id:"parameters-33",level:4},{value:"ts_tz",id:"ts_tz",level:3},{value:"Parameters",id:"parameters-34",level:4},{value:"Examples",id:"examples-67",level:4},{value:"ts_unix",id:"ts_unix",level:3},{value:"Examples",id:"examples-68",level:4},{value:"ts_unix_micro",id:"ts_unix_micro",level:3},{value:"Examples",id:"examples-69",level:4},{value:"ts_unix_milli",id:"ts_unix_milli",level:3},{value:"Examples",id:"examples-70",level:4},{value:"ts_unix_nano",id:"ts_unix_nano",level:3},{value:"Examples",id:"examples-71",level:4},{value:"Type Coercion",id:"type-coercion",level:2},{value:"bool",id:"bool",level:3},{value:"Parameters",id:"parameters-35",level:4},{value:"Examples",id:"examples-72",level:4},{value:"bytes",id:"bytes",level:3},{value:"Examples",id:"examples-73",level:4},{value:"not_empty",id:"not_empty",level:3},{value:"Examples",id:"examples-74",level:4},{value:"not_null",id:"not_null",level:3},{value:"Examples",id:"examples-75",level:4},{value:"number",id:"number",level:3},{value:"Parameters",id:"parameters-36",level:4},{value:"Examples",id:"examples-76",level:4},{value:"string",id:"string",level:3},{value:"Examples",id:"examples-77",level:4},{value:"type",id:"type",level:3},{value:"Examples",id:"examples-78",level:4},{value:"Object & Array Manipulation",id:"object--array-manipulation",level:2},{value:"all",id:"all",level:3},{value:"Parameters",id:"parameters-37",level:4},{value:"Examples",id:"examples-79",level:4},{value:"any",id:"any",level:3},{value:"Parameters",id:"parameters-38",level:4},{value:"Examples",id:"examples-80",level:4},{value:"append",id:"append",level:3},{value:"Examples",id:"examples-81",level:4},{value:"assign",id:"assign",level:3},{value:"Parameters",id:"parameters-39",level:4},{value:"Examples",id:"examples-82",level:4},{value:"collapse",id:"collapse",level:3},{value:"Parameters",id:"parameters-40",level:4},{value:"Examples",id:"examples-83",level:4},{value:"concat",id:"concat",level:3},{value:"Examples",id:"examples-84",level:4},{value:"contains",id:"contains-1",level:3},{value:"Parameters",id:"parameters-41",level:4},{value:"Examples",id:"examples-85",level:4},{value:"diff",id:"diff",level:3},{value:"Parameters",id:"parameters-42",level:4},{value:"enumerated",id:"enumerated",level:3},{value:"Examples",id:"examples-86",level:4},{value:"explode",id:"explode",level:3},{value:"Parameters",id:"parameters-43",level:4},{value:"Examples",id:"examples-87",level:4},{value:"On arrays",id:"on-arrays",level:5},{value:"On objects",id:"on-objects",level:5},{value:"filter",id:"filter",level:3},{value:"Parameters",id:"parameters-44",level:4},{value:"Examples",id:"examples-88",level:4},{value:"On objects",id:"on-objects-1",level:5},{value:"find",id:"find",level:3},{value:"Parameters",id:"parameters-45",level:4},{value:"Examples",id:"examples-89",level:4},{value:"find_all",id:"find_all",level:3},{value:"Parameters",id:"parameters-46",level:4},{value:"Examples",id:"examples-90",level:4},{value:"find_all_by",id:"find_all_by",level:3},{value:"Parameters",id:"parameters-47",level:4},{value:"Examples",id:"examples-91",level:4},{value:"find_by",id:"find_by",level:3},{value:"Parameters",id:"parameters-48",level:4},{value:"Examples",id:"examples-92",level:4},{value:"flatten",id:"flatten",level:3},{value:"Examples",id:"examples-93",level:4},{value:"fold",id:"fold",level:3},{value:"Parameters",id:"parameters-49",level:4},{value:"Examples",id:"examples-94",level:4},{value:"get",id:"get",level:3},{value:"Parameters",id:"parameters-50",level:4},{value:"Examples",id:"examples-95",level:4},{value:"index",id:"index",level:3},{value:"Parameters",id:"parameters-51",level:4},{value:"Examples",id:"examples-96",level:4},{value:"join",id:"join",level:3},{value:"Parameters",id:"parameters-52",level:4},{value:"Examples",id:"examples-97",level:4},{value:"json_path",id:"json_path",level:3},{value:"Parameters",id:"parameters-53",level:4},{value:"Examples",id:"examples-98",level:4},{value:"json_schema",id:"json_schema",level:3},{value:"Parameters",id:"parameters-54",level:4},{value:"Examples",id:"examples-99",level:4},{value:"key_values",id:"key_values",level:3},{value:"Examples",id:"examples-100",level:4},{value:"keys",id:"keys",level:3},{value:"Examples",id:"examples-101",level:4},{value:"length",id:"length-1",level:3},{value:"Examples",id:"examples-102",level:4},{value:"map_each",id:"map_each",level:3},{value:"Parameters",id:"parameters-55",level:4},{value:"Examples",id:"examples-103",level:4},{value:"On arrays",id:"on-arrays-1",level:5},{value:"On objects",id:"on-objects-2",level:5},{value:"map_each_key",id:"map_each_key",level:3},{value:"Parameters",id:"parameters-56",level:4},{value:"Examples",id:"examples-104",level:4},{value:"merge",id:"merge",level:3},{value:"Parameters",id:"parameters-57",level:4},{value:"Examples",id:"examples-105",level:4},{value:"patch",id:"patch",level:3},{value:"Parameters",id:"parameters-58",level:4},{value:"slice",id:"slice-1",level:3},{value:"Parameters",id:"parameters-59",level:4},{value:"Examples",id:"examples-106",level:4},{value:"sort",id:"sort",level:3},{value:"Parameters",id:"parameters-60",level:4},{value:"Examples",id:"examples-107",level:4},{value:"sort_by",id:"sort_by",level:3},{value:"Parameters",id:"parameters-61",level:4},{value:"Examples",id:"examples-108",level:4},{value:"squash",id:"squash",level:3},{value:"Examples",id:"examples-109",level:4},{value:"sum",id:"sum",level:3},{value:"Examples",id:"examples-110",level:4},{value:"unique",id:"unique",level:3},{value:"Parameters",id:"parameters-62",level:4},{value:"Examples",id:"examples-111",level:4},{value:"values",id:"values",level:3},{value:"Examples",id:"examples-112",level:4},{value:"with",id:"with",level:3},{value:"Examples",id:"examples-113",level:4},{value:"without",id:"without",level:3},{value:"Examples",id:"examples-114",level:4},{value:"zip",id:"zip",level:3},{value:"Examples",id:"examples-115",level:4},{value:"Parsing",id:"parsing",level:2},{value:"bloblang",id:"bloblang",level:3},{value:"Parameters",id:"parameters-63",level:4},{value:"Examples",id:"examples-116",level:4},{value:"format_json",id:"format_json",level:3},{value:"Parameters",id:"parameters-64",level:4},{value:"Examples",id:"examples-117",level:4},{value:"format_msgpack",id:"format_msgpack",level:3},{value:"Examples",id:"examples-118",level:4},{value:"format_xml",id:"format_xml",level:3},{value:"Parameters",id:"parameters-65",level:4},{value:"Examples",id:"examples-119",level:4},{value:"format_yaml",id:"format_yaml",level:3},{value:"Examples",id:"examples-120",level:4},{value:"parse_csv",id:"parse_csv",level:3},{value:"Parameters",id:"parameters-66",level:4},{value:"Examples",id:"examples-121",level:4},{value:"parse_form_url_encoded",id:"parse_form_url_encoded",level:3},{value:"Examples",id:"examples-122",level:4},{value:"parse_json",id:"parse_json",level:3},{value:"Parameters",id:"parameters-67",level:4},{value:"Examples",id:"examples-123",level:4},{value:"parse_msgpack",id:"parse_msgpack",level:3},{value:"Examples",id:"examples-124",level:4},{value:"parse_parquet",id:"parse_parquet",level:3},{value:"Parameters",id:"parameters-68",level:4},{value:"Examples",id:"examples-125",level:4},{value:"parse_url",id:"parse_url",level:3},{value:"Examples",id:"examples-126",level:4},{value:"parse_xml",id:"parse_xml",level:3},{value:"Parameters",id:"parameters-69",level:4},{value:"Examples",id:"examples-127",level:4},{value:"parse_yaml",id:"parse_yaml",level:3},{value:"Examples",id:"examples-128",level:4},{value:"Encoding and Encryption",id:"encoding-and-encryption",level:2},{value:"compress",id:"compress",level:3},{value:"Parameters",id:"parameters-70",level:4},{value:"Examples",id:"examples-129",level:4},{value:"decode",id:"decode",level:3},{value:"Parameters",id:"parameters-71",level:4},{value:"Examples",id:"examples-130",level:4},{value:"decompress",id:"decompress",level:3},{value:"Parameters",id:"parameters-72",level:4},{value:"Examples",id:"examples-131",level:4},{value:"decrypt_aes",id:"decrypt_aes",level:3},{value:"Parameters",id:"parameters-73",level:4},{value:"Examples",id:"examples-132",level:4},{value:"encode",id:"encode",level:3},{value:"Parameters",id:"parameters-74",level:4},{value:"Examples",id:"examples-133",level:4},{value:"encrypt_aes",id:"encrypt_aes",level:3},{value:"Parameters",id:"parameters-75",level:4},{value:"Examples",id:"examples-134",level:4},{value:"hash",id:"hash",level:3},{value:"Parameters",id:"parameters-76",level:4},{value:"Examples",id:"examples-135",level:4},{value:"JSON Web Tokens",id:"json-web-tokens",level:2},{value:"parse_jwt_es256",id:"parse_jwt_es256",level:3},{value:"Parameters",id:"parameters-77",level:4},{value:"Examples",id:"examples-136",level:4},{value:"parse_jwt_es384",id:"parse_jwt_es384",level:3},{value:"Parameters",id:"parameters-78",level:4},{value:"Examples",id:"examples-137",level:4},{value:"parse_jwt_es512",id:"parse_jwt_es512",level:3},{value:"Parameters",id:"parameters-79",level:4},{value:"Examples",id:"examples-138",level:4},{value:"parse_jwt_hs256",id:"parse_jwt_hs256",level:3},{value:"Parameters",id:"parameters-80",level:4},{value:"Examples",id:"examples-139",level:4},{value:"parse_jwt_hs384",id:"parse_jwt_hs384",level:3},{value:"Parameters",id:"parameters-81",level:4},{value:"Examples",id:"examples-140",level:4},{value:"parse_jwt_hs512",id:"parse_jwt_hs512",level:3},{value:"Parameters",id:"parameters-82",level:4},{value:"Examples",id:"examples-141",level:4},{value:"parse_jwt_rs256",id:"parse_jwt_rs256",level:3},{value:"Parameters",id:"parameters-83",level:4},{value:"Examples",id:"examples-142",level:4},{value:"parse_jwt_rs384",id:"parse_jwt_rs384",level:3},{value:"Parameters",id:"parameters-84",level:4},{value:"Examples",id:"examples-143",level:4},{value:"parse_jwt_rs512",id:"parse_jwt_rs512",level:3},{value:"Parameters",id:"parameters-85",level:4},{value:"Examples",id:"examples-144",level:4},{value:"sign_jwt_es256",id:"sign_jwt_es256",level:3},{value:"Parameters",id:"parameters-86",level:4},{value:"Examples",id:"examples-145",level:4},{value:"sign_jwt_es384",id:"sign_jwt_es384",level:3},{value:"Parameters",id:"parameters-87",level:4},{value:"Examples",id:"examples-146",level:4},{value:"sign_jwt_es512",id:"sign_jwt_es512",level:3},{value:"Parameters",id:"parameters-88",level:4},{value:"Examples",id:"examples-147",level:4},{value:"sign_jwt_hs256",id:"sign_jwt_hs256",level:3},{value:"Parameters",id:"parameters-89",level:4},{value:"Examples",id:"examples-148",level:4},{value:"sign_jwt_hs384",id:"sign_jwt_hs384",level:3},{value:"Parameters",id:"parameters-90",level:4},{value:"Examples",id:"examples-149",level:4},{value:"sign_jwt_hs512",id:"sign_jwt_hs512",level:3},{value:"Parameters",id:"parameters-91",level:4},{value:"Examples",id:"examples-150",level:4},{value:"sign_jwt_rs256",id:"sign_jwt_rs256",level:3},{value:"Parameters",id:"parameters-92",level:4},{value:"Examples",id:"examples-151",level:4},{value:"sign_jwt_rs384",id:"sign_jwt_rs384",level:3},{value:"Parameters",id:"parameters-93",level:4},{value:"Examples",id:"examples-152",level:4},{value:"sign_jwt_rs512",id:"sign_jwt_rs512",level:3},{value:"Parameters",id:"parameters-94",level:4},{value:"Examples",id:"examples-153",level:4},{value:"GeoIP",id:"geoip",level:2},{value:"geoip_anonymous_ip",id:"geoip_anonymous_ip",level:3},{value:"Parameters",id:"parameters-95",level:4},{value:"geoip_asn",id:"geoip_asn",level:3},{value:"Parameters",id:"parameters-96",level:4},{value:"geoip_city",id:"geoip_city",level:3},{value:"Parameters",id:"parameters-97",level:4},{value:"geoip_connection_type",id:"geoip_connection_type",level:3},{value:"Parameters",id:"parameters-98",level:4},{value:"geoip_country",id:"geoip_country",level:3},{value:"Parameters",id:"parameters-99",level:4},{value:"geoip_domain",id:"geoip_domain",level:3},{value:"Parameters",id:"parameters-100",level:4},{value:"geoip_enterprise",id:"geoip_enterprise",level:3},{value:"Parameters",id:"parameters-101",level:4},{value:"geoip_isp",id:"geoip_isp",level:3},{value:"Parameters",id:"parameters-102",level:4},{value:"Deprecated",id:"deprecated",level:2},{value:"format_timestamp",id:"format_timestamp",level:3},{value:"Parameters",id:"parameters-103",level:4},{value:"format_timestamp_strftime",id:"format_timestamp_strftime",level:3},{value:"Parameters",id:"parameters-104",level:4},{value:"format_timestamp_unix",id:"format_timestamp_unix",level:3},{value:"format_timestamp_unix_micro",id:"format_timestamp_unix_micro",level:3},{value:"format_timestamp_unix_milli",id:"format_timestamp_unix_milli",level:3},{value:"format_timestamp_unix_nano",id:"format_timestamp_unix_nano",level:3},{value:"parse_timestamp",id:"parse_timestamp",level:3},{value:"Parameters",id:"parameters-105",level:4},{value:"parse_timestamp_strptime",id:"parse_timestamp_strptime",level:3},{value:"Parameters",id:"parameters-106",level:4}];function c(e){const n={a:"a",admonition:"admonition",br:"br",code:"code",h2:"h2",h3:"h3",h4:"h4",h5:"h5",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.p,{children:"Methods provide most of the power in Bloblang as they allow you to augment values and can be added to any expression (including other methods):"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc.id = this.thing.id.string().catch(uuid_v4())\nroot.doc.reduced_nums = this.thing.nums.map_each(num -> if num < 10 {\n deleted()\n} else {\n num - 10\n})\nroot.has_good_taste = ["pikachu","mewtwo","magmar"].contains(this.user.fav_pokemon)\n'})}),"\n",(0,a.jsx)(n.p,{children:"Methods support both named and nameless style arguments:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_one = this.(bar | baz).trim().replace_all(old: "dog", new: "cat")\nroot.foo_two = this.(bar | baz).trim().replace_all("dog", "cat")\n'})}),"\n",(0,a.jsx)(n.h2,{id:"general",children:"General"}),"\n",(0,a.jsx)(n.h3,{id:"apply",children:(0,a.jsx)(n.code,{children:"apply"})}),"\n",(0,a.jsx)(n.p,{children:"Apply a declared mapping to a target value."}),"\n",(0,a.jsx)(n.h4,{id:"parameters",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"mapping"})})," The mapping to apply."]}),"\n",(0,a.jsx)(n.h4,{id:"examples",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'map thing {\n root.inner = this.first\n}\n\nroot.foo = this.doc.apply("thing")\n\n# In: {"doc":{"first":"hello world"}}\n# Out: {"foo":{"inner":"hello world"}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'map create_foo {\n root.name = "a foo"\n root.purpose = "to be a foo"\n}\n\nroot = this\nroot.foo = null.apply("create_foo")\n\n# In: {"id":"1234"}\n# Out: {"foo":{"name":"a foo","purpose":"to be a foo"},"id":"1234"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"catch",children:(0,a.jsx)(n.code,{children:"catch"})}),"\n",(0,a.jsx)(n.p,{children:"If the result of a target query fails (due to incorrect types, failed parsing, etc) the argument is returned instead."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"fallback"})})," A value to yield, or query to execute, if the target query fails."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-1",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root.doc.id = this.thing.id.string().catch(uuid_v4())\n"})}),"\n",(0,a.jsx)(n.p,{children:"The fallback argument can be a mapping, allowing you to capture the error string and yield structured data back."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.url = this.url.parse_url().catch(err -> {"error":err,"input":this.url})\n\n# In: {"url":"invalid % url"}\n# Out: {"url":{"error":"field `this.url`: parse \\"invalid %&\\": invalid URL escape \\"%&\\"","input":"invalid % url"}}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["When the input document is not structured attempting to reference structured fields with ",(0,a.jsx)(n.code,{children:"this"})," will result in an error. Therefore, a convenient way to delete non-structured data is with a catch."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.catch(deleted())\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {"doc":{"foo":"bar"}}\n\n# In: not structured data\n# Out: \n'})}),"\n",(0,a.jsx)(n.h3,{id:"exists",children:(0,a.jsx)(n.code,{children:"exists"})}),"\n",(0,a.jsxs)(n.p,{children:["Checks that a field, identified via a ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"dot path"}),", exists in an object."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-2",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"dot path"})," to a field."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-2",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.foo.exists("bar.baz")\n\n# In: {"foo":{"bar":{"baz":"yep, I exist"}}}\n# Out: {"result":true}\n\n# In: {"foo":{"bar":{}}}\n# Out: {"result":false}\n\n# In: {"foo":{}}\n# Out: {"result":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"from",children:(0,a.jsx)(n.code,{children:"from"})}),"\n",(0,a.jsxs)(n.p,{children:["Modifies a target query such that certain functions are executed from the perspective of another message in the batch. This allows you to mutate events based on the contents of other messages. Functions that support this behaviour are ",(0,a.jsx)(n.code,{children:"content"}),", ",(0,a.jsx)(n.code,{children:"json"})," and ",(0,a.jsx)(n.code,{children:"meta"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-3",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"index"})})," The message index to use as a perspective."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-3",children:"Examples"}),"\n",(0,a.jsxs)(n.p,{children:["For example, the following map extracts the contents of the JSON field ",(0,a.jsx)(n.code,{children:"foo"})," specifically from message index ",(0,a.jsx)(n.code,{children:"1"})," of a batch, effectively overriding the field ",(0,a.jsx)(n.code,{children:"foo"})," for all messages of a batch to that of message 1:"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this\nroot.foo = json("foo").from(1)\n'})}),"\n",(0,a.jsx)(n.h3,{id:"from_all",children:(0,a.jsx)(n.code,{children:"from_all"})}),"\n",(0,a.jsxs)(n.p,{children:["Modifies a target query such that certain functions are executed from the perspective of each message in the batch, and returns the set of results as an array. Functions that support this behaviour are ",(0,a.jsx)(n.code,{children:"content"}),", ",(0,a.jsx)(n.code,{children:"json"})," and ",(0,a.jsx)(n.code,{children:"meta"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-4",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this\nroot.foo_summed = json("foo").from_all().sum()\n'})}),"\n",(0,a.jsx)(n.h3,{id:"or",children:(0,a.jsx)(n.code,{children:"or"})}),"\n",(0,a.jsxs)(n.p,{children:["If the result of the target query fails or resolves to ",(0,a.jsx)(n.code,{children:"null"}),", returns the argument instead. This is an explicit method alternative to the coalesce pipe operator ",(0,a.jsx)(n.code,{children:"|"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-4",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"fallback"})})," A value to yield, or query to execute, if the target query fails or resolves to ",(0,a.jsx)(n.code,{children:"null"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-5",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root.doc.id = this.thing.id.or(uuid_v4())\n"})}),"\n",(0,a.jsx)(n.h2,{id:"string-manipulation",children:"String Manipulation"}),"\n",(0,a.jsx)(n.h3,{id:"capitalize",children:(0,a.jsx)(n.code,{children:"capitalize"})}),"\n",(0,a.jsx)(n.p,{children:"Takes a string value and returns a copy with all Unicode letters that begin words mapped to their Unicode title case."}),"\n",(0,a.jsx)(n.h4,{id:"examples-6",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.title = this.title.capitalize()\n\n# In: {"title":"the foo bar"}\n# Out: {"title":"The Foo Bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"compare_argon2",children:(0,a.jsx)(n.code,{children:"compare_argon2"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a string matches a hashed secret using Argon2."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-5",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"hashed_secret"})})," The hashed secret to compare with the input. This must be a fully-qualified string which encodes the Argon2 options used to generate the hash."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-7",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.match = this.secret.compare_argon2("$argon2id$v=19$m=4096,t=3,p=1$c2FsdHktbWNzYWx0ZmFjZQ$RMUMwgtS32/mbszd+ke4o4Ej1jFpYiUqY6MHWa69X7Y")\n\n# In: {"secret":"there-are-many-blobs-in-the-sea"}\n# Out: {"match":true}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.match = this.secret.compare_argon2("$argon2id$v=19$m=4096,t=3,p=1$c2FsdHktbWNzYWx0ZmFjZQ$RMUMwgtS32/mbszd+ke4o4Ej1jFpYiUqY6MHWa69X7Y")\n\n# In: {"secret":"will-i-ever-find-love"}\n# Out: {"match":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"compare_bcrypt",children:(0,a.jsx)(n.code,{children:"compare_bcrypt"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a string matches a hashed secret using bcrypt."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-6",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"hashed_secret"})})," The hashed secret value to compare with the input."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-8",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.match = this.secret.compare_bcrypt("$2y$10$Dtnt5NNzVtMCOZONT705tOcS8It6krJX8bEjnDJnwxiFKsz1C.3Ay")\n\n# In: {"secret":"there-are-many-blobs-in-the-sea"}\n# Out: {"match":true}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.match = this.secret.compare_bcrypt("$2y$10$Dtnt5NNzVtMCOZONT705tOcS8It6krJX8bEjnDJnwxiFKsz1C.3Ay")\n\n# In: {"secret":"will-i-ever-find-love"}\n# Out: {"match":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"contains",children:(0,a.jsx)(n.code,{children:"contains"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a string contains a substring and returns a boolean result."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-7",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," A value to test against elements of the target."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-9",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.has_foo = this.thing.contains("foo")\n\n# In: {"thing":"this foo that"}\n# Out: {"has_foo":true}\n\n# In: {"thing":"this bar that"}\n# Out: {"has_foo":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"escape_html",children:(0,a.jsx)(n.code,{children:"escape_html"})}),"\n",(0,a.jsxs)(n.p,{children:["Escapes a string so that special characters like ",(0,a.jsx)(n.code,{children:"<"})," to become ",(0,a.jsx)(n.code,{children:"<"}),". It escapes only five such characters: ",(0,a.jsx)(n.code,{children:"<"}),", ",(0,a.jsx)(n.code,{children:">"}),", ",(0,a.jsx)(n.code,{children:"&"}),", ",(0,a.jsx)(n.code,{children:"'"})," and ",(0,a.jsx)(n.code,{children:'"'})," so that it can be safely placed within an HTML entity."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-10",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.escaped = this.value.escape_html()\n\n# In: {"value":"foo & bar"}\n# Out: {"escaped":"foo & bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"escape_url_query",children:(0,a.jsx)(n.code,{children:"escape_url_query"})}),"\n",(0,a.jsx)(n.p,{children:"Escapes a string so that it can be safely placed within a URL query."}),"\n",(0,a.jsx)(n.h4,{id:"examples-11",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.escaped = this.value.escape_url_query()\n\n# In: {"value":"foo & bar"}\n# Out: {"escaped":"foo+%26+bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"filepath_join",children:(0,a.jsx)(n.code,{children:"filepath_join"})}),"\n",(0,a.jsx)(n.p,{children:"Joins an array of path elements into a single file path. The separator depends on the operating system of the machine."}),"\n",(0,a.jsx)(n.h4,{id:"examples-12",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.path = this.path_elements.filepath_join()\n\n# In: {"path_elements":["/foo/","bar.txt"]}\n# Out: {"path":"/foo/bar.txt"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"filepath_split",children:(0,a.jsx)(n.code,{children:"filepath_split"})}),"\n",(0,a.jsx)(n.p,{children:"Splits a file path immediately following the final Separator, separating it into a directory and file name component returned as a two element array of strings. If there is no Separator in the path, the first element will be empty and the second will contain the path. The separator depends on the operating system of the machine."}),"\n",(0,a.jsx)(n.h4,{id:"examples-13",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.path_sep = this.path.filepath_split()\n\n# In: {"path":"/foo/bar.txt"}\n# Out: {"path_sep":["/foo/","bar.txt"]}\n\n# In: {"path":"baz.txt"}\n# Out: {"path_sep":["","baz.txt"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"format",children:(0,a.jsx)(n.code,{children:"format"})}),"\n",(0,a.jsxs)(n.p,{children:["Use a value string as a format specifier in order to produce a new string, using any number of provided arguments. Please refer to the Go ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/fmt",children:[(0,a.jsx)(n.code,{children:"fmt"})," package documentation"]})," for the list of valid format verbs."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-14",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = "%s(%v): %v".format(this.name, this.age, this.fingers)\n\n# In: {"name":"lance","age":37,"fingers":13}\n# Out: {"foo":"lance(37): 13"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"has_prefix",children:(0,a.jsx)(n.code,{children:"has_prefix"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a string has a prefix argument and returns a bool."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-8",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," The string to test."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-15",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.t1 = this.v1.has_prefix("foo")\nroot.t2 = this.v2.has_prefix("foo")\n\n# In: {"v1":"foobar","v2":"barfoo"}\n# Out: {"t1":true,"t2":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"has_suffix",children:(0,a.jsx)(n.code,{children:"has_suffix"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a string has a suffix argument and returns a bool."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-9",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," The string to test."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-16",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.t1 = this.v1.has_suffix("foo")\nroot.t2 = this.v2.has_suffix("foo")\n\n# In: {"v1":"foobar","v2":"barfoo"}\n# Out: {"t1":false,"t2":true}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"index_of",children:(0,a.jsx)(n.code,{children:"index_of"})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the starting index of the argument substring in a string target, or ",(0,a.jsx)(n.code,{children:"-1"})," if the target doesn't contain the argument."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-10",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," A string to search for."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-17",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.thing.index_of("bar")\n\n# In: {"thing":"foobar"}\n# Out: {"index":3}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = content().index_of("meow")\n\n# In: the cat meowed, the dog woofed\n# Out: {"index":8}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"length",children:(0,a.jsx)(n.code,{children:"length"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the length of a string."}),"\n",(0,a.jsx)(n.h4,{id:"examples-18",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_len = this.foo.length()\n\n# In: {"foo":"hello world"}\n# Out: {"foo_len":11}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"lowercase",children:(0,a.jsx)(n.code,{children:"lowercase"})}),"\n",(0,a.jsx)(n.p,{children:"Convert a string value into lowercase."}),"\n",(0,a.jsx)(n.h4,{id:"examples-19",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.lowercase()\n\n# In: {"foo":"HELLO WORLD"}\n# Out: {"foo":"hello world"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"quote",children:(0,a.jsx)(n.code,{children:"quote"})}),"\n",(0,a.jsxs)(n.p,{children:["Quotes a target string using escape sequences (",(0,a.jsx)(n.code,{children:"\\t"}),", ",(0,a.jsx)(n.code,{children:"\\n"}),", ",(0,a.jsx)(n.code,{children:"\\xFF"}),", ",(0,a.jsx)(n.code,{children:"\\u0100"}),") for control characters and non-printable characters."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-20",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.quoted = this.thing.quote()\n\n# In: {"thing":"foo\\nbar"}\n# Out: {"quoted":"\\"foo\\\\nbar\\""}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"replace_all",children:(0,a.jsx)(n.code,{children:"replace_all"})}),"\n",(0,a.jsx)(n.p,{children:"Replaces all occurrences of the first argument in a target string with the second argument."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-11",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"old"})})," A string to match against.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"new"})})," A string to replace with."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-21",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.replace_all("foo","dog")\n\n# In: {"value":"The foo ate my homework"}\n# Out: {"new_value":"The dog ate my homework"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"replace_all_many",children:(0,a.jsx)(n.code,{children:"replace_all_many"})}),"\n",(0,a.jsxs)(n.p,{children:["For each pair of strings in an argument array, replaces all occurrences of the first item of the pair with the second. This is a more compact way of chaining a series of ",(0,a.jsx)(n.code,{children:"replace_all"})," methods."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-12",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"values"})})," An array of values, each even value will be replaced with the following odd value."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-22",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.replace_all_many([\n "", "<b>",\n "", "</b>",\n "", "<i>",\n "", "</i>",\n])\n\n# In: {"value":"HelloWorld"}\n# Out: {"new_value":"<i>Hello</i> <b>World</b>"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"reverse",children:(0,a.jsx)(n.code,{children:"reverse"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the target string in reverse order."}),"\n",(0,a.jsx)(n.h4,{id:"examples-23",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.reversed = this.thing.reverse()\n\n# In: {"thing":"backwards"}\n# Out: {"reversed":"sdrawkcab"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = content().reverse()\n\n# In: {"thing":"backwards"}\n# Out: }"sdrawkcab":"gniht"{\n'})}),"\n",(0,a.jsx)(n.h3,{id:"slice",children:(0,a.jsx)(n.code,{children:"slice"})}),"\n",(0,a.jsx)(n.p,{children:"Extract a slice from a string by specifying two indices, a low and high bound, which selects a half-open range that includes the first character, but excludes the last one. If the second index is omitted then it defaults to the length of the input sequence."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-13",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"low"})})," The low bound, which is the first element of the selection, or if negative selects from the end.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"high"})})," <(optional) integer> An optional high bound."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-24",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.beginning = this.value.slice(0, 2)\nroot.end = this.value.slice(4)\n\n# In: {"value":"foo bar"}\n# Out: {"beginning":"fo","end":"bar"}\n'})}),"\n",(0,a.jsx)(n.p,{children:"A negative low index can be used, indicating an offset from the end of the sequence. If the low index is greater than the length of the sequence then an empty result is returned."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.last_chunk = this.value.slice(-4)\nroot.the_rest = this.value.slice(0, -4)\n\n# In: {"value":"foo bar"}\n# Out: {"last_chunk":" bar","the_rest":"foo"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"slug",children:(0,a.jsx)(n.code,{children:"slug"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:['Creates a "slug" from a given string. Wraps the github.com/gosimple/slug package. See its ',(0,a.jsx)(n.a,{href:"https://pkg.go.dev/github.com/gosimple/slug",children:"docs"})," for more information."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.2.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-14",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"lang"})})," <(optional) string, default ",(0,a.jsx)(n.code,{children:'"en"'}),">"]}),"\n",(0,a.jsx)(n.h4,{id:"examples-25",children:"Examples"}),"\n",(0,a.jsx)(n.p,{children:"Creates a slug from an English string"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.slug = this.value.slug()\n\n# In: {"value":"Gopher & Bento"}\n# Out: {"slug":"gopher-and-bento"}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Creates a slug from a French string"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.slug = this.value.slug("fr")\n\n# In: {"value":"Gaufre & Poisson d\'Eau Profonde"}\n# Out: {"slug":"gaufre-et-poisson-deau-profonde"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"split",children:(0,a.jsx)(n.code,{children:"split"})}),"\n",(0,a.jsx)(n.p,{children:"Split a string value into an array of strings by splitting it on a string separator."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-15",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"delimiter"})})," The delimiter to split with."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-26",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.split(",")\n\n# In: {"value":"foo,bar,baz"}\n# Out: {"new_value":["foo","bar","baz"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"strip_html",children:(0,a.jsx)(n.code,{children:"strip_html"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to remove all HTML tags from a target string."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-16",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"preserve"})})," <(optional) array> An optional array of element types to preserve in the output."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-27",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.stripped = this.value.strip_html()\n\n# In: {"value":"
the plain old text
"}\n# Out: {"stripped":"the plain old text"}\n'})}),"\n",(0,a.jsx)(n.p,{children:"It's also possible to provide an explicit list of element types to preserve in the output."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.stripped = this.value.strip_html(["article"])\n\n# In: {"value":"
the plain old text
"}\n# Out: {"stripped":"the plain old text"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"trim",children:(0,a.jsx)(n.code,{children:"trim"})}),"\n",(0,a.jsx)(n.p,{children:"Remove all leading and trailing characters from a string that are contained within an argument cutset. If no arguments are provided then whitespace is removed."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-17",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"cutset"})})," <(optional) string> An optional string of characters to trim from the target value."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-28",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.title = this.title.trim("!?")\nroot.description = this.description.trim()\n\n# In: {"description":" something happened and its amazing! ","title":"!!!watch out!?"}\n# Out: {"description":"something happened and its amazing!","title":"watch out"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"trim_prefix",children:(0,a.jsx)(n.code,{children:"trim_prefix"})}),"\n",(0,a.jsx)(n.p,{children:"Remove the provided leading prefix substring from a string. If the string does not have the prefix substring, it is returned unchanged."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-18",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"prefix"})})," The leading prefix substring to trim from the string."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-29",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.name = this.name.trim_prefix("foobar_")\nroot.description = this.description.trim_prefix("foobar_")\n\n# In: {"description":"unchanged","name":"foobar_blobton"}\n# Out: {"description":"unchanged","name":"blobton"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"trim_suffix",children:(0,a.jsx)(n.code,{children:"trim_suffix"})}),"\n",(0,a.jsx)(n.p,{children:"Remove the provided trailing suffix substring from a string. If the string does not have the suffix substring, it is returned unchanged."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-19",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"suffix"})})," The trailing suffix substring to trim from the string."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-30",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.name = this.name.trim_suffix("_foobar")\nroot.description = this.description.trim_suffix("_foobar")\n\n# In: {"description":"unchanged","name":"blobton_foobar"}\n# Out: {"description":"unchanged","name":"blobton"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"unescape_html",children:(0,a.jsx)(n.code,{children:"unescape_html"})}),"\n",(0,a.jsxs)(n.p,{children:["Unescapes a string so that entities like ",(0,a.jsx)(n.code,{children:"<"})," become ",(0,a.jsx)(n.code,{children:"<"}),". It unescapes a larger range of entities than ",(0,a.jsx)(n.code,{children:"escape_html"})," escapes. For example, ",(0,a.jsx)(n.code,{children:"á"})," unescapes to ",(0,a.jsx)(n.code,{children:"\xe1"}),", as does ",(0,a.jsx)(n.code,{children:"á"})," and ",(0,a.jsx)(n.code,{children:"&xE1;"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-31",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.unescaped = this.value.unescape_html()\n\n# In: {"value":"foo & bar"}\n# Out: {"unescaped":"foo & bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"unescape_url_query",children:(0,a.jsx)(n.code,{children:"unescape_url_query"})}),"\n",(0,a.jsx)(n.p,{children:"Expands escape sequences from a URL query string."}),"\n",(0,a.jsx)(n.h4,{id:"examples-32",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.unescaped = this.value.unescape_url_query()\n\n# In: {"value":"foo+%26+bar"}\n# Out: {"unescaped":"foo & bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"unquote",children:(0,a.jsx)(n.code,{children:"unquote"})}),"\n",(0,a.jsxs)(n.p,{children:["Unquotes a target string, expanding any escape sequences (",(0,a.jsx)(n.code,{children:"\\t"}),", ",(0,a.jsx)(n.code,{children:"\\n"}),", ",(0,a.jsx)(n.code,{children:"\\xFF"}),", ",(0,a.jsx)(n.code,{children:"\\u0100"}),") for control characters and non-printable characters."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-33",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.unquoted = this.thing.unquote()\n\n# In: {"thing":"\\"foo\\\\nbar\\""}\n# Out: {"unquoted":"foo\\nbar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"uppercase",children:(0,a.jsx)(n.code,{children:"uppercase"})}),"\n",(0,a.jsx)(n.p,{children:"Convert a string value into uppercase."}),"\n",(0,a.jsx)(n.h4,{id:"examples-34",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.uppercase()\n\n# In: {"foo":"hello world"}\n# Out: {"foo":"HELLO WORLD"}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"regular-expressions",children:"Regular Expressions"}),"\n",(0,a.jsx)(n.h3,{id:"re_find_all",children:(0,a.jsx)(n.code,{children:"re_find_all"})}),"\n",(0,a.jsx)(n.p,{children:"Returns an array containing all successive matches of a regular expression in a string."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-20",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-35",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_all("a.")\n\n# In: {"value":"paranormal"}\n# Out: {"matches":["ar","an","al"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"re_find_all_object",children:(0,a.jsx)(n.code,{children:"re_find_all_object"})}),"\n",(0,a.jsx)(n.p,{children:"Returns an array of objects containing all matches of the regular expression and the matches of its subexpressions. The key of each match value is the name of the group when specified, otherwise it is the index of the matching group, starting with the expression as a whole at 0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-21",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-36",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_all_object("a(?Px*)b")\n\n# In: {"value":"-axxb-ab-"}\n# Out: {"matches":[{"0":"axxb","foo":"xx"},{"0":"ab","foo":""}]}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_all_object("(?m)(?P\\\\w+):\\\\s+(?P\\\\w+)$")\n\n# In: {"value":"option1: value1\\noption2: value2\\noption3: value3"}\n# Out: {"matches":[{"0":"option1: value1","key":"option1","value":"value1"},{"0":"option2: value2","key":"option2","value":"value2"},{"0":"option3: value3","key":"option3","value":"value3"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"re_find_all_submatch",children:(0,a.jsx)(n.code,{children:"re_find_all_submatch"})}),"\n",(0,a.jsx)(n.p,{children:"Returns an array of arrays containing all successive matches of the regular expression in a string and the matches, if any, of its subexpressions."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-22",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-37",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_all_submatch("a(x*)b")\n\n# In: {"value":"-axxb-ab-"}\n# Out: {"matches":[["axxb","xx"],["ab",""]]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"re_find_object",children:(0,a.jsx)(n.code,{children:"re_find_object"})}),"\n",(0,a.jsx)(n.p,{children:"Returns an object containing the first match of the regular expression and the matches of its subexpressions. The key of each match value is the name of the group when specified, otherwise it is the index of the matching group, starting with the expression as a whole at 0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-23",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-38",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_object("a(?Px*)b")\n\n# In: {"value":"-axxb-ab-"}\n# Out: {"matches":{"0":"axxb","foo":"xx"}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_object("(?P\\\\w+):\\\\s+(?P\\\\w+)")\n\n# In: {"value":"option1: value1"}\n# Out: {"matches":{"0":"option1: value1","key":"option1","value":"value1"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"re_match",children:(0,a.jsx)(n.code,{children:"re_match"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a regular expression matches against any part of a string and returns a boolean."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-24",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-39",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_match("[0-9]")\n\n# In: {"value":"there are 10 puppies"}\n# Out: {"matches":true}\n\n# In: {"value":"there are ten puppies"}\n# Out: {"matches":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"re_replace_all",children:(0,a.jsx)(n.code,{children:"re_replace_all"})}),"\n",(0,a.jsxs)(n.p,{children:["Replaces all occurrences of the argument regular expression in a string with a value. Inside the value $ signs are interpreted as submatch expansions, e.g. ",(0,a.jsx)(n.code,{children:"$1"})," represents the text of the first submatch."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-25",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," The value to replace with."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-40",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.re_replace_all("ADD ([0-9]+)","+($1)")\n\n# In: {"value":"foo ADD 70"}\n# Out: {"new_value":"foo +(70)"}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"number-manipulation",children:"Number Manipulation"}),"\n",(0,a.jsx)(n.h3,{id:"abs",children:(0,a.jsx)(n.code,{children:"abs"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the absolute value of an int64 or float64 number. As a special case, when an integer is provided that is the minimum value it is converted to the maximum value."}),"\n",(0,a.jsx)(n.h4,{id:"examples-41",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.outs = this.ins.map_each(ele -> ele.abs())\n\n\n# In: {"ins":[9,-18,1.23,-4.56]}\n# Out: {"outs":[9,18,1.23,4.56]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ceil",children:(0,a.jsx)(n.code,{children:"ceil"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the least integer value greater than or equal to a number. If the resulting value fits within a 64-bit integer then that is returned, otherwise a new floating point number is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-42",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.ceil()\n\n# In: {"value":5.3}\n# Out: {"new_value":6}\n\n# In: {"value":-5.9}\n# Out: {"new_value":-5}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"float32",children:(0,a.jsx)(n.code,{children:"float32"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 32-bit floating point number, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 32-bit floating point number. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseFloat",children:[(0,a.jsx)(n.code,{children:"strconv.ParseFloat"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-43",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.out = this.in.float32()\n\n\n# In: {"in":"6.674282313423543523453425345e-11"}\n# Out: {"out":6.674283e-11}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"float64",children:(0,a.jsx)(n.code,{children:"float64"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 64-bit floating point number, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 64-bit floating point number. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseFloat",children:[(0,a.jsx)(n.code,{children:"strconv.ParseFloat"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-44",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.out = this.in.float64()\n\n\n# In: {"in":"6.674282313423543523453425345e-11"}\n# Out: {"out":6.674282313423544e-11}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"floor",children:(0,a.jsx)(n.code,{children:"floor"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the greatest integer value less than or equal to the target number. If the resulting value fits within a 64-bit integer then that is returned, otherwise a new floating point number is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-45",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.floor()\n\n# In: {"value":5.7}\n# Out: {"new_value":5}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"int16",children:(0,a.jsx)(n.code,{children:"int16"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 16-bit signed integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 16-bit signed integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-46",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.int16()\nroot.b = this.b.round().int16()\nroot.c = this.c.int16()\nroot.d = this.d.int16().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":-12}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.int16()\n\n\n# In: "0xDE"\n# Out: 222\n'})}),"\n",(0,a.jsx)(n.h3,{id:"int32",children:(0,a.jsx)(n.code,{children:"int32"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 32-bit signed integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 32-bit signed integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-47",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.int32()\nroot.b = this.b.round().int32()\nroot.c = this.c.int32()\nroot.d = this.d.int32().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":-12}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.int32()\n\n\n# In: "0xDEAD"\n# Out: 57005\n'})}),"\n",(0,a.jsx)(n.h3,{id:"int64",children:(0,a.jsx)(n.code,{children:"int64"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 64-bit signed integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 64-bit signed integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-48",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.int64()\nroot.b = this.b.round().int64()\nroot.c = this.c.int64()\nroot.d = this.d.int64().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":-12}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.int64()\n\n\n# In: "0xDEADBEEF"\n# Out: 3735928559\n'})}),"\n",(0,a.jsx)(n.h3,{id:"int8",children:(0,a.jsx)(n.code,{children:"int8"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 8-bit signed integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 8-bit signed integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-49",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.int8()\nroot.b = this.b.round().int8()\nroot.c = this.c.int8()\nroot.d = this.d.int8().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":-12}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.int8()\n\n\n# In: "0xD"\n# Out: 13\n'})}),"\n",(0,a.jsx)(n.h3,{id:"log",children:(0,a.jsx)(n.code,{children:"log"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the natural logarithm of a number."}),"\n",(0,a.jsx)(n.h4,{id:"examples-50",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.log().round()\n\n# In: {"value":1}\n# Out: {"new_value":0}\n\n# In: {"value":2.7183}\n# Out: {"new_value":1}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"log10",children:(0,a.jsx)(n.code,{children:"log10"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the decimal logarithm of a number."}),"\n",(0,a.jsx)(n.h4,{id:"examples-51",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.log10()\n\n# In: {"value":100}\n# Out: {"new_value":2}\n\n# In: {"value":1000}\n# Out: {"new_value":3}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"max",children:(0,a.jsx)(n.code,{children:"max"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the largest numerical value found within an array. All values must be numerical and the array must not be empty, otherwise an error is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-52",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.biggest = this.values.max()\n\n# In: {"values":[0,3,2.5,7,5]}\n# Out: {"biggest":7}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = [0,this.value].max()\n\n# In: {"value":-1}\n# Out: {"new_value":0}\n\n# In: {"value":7}\n# Out: {"new_value":7}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"min",children:(0,a.jsx)(n.code,{children:"min"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the smallest numerical value found within an array. All values must be numerical and the array must not be empty, otherwise an error is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-53",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.smallest = this.values.min()\n\n# In: {"values":[0,3,-2.5,7,5]}\n# Out: {"smallest":-2.5}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = [10,this.value].min()\n\n# In: {"value":2}\n# Out: {"new_value":2}\n\n# In: {"value":23}\n# Out: {"new_value":10}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"round",children:(0,a.jsx)(n.code,{children:"round"})}),"\n",(0,a.jsx)(n.p,{children:"Rounds numbers to the nearest integer, rounding half away from zero. If the resulting value fits within a 64-bit integer then that is returned, otherwise a new floating point number is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-54",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.round()\n\n# In: {"value":5.3}\n# Out: {"new_value":5}\n\n# In: {"value":5.9}\n# Out: {"new_value":6}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"uint16",children:(0,a.jsx)(n.code,{children:"uint16"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 16-bit unsigned integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 16-bit unsigned integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-55",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.uint16()\nroot.b = this.b.round().uint16()\nroot.c = this.c.uint16()\nroot.d = this.d.uint16().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":0}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.uint16()\n\n\n# In: "0xDE"\n# Out: 222\n'})}),"\n",(0,a.jsx)(n.h3,{id:"uint32",children:(0,a.jsx)(n.code,{children:"uint32"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 32-bit unsigned integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 32-bit unsigned integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-56",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.uint32()\nroot.b = this.b.round().uint32()\nroot.c = this.c.uint32()\nroot.d = this.d.uint32().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":0}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.uint32()\n\n\n# In: "0xDEAD"\n# Out: 57005\n'})}),"\n",(0,a.jsx)(n.h3,{id:"uint64",children:(0,a.jsx)(n.code,{children:"uint64"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 64-bit unsigned integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 64-bit unsigned integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-57",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.uint64()\nroot.b = this.b.round().uint64()\nroot.c = this.c.uint64()\nroot.d = this.d.uint64().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":0}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.uint64()\n\n\n# In: "0xDEADBEEF"\n# Out: 3735928559\n'})}),"\n",(0,a.jsx)(n.h3,{id:"uint8",children:(0,a.jsx)(n.code,{children:"uint8"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 8-bit unsigned integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 8-bit unsigned integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-58",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.uint8()\nroot.b = this.b.round().uint8()\nroot.c = this.c.uint8()\nroot.d = this.d.uint8().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":0}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.uint8()\n\n\n# In: "0xD"\n# Out: 13\n'})}),"\n",(0,a.jsx)(n.h2,{id:"timestamp-manipulation",children:"Timestamp Manipulation"}),"\n",(0,a.jsx)(n.h3,{id:"parse_duration",children:(0,a.jsx)(n.code,{children:"parse_duration"})}),"\n",(0,a.jsx)(n.p,{children:'Attempts to parse a string as a duration and returns an integer of nanoseconds. A duration string is a possibly signed sequence of decimal numbers, each with an optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "\xb5s"), "ms", "s", "m", "h".'}),"\n",(0,a.jsx)(n.h4,{id:"examples-59",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.delay_for_ns = this.delay_for.parse_duration()\n\n# In: {"delay_for":"50us"}\n# Out: {"delay_for_ns":50000}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.delay_for_s = this.delay_for.parse_duration() / 1000000000\n\n# In: {"delay_for":"2h"}\n# Out: {"delay_for_s":7200}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_duration_iso8601",children:(0,a.jsx)(n.code,{children:"parse_duration_iso8601"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:'Attempts to parse a string using ISO-8601 rules as a duration and returns an integer of nanoseconds. A duration string is represented by the format "P[n]Y[n]M[n]DT[n]H[n]M[n]S" or "P[n]W". In these representations, the "[n]" is replaced by the value for each of the date and time elements that follow the "[n]". For example, "P3Y6M4DT12H30M5S" represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds". The last field of the format allows fractions with one decimal place, so "P3.5S" will return 3500000000ns. Any additional decimals will be truncated.'}),"\n",(0,a.jsx)(n.h4,{id:"examples-60",children:"Examples"}),"\n",(0,a.jsx)(n.p,{children:"Arbitrary ISO-8601 duration string to nanoseconds:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.delay_for_ns = this.delay_for.parse_duration_iso8601()\n\n# In: {"delay_for":"P3Y6M4DT12H30M5S"}\n# Out: {"delay_for_ns":110839937000000000}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Two hours ISO-8601 duration string to seconds:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.delay_for_s = this.delay_for.parse_duration_iso8601() / 1000000000\n\n# In: {"delay_for":"PT2H"}\n# Out: {"delay_for_s":7200}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Two and a half seconds ISO-8601 duration string to seconds:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.delay_for_s = this.delay_for.parse_duration_iso8601() / 1000000000\n\n# In: {"delay_for":"PT2.5S"}\n# Out: {"delay_for_s":2.5}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_add_iso8601",children:(0,a.jsx)(n.code,{children:"ts_add_iso8601"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Parse parameter string as ISO 8601 period and add it to value with high precision for units larger than an hour."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-26",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"duration"})})," Duration in ISO 8601 format"]}),"\n",(0,a.jsx)(n.h3,{id:"ts_format",children:(0,a.jsx)(n.code,{children:"ts_format"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to format a timestamp value as a string according to a specified format, or RFC 3339 by default. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format."}),"\n",(0,a.jsxs)(n.p,{children:["The output format is defined by showing how the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006, would be displayed if it were the value. For an alternative way to specify formats check out the ",(0,a.jsx)(n.a,{href:"#ts_strftime",children:(0,a.jsx)(n.code,{children:"ts_strftime"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-27",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The output format to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"tz"})})," <(optional) string> An optional timezone to use, otherwise the timezone of the input string is used, or in the case of unix timestamps the local timezone is used."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-61",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root.something_at = (this.created_at + 300).ts_format()\n"})}),"\n",(0,a.jsx)(n.p,{children:"An optional string argument can be used in order to specify the output format of the timestamp. The format is defined by showing how the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006, would be displayed if it were the value."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = (this.created_at + 300).ts_format("2006-Jan-02 15:04:05")\n'})}),"\n",(0,a.jsx)(n.p,{children:"A second optional string argument can also be used in order to specify a timezone, otherwise the timezone of the input string is used, or in the case of unix timestamps the local timezone is used."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = this.created_at.ts_format(format: "2006-Jan-02 15:04:05", tz: "UTC")\n\n# In: {"created_at":1597405526}\n# Out: {"something_at":"2020-Aug-14 11:45:26"}\n\n# In: {"created_at":"2020-08-14T11:50:26.371Z"}\n# Out: {"something_at":"2020-Aug-14 11:50:26"}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["And ",(0,a.jsx)(n.code,{children:"ts_format"})," supports up to nanosecond precision with floating point timestamp values."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = this.created_at.ts_format("2006-Jan-02 15:04:05.999999", "UTC")\n\n# In: {"created_at":1597405526.123456}\n# Out: {"something_at":"2020-Aug-14 11:45:26.123456"}\n\n# In: {"created_at":"2020-08-14T11:50:26.371Z"}\n# Out: {"something_at":"2020-Aug-14 11:50:26.371"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to parse a string as a timestamp following a specified format and outputs a timestamp, which can then be fed into methods such as ",(0,a.jsx)(n.a,{href:"#ts_format",children:(0,a.jsx)(n.code,{children:"ts_format"})}),"."]}),"\n",(0,a.jsxs)(n.p,{children:["The input format is defined by showing how the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006, would be displayed if it were the value. For an alternative way to specify formats check out the ",(0,a.jsx)(n.a,{href:"#ts_strptime",children:(0,a.jsx)(n.code,{children:"ts_strptime"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-28",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The format of the target string."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-62",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc.timestamp = this.doc.timestamp.ts_parse("2006-Jan-02")\n\n# In: {"doc":{"timestamp":"2020-Aug-14"}}\n# Out: {"doc":{"timestamp":"2020-08-14T00:00:00Z"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_round",children:(0,a.jsx)(n.code,{children:"ts_round"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the result of rounding a timestamp to the nearest multiple of the argument duration (nanoseconds). The rounding behavior for halfway values is to round up. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.2.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-29",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"duration"})})," A duration measured in nanoseconds to round by."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-63",children:"Examples"}),"\n",(0,a.jsxs)(n.p,{children:["Use the method ",(0,a.jsx)(n.code,{children:"parse_duration"})," to convert a duration string into an integer argument."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_hour = this.created_at.ts_round("1h".parse_duration())\n\n# In: {"created_at":"2020-08-14T05:54:23Z"}\n# Out: {"created_at_hour":"2020-08-14T06:00:00Z"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_strftime",children:(0,a.jsx)(n.code,{children:"ts_strftime"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to format a timestamp value as a string according to a specified strftime-compatible format. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-30",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The output format to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"tz"})})," <(optional) string> An optional timezone to use, otherwise the timezone of the input string is used."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-64",children:"Examples"}),"\n",(0,a.jsxs)(n.p,{children:["The format consists of zero or more conversion specifiers and ordinary characters (except ",(0,a.jsx)(n.code,{children:"%"}),"). All ordinary characters are copied to the output string without modification. Each conversion specification begins with ",(0,a.jsx)(n.code,{children:"%"})," character followed by the character that determines the behaviour of the specifier. Please refer to ",(0,a.jsx)(n.a,{href:"https://linux.die.net/man/3/strftime",children:"man 3 strftime"})," for the list of format specifiers."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = (this.created_at + 300).ts_strftime("%Y-%b-%d %H:%M:%S")\n'})}),"\n",(0,a.jsx)(n.p,{children:"A second optional string argument can also be used in order to specify a timezone, otherwise the timezone of the input string is used, or in the case of unix timestamps the local timezone is used."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = this.created_at.ts_strftime("%Y-%b-%d %H:%M:%S", "UTC")\n\n# In: {"created_at":1597405526}\n# Out: {"something_at":"2020-Aug-14 11:45:26"}\n\n# In: {"created_at":"2020-08-14T11:50:26.371Z"}\n# Out: {"something_at":"2020-Aug-14 11:50:26"}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["As an extension provided by the underlying formatting library, ",(0,a.jsx)(n.a,{href:"https://github.com/itchyny/timefmt-go",children:"itchyny/timefmt-go"}),", the ",(0,a.jsx)(n.code,{children:"%f"})," directive is supported for zero-padded microseconds, which originates from Python. Note that E and O modifier characters are not supported."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = this.created_at.ts_strftime("%Y-%b-%d %H:%M:%S.%f", "UTC")\n\n# In: {"created_at":1597405526}\n# Out: {"something_at":"2020-Aug-14 11:45:26.000000"}\n\n# In: {"created_at":"2020-08-14T11:50:26.371Z"}\n# Out: {"something_at":"2020-Aug-14 11:50:26.371000"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_strptime",children:(0,a.jsx)(n.code,{children:"ts_strptime"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to parse a string as a timestamp following a specified strptime-compatible format and outputs a timestamp, which can then be fed into ",(0,a.jsx)(n.a,{href:"#ts_format",children:(0,a.jsx)(n.code,{children:"ts_format"})}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-31",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The format of the target string."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-65",children:"Examples"}),"\n",(0,a.jsxs)(n.p,{children:["The format consists of zero or more conversion specifiers and ordinary characters (except ",(0,a.jsx)(n.code,{children:"%"}),"). All ordinary characters are copied to the output string without modification. Each conversion specification begins with a ",(0,a.jsx)(n.code,{children:"%"})," character followed by the character that determines the behaviour of the specifier. Please refer to ",(0,a.jsx)(n.a,{href:"https://linux.die.net/man/3/strptime",children:"man 3 strptime"})," for the list of format specifiers."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc.timestamp = this.doc.timestamp.ts_strptime("%Y-%b-%d")\n\n# In: {"doc":{"timestamp":"2020-Aug-14"}}\n# Out: {"doc":{"timestamp":"2020-08-14T00:00:00Z"}}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["As an extension provided by the underlying formatting library, ",(0,a.jsx)(n.a,{href:"https://github.com/itchyny/timefmt-go",children:"itchyny/timefmt-go"}),", the ",(0,a.jsx)(n.code,{children:"%f"})," directive is supported for zero-padded microseconds, which originates from Python. Note that E and O modifier characters are not supported."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc.timestamp = this.doc.timestamp.ts_strptime("%Y-%b-%d %H:%M:%S.%f")\n\n# In: {"doc":{"timestamp":"2020-Aug-14 11:50:26.371000"}}\n# Out: {"doc":{"timestamp":"2020-08-14T11:50:26.371Z"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_sub",children:(0,a.jsx)(n.code,{children:"ts_sub"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the difference in nanoseconds between the target timestamp (t1) and the timestamp provided as a parameter (t2). The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.23.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-32",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"t2"})})," The second timestamp to be subtracted from the method target."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-66",children:"Examples"}),"\n",(0,a.jsxs)(n.p,{children:["Use the ",(0,a.jsx)(n.code,{children:".abs()"})," method in order to calculate an absolute duration between two timestamps."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.between = this.started_at.ts_sub("2020-08-14T05:54:23Z").abs()\n\n# In: {"started_at":"2020-08-13T05:54:23Z"}\n# Out: {"between":86400000000000}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_sub_iso8601",children:(0,a.jsx)(n.code,{children:"ts_sub_iso8601"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Parse parameter string as ISO 8601 period and subtract it from value with high precision for units larger than an hour."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-33",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"duration"})})," Duration in ISO 8601 format"]}),"\n",(0,a.jsx)(n.h3,{id:"ts_tz",children:(0,a.jsx)(n.code,{children:"ts_tz"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the result of converting a timestamp to a specified timezone. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.3.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-34",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"tz"})}),' The timezone to change to. If set to "UTC" then the timezone will be UTC. If set to "Local" then the local timezone will be used. Otherwise, the argument is taken to be a location name corresponding to a file in the IANA Time Zone database, such as "America/New_York".']}),"\n",(0,a.jsx)(n.h4,{id:"examples-67",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_utc = this.created_at.ts_tz("UTC")\n\n# In: {"created_at":"2021-02-03T17:05:06+01:00"}\n# Out: {"created_at_utc":"2021-02-03T16:05:06Z"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_unix",children:(0,a.jsx)(n.code,{children:"ts_unix"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-68",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_unix = this.created_at.ts_unix()\n\n# In: {"created_at":"2009-11-10T23:00:00Z"}\n# Out: {"created_at_unix":1257894000}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_unix_micro",children:(0,a.jsx)(n.code,{children:"ts_unix_micro"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with microsecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-69",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_unix = this.created_at.ts_unix_micro()\n\n# In: {"created_at":"2009-11-10T23:00:00Z"}\n# Out: {"created_at_unix":1257894000000000}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_unix_milli",children:(0,a.jsx)(n.code,{children:"ts_unix_milli"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with millisecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-70",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_unix = this.created_at.ts_unix_milli()\n\n# In: {"created_at":"2009-11-10T23:00:00Z"}\n# Out: {"created_at_unix":1257894000000}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_unix_nano",children:(0,a.jsx)(n.code,{children:"ts_unix_nano"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with nanosecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-71",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_unix = this.created_at.ts_unix_nano()\n\n# In: {"created_at":"2009-11-10T23:00:00Z"}\n# Out: {"created_at_unix":1257894000000000000}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"type-coercion",children:"Type Coercion"}),"\n",(0,a.jsx)(n.h3,{id:"bool",children:(0,a.jsx)(n.code,{children:"bool"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempt to parse a value into a boolean. An optional argument can be provided, in which case if the value cannot be parsed the argument will be returned instead. If the value is a number then any non-zero value will resolve to ",(0,a.jsx)(n.code,{children:"true"}),", if the value is a string then any of the following values are considered valid: ",(0,a.jsx)(n.code,{children:"1, t, T, TRUE, true, True, 0, f, F, FALSE"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-35",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"default"})})," <(optional) bool> An optional value to yield if the target cannot be parsed as a boolean."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-72",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root.foo = this.thing.bool()\nroot.bar = this.thing.bool(true)\n"})}),"\n",(0,a.jsx)(n.h3,{id:"bytes",children:(0,a.jsx)(n.code,{children:"bytes"})}),"\n",(0,a.jsx)(n.p,{children:"Marshal a value into a byte array. If the value is already a byte array it is unchanged."}),"\n",(0,a.jsx)(n.h4,{id:"examples-73",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.first_byte = this.name.bytes().index(0)\n\n# In: {"name":"foobar bazson"}\n# Out: {"first_byte":102}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"not_empty",children:(0,a.jsx)(n.code,{children:"not_empty"})}),"\n",(0,a.jsx)(n.p,{children:"Ensures that the given string, array or object value is not empty, and if so returns it, otherwise an error is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-74",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.a = this.a.not_empty()\n\n# In: {"a":"foo"}\n# Out: {"a":"foo"}\n\n# In: {"a":""}\n# Out: Error("failed assignment (line 1): field `this.a`: string value is empty")\n\n# In: {"a":["foo","bar"]}\n# Out: {"a":["foo","bar"]}\n\n# In: {"a":[]}\n# Out: Error("failed assignment (line 1): field `this.a`: array value is empty")\n\n# In: {"a":{"b":"foo","c":"bar"}}\n# Out: {"a":{"b":"foo","c":"bar"}}\n\n# In: {"a":{}}\n# Out: Error("failed assignment (line 1): field `this.a`: object value is empty")\n'})}),"\n",(0,a.jsx)(n.h3,{id:"not_null",children:(0,a.jsx)(n.code,{children:"not_null"})}),"\n",(0,a.jsxs)(n.p,{children:["Ensures that the given value is not ",(0,a.jsx)(n.code,{children:"null"}),", and if so returns it, otherwise an error is returned."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-75",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.a = this.a.not_null()\n\n# In: {"a":"foobar","b":"barbaz"}\n# Out: {"a":"foobar"}\n\n# In: {"b":"barbaz"}\n# Out: Error("failed assignment (line 1): field `this.a`: value is null")\n'})}),"\n",(0,a.jsx)(n.h3,{id:"number",children:(0,a.jsx)(n.code,{children:"number"})}),"\n",(0,a.jsx)(n.p,{children:"Attempt to parse a value into a number. An optional argument can be provided, in which case if the value cannot be parsed into a number the argument will be returned instead."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-36",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"default"})})," <(optional) float> An optional value to yield if the target cannot be parsed as a number."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-76",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root.foo = this.thing.number() + 10\nroot.bar = this.thing.number(5) * 10\n"})}),"\n",(0,a.jsx)(n.h3,{id:"string",children:(0,a.jsx)(n.code,{children:"string"})}),"\n",(0,a.jsx)(n.p,{children:"Marshal a value into a string. If the value is already a string it is unchanged."}),"\n",(0,a.jsx)(n.h4,{id:"examples-77",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.nested_json = this.string()\n\n# In: {"foo":"bar"}\n# Out: {"nested_json":"{\\"foo\\":\\"bar\\"}"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.id = this.id.string()\n\n# In: {"id":228930314431312345}\n# Out: {"id":"228930314431312345"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"type",children:(0,a.jsx)(n.code,{children:"type"})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the type of a value as a string, providing one of the following values: ",(0,a.jsx)(n.code,{children:"string"}),", ",(0,a.jsx)(n.code,{children:"bytes"}),", ",(0,a.jsx)(n.code,{children:"number"}),", ",(0,a.jsx)(n.code,{children:"bool"}),", ",(0,a.jsx)(n.code,{children:"timestamp"}),", ",(0,a.jsx)(n.code,{children:"array"}),", ",(0,a.jsx)(n.code,{children:"object"})," or ",(0,a.jsx)(n.code,{children:"null"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-78",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.bar_type = this.bar.type()\nroot.foo_type = this.foo.type()\n\n# In: {"bar":10,"foo":"is a string"}\n# Out: {"bar_type":"number","foo_type":"string"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.type = this.type()\n\n# In: "foobar"\n# Out: {"type":"string"}\n\n# In: 666\n# Out: {"type":"number"}\n\n# In: false\n# Out: {"type":"bool"}\n\n# In: ["foo", "bar"]\n# Out: {"type":"array"}\n\n# In: {"foo": "bar"}\n# Out: {"type":"object"}\n\n# In: null\n# Out: {"type":"null"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.type = content().type()\n\n# In: foobar\n# Out: {"type":"bytes"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.type = this.ts_parse("2006-01-02").type()\n\n# In: "2022-06-06"\n# Out: {"type":"timestamp"}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"object--array-manipulation",children:"Object & Array Manipulation"}),"\n",(0,a.jsx)(n.h3,{id:"all",children:(0,a.jsx)(n.code,{children:"all"})}),"\n",(0,a.jsx)(n.p,{children:"Checks each element of an array against a query and returns true if all elements passed. An error occurs if the target is not an array, or if any element results in the provided query returning a non-boolean result. Returns false if the target array is empty."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-37",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"test"})})," A test query to apply to each element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-79",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.all_over_21 = this.patrons.all(patron -> patron.age >= 21)\n\n# In: {"patrons":[{"id":"1","age":18},{"id":"2","age":23}]}\n# Out: {"all_over_21":false}\n\n# In: {"patrons":[{"id":"1","age":45},{"id":"2","age":23}]}\n# Out: {"all_over_21":true}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"any",children:(0,a.jsx)(n.code,{children:"any"})}),"\n",(0,a.jsx)(n.p,{children:"Checks the elements of an array against a query and returns true if any element passes. An error occurs if the target is not an array, or if an element results in the provided query returning a non-boolean result. Returns false if the target array is empty."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-38",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"test"})})," A test query to apply to each element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-80",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.any_over_21 = this.patrons.any(patron -> patron.age >= 21)\n\n# In: {"patrons":[{"id":"1","age":18},{"id":"2","age":23}]}\n# Out: {"any_over_21":true}\n\n# In: {"patrons":[{"id":"1","age":10},{"id":"2","age":12}]}\n# Out: {"any_over_21":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"append",children:(0,a.jsx)(n.code,{children:"append"})}),"\n",(0,a.jsx)(n.p,{children:"Returns an array with new elements appended to the end."}),"\n",(0,a.jsx)(n.h4,{id:"examples-81",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.append("and", "this")\n\n# In: {"foo":["bar","baz"]}\n# Out: {"foo":["bar","baz","and","this"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"assign",children:(0,a.jsx)(n.code,{children:"assign"})}),"\n",(0,a.jsxs)(n.p,{children:["Merge a source object into an existing destination object. When a collision is found within the merged structures (both a source and destination object contain the same non-object keys) the value in the destination object will be overwritten by that of source object. In order to preserve both values on collision use the ",(0,a.jsx)(n.a,{href:"#merge",children:(0,a.jsx)(n.code,{children:"merge"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-39",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"with"})})," A value to merge the target value with."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-82",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.foo.assign(this.bar)\n\n# In: {"foo":{"first_name":"fooer","likes":"bars"},"bar":{"second_name":"barer","likes":"foos"}}\n# Out: {"first_name":"fooer","likes":"foos","second_name":"barer"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"collapse",children:(0,a.jsx)(n.code,{children:"collapse"})}),"\n",(0,a.jsx)(n.p,{children:"Collapse an array or object into an object of key/value pairs for each field, where the key is the full path of the structured field in dot path notation. Empty arrays an objects are ignored by default."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-40",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"include_empty"})})," Whether to include empty objects and arrays in the resulting object."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-83",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.collapse()\n\n# In: {"foo":[{"bar":"1"},{"bar":{}},{"bar":"2"},{"bar":[]}]}\n# Out: {"result":{"foo.0.bar":"1","foo.2.bar":"2"}}\n'})}),"\n",(0,a.jsx)(n.p,{children:"An optional boolean parameter can be set to true in order to include empty objects and arrays."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.collapse(include_empty: true)\n\n# In: {"foo":[{"bar":"1"},{"bar":{}},{"bar":"2"},{"bar":[]}]}\n# Out: {"result":{"foo.0.bar":"1","foo.1.bar":{},"foo.2.bar":"2","foo.3.bar":[]}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"concat",children:(0,a.jsx)(n.code,{children:"concat"})}),"\n",(0,a.jsx)(n.p,{children:"Concatenates an array value with one or more argument arrays."}),"\n",(0,a.jsx)(n.h4,{id:"examples-84",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.concat(this.bar, this.baz)\n\n# In: {"foo":["a","b"],"bar":["c"],"baz":["d","e","f"]}\n# Out: {"foo":["a","b","c","d","e","f"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"contains-1",children:(0,a.jsx)(n.code,{children:"contains"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether an array contains an element matching the argument, or an object contains a value matching the argument, and returns a boolean result. Numerical comparisons are made irrespective of the representation type (float versus integer)."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-41",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," A value to test against elements of the target."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-85",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.has_foo = this.thing.contains("foo")\n\n# In: {"thing":["this","foo","that"]}\n# Out: {"has_foo":true}\n\n# In: {"thing":["this","bar","that"]}\n# Out: {"has_foo":false}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.has_bar = this.thing.contains(20)\n\n# In: {"thing":[10.3,20.0,"huh",3]}\n# Out: {"has_bar":true}\n\n# In: {"thing":[2,3,40,67]}\n# Out: {"has_bar":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"diff",children:(0,a.jsx)(n.code,{children:"diff"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Create a diff by comparing the current value with the given one. Wraps the github.com/r3labs/diff/v3 package. See its ",(0,a.jsx)(n.a,{href:"https://pkg.go.dev/github.com/r3labs/diff/v3",children:"docs"})," for more information."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.25.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-42",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"other"})})," The value to compare against."]}),"\n",(0,a.jsx)(n.h3,{id:"enumerated",children:(0,a.jsx)(n.code,{children:"enumerated"})}),"\n",(0,a.jsxs)(n.p,{children:["Converts an array into a new array of objects, where each object has a field index containing the ",(0,a.jsx)(n.code,{children:"index"})," of the element and a field ",(0,a.jsx)(n.code,{children:"value"})," containing the original value of the element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-86",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.enumerated()\n\n# In: {"foo":["bar","baz"]}\n# Out: {"foo":[{"index":0,"value":"bar"},{"index":1,"value":"baz"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"explode",children:(0,a.jsx)(n.code,{children:"explode"})}),"\n",(0,a.jsxs)(n.p,{children:["Explodes an array or object at a ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"field path"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-43",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"dot path"})," to a field to explode."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-87",children:"Examples"}),"\n",(0,a.jsx)(n.h5,{id:"on-arrays",children:"On arrays"}),"\n",(0,a.jsx)(n.p,{children:"Exploding arrays results in an array containing elements matching the original document, where the target field of each element is an element of the exploded array:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.explode("value")\n\n# In: {"id":1,"value":["foo","bar","baz"]}\n# Out: [{"id":1,"value":"foo"},{"id":1,"value":"bar"},{"id":1,"value":"baz"}]\n'})}),"\n",(0,a.jsx)(n.h5,{id:"on-objects",children:"On objects"}),"\n",(0,a.jsx)(n.p,{children:"Exploding objects results in an object where the keys match the target object, and the values match the original document but with the target field replaced by the exploded value:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.explode("value")\n\n# In: {"id":1,"value":{"foo":2,"bar":[3,4],"baz":{"bev":5}}}\n# Out: {"bar":{"id":1,"value":[3,4]},"baz":{"id":1,"value":{"bev":5}},"foo":{"id":1,"value":2}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"filter",children:(0,a.jsx)(n.code,{children:"filter"})}),"\n",(0,a.jsxs)(n.p,{children:["Executes a mapping query argument for each element of an array or key/value pair of an object. If the query returns ",(0,a.jsx)(n.code,{children:"false"})," the item is removed from the resulting array or object. The item will also be removed if the query returns any non-boolean value."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-44",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"test"})})," A query to apply to each element, if this query resolves to any value other than a boolean ",(0,a.jsx)(n.code,{children:"true"})," the element will be removed from the result."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-88",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_nums = this.nums.filter(num -> num > 10)\n\n# In: {"nums":[3,11,4,17]}\n# Out: {"new_nums":[11,17]}\n'})}),"\n",(0,a.jsx)(n.h5,{id:"on-objects-1",children:"On objects"}),"\n",(0,a.jsxs)(n.p,{children:["When filtering objects the mapping query argument is provided a context with a field ",(0,a.jsx)(n.code,{children:"key"})," containing the value key, and a field ",(0,a.jsx)(n.code,{children:"value"})," containing the value."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_dict = this.dict.filter(item -> item.value.contains("foo"))\n\n# In: {"dict":{"first":"hello foo","second":"world","third":"this foo is great"}}\n# Out: {"new_dict":{"first":"hello foo","third":"this foo is great"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"find",children:(0,a.jsx)(n.code,{children:"find"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the index of the first occurrence of a value in an array. ",(0,a.jsx)(n.code,{children:"-1"})," is returned if there are no matches. Numerical comparisons are made irrespective of the representation type (float versus integer)."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-45",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," A value to find."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-89",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.find("bar")\n\n# In: ["foo", "bar", "baz"]\n# Out: {"index":1}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.things.find(this.goal)\n\n# In: {"goal":"bar","things":["foo", "bar", "baz"]}\n# Out: {"index":1}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"find_all",children:(0,a.jsx)(n.code,{children:"find_all"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Returns an array containing the indexes of all occurrences of a value in an array. An empty array is returned if there are no matches. Numerical comparisons are made irrespective of the representation type (float versus integer)."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-46",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," A value to find."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-90",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.find_all("bar")\n\n# In: ["foo", "bar", "baz", "bar"]\n# Out: {"index":[1,3]}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.indexes = this.things.find_all(this.goal)\n\n# In: {"goal":"bar","things":["foo", "bar", "baz", "bar", "buz"]}\n# Out: {"indexes":[1,3]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"find_all_by",children:(0,a.jsx)(n.code,{children:"find_all_by"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns an array containing the indexes of all occurrences of an array where the provided query resolves to a boolean ",(0,a.jsx)(n.code,{children:"true"}),". An empty array is returned if there are no matches. Numerical comparisons are made irrespective of the representation type (float versus integer)."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-47",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query to execute for each element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-91",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.find_all_by(v -> v != "bar")\n\n# In: ["foo", "bar", "baz"]\n# Out: {"index":[0,2]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"find_by",children:(0,a.jsx)(n.code,{children:"find_by"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the index of the first occurrence of an array where the provided query resolves to a boolean ",(0,a.jsx)(n.code,{children:"true"}),". ",(0,a.jsx)(n.code,{children:"-1"})," is returned if there are no matches."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-48",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query to execute for each element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-92",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.find_by(v -> v != "bar")\n\n# In: ["foo", "bar", "baz"]\n# Out: {"index":0}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"flatten",children:(0,a.jsx)(n.code,{children:"flatten"})}),"\n",(0,a.jsx)(n.p,{children:"Iterates an array and any element that is itself an array is removed and has its elements inserted directly in the resulting array."}),"\n",(0,a.jsx)(n.h4,{id:"examples-93",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.flatten()\n\n# In: ["foo",["bar","baz"],"buz"]\n# Out: {"result":["foo","bar","baz","buz"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"fold",children:(0,a.jsx)(n.code,{children:"fold"})}),"\n",(0,a.jsxs)(n.p,{children:["Takes two arguments: an initial value, and a mapping query. For each element of an array the mapping context is an object with two fields ",(0,a.jsx)(n.code,{children:"tally"})," and ",(0,a.jsx)(n.code,{children:"value"}),", where ",(0,a.jsx)(n.code,{children:"tally"})," contains the current accumulated value and ",(0,a.jsx)(n.code,{children:"value"})," is the value of the current element. The mapping must return the result of adding the value to the tally."]}),"\n",(0,a.jsxs)(n.p,{children:["The first argument is the value that ",(0,a.jsx)(n.code,{children:"tally"})," will have on the first call."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-49",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"initial"})})," The initial value to start the fold with. For example, an empty object ",(0,a.jsx)(n.code,{children:"{}"}),", a zero count ",(0,a.jsx)(n.code,{children:"0"}),", or an empty string ",(0,a.jsx)(n.code,{children:'""'}),".",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query to apply for each element. The query is provided an object with two fields; ",(0,a.jsx)(n.code,{children:"tally"})," containing the current tally, and ",(0,a.jsx)(n.code,{children:"value"})," containing the value of the current element. The query should result in a new tally to be passed to the next element query."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-94",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.sum = this.foo.fold(0, item -> item.tally + item.value)\n\n# In: {"foo":[3,8,11]}\n# Out: {"sum":22}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.foo.fold("", item -> "%v%v".format(item.tally, item.value))\n\n# In: {"foo":["hello ", "world"]}\n# Out: {"result":"hello world"}\n'})}),"\n",(0,a.jsx)(n.p,{children:"You can use fold to merge an array of objects together:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.smoothie = this.fruits.fold({}, item -> item.tally.merge(item.value))\n\n# In: {"fruits":[{"apple":5},{"banana":3},{"orange":8}]}\n# Out: {"smoothie":{"apple":5,"banana":3,"orange":8}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"get",children:(0,a.jsx)(n.code,{children:"get"})}),"\n",(0,a.jsxs)(n.p,{children:["Extract a field value, identified via a ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"dot path"}),", from an object."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-50",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"dot path"})," identifying a field to obtain."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-95",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.foo.get(this.target)\n\n# In: {"foo":{"bar":"from bar","baz":"from baz"},"target":"bar"}\n# Out: {"result":"from bar"}\n\n# In: {"foo":{"bar":"from bar","baz":"from baz"},"target":"baz"}\n# Out: {"result":"from baz"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"index",children:(0,a.jsx)(n.code,{children:"index"})}),"\n",(0,a.jsx)(n.p,{children:"Extract an element from an array by an index. The index can be negative, and if so the element will be selected from the end counting backwards starting from -1. E.g. an index of -1 returns the last element, an index of -2 returns the element before the last, and so on."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-51",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"index"})})," The index to obtain from an array."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-96",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.last_name = this.names.index(-1)\n\n# In: {"names":["rachel","stevens"]}\n# Out: {"last_name":"stevens"}\n'})}),"\n",(0,a.jsx)(n.p,{children:"It is also possible to use this method on byte arrays, in which case the selected element will be returned as an integer."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.last_byte = this.name.bytes().index(-1)\n\n# In: {"name":"foobar bazson"}\n# Out: {"last_byte":110}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"join",children:(0,a.jsx)(n.code,{children:"join"})}),"\n",(0,a.jsx)(n.p,{children:"Join an array of strings with an optional delimiter into a single string."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-52",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"delimiter"})})," <(optional) string> An optional delimiter to add between each string."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-97",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.joined_words = this.words.join()\nroot.joined_numbers = this.numbers.map_each(this.string()).join(",")\n\n# In: {"words":["hello","world"],"numbers":[3,8,11]}\n# Out: {"joined_numbers":"3,8,11","joined_words":"helloworld"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"json_path",children:(0,a.jsx)(n.code,{children:"json_path"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Executes the given JSONPath expression on an object or array and returns the result. The JSONPath expression syntax can be found at ",(0,a.jsx)(n.a,{href:"https://goessner.net/articles/JsonPath/",children:"https://goessner.net/articles/JsonPath/"}),". For more complex logic, you can use Gval expressions (",(0,a.jsx)(n.a,{href:"https://github.com/PaesslerAG/gval",children:"https://github.com/PaesslerAG/gval"}),")."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-53",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"expression"})})," The JSONPath expression to execute."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-98",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.all_names = this.json_path("$..name")\n\n# In: {"name":"alice","foo":{"name":"bob"}}\n# Out: {"all_names":["alice","bob"]}\n\n# In: {"thing":["this","bar",{"name":"alice"}]}\n# Out: {"all_names":["alice"]}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.text_objects = this.json_path("$.body[?(@.type==\'text\')]")\n\n# In: {"body":[{"type":"image","id":"foo"},{"type":"text","id":"bar"}]}\n# Out: {"text_objects":[{"id":"bar","type":"text"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"json_schema",children:(0,a.jsx)(n.code,{children:"json_schema"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Checks a ",(0,a.jsx)(n.a,{href:"https://json-schema.org/",children:"JSON schema"})," against a value and returns the value if it matches or throws and error if it does not."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-54",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"schema"})})," The schema to check values against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-99",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.json_schema("""{\n "type":"object",\n "properties":{\n "foo":{\n "type":"string"\n }\n }\n}""")\n\n# In: {"foo":"bar"}\n# Out: {"foo":"bar"}\n\n# In: {"foo":5}\n# Out: Error("failed assignment (line 1): field `this`: foo invalid type. expected: string, given: integer")\n'})}),"\n",(0,a.jsxs)(n.p,{children:["In order to load a schema from a file use the ",(0,a.jsx)(n.code,{children:"file"})," function."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.json_schema(file(env("BENTO_TEST_BLOBLANG_SCHEMA_FILE")))\n'})}),"\n",(0,a.jsx)(n.h3,{id:"key_values",children:(0,a.jsx)(n.code,{children:"key_values"})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the key/value pairs of an object as an array, where each element is an object with a ",(0,a.jsx)(n.code,{children:"key"})," field and a ",(0,a.jsx)(n.code,{children:"value"})," field. The order of the resulting array will be random."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-100",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_key_values = this.foo.key_values().sort_by(pair -> pair.key)\n\n# In: {"foo":{"bar":1,"baz":2}}\n# Out: {"foo_key_values":[{"key":"bar","value":1},{"key":"baz","value":2}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"keys",children:(0,a.jsx)(n.code,{children:"keys"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the keys of an object as an array."}),"\n",(0,a.jsx)(n.h4,{id:"examples-101",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_keys = this.foo.keys()\n\n# In: {"foo":{"bar":1,"baz":2}}\n# Out: {"foo_keys":["bar","baz"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"length-1",children:(0,a.jsx)(n.code,{children:"length"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the length of an array or object (number of keys)."}),"\n",(0,a.jsx)(n.h4,{id:"examples-102",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_len = this.foo.length()\n\n# In: {"foo":["first","second"]}\n# Out: {"foo_len":2}\n\n# In: {"foo":{"first":"bar","second":"baz"}}\n# Out: {"foo_len":2}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"map_each",children:(0,a.jsx)(n.code,{children:"map_each"})}),"\n",(0,a.jsx)(n.h4,{id:"parameters-55",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query that will be used to map each element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-103",children:"Examples"}),"\n",(0,a.jsx)(n.h5,{id:"on-arrays-1",children:"On arrays"}),"\n",(0,a.jsx)(n.p,{children:"Apply a mapping to each element of an array and replace the element with the result. Within the argument mapping the context is the value of the element being mapped."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_nums = this.nums.map_each(num -> if num < 10 {\n deleted()\n} else {\n num - 10\n})\n\n# In: {"nums":[3,11,4,17]}\n# Out: {"new_nums":[1,7]}\n'})}),"\n",(0,a.jsx)(n.h5,{id:"on-objects-2",children:"On objects"}),"\n",(0,a.jsxs)(n.p,{children:["Apply a mapping to each value of an object and replace the value with the result. Within the argument mapping the context is an object with a field ",(0,a.jsx)(n.code,{children:"key"})," containing the value key, and a field ",(0,a.jsx)(n.code,{children:"value"}),"."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_dict = this.dict.map_each(item -> item.value.uppercase())\n\n# In: {"dict":{"foo":"hello","bar":"world"}}\n# Out: {"new_dict":{"bar":"WORLD","foo":"HELLO"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"map_each_key",children:(0,a.jsx)(n.code,{children:"map_each_key"})}),"\n",(0,a.jsx)(n.p,{children:"Apply a mapping to each key of an object, and replace the key with the result, which must be a string."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-56",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query that will be used to map each key."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-104",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_dict = this.dict.map_each_key(key -> key.uppercase())\n\n# In: {"dict":{"keya":"hello","keyb":"world"}}\n# Out: {"new_dict":{"KEYA":"hello","KEYB":"world"}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.map_each_key(key -> if key.contains("kafka") { "_" + key })\n\n# In: {"amqp_key":"foo","kafka_key":"bar","kafka_topic":"baz"}\n# Out: {"_kafka_key":"bar","_kafka_topic":"baz","amqp_key":"foo"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"merge",children:(0,a.jsx)(n.code,{children:"merge"})}),"\n",(0,a.jsxs)(n.p,{children:["Merge a source object into an existing destination object. When a collision is found within the merged structures (both a source and destination object contain the same non-object keys) the result will be an array containing both values, where values that are already arrays will be expanded into the resulting array. In order to simply override destination fields on collision use the ",(0,a.jsx)(n.a,{href:"#assign",children:(0,a.jsx)(n.code,{children:"assign"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-57",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"with"})})," A value to merge the target value with."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-105",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.foo.merge(this.bar)\n\n# In: {"foo":{"first_name":"fooer","likes":"bars"},"bar":{"second_name":"barer","likes":"foos"}}\n# Out: {"first_name":"fooer","likes":["bars","foos"],"second_name":"barer"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"patch",children:(0,a.jsx)(n.code,{children:"patch"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Create a diff by comparing the current value with the given one. Wraps the github.com/r3labs/diff/v3 package. See its ",(0,a.jsx)(n.a,{href:"https://pkg.go.dev/github.com/r3labs/diff/v3",children:"docs"})," for more information."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.25.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-58",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"changelog"})})," The changelog to apply."]}),"\n",(0,a.jsx)(n.h3,{id:"slice-1",children:(0,a.jsx)(n.code,{children:"slice"})}),"\n",(0,a.jsx)(n.p,{children:"Extract a slice from an array by specifying two indices, a low and high bound, which selects a half-open range that includes the first element, but excludes the last one. If the second index is omitted then it defaults to the length of the input sequence."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-59",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"low"})})," The low bound, which is the first element of the selection, or if negative selects from the end.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"high"})})," <(optional) integer> An optional high bound."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-106",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.beginning = this.value.slice(0, 2)\nroot.end = this.value.slice(4)\n\n# In: {"value":["foo","bar","baz","buz","bev"]}\n# Out: {"beginning":["foo","bar"],"end":["bev"]}\n'})}),"\n",(0,a.jsx)(n.p,{children:"A negative low index can be used, indicating an offset from the end of the sequence. If the low index is greater than the length of the sequence then an empty result is returned."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.last_chunk = this.value.slice(-2)\nroot.the_rest = this.value.slice(0, -2)\n\n# In: {"value":["foo","bar","baz","buz","bev"]}\n# Out: {"last_chunk":["buz","bev"],"the_rest":["foo","bar","baz"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sort",children:(0,a.jsx)(n.code,{children:"sort"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to sort the values of an array in increasing order. The type of all values must match in order for the ordering to succeed. Supports string and number values."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-60",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"compare"})})," <(optional) query expression> An optional query that should explicitly compare elements ",(0,a.jsx)(n.code,{children:"left"})," and ",(0,a.jsx)(n.code,{children:"right"})," and provide a boolean result."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-107",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.sorted = this.foo.sort()\n\n# In: {"foo":["bbb","ccc","aaa"]}\n# Out: {"sorted":["aaa","bbb","ccc"]}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["It's also possible to specify a mapping argument, which is provided an object context with fields ",(0,a.jsx)(n.code,{children:"left"})," and ",(0,a.jsx)(n.code,{children:"right"}),", the mapping must return a boolean indicating whether the ",(0,a.jsx)(n.code,{children:"left"})," value is less than ",(0,a.jsx)(n.code,{children:"right"}),". This allows you to sort arrays containing non-string or non-number values."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.sorted = this.foo.sort(item -> item.left.v < item.right.v)\n\n# In: {"foo":[{"id":"foo","v":"bbb"},{"id":"bar","v":"ccc"},{"id":"baz","v":"aaa"}]}\n# Out: {"sorted":[{"id":"baz","v":"aaa"},{"id":"foo","v":"bbb"},{"id":"bar","v":"ccc"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sort_by",children:(0,a.jsx)(n.code,{children:"sort_by"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to sort the elements of an array, in increasing order, by a value emitted by an argument query applied to each element. The type of all values must match in order for the ordering to succeed. Supports string and number values."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-61",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query to apply to each element that yields a value used for sorting."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-108",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.sorted = this.foo.sort_by(ele -> ele.id)\n\n# In: {"foo":[{"id":"bbb","message":"bar"},{"id":"aaa","message":"foo"},{"id":"ccc","message":"baz"}]}\n# Out: {"sorted":[{"id":"aaa","message":"foo"},{"id":"bbb","message":"bar"},{"id":"ccc","message":"baz"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"squash",children:(0,a.jsx)(n.code,{children:"squash"})}),"\n",(0,a.jsxs)(n.p,{children:["Squashes an array of objects into a single object, where key collisions result in the values being merged (following similar rules as the ",(0,a.jsx)(n.code,{children:".merge()"})," method)"]}),"\n",(0,a.jsx)(n.h4,{id:"examples-109",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.locations = this.locations.map_each(loc -> {loc.state: [loc.name]}).squash()\n\n# In: {"locations":[{"name":"Seattle","state":"WA"},{"name":"New York","state":"NY"},{"name":"Bellevue","state":"WA"},{"name":"Olympia","state":"WA"}]}\n# Out: {"locations":{"NY":["New York"],"WA":["Seattle","Bellevue","Olympia"]}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sum",children:(0,a.jsx)(n.code,{children:"sum"})}),"\n",(0,a.jsx)(n.p,{children:"Sum the numerical values of an array."}),"\n",(0,a.jsx)(n.h4,{id:"examples-110",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.sum = this.foo.sum()\n\n# In: {"foo":[3,8,4]}\n# Out: {"sum":15}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"unique",children:(0,a.jsx)(n.code,{children:"unique"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to remove duplicate values from an array. The array may contain a combination of different value types, but numbers and strings are checked separately (",(0,a.jsx)(n.code,{children:'"5"'})," is a different element to ",(0,a.jsx)(n.code,{children:"5"}),")."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-62",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"emit"})})," <(optional) query expression> An optional query that can be used in order to yield a value for each element to determine uniqueness."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-111",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.uniques = this.foo.unique()\n\n# In: {"foo":["a","b","a","c"]}\n# Out: {"uniques":["a","b","c"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"values",children:(0,a.jsx)(n.code,{children:"values"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the values of an object as an array. The order of the resulting array will be random."}),"\n",(0,a.jsx)(n.h4,{id:"examples-112",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_vals = this.foo.values().sort()\n\n# In: {"foo":{"bar":1,"baz":2}}\n# Out: {"foo_vals":[1,2]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"with",children:(0,a.jsx)(n.code,{children:"with"})}),"\n",(0,a.jsxs)(n.p,{children:["Returns an object where all but one or more ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"field path"})," arguments are removed. Each path specifies a specific field to be retained from the input object, allowing for nested fields."]}),"\n",(0,a.jsx)(n.p,{children:"If a key within a nested path does not exist then it is ignored."}),"\n",(0,a.jsx)(n.h4,{id:"examples-113",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.with("inner.a","inner.c","d")\n\n# In: {"inner":{"a":"first","b":"second","c":"third"},"d":"fourth","e":"fifth"}\n# Out: {"d":"fourth","inner":{"a":"first","c":"third"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"without",children:(0,a.jsx)(n.code,{children:"without"})}),"\n",(0,a.jsxs)(n.p,{children:["Returns an object where one or more ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"field path"})," arguments are removed. Each path specifies a specific field to be deleted from the input object, allowing for nested fields."]}),"\n",(0,a.jsx)(n.p,{children:"If a key within a nested path does not exist or is not an object then it is not removed."}),"\n",(0,a.jsx)(n.h4,{id:"examples-114",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.without("inner.a","inner.c","d")\n\n# In: {"inner":{"a":"first","b":"second","c":"third"},"d":"fourth","e":"fifth"}\n# Out: {"e":"fifth","inner":{"b":"second"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"zip",children:(0,a.jsx)(n.code,{children:"zip"})}),"\n",(0,a.jsx)(n.p,{children:"Zip an array value with one or more argument arrays. Each array must match in length."}),"\n",(0,a.jsx)(n.h4,{id:"examples-115",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.zip(this.bar, this.baz)\n\n# In: {"foo":["a","b","c"],"bar":[1,2,3],"baz":[4,5,6]}\n# Out: {"foo":[["a",1,4],["b",2,5],["c",3,6]]}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"parsing",children:"Parsing"}),"\n",(0,a.jsx)(n.h3,{id:"bloblang",children:(0,a.jsx)(n.code,{children:"bloblang"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Executes an argument Bloblang mapping on the target. This method can be used in order to execute dynamic mappings. Imports and functions that interact with the environment, such as ",(0,a.jsx)(n.code,{children:"file"})," and ",(0,a.jsx)(n.code,{children:"env"}),", or that access message information directly, such as ",(0,a.jsx)(n.code,{children:"content"})," or ",(0,a.jsx)(n.code,{children:"json"}),", are not enabled for dynamic Bloblang mappings."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-63",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"mapping"})})," The mapping to execute."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-116",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.body = this.body.bloblang(this.mapping)\n\n# In: {"body":{"foo":"hello world"},"mapping":"root.foo = this.foo.uppercase()"}\n# Out: {"body":{"foo":"HELLO WORLD"}}\n\n# In: {"body":{"foo":"hello world 2"},"mapping":"root.foo = this.foo.capitalize()"}\n# Out: {"body":{"foo":"Hello World 2"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"format_json",children:(0,a.jsx)(n.code,{children:"format_json"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Serializes a target value into a pretty-printed JSON byte array (with 4 space indentation by default)."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-64",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"indent"})})," Indentation string. Each element in a JSON object or array will begin on a new, indented line followed by one or more copies of indent according to the indentation nesting.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"no_indent"})})," Disable indentation."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-117",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.doc.format_json()\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {\n# "foo": "bar"\n# }\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Pass a string to the ",(0,a.jsx)(n.code,{children:"indent"})," parameter in order to customise the indentation."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.format_json(" ")\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {\n# "doc": {\n# "foo": "bar"\n# }\n# }\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Use the ",(0,a.jsx)(n.code,{children:".string()"})," method in order to coerce the result into a string."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.format_json().string()\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {"doc":"{\\n \\"foo\\": \\"bar\\"\\n}"}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Set the ",(0,a.jsx)(n.code,{children:"no_indent"})," parameter to true to disable indentation. The result is equivalent to calling ",(0,a.jsx)(n.code,{children:"bytes()"}),"."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.doc.format_json(no_indent: true)\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {"foo":"bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"format_msgpack",children:(0,a.jsx)(n.code,{children:"format_msgpack"})}),"\n",(0,a.jsxs)(n.p,{children:["Formats data as a ",(0,a.jsx)(n.a,{href:"https://msgpack.org/",children:"MessagePack"})," message in bytes format."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-118",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.format_msgpack().encode("hex")\n\n# In: {"foo":"bar"}\n# Out: 81a3666f6fa3626172\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.encoded = this.format_msgpack().encode("base64")\n\n# In: {"foo":"bar"}\n# Out: {"encoded":"gaNmb2+jYmFy"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"format_xml",children:(0,a.jsx)(n.code,{children:"format_xml"})}),"\n",(0,a.jsx)(n.p,{children:"Serializes a target value into an XML byte array."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-65",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"indent"})})," Indentation string. Each element in an XML object or array will begin on a new, indented line followed by one or more copies of indent according to the indentation nesting.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"no_indent"})})," Disable indentation."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-119",children:"Examples"}),"\n",(0,a.jsx)(n.p,{children:"Serializes a target value into a pretty-printed XML byte array (with 4 space indentation by default)."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.format_xml()\n\n# In: {"foo":{"bar":{"baz":"foo bar baz"}}}\n# Out: \n# \n# foo bar baz\n# \n# \n'})}),"\n",(0,a.jsxs)(n.p,{children:["Pass a string to the ",(0,a.jsx)(n.code,{children:"indent"})," parameter in order to customise the indentation."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.format_xml(" ")\n\n# In: {"foo":{"bar":{"baz":"foo bar baz"}}}\n# Out: \n# \n# foo bar baz\n# \n# \n'})}),"\n",(0,a.jsxs)(n.p,{children:["Use the ",(0,a.jsx)(n.code,{children:".string()"})," method in order to coerce the result into a string."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.format_xml("").string()\n\n# In: {"foo":{"bar":{"baz":"foo bar baz"}}}\n# Out: {"doc":"\\n\\nfoo bar baz\\n\\n"}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Set the ",(0,a.jsx)(n.code,{children:"no_indent"})," parameter to true to disable indentation."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.format_xml(no_indent: true)\n\n# In: {"foo":{"bar":{"baz":"foo bar baz"}}}\n# Out: foo bar baz\n'})}),"\n",(0,a.jsx)(n.h3,{id:"format_yaml",children:(0,a.jsx)(n.code,{children:"format_yaml"})}),"\n",(0,a.jsx)(n.p,{children:"Serializes a target value into a YAML byte array."}),"\n",(0,a.jsx)(n.h4,{id:"examples-120",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.doc.format_yaml()\n\n# In: {"doc":{"foo":"bar"}}\n# Out: foo: bar\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Use the ",(0,a.jsx)(n.code,{children:".string()"})," method in order to coerce the result into a string."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.format_yaml().string()\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {"doc":"foo: bar\\n"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_csv",children:(0,a.jsx)(n.code,{children:"parse_csv"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to parse a string into an array of objects by following the CSV format described in RFC 4180."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-66",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"parse_header_row"})})," Whether to reference the first row as a header row. If set to true the output structure for messages will be an object where field keys are determined by the header row. Otherwise, the output will be an array of row arrays.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"delimiter"})})," The delimiter to use for splitting values in each record. It must be a single character.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"lazy_quotes"})})," If set to ",(0,a.jsx)(n.code,{children:"true"}),", a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-121",children:"Examples"}),"\n",(0,a.jsx)(n.p,{children:"Parses CSV data with a header row"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.orders = this.orders.parse_csv()\n\n# In: {"orders":"foo,bar\\nfoo 1,bar 1\\nfoo 2,bar 2"}\n# Out: {"orders":[{"bar":"bar 1","foo":"foo 1"},{"bar":"bar 2","foo":"foo 2"}]}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Parses CSV data without a header row"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.orders = this.orders.parse_csv(false)\n\n# In: {"orders":"foo 1,bar 1\\nfoo 2,bar 2"}\n# Out: {"orders":[["foo 1","bar 1"],["foo 2","bar 2"]]}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Parses CSV data delimited by dots"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.orders = this.orders.parse_csv(delimiter:".")\n\n# In: {"orders":"foo.bar\\nfoo 1.bar 1\\nfoo 2.bar 2"}\n# Out: {"orders":[{"bar":"bar 1","foo":"foo 1"},{"bar":"bar 2","foo":"foo 2"}]}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Parses CSV data containing a quote in an unquoted field"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.orders = this.orders.parse_csv(lazy_quotes:true)\n\n# In: {"orders":"foo,bar\\nfoo 1,bar 1\\nfoo\\" \\"2,bar\\" \\"2"}\n# Out: {"orders":[{"bar":"bar 1","foo":"foo 1"},{"bar":"bar\\" \\"2","foo":"foo\\" \\"2"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_form_url_encoded",children:(0,a.jsx)(n.code,{children:"parse_form_url_encoded"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to parse a url-encoded query string (from an x-www-form-urlencoded request body) and returns a structured result."}),"\n",(0,a.jsx)(n.h4,{id:"examples-122",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.values = this.body.parse_form_url_encoded()\n\n# In: {"body":"noise=meow&animal=cat&fur=orange&fur=fluffy"}\n# Out: {"values":{"animal":"cat","fur":["orange","fluffy"],"noise":"meow"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_json",children:(0,a.jsx)(n.code,{children:"parse_json"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to parse a string as a JSON document and returns the result."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-67",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"use_number"})})," <(optional) bool> An optional flag that when set makes parsing numbers as json.Number instead of the default float64."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-123",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_json()\n\n# In: {"doc":"{\\"foo\\":\\"bar\\"}"}\n# Out: {"doc":{"foo":"bar"}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_json(use_number: true)\n\n# In: {"doc":"{\\"foo\\":\\"11380878173205700000000000000000000000000000000\\"}"}\n# Out: {"doc":{"foo":"11380878173205700000000000000000000000000000000"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_msgpack",children:(0,a.jsx)(n.code,{children:"parse_msgpack"})}),"\n",(0,a.jsxs)(n.p,{children:["Parses a ",(0,a.jsx)(n.a,{href:"https://msgpack.org/",children:"MessagePack"})," message into a structured document."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-124",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = content().decode("hex").parse_msgpack()\n\n# In: 81a3666f6fa3626172\n# Out: {"foo":"bar"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.encoded.decode("base64").parse_msgpack()\n\n# In: {"encoded":"gaNmb2+jYmFy"}\n# Out: {"foo":"bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_parquet",children:(0,a.jsx)(n.code,{children:"parse_parquet"})}),"\n",(0,a.jsxs)(n.p,{children:["Decodes a ",(0,a.jsx)(n.a,{href:"https://parquet.apache.org/docs/",children:"Parquet file"})," into an array of objects, one for each row within the file."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-68",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"byte_array_as_string"})})," Deprecated: This parameter is no longer used."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-125",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root = content().parse_parquet()\n"})}),"\n",(0,a.jsx)(n.h3,{id:"parse_url",children:(0,a.jsx)(n.code,{children:"parse_url"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to parse a URL from a string value, returning a structured result that describes the various facets of the URL. The fields returned within the structured result roughly follow ",(0,a.jsx)(n.a,{href:"https://pkg.go.dev/net/url#URL",children:"https://pkg.go.dev/net/url#URL"}),", and may be expanded in future in order to present more information."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-126",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_url = this.foo_url.parse_url()\n\n# In: {"foo_url":"https://warpstreamlabs.github.io/bento/docs/guides/bloblang/about"}\n# Out: {"foo_url":{"fragment":"","host":"www.benthos.dev","opaque":"","path":"/docs/guides/bloblang/about","raw_fragment":"","raw_path":"","raw_query":"","scheme":"https"}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.username = this.url.parse_url().user.name | "unknown"\n\n# In: {"url":"amqp://foo:bar@127.0.0.1:5672/"}\n# Out: {"username":"foo"}\n\n# In: {"url":"redis://localhost:6379"}\n# Out: {"username":"unknown"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_xml",children:(0,a.jsx)(n.code,{children:"parse_xml"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to parse a string as an XML document and returns a structured result, where elements appear as keys of an object according to the following rules:"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:["If an element contains attributes they are parsed by prefixing a hyphen, ",(0,a.jsx)(n.code,{children:"-"}),", to the attribute label."]}),"\n",(0,a.jsxs)(n.li,{children:["If the element is a simple element and has attributes, the element value is given the key ",(0,a.jsx)(n.code,{children:"#text"}),"."]}),"\n",(0,a.jsx)(n.li,{children:"XML comments, directives, and process instructions are ignored."}),"\n",(0,a.jsx)(n.li,{children:"When elements are repeated the resulting JSON value is an array."}),"\n",(0,a.jsx)(n.li,{children:"If cast is true, try to cast values to numbers and booleans instead of returning strings."}),"\n"]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-69",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"cast"})})," <(optional) bool, default ",(0,a.jsx)(n.code,{children:"false"}),"> whether to try to cast values that are numbers and booleans to the right type."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-127",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_xml()\n\n# In: {"doc":"This is a titleThis is some content"}\n# Out: {"doc":{"root":{"content":"This is some content","title":"This is a title"}}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_xml(cast: false)\n\n# In: {"doc":"This is a title123True"}\n# Out: {"doc":{"root":{"bool":"True","number":{"#text":"123","-id":"99"},"title":"This is a title"}}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_xml(cast: true)\n\n# In: {"doc":"This is a title123True"}\n# Out: {"doc":{"root":{"bool":true,"number":{"#text":123,"-id":99},"title":"This is a title"}}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_yaml",children:(0,a.jsx)(n.code,{children:"parse_yaml"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to parse a string as a single YAML document and returns the result."}),"\n",(0,a.jsx)(n.h4,{id:"examples-128",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_yaml()\n\n# In: {"doc":"foo: bar"}\n# Out: {"doc":{"foo":"bar"}}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"encoding-and-encryption",children:"Encoding and Encryption"}),"\n",(0,a.jsx)(n.h3,{id:"compress",children:(0,a.jsx)(n.code,{children:"compress"})}),"\n",(0,a.jsx)(n.p,{children:"Compresses a string or byte array value according to a specified algorithm."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-70",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"algorithm"})})," One of ",(0,a.jsx)(n.code,{children:"flate"}),", ",(0,a.jsx)(n.code,{children:"gzip"}),", ",(0,a.jsx)(n.code,{children:"pgzip"}),", ",(0,a.jsx)(n.code,{children:"lz4"}),", ",(0,a.jsx)(n.code,{children:"snappy"}),", ",(0,a.jsx)(n.code,{children:"zlib"}),", ",(0,a.jsx)(n.code,{children:"zstd"}),".",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"level"})})," The level of compression to use. May not be applicable to all algorithms."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-129",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'let long_content = range(0, 1000).map_each(content()).join(" ")\nroot.a_len = $long_content.length()\nroot.b_len = $long_content.compress("gzip").length()\n\n\n# In: hello world this is some content\n# Out: {"a_len":32999,"b_len":161}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.compressed = content().compress("lz4").encode("base64")\n\n# In: hello world I love space\n# Out: {"compressed":"BCJNGGRwuRgAAIBoZWxsbyB3b3JsZCBJIGxvdmUgc3BhY2UAAAAAGoETLg=="}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"decode",children:(0,a.jsx)(n.code,{children:"decode"})}),"\n",(0,a.jsxs)(n.p,{children:["Decodes an encoded string target according to a chosen scheme and returns the result as a byte array. When mapping the result to a JSON field the value should be cast to a string using the method ",(0,a.jsx)(n.a,{href:"#string",children:(0,a.jsx)(n.code,{children:"string"})}),", or encoded using the method ",(0,a.jsx)(n.a,{href:"#encode",children:(0,a.jsx)(n.code,{children:"encode"})}),", otherwise it will be base64 encoded by default."]}),"\n",(0,a.jsxs)(n.p,{children:["Available schemes are: ",(0,a.jsx)(n.code,{children:"base64"}),", ",(0,a.jsx)(n.code,{children:"base64url"})," ",(0,a.jsx)(n.a,{href:"https://rfc-editor.org/rfc/rfc4648.html",children:"(RFC 4648 with padding characters)"}),", ",(0,a.jsx)(n.code,{children:"base64rawurl"})," ",(0,a.jsx)(n.a,{href:"https://rfc-editor.org/rfc/rfc4648.html",children:"(RFC 4648 without padding characters)"}),", ",(0,a.jsx)(n.code,{children:"hex"}),", ",(0,a.jsx)(n.code,{children:"ascii85"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-71",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"scheme"})})," The decoding scheme to use."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-130",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.decoded = this.value.decode("hex").string()\n\n# In: {"value":"68656c6c6f20776f726c64"}\n# Out: {"decoded":"hello world"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.encoded.decode("ascii85")\n\n# In: {"encoded":"FD,B0+DGm>FDl80Ci\\"A>F`)8BEckl6F`M&(+Cno&@/"}\n# Out: this is totally unstructured data\n'})}),"\n",(0,a.jsx)(n.h3,{id:"decompress",children:(0,a.jsx)(n.code,{children:"decompress"})}),"\n",(0,a.jsx)(n.p,{children:"Decompresses a string or byte array value according to a specified algorithm. The result of decompression"}),"\n",(0,a.jsx)(n.h4,{id:"parameters-72",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"algorithm"})})," One of ",(0,a.jsx)(n.code,{children:"gzip"}),", ",(0,a.jsx)(n.code,{children:"pgzip"}),", ",(0,a.jsx)(n.code,{children:"zlib"}),", ",(0,a.jsx)(n.code,{children:"bzip2"}),", ",(0,a.jsx)(n.code,{children:"flate"}),", ",(0,a.jsx)(n.code,{children:"snappy"}),", ",(0,a.jsx)(n.code,{children:"lz4"}),", ",(0,a.jsx)(n.code,{children:"zstd"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-131",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.compressed.decode("base64").decompress("lz4")\n\n# In: {"compressed":"BCJNGGRwuRgAAIBoZWxsbyB3b3JsZCBJIGxvdmUgc3BhY2UAAAAAGoETLg=="}\n# Out: hello world I love space\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Use the ",(0,a.jsx)(n.code,{children:".string()"})," method in order to coerce the result into a string, this makes it possible to place the data within a JSON document without automatic base64 encoding."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.compressed.decode("base64").decompress("lz4").string()\n\n# In: {"compressed":"BCJNGGRwuRgAAIBoZWxsbyB3b3JsZCBJIGxvdmUgc3BhY2UAAAAAGoETLg=="}\n# Out: {"result":"hello world I love space"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"decrypt_aes",children:(0,a.jsx)(n.code,{children:"decrypt_aes"})}),"\n",(0,a.jsxs)(n.p,{children:["Decrypts an encrypted string or byte array target according to a chosen AES encryption method and returns the result as a byte array. The algorithms require a key and an initialization vector / nonce. Available schemes are: ",(0,a.jsx)(n.code,{children:"ctr"}),", ",(0,a.jsx)(n.code,{children:"ofb"}),", ",(0,a.jsx)(n.code,{children:"cbc"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-73",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"scheme"})})," The scheme to use for decryption, one of ",(0,a.jsx)(n.code,{children:"ctr"}),", ",(0,a.jsx)(n.code,{children:"ofb"}),", ",(0,a.jsx)(n.code,{children:"cbc"}),".",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"key"})})," A key to decrypt with.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"iv"})})," An initialization vector / nonce."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-132",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'let key = "2b7e151628aed2a6abf7158809cf4f3c".decode("hex")\nlet vector = "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff".decode("hex")\nroot.decrypted = this.value.decode("hex").decrypt_aes("ctr", $key, $vector).string()\n\n# In: {"value":"84e9b31ff7400bdf80be7254"}\n# Out: {"decrypted":"hello world!"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"encode",children:(0,a.jsx)(n.code,{children:"encode"})}),"\n",(0,a.jsxs)(n.p,{children:["Encodes a string or byte array target according to a chosen scheme and returns a string result. Available schemes are: ",(0,a.jsx)(n.code,{children:"base64"}),", ",(0,a.jsx)(n.code,{children:"base64url"})," ",(0,a.jsx)(n.a,{href:"https://rfc-editor.org/rfc/rfc4648.html",children:"(RFC 4648 with padding characters)"}),", ",(0,a.jsx)(n.code,{children:"base64rawurl"})," ",(0,a.jsx)(n.a,{href:"https://rfc-editor.org/rfc/rfc4648.html",children:"(RFC 4648 without padding characters)"}),", ",(0,a.jsx)(n.code,{children:"hex"}),", ",(0,a.jsx)(n.code,{children:"ascii85"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-74",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"scheme"})})," The encoding scheme to use."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-133",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.encoded = this.value.encode("hex")\n\n# In: {"value":"hello world"}\n# Out: {"encoded":"68656c6c6f20776f726c64"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.encoded = content().encode("ascii85")\n\n# In: this is totally unstructured data\n# Out: {"encoded":"FD,B0+DGm>FDl80Ci\\"A>F`)8BEckl6F`M&(+Cno&@/"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"encrypt_aes",children:(0,a.jsx)(n.code,{children:"encrypt_aes"})}),"\n",(0,a.jsxs)(n.p,{children:["Encrypts a string or byte array target according to a chosen AES encryption method and returns a string result. The algorithms require a key and an initialization vector / nonce. Available schemes are: ",(0,a.jsx)(n.code,{children:"ctr"}),", ",(0,a.jsx)(n.code,{children:"ofb"}),", ",(0,a.jsx)(n.code,{children:"cbc"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-75",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"scheme"})})," The scheme to use for encryption, one of ",(0,a.jsx)(n.code,{children:"ctr"}),", ",(0,a.jsx)(n.code,{children:"ofb"}),", ",(0,a.jsx)(n.code,{children:"cbc"}),".",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"key"})})," A key to encrypt with.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"iv"})})," An initialization vector / nonce."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-134",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'let key = "2b7e151628aed2a6abf7158809cf4f3c".decode("hex")\nlet vector = "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff".decode("hex")\nroot.encrypted = this.value.encrypt_aes("ctr", $key, $vector).encode("hex")\n\n# In: {"value":"hello world!"}\n# Out: {"encrypted":"84e9b31ff7400bdf80be7254"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"hash",children:(0,a.jsx)(n.code,{children:"hash"})}),"\n",(0,a.jsxs)(n.p,{children:["Hashes a string or byte array according to a chosen algorithm and returns the result as a byte array. When mapping the result to a JSON field the value should be cast to a string using the method ",(0,a.jsx)(n.a,{href:"#string",children:(0,a.jsx)(n.code,{children:"string"})}),", or encoded using the method ",(0,a.jsx)(n.a,{href:"#encode",children:(0,a.jsx)(n.code,{children:"encode"})}),", otherwise it will be base64 encoded by default."]}),"\n",(0,a.jsxs)(n.p,{children:["Available algorithms are: ",(0,a.jsx)(n.code,{children:"hmac_sha1"}),", ",(0,a.jsx)(n.code,{children:"hmac_sha256"}),", ",(0,a.jsx)(n.code,{children:"hmac_sha512"}),", ",(0,a.jsx)(n.code,{children:"md5"}),", ",(0,a.jsx)(n.code,{children:"sha1"}),", ",(0,a.jsx)(n.code,{children:"sha256"}),", ",(0,a.jsx)(n.code,{children:"sha512"}),", ",(0,a.jsx)(n.code,{children:"xxhash64"}),", ",(0,a.jsx)(n.code,{children:"crc32"}),"."]}),"\n",(0,a.jsxs)(n.p,{children:["The following algorithms require a key, which is specified as a second argument: ",(0,a.jsx)(n.code,{children:"hmac_sha1"}),", ",(0,a.jsx)(n.code,{children:"hmac_sha256"}),", ",(0,a.jsx)(n.code,{children:"hmac_sha512"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-76",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"algorithm"})})," The hasing algorithm to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"key"})})," <(optional) string> An optional key to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"polynomial"})})," An optional polynomial key to use when selecting the ",(0,a.jsx)(n.code,{children:"crc32"})," algorithm, otherwise ignored. Options are ",(0,a.jsx)(n.code,{children:"IEEE"})," (default), ",(0,a.jsx)(n.code,{children:"Castagnoli"})," and ",(0,a.jsx)(n.code,{children:"Koopman"})]}),"\n",(0,a.jsx)(n.h4,{id:"examples-135",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.h1 = this.value.hash("sha1").encode("hex")\nroot.h2 = this.value.hash("hmac_sha1","static-key").encode("hex")\n\n# In: {"value":"hello world"}\n# Out: {"h1":"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed","h2":"d87e5f068fa08fe90bb95bc7c8344cb809179d76"}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["The ",(0,a.jsx)(n.code,{children:"crc32"})," algorithm supports options for the polynomial."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.h1 = this.value.hash(algorithm: "crc32", polynomial: "Castagnoli").encode("hex")\nroot.h2 = this.value.hash(algorithm: "crc32", polynomial: "Koopman").encode("hex")\n\n# In: {"value":"hello world"}\n# Out: {"h1":"c99465aa","h2":"df373d3c"}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"json-web-tokens",children:"JSON Web Tokens"}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_es256",children:(0,a.jsx)(n.code,{children:"parse_jwt_es256"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with ES256. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-77",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The ES256 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-136",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_es256("""-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEGtLqIBePHmIhQcf0JLgc+F/4W/oI\ndp0Gta53G35VerNDgUUXmp78J2kfh4qLdh0XtmOMI587tCaqjvDAXfs//w==\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.GIRajP9JJbpTlqSCdNEz4qpQkRvzX4Q51YnTwVyxLDM9tKjR_a8ggHWn9CWj7KG0x8J56OWtmUxn112SRTZVhQ"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_es384",children:(0,a.jsx)(n.code,{children:"parse_jwt_es384"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with ES384. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-78",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The ES384 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-137",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_es384("""-----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAERoz74/B6SwmLhs8X7CWhnrWyRrB13AuU\n8OYeqy0qHRu9JWNw8NIavqpTmu6XPT4xcFanYjq8FbeuM11eq06C52mNmS4LLwzA\n2imlFEgn85bvJoC3bnkuq4mQjwt9VxdH\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.H2HBSlrvQBaov2tdreGonbBexxtQB-xzaPL4-tNQZ6TVh7VH8VBcSwcWHYa1lBAHmdsKOFcB2Wk0SB7QWeGT3ptSgr-_EhDMaZ8bA5spgdpq5DsKfaKHrd7DbbQlmxNq"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_es512",children:(0,a.jsx)(n.code,{children:"parse_jwt_es512"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with ES512. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-79",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The ES512 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-138",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_es512("""-----BEGIN PUBLIC KEY-----\nMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAkHLdts9P56fFkyhpYQ31M/Stwt3w\nvpaxhlfudxnXgTO1IP4RQRgryRxZ19EUzhvWDcG3GQIckoNMY5PelsnCGnIBT2Xh\n9NQkjWF5K6xS4upFsbGSAwQ+GIyyk5IPJ2LHgOyMSCVh5gRZXV3CZLzXujx/umC9\nUeYyTt05zRRWuD+p5bY=\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.ACrpLuU7TKpAnncDCpN9m85nkL55MJ45NFOBl6-nEXmNT1eIxWjiP4pwWVbFH9et_BgN14119jbL_KqEJInPYc9nAXC6dDLq0aBU-dalvNl4-O5YWpP43-Y-TBGAsWnbMTrchILJ4-AEiICe73Ck5yWPleKg9c3LtkEFWfGs7BoPRguZ"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_hs256",children:(0,a.jsx)(n.code,{children:"parse_jwt_hs256"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with HS256. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-80",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The HS256 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-139",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_hs256("""dont-tell-anyone""")\n\n# In: {"signed":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.YwXOM8v3gHVWcQRRRQc_zDlhmLnM62fwhFYGpiA0J1A"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_hs384",children:(0,a.jsx)(n.code,{children:"parse_jwt_hs384"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with HS384. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-81",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The HS384 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-140",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_hs384("""dont-tell-anyone""")\n\n# In: {"signed":"eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.2Y8rf_ijwN4t8hOGGViON_GrirLkCQVbCOuax6EoZ3nluX0tCGezcJxbctlIfsQ2"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_hs512",children:(0,a.jsx)(n.code,{children:"parse_jwt_hs512"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with HS512. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-82",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The HS512 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-141",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_hs512("""dont-tell-anyone""")\n\n# In: {"signed":"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.utRb0urG6LGGyranZJVo5Dk0Fns1QNcSUYPN0TObQ-YzsGGB8jrxHwM5NAJccjJZzKectEUqmmKCaETZvuX4Fg"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_rs256",children:(0,a.jsx)(n.code,{children:"parse_jwt_rs256"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with RS256. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-83",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The RS256 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-142",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_rs256("""-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/ibN8r68pLMR6gRzg4S\n8v8l6Q7yi8qURjkEbcNeM1rkokC7xh0I4JVTwxYSVv/JIW8qJdyspl5NIfuAVi32\nWfKvSAs+NIs+DMsNPYw3yuQals4AX8hith1YDvYpr8SD44jxhz/DR9lYKZFGhXGB\n+7NqQ7vpTWp3BceLYocazWJgusZt7CgecIq57ycM5hjM93BvlrUJ8nQ1a46wfL/8\nCy4P0et70hzZrsjjN41KFhKY0iUwlyU41yEiDHvHDDsTMBxAZosWjSREGfJL6Mfp\nXOInTHs/Gg6DZMkbxjQu6L06EdJ+Q/NwglJdAXM7Zo9rNELqRig6DdvG5JesdMsO\n+QIDAQAB\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.b0lH3jEupZZ4zoaly4Y_GCvu94HH6UKdKY96zfGNsIkPZpQLHIkZ7jMWlLlNOAd8qXlsBGP_i8H2qCKI4zlWJBGyPZgxXDzNRPVrTDfFpn4t4nBcA1WK2-ntXP3ehQxsaHcQU8Z_nsogId7Pme5iJRnoHWEnWtbwz5DLSXL3ZZNnRdrHM9MdI7QSDz9mojKDCaMpGN9sG7Xl-tGdBp1XzXuUOzG8S03mtZ1IgVR1uiBL2N6oohHIAunk8DIAmNWI-zgycTgzUGU7mvPkKH43qO8Ua1-13tCUBKKa8VxcotZ67Mxm1QAvBGoDnTKwWMwghLzs6d6WViXQg6eWlJcpBA"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_rs384",children:(0,a.jsx)(n.code,{children:"parse_jwt_rs384"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with RS384. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-84",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The RS384 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-143",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_rs384("""-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/ibN8r68pLMR6gRzg4S\n8v8l6Q7yi8qURjkEbcNeM1rkokC7xh0I4JVTwxYSVv/JIW8qJdyspl5NIfuAVi32\nWfKvSAs+NIs+DMsNPYw3yuQals4AX8hith1YDvYpr8SD44jxhz/DR9lYKZFGhXGB\n+7NqQ7vpTWp3BceLYocazWJgusZt7CgecIq57ycM5hjM93BvlrUJ8nQ1a46wfL/8\nCy4P0et70hzZrsjjN41KFhKY0iUwlyU41yEiDHvHDDsTMBxAZosWjSREGfJL6Mfp\nXOInTHs/Gg6DZMkbxjQu6L06EdJ+Q/NwglJdAXM7Zo9rNELqRig6DdvG5JesdMsO\n+QIDAQAB\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.orcXYBcjVE5DU7mvq4KKWFfNdXR4nEY_xupzWoETRpYmQZIozlZnM_nHxEk2dySvpXlAzVm7kgOPK2RFtGlOVaNRIa3x-pMMr-bhZTno4L8Hl4sYxOks3bWtjK7wql4uqUbqThSJB12psAXw2-S-I_FMngOPGIn4jDT9b802ottJSvTpXcy0-eKTjrV2PSkRRu-EYJh0CJZW55MNhqlt6kCGhAXfbhNazN3ASX-dmpd_JixyBKphrngr_zRA-FCn_Xf3QQDA-5INopb4Yp5QiJ7UxVqQEKI80X_JvJqz9WE1qiAw8pq5-xTen1t7zTP-HT1NbbD3kltcNa3G8acmNg"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_rs512",children:(0,a.jsx)(n.code,{children:"parse_jwt_rs512"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with RS512. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-85",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The RS512 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-144",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_rs512("""-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/ibN8r68pLMR6gRzg4S\n8v8l6Q7yi8qURjkEbcNeM1rkokC7xh0I4JVTwxYSVv/JIW8qJdyspl5NIfuAVi32\nWfKvSAs+NIs+DMsNPYw3yuQals4AX8hith1YDvYpr8SD44jxhz/DR9lYKZFGhXGB\n+7NqQ7vpTWp3BceLYocazWJgusZt7CgecIq57ycM5hjM93BvlrUJ8nQ1a46wfL/8\nCy4P0et70hzZrsjjN41KFhKY0iUwlyU41yEiDHvHDDsTMBxAZosWjSREGfJL6Mfp\nXOInTHs/Gg6DZMkbxjQu6L06EdJ+Q/NwglJdAXM7Zo9rNELqRig6DdvG5JesdMsO\n+QIDAQAB\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.rsMp_X5HMrUqKnZJIxo27aAoscovRA6SSQYR9rq7pifIj0YHXxMyNyOBDGnvVALHKTi25VUGHpfNUW0VVMmae0A4t_ObNU6hVZHguWvetKZZq4FZpW1lgWHCMqgPGwT5_uOqwYCH6r8tJuZT3pqXeL0CY4putb1AN2w6CVp620nh3l8d3XWb4jaifycd_4CEVCqHuWDmohfug4VhmoVKlIXZkYoAQowgHlozATDssBSWdYtv107Wd2AzEoiXPu6e3pflsuXULlyqQnS4ELEKPYThFLafh1NqvZDPddqozcPZ-iODBW-xf3A4DYDdivnMYLrh73AZOGHexxu8ay6nDA"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_es256",children:(0,a.jsx)(n.code,{children:"sign_jwt_es256"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using ES256."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-86",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-145",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_es256("""-----BEGIN EC PRIVATE KEY-----\n... signature data ...\n-----END EC PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.-8LrOdkEiv_44ADWW08lpbq41ZmHCel58NMORPq1q4Dyw0zFhqDVLrRoSvCvuyyvgXAFb9IHfR-9MlJ_2ShA9A"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_es384",children:(0,a.jsx)(n.code,{children:"sign_jwt_es384"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using ES384."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-87",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-146",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_es384("""-----BEGIN EC PRIVATE KEY-----\n... signature data ...\n-----END EC PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.8FmTKH08dl7dyxrNu0rmvhegiIBCy-O9cddGco2e9lpZtgv5mS5qHgPkgBC5eRw1d7SRJsHwHZeehzdqT5Ba7aZJIhz9ds0sn37YQ60L7jT0j2gxCzccrt4kECHnUnLw"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_es512",children:(0,a.jsx)(n.code,{children:"sign_jwt_es512"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using ES512."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-88",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-147",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_es512("""-----BEGIN EC PRIVATE KEY-----\n... signature data ...\n-----END EC PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.AQbEWymoRZxDJEJtKSFFG2k2VbDCTYSuBwAZyMqexCspr3If8aERTVGif8HXG3S7TzMBCCzxkcKr3eIU441l3DlpAMNfQbkcOlBqMvNBn-CX481WyKf3K5rFHQ-6wRonz05aIsWAxCDvAozI_9J0OWllxdQ2MBAuTPbPJ38OqXsYkCQs"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_hs256",children:(0,a.jsx)(n.code,{children:"sign_jwt_hs256"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using HS256."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-89",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-148",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_hs256("""dont-tell-anyone""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.hUl-nngPMY_3h9vveWJUPsCcO5PeL6k9hWLnMYeFbFQ"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_hs384",children:(0,a.jsx)(n.code,{children:"sign_jwt_hs384"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using HS384."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-90",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-149",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_hs384("""dont-tell-anyone""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.zGYLr83aToon1efUNq-hw7XgT20lPvZb8sYei8x6S6mpHwb433SJdXJXx0Oio8AZ"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_hs512",children:(0,a.jsx)(n.code,{children:"sign_jwt_hs512"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using HS512."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-91",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-150",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_hs512("""dont-tell-anyone""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.zBNR9o_6EDwXXKkpKLNJhG26j8Dc-mV-YahBwmEdCrmiWt5les8I9rgmNlWIowpq6Yxs4kLNAdFhqoRz3NXT3w"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_rs256",children:(0,a.jsx)(n.code,{children:"sign_jwt_rs256"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using RS256."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.18.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-92",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-151",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_rs256("""-----BEGIN RSA PRIVATE KEY-----\n... signature data ...\n-----END RSA PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.b0lH3jEupZZ4zoaly4Y_GCvu94HH6UKdKY96zfGNsIkPZpQLHIkZ7jMWlLlNOAd8qXlsBGP_i8H2qCKI4zlWJBGyPZgxXDzNRPVrTDfFpn4t4nBcA1WK2-ntXP3ehQxsaHcQU8Z_nsogId7Pme5iJRnoHWEnWtbwz5DLSXL3ZZNnRdrHM9MdI7QSDz9mojKDCaMpGN9sG7Xl-tGdBp1XzXuUOzG8S03mtZ1IgVR1uiBL2N6oohHIAunk8DIAmNWI-zgycTgzUGU7mvPkKH43qO8Ua1-13tCUBKKa8VxcotZ67Mxm1QAvBGoDnTKwWMwghLzs6d6WViXQg6eWlJcpBA"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_rs384",children:(0,a.jsx)(n.code,{children:"sign_jwt_rs384"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using RS384."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.18.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-93",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-152",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_rs384("""-----BEGIN RSA PRIVATE KEY-----\n... signature data ...\n-----END RSA PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.orcXYBcjVE5DU7mvq4KKWFfNdXR4nEY_xupzWoETRpYmQZIozlZnM_nHxEk2dySvpXlAzVm7kgOPK2RFtGlOVaNRIa3x-pMMr-bhZTno4L8Hl4sYxOks3bWtjK7wql4uqUbqThSJB12psAXw2-S-I_FMngOPGIn4jDT9b802ottJSvTpXcy0-eKTjrV2PSkRRu-EYJh0CJZW55MNhqlt6kCGhAXfbhNazN3ASX-dmpd_JixyBKphrngr_zRA-FCn_Xf3QQDA-5INopb4Yp5QiJ7UxVqQEKI80X_JvJqz9WE1qiAw8pq5-xTen1t7zTP-HT1NbbD3kltcNa3G8acmNg"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_rs512",children:(0,a.jsx)(n.code,{children:"sign_jwt_rs512"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using RS512."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.18.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-94",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-153",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_rs512("""-----BEGIN RSA PRIVATE KEY-----\n... signature data ...\n-----END RSA PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.rsMp_X5HMrUqKnZJIxo27aAoscovRA6SSQYR9rq7pifIj0YHXxMyNyOBDGnvVALHKTi25VUGHpfNUW0VVMmae0A4t_ObNU6hVZHguWvetKZZq4FZpW1lgWHCMqgPGwT5_uOqwYCH6r8tJuZT3pqXeL0CY4putb1AN2w6CVp620nh3l8d3XWb4jaifycd_4CEVCqHuWDmohfug4VhmoVKlIXZkYoAQowgHlozATDssBSWdYtv107Wd2AzEoiXPu6e3pflsuXULlyqQnS4ELEKPYThFLafh1NqvZDPddqozcPZ-iODBW-xf3A4DYDdivnMYLrh73AZOGHexxu8ay6nDA"}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"geoip",children:"GeoIP"}),"\n",(0,a.jsx)(n.h3,{id:"geoip_anonymous_ip",children:(0,a.jsx)(n.code,{children:"geoip_anonymous_ip"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the anonymous IP associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-95",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_asn",children:(0,a.jsx)(n.code,{children:"geoip_asn"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the ASN associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-96",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_city",children:(0,a.jsx)(n.code,{children:"geoip_city"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the city associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-97",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_connection_type",children:(0,a.jsx)(n.code,{children:"geoip_connection_type"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the connection type associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-98",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_country",children:(0,a.jsx)(n.code,{children:"geoip_country"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the country associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-99",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_domain",children:(0,a.jsx)(n.code,{children:"geoip_domain"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the domain associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-100",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_enterprise",children:(0,a.jsx)(n.code,{children:"geoip_enterprise"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the enterprise associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-101",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_isp",children:(0,a.jsx)(n.code,{children:"geoip_isp"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the ISP associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-102",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h2,{id:"deprecated",children:"Deprecated"}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp",children:(0,a.jsx)(n.code,{children:"format_timestamp"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to format a timestamp value as a string according to a specified format, or RFC 3339 by default. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format."}),"\n",(0,a.jsxs)(n.p,{children:["The output format is defined by showing how the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006, would be displayed if it were the value. For an alternative way to specify formats check out the ",(0,a.jsx)(n.a,{href:"#ts_strftime",children:(0,a.jsx)(n.code,{children:"ts_strftime"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-103",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The output format to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"tz"})})," <(optional) string> An optional timezone to use, otherwise the timezone of the input string is used, or in the case of unix timestamps the local timezone is used."]}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp_strftime",children:(0,a.jsx)(n.code,{children:"format_timestamp_strftime"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to format a timestamp value as a string according to a specified strftime-compatible format. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-104",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The output format to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"tz"})})," <(optional) string> An optional timezone to use, otherwise the timezone of the input string is used."]}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp_unix",children:(0,a.jsx)(n.code,{children:"format_timestamp_unix"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp_unix_micro",children:(0,a.jsx)(n.code,{children:"format_timestamp_unix_micro"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with microsecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp_unix_milli",children:(0,a.jsx)(n.code,{children:"format_timestamp_unix_milli"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with millisecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp_unix_nano",children:(0,a.jsx)(n.code,{children:"format_timestamp_unix_nano"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with nanosecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h3,{id:"parse_timestamp",children:(0,a.jsx)(n.code,{children:"parse_timestamp"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to parse a string as a timestamp following a specified format and outputs a timestamp, which can then be fed into methods such as ",(0,a.jsx)(n.a,{href:"#ts_format",children:(0,a.jsx)(n.code,{children:"ts_format"})}),"."]}),"\n",(0,a.jsxs)(n.p,{children:["The input format is defined by showing how the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006, would be displayed if it were the value. For an alternative way to specify formats check out the ",(0,a.jsx)(n.a,{href:"#ts_strptime",children:(0,a.jsx)(n.code,{children:"ts_strptime"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-105",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The format of the target string."]}),"\n",(0,a.jsx)(n.h3,{id:"parse_timestamp_strptime",children:(0,a.jsx)(n.code,{children:"parse_timestamp_strptime"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to parse a string as a timestamp following a specified strptime-compatible format and outputs a timestamp, which can then be fed into ",(0,a.jsx)(n.a,{href:"#ts_format",children:(0,a.jsx)(n.code,{children:"ts_format"})}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-106",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The format of the target string."]})]})}function h(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(c,{...e})}):c(e)}},5162:function(e,n,s){s.d(n,{Z:function(){return t}});s(7294);var a=s(6010),r={tabItem:"tabItem_Ymn6"},i=s(5893);function t(e){let{children:n,hidden:s,className:t}=e;return(0,i.jsx)("div",{role:"tabpanel",className:(0,a.Z)(r.tabItem,t),hidden:s,children:n})}},4866:function(e,n,s){s.d(n,{Z:function(){return y}});var a=s(7294),r=s(6010),i=s(2466),t=s(6550),l=s(469),o=s(1980),d=s(7392),c=s(12);function h(e){var n,s;return null!=(n=null==(s=a.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,a.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:s.filter(Boolean))?n:[]}function m(e){const{values:n,children:s}=e;return(0,a.useMemo)((()=>{const e=null!=n?n:function(e){return h(e).map((e=>{let{props:{value:n,label:s,attributes:a,default:r}}=e;return{value:n,label:s,attributes:a,default:r}}))}(s);return function(e){const n=(0,d.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error('Docusaurus error: Duplicate values "'+n.map((e=>e.value)).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[n,s])}function u(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function p(e){let{queryString:n=!1,groupId:s}=e;const r=(0,t.k6)(),i=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=s?s:null}({queryString:n,groupId:s});return[(0,o._X)(i),(0,a.useCallback)((e=>{if(!i)return;const n=new URLSearchParams(r.location.search);n.set(i,e),r.replace({...r.location,search:n.toString()})}),[i,r])]}function x(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,i=m(e),[t,o]=(0,a.useState)((()=>function(e){var n;let{defaultValue:s,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(s){if(!u({value:s,tabValues:a}))throw new Error('Docusaurus error: The has a defaultValue "'+s+'" but none of its children has the corresponding value. Available values are: '+a.map((e=>e.value)).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return s}const r=null!=(n=a.find((e=>e.default)))?n:a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:i}))),[d,h]=p({queryString:s,groupId:r}),[x,j]=function(e){let{groupId:n}=e;const s=function(e){return e?"docusaurus.tab."+e:null}(n),[r,i]=(0,c.Nk)(s);return[r,(0,a.useCallback)((e=>{s&&i.set(e)}),[s,i])]}({groupId:r}),f=(()=>{const e=null!=d?d:x;return u({value:e,tabValues:i})?e:null})();(0,l.Z)((()=>{f&&o(f)}),[f]);return{selectedValue:t,selectValue:(0,a.useCallback)((e=>{if(!u({value:e,tabValues:i}))throw new Error("Can't select invalid tab value="+e);o(e),h(e),j(e)}),[h,j,i]),tabValues:i}}var j=s(2389),f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"},g=s(5893);function v(e){let{className:n,block:s,selectedValue:a,selectValue:t,tabValues:l}=e;const o=[],{blockElementScrollPositionUntilNextRender:d}=(0,i.o5)(),c=e=>{const n=e.currentTarget,s=o.indexOf(n),r=l[s].value;r!==a&&(d(n),t(r))},h=e=>{var n;let s=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{var a;const n=o.indexOf(e.currentTarget)+1;s=null!=(a=o[n])?a:o[0];break}case"ArrowLeft":{var r;const n=o.indexOf(e.currentTarget)-1;s=null!=(r=o[n])?r:o[o.length-1];break}}null==(n=s)||n.focus()};return(0,g.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.Z)("tabs",{"tabs--block":s},n),children:l.map((e=>{let{value:n,label:s,attributes:i}=e;return(0,g.jsx)("li",{role:"tab",tabIndex:a===n?0:-1,"aria-selected":a===n,ref:e=>o.push(e),onKeyDown:h,onClick:c,...i,className:(0,r.Z)("tabs__item",f.tabItem,null==i?void 0:i.className,{"tabs__item--active":a===n}),children:null!=s?s:n},n)}))})}function b(e){let{lazy:n,children:s,selectedValue:r}=e;const i=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=i.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return(0,g.jsx)("div",{className:"margin-top--md",children:i.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r})))})}function _(e){const n=x(e);return(0,g.jsxs)("div",{className:(0,r.Z)("tabs-container",f.tabList),children:[(0,g.jsx)(v,{...e,...n}),(0,g.jsx)(b,{...e,...n})]})}function y(e){const n=(0,j.Z)();return(0,g.jsx)(_,{...e,children:h(e.children)},String(n))}},1151:function(e,n,s){s.d(n,{Z:function(){return l},a:function(){return t}});var a=s(7294);const r={},i=a.createContext(r);function t(e){const n=a.useContext(i);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:t(e.components),a.createElement(i.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
+"use strict";(self.webpackChunkbento=self.webpackChunkbento||[]).push([[4561],{5968:function(e,n,s){s.r(n),s.d(n,{assets:function(){return o},contentTitle:function(){return t},default:function(){return h},frontMatter:function(){return i},metadata:function(){return l},toc:function(){return d}});var a=s(5893),r=s(1151);s(4866),s(5162);const i={title:"Bloblang Methods",sidebar_label:"Methods",description:"A list of Bloblang methods"},t=void 0,l={id:"guides/bloblang/methods",title:"Bloblang Methods",description:"A list of Bloblang methods",source:"@site/docs/guides/bloblang/methods.md",sourceDirName:"guides/bloblang",slug:"/guides/bloblang/methods",permalink:"/bento/docs/guides/bloblang/methods",draft:!1,unlisted:!1,editUrl:"https://github.com/warpstreamlabs/bento/edit/main/website/docs/guides/bloblang/methods.md",tags:[],version:"current",frontMatter:{title:"Bloblang Methods",sidebar_label:"Methods",description:"A list of Bloblang methods"},sidebar:"docs",previous:{title:"Functions",permalink:"/bento/docs/guides/bloblang/functions"},next:{title:"Arithmetic",permalink:"/bento/docs/guides/bloblang/arithmetic"}},o={},d=[{value:"General",id:"general",level:2},{value:"apply",id:"apply",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Examples",id:"examples",level:4},{value:"catch",id:"catch",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Examples",id:"examples-1",level:4},{value:"exists",id:"exists",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Examples",id:"examples-2",level:4},{value:"from",id:"from",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"from_all",id:"from_all",level:3},{value:"Examples",id:"examples-4",level:4},{value:"or",id:"or",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Examples",id:"examples-5",level:4},{value:"String Manipulation",id:"string-manipulation",level:2},{value:"capitalize",id:"capitalize",level:3},{value:"Examples",id:"examples-6",level:4},{value:"compare_argon2",id:"compare_argon2",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Examples",id:"examples-7",level:4},{value:"compare_bcrypt",id:"compare_bcrypt",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Examples",id:"examples-8",level:4},{value:"contains",id:"contains",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Examples",id:"examples-9",level:4},{value:"escape_html",id:"escape_html",level:3},{value:"Examples",id:"examples-10",level:4},{value:"escape_url_query",id:"escape_url_query",level:3},{value:"Examples",id:"examples-11",level:4},{value:"filepath_join",id:"filepath_join",level:3},{value:"Examples",id:"examples-12",level:4},{value:"filepath_split",id:"filepath_split",level:3},{value:"Examples",id:"examples-13",level:4},{value:"format",id:"format",level:3},{value:"Examples",id:"examples-14",level:4},{value:"has_prefix",id:"has_prefix",level:3},{value:"Parameters",id:"parameters-8",level:4},{value:"Examples",id:"examples-15",level:4},{value:"has_suffix",id:"has_suffix",level:3},{value:"Parameters",id:"parameters-9",level:4},{value:"Examples",id:"examples-16",level:4},{value:"index_of",id:"index_of",level:3},{value:"Parameters",id:"parameters-10",level:4},{value:"Examples",id:"examples-17",level:4},{value:"length",id:"length",level:3},{value:"Examples",id:"examples-18",level:4},{value:"lowercase",id:"lowercase",level:3},{value:"Examples",id:"examples-19",level:4},{value:"quote",id:"quote",level:3},{value:"Examples",id:"examples-20",level:4},{value:"replace_all",id:"replace_all",level:3},{value:"Parameters",id:"parameters-11",level:4},{value:"Examples",id:"examples-21",level:4},{value:"replace_all_many",id:"replace_all_many",level:3},{value:"Parameters",id:"parameters-12",level:4},{value:"Examples",id:"examples-22",level:4},{value:"reverse",id:"reverse",level:3},{value:"Examples",id:"examples-23",level:4},{value:"slice",id:"slice",level:3},{value:"Parameters",id:"parameters-13",level:4},{value:"Examples",id:"examples-24",level:4},{value:"slug",id:"slug",level:3},{value:"Parameters",id:"parameters-14",level:4},{value:"Examples",id:"examples-25",level:4},{value:"split",id:"split",level:3},{value:"Parameters",id:"parameters-15",level:4},{value:"Examples",id:"examples-26",level:4},{value:"strip_html",id:"strip_html",level:3},{value:"Parameters",id:"parameters-16",level:4},{value:"Examples",id:"examples-27",level:4},{value:"trim",id:"trim",level:3},{value:"Parameters",id:"parameters-17",level:4},{value:"Examples",id:"examples-28",level:4},{value:"trim_prefix",id:"trim_prefix",level:3},{value:"Parameters",id:"parameters-18",level:4},{value:"Examples",id:"examples-29",level:4},{value:"trim_suffix",id:"trim_suffix",level:3},{value:"Parameters",id:"parameters-19",level:4},{value:"Examples",id:"examples-30",level:4},{value:"unescape_html",id:"unescape_html",level:3},{value:"Examples",id:"examples-31",level:4},{value:"unescape_url_query",id:"unescape_url_query",level:3},{value:"Examples",id:"examples-32",level:4},{value:"unquote",id:"unquote",level:3},{value:"Examples",id:"examples-33",level:4},{value:"uppercase",id:"uppercase",level:3},{value:"Examples",id:"examples-34",level:4},{value:"Regular Expressions",id:"regular-expressions",level:2},{value:"re_find_all",id:"re_find_all",level:3},{value:"Parameters",id:"parameters-20",level:4},{value:"Examples",id:"examples-35",level:4},{value:"re_find_all_object",id:"re_find_all_object",level:3},{value:"Parameters",id:"parameters-21",level:4},{value:"Examples",id:"examples-36",level:4},{value:"re_find_all_submatch",id:"re_find_all_submatch",level:3},{value:"Parameters",id:"parameters-22",level:4},{value:"Examples",id:"examples-37",level:4},{value:"re_find_object",id:"re_find_object",level:3},{value:"Parameters",id:"parameters-23",level:4},{value:"Examples",id:"examples-38",level:4},{value:"re_match",id:"re_match",level:3},{value:"Parameters",id:"parameters-24",level:4},{value:"Examples",id:"examples-39",level:4},{value:"re_replace_all",id:"re_replace_all",level:3},{value:"Parameters",id:"parameters-25",level:4},{value:"Examples",id:"examples-40",level:4},{value:"Number Manipulation",id:"number-manipulation",level:2},{value:"abs",id:"abs",level:3},{value:"Examples",id:"examples-41",level:4},{value:"ceil",id:"ceil",level:3},{value:"Examples",id:"examples-42",level:4},{value:"float32",id:"float32",level:3},{value:"Examples",id:"examples-43",level:4},{value:"float64",id:"float64",level:3},{value:"Examples",id:"examples-44",level:4},{value:"floor",id:"floor",level:3},{value:"Examples",id:"examples-45",level:4},{value:"int16",id:"int16",level:3},{value:"Examples",id:"examples-46",level:4},{value:"int32",id:"int32",level:3},{value:"Examples",id:"examples-47",level:4},{value:"int64",id:"int64",level:3},{value:"Examples",id:"examples-48",level:4},{value:"int8",id:"int8",level:3},{value:"Examples",id:"examples-49",level:4},{value:"log",id:"log",level:3},{value:"Examples",id:"examples-50",level:4},{value:"log10",id:"log10",level:3},{value:"Examples",id:"examples-51",level:4},{value:"max",id:"max",level:3},{value:"Examples",id:"examples-52",level:4},{value:"min",id:"min",level:3},{value:"Examples",id:"examples-53",level:4},{value:"round",id:"round",level:3},{value:"Examples",id:"examples-54",level:4},{value:"uint16",id:"uint16",level:3},{value:"Examples",id:"examples-55",level:4},{value:"uint32",id:"uint32",level:3},{value:"Examples",id:"examples-56",level:4},{value:"uint64",id:"uint64",level:3},{value:"Examples",id:"examples-57",level:4},{value:"uint8",id:"uint8",level:3},{value:"Examples",id:"examples-58",level:4},{value:"Timestamp Manipulation",id:"timestamp-manipulation",level:2},{value:"parse_duration",id:"parse_duration",level:3},{value:"Examples",id:"examples-59",level:4},{value:"parse_duration_iso8601",id:"parse_duration_iso8601",level:3},{value:"Examples",id:"examples-60",level:4},{value:"ts_add_iso8601",id:"ts_add_iso8601",level:3},{value:"Parameters",id:"parameters-26",level:4},{value:"ts_format",id:"ts_format",level:3},{value:"Parameters",id:"parameters-27",level:4},{value:"Examples",id:"examples-61",level:4},{value:"ts_parse",id:"ts_parse",level:3},{value:"Parameters",id:"parameters-28",level:4},{value:"Examples",id:"examples-62",level:4},{value:"ts_round",id:"ts_round",level:3},{value:"Parameters",id:"parameters-29",level:4},{value:"Examples",id:"examples-63",level:4},{value:"ts_strftime",id:"ts_strftime",level:3},{value:"Parameters",id:"parameters-30",level:4},{value:"Examples",id:"examples-64",level:4},{value:"ts_strptime",id:"ts_strptime",level:3},{value:"Parameters",id:"parameters-31",level:4},{value:"Examples",id:"examples-65",level:4},{value:"ts_sub",id:"ts_sub",level:3},{value:"Parameters",id:"parameters-32",level:4},{value:"Examples",id:"examples-66",level:4},{value:"ts_sub_iso8601",id:"ts_sub_iso8601",level:3},{value:"Parameters",id:"parameters-33",level:4},{value:"ts_tz",id:"ts_tz",level:3},{value:"Parameters",id:"parameters-34",level:4},{value:"Examples",id:"examples-67",level:4},{value:"ts_unix",id:"ts_unix",level:3},{value:"Examples",id:"examples-68",level:4},{value:"ts_unix_micro",id:"ts_unix_micro",level:3},{value:"Examples",id:"examples-69",level:4},{value:"ts_unix_milli",id:"ts_unix_milli",level:3},{value:"Examples",id:"examples-70",level:4},{value:"ts_unix_nano",id:"ts_unix_nano",level:3},{value:"Examples",id:"examples-71",level:4},{value:"Type Coercion",id:"type-coercion",level:2},{value:"bool",id:"bool",level:3},{value:"Parameters",id:"parameters-35",level:4},{value:"Examples",id:"examples-72",level:4},{value:"bytes",id:"bytes",level:3},{value:"Examples",id:"examples-73",level:4},{value:"not_empty",id:"not_empty",level:3},{value:"Examples",id:"examples-74",level:4},{value:"not_null",id:"not_null",level:3},{value:"Examples",id:"examples-75",level:4},{value:"number",id:"number",level:3},{value:"Parameters",id:"parameters-36",level:4},{value:"Examples",id:"examples-76",level:4},{value:"string",id:"string",level:3},{value:"Examples",id:"examples-77",level:4},{value:"type",id:"type",level:3},{value:"Examples",id:"examples-78",level:4},{value:"Object & Array Manipulation",id:"object--array-manipulation",level:2},{value:"all",id:"all",level:3},{value:"Parameters",id:"parameters-37",level:4},{value:"Examples",id:"examples-79",level:4},{value:"any",id:"any",level:3},{value:"Parameters",id:"parameters-38",level:4},{value:"Examples",id:"examples-80",level:4},{value:"append",id:"append",level:3},{value:"Examples",id:"examples-81",level:4},{value:"assign",id:"assign",level:3},{value:"Parameters",id:"parameters-39",level:4},{value:"Examples",id:"examples-82",level:4},{value:"collapse",id:"collapse",level:3},{value:"Parameters",id:"parameters-40",level:4},{value:"Examples",id:"examples-83",level:4},{value:"concat",id:"concat",level:3},{value:"Examples",id:"examples-84",level:4},{value:"contains",id:"contains-1",level:3},{value:"Parameters",id:"parameters-41",level:4},{value:"Examples",id:"examples-85",level:4},{value:"diff",id:"diff",level:3},{value:"Parameters",id:"parameters-42",level:4},{value:"enumerated",id:"enumerated",level:3},{value:"Examples",id:"examples-86",level:4},{value:"explode",id:"explode",level:3},{value:"Parameters",id:"parameters-43",level:4},{value:"Examples",id:"examples-87",level:4},{value:"On arrays",id:"on-arrays",level:5},{value:"On objects",id:"on-objects",level:5},{value:"filter",id:"filter",level:3},{value:"Parameters",id:"parameters-44",level:4},{value:"Examples",id:"examples-88",level:4},{value:"On objects",id:"on-objects-1",level:5},{value:"find",id:"find",level:3},{value:"Parameters",id:"parameters-45",level:4},{value:"Examples",id:"examples-89",level:4},{value:"find_all",id:"find_all",level:3},{value:"Parameters",id:"parameters-46",level:4},{value:"Examples",id:"examples-90",level:4},{value:"find_all_by",id:"find_all_by",level:3},{value:"Parameters",id:"parameters-47",level:4},{value:"Examples",id:"examples-91",level:4},{value:"find_by",id:"find_by",level:3},{value:"Parameters",id:"parameters-48",level:4},{value:"Examples",id:"examples-92",level:4},{value:"flatten",id:"flatten",level:3},{value:"Examples",id:"examples-93",level:4},{value:"fold",id:"fold",level:3},{value:"Parameters",id:"parameters-49",level:4},{value:"Examples",id:"examples-94",level:4},{value:"get",id:"get",level:3},{value:"Parameters",id:"parameters-50",level:4},{value:"Examples",id:"examples-95",level:4},{value:"index",id:"index",level:3},{value:"Parameters",id:"parameters-51",level:4},{value:"Examples",id:"examples-96",level:4},{value:"join",id:"join",level:3},{value:"Parameters",id:"parameters-52",level:4},{value:"Examples",id:"examples-97",level:4},{value:"json_path",id:"json_path",level:3},{value:"Parameters",id:"parameters-53",level:4},{value:"Examples",id:"examples-98",level:4},{value:"json_schema",id:"json_schema",level:3},{value:"Parameters",id:"parameters-54",level:4},{value:"Examples",id:"examples-99",level:4},{value:"key_values",id:"key_values",level:3},{value:"Examples",id:"examples-100",level:4},{value:"keys",id:"keys",level:3},{value:"Examples",id:"examples-101",level:4},{value:"length",id:"length-1",level:3},{value:"Examples",id:"examples-102",level:4},{value:"map_each",id:"map_each",level:3},{value:"Parameters",id:"parameters-55",level:4},{value:"Examples",id:"examples-103",level:4},{value:"On arrays",id:"on-arrays-1",level:5},{value:"On objects",id:"on-objects-2",level:5},{value:"map_each_key",id:"map_each_key",level:3},{value:"Parameters",id:"parameters-56",level:4},{value:"Examples",id:"examples-104",level:4},{value:"merge",id:"merge",level:3},{value:"Parameters",id:"parameters-57",level:4},{value:"Examples",id:"examples-105",level:4},{value:"patch",id:"patch",level:3},{value:"Parameters",id:"parameters-58",level:4},{value:"slice",id:"slice-1",level:3},{value:"Parameters",id:"parameters-59",level:4},{value:"Examples",id:"examples-106",level:4},{value:"sort",id:"sort",level:3},{value:"Parameters",id:"parameters-60",level:4},{value:"Examples",id:"examples-107",level:4},{value:"sort_by",id:"sort_by",level:3},{value:"Parameters",id:"parameters-61",level:4},{value:"Examples",id:"examples-108",level:4},{value:"squash",id:"squash",level:3},{value:"Examples",id:"examples-109",level:4},{value:"sum",id:"sum",level:3},{value:"Examples",id:"examples-110",level:4},{value:"unique",id:"unique",level:3},{value:"Parameters",id:"parameters-62",level:4},{value:"Examples",id:"examples-111",level:4},{value:"values",id:"values",level:3},{value:"Examples",id:"examples-112",level:4},{value:"with",id:"with",level:3},{value:"Examples",id:"examples-113",level:4},{value:"without",id:"without",level:3},{value:"Examples",id:"examples-114",level:4},{value:"zip",id:"zip",level:3},{value:"Examples",id:"examples-115",level:4},{value:"Parsing",id:"parsing",level:2},{value:"bloblang",id:"bloblang",level:3},{value:"Parameters",id:"parameters-63",level:4},{value:"Examples",id:"examples-116",level:4},{value:"format_json",id:"format_json",level:3},{value:"Parameters",id:"parameters-64",level:4},{value:"Examples",id:"examples-117",level:4},{value:"format_msgpack",id:"format_msgpack",level:3},{value:"Examples",id:"examples-118",level:4},{value:"format_xml",id:"format_xml",level:3},{value:"Parameters",id:"parameters-65",level:4},{value:"Examples",id:"examples-119",level:4},{value:"format_yaml",id:"format_yaml",level:3},{value:"Examples",id:"examples-120",level:4},{value:"parse_csv",id:"parse_csv",level:3},{value:"Parameters",id:"parameters-66",level:4},{value:"Examples",id:"examples-121",level:4},{value:"parse_form_url_encoded",id:"parse_form_url_encoded",level:3},{value:"Examples",id:"examples-122",level:4},{value:"parse_json",id:"parse_json",level:3},{value:"Parameters",id:"parameters-67",level:4},{value:"Examples",id:"examples-123",level:4},{value:"parse_msgpack",id:"parse_msgpack",level:3},{value:"Examples",id:"examples-124",level:4},{value:"parse_parquet",id:"parse_parquet",level:3},{value:"Parameters",id:"parameters-68",level:4},{value:"Examples",id:"examples-125",level:4},{value:"parse_url",id:"parse_url",level:3},{value:"Examples",id:"examples-126",level:4},{value:"parse_xml",id:"parse_xml",level:3},{value:"Parameters",id:"parameters-69",level:4},{value:"Examples",id:"examples-127",level:4},{value:"parse_yaml",id:"parse_yaml",level:3},{value:"Examples",id:"examples-128",level:4},{value:"Encoding and Encryption",id:"encoding-and-encryption",level:2},{value:"compress",id:"compress",level:3},{value:"Parameters",id:"parameters-70",level:4},{value:"Examples",id:"examples-129",level:4},{value:"decode",id:"decode",level:3},{value:"Parameters",id:"parameters-71",level:4},{value:"Examples",id:"examples-130",level:4},{value:"decompress",id:"decompress",level:3},{value:"Parameters",id:"parameters-72",level:4},{value:"Examples",id:"examples-131",level:4},{value:"decrypt_aes",id:"decrypt_aes",level:3},{value:"Parameters",id:"parameters-73",level:4},{value:"Examples",id:"examples-132",level:4},{value:"encode",id:"encode",level:3},{value:"Parameters",id:"parameters-74",level:4},{value:"Examples",id:"examples-133",level:4},{value:"encrypt_aes",id:"encrypt_aes",level:3},{value:"Parameters",id:"parameters-75",level:4},{value:"Examples",id:"examples-134",level:4},{value:"hash",id:"hash",level:3},{value:"Parameters",id:"parameters-76",level:4},{value:"Examples",id:"examples-135",level:4},{value:"JSON Web Tokens",id:"json-web-tokens",level:2},{value:"parse_jwt_es256",id:"parse_jwt_es256",level:3},{value:"Parameters",id:"parameters-77",level:4},{value:"Examples",id:"examples-136",level:4},{value:"parse_jwt_es384",id:"parse_jwt_es384",level:3},{value:"Parameters",id:"parameters-78",level:4},{value:"Examples",id:"examples-137",level:4},{value:"parse_jwt_es512",id:"parse_jwt_es512",level:3},{value:"Parameters",id:"parameters-79",level:4},{value:"Examples",id:"examples-138",level:4},{value:"parse_jwt_hs256",id:"parse_jwt_hs256",level:3},{value:"Parameters",id:"parameters-80",level:4},{value:"Examples",id:"examples-139",level:4},{value:"parse_jwt_hs384",id:"parse_jwt_hs384",level:3},{value:"Parameters",id:"parameters-81",level:4},{value:"Examples",id:"examples-140",level:4},{value:"parse_jwt_hs512",id:"parse_jwt_hs512",level:3},{value:"Parameters",id:"parameters-82",level:4},{value:"Examples",id:"examples-141",level:4},{value:"parse_jwt_rs256",id:"parse_jwt_rs256",level:3},{value:"Parameters",id:"parameters-83",level:4},{value:"Examples",id:"examples-142",level:4},{value:"parse_jwt_rs384",id:"parse_jwt_rs384",level:3},{value:"Parameters",id:"parameters-84",level:4},{value:"Examples",id:"examples-143",level:4},{value:"parse_jwt_rs512",id:"parse_jwt_rs512",level:3},{value:"Parameters",id:"parameters-85",level:4},{value:"Examples",id:"examples-144",level:4},{value:"sign_jwt_es256",id:"sign_jwt_es256",level:3},{value:"Parameters",id:"parameters-86",level:4},{value:"Examples",id:"examples-145",level:4},{value:"sign_jwt_es384",id:"sign_jwt_es384",level:3},{value:"Parameters",id:"parameters-87",level:4},{value:"Examples",id:"examples-146",level:4},{value:"sign_jwt_es512",id:"sign_jwt_es512",level:3},{value:"Parameters",id:"parameters-88",level:4},{value:"Examples",id:"examples-147",level:4},{value:"sign_jwt_hs256",id:"sign_jwt_hs256",level:3},{value:"Parameters",id:"parameters-89",level:4},{value:"Examples",id:"examples-148",level:4},{value:"sign_jwt_hs384",id:"sign_jwt_hs384",level:3},{value:"Parameters",id:"parameters-90",level:4},{value:"Examples",id:"examples-149",level:4},{value:"sign_jwt_hs512",id:"sign_jwt_hs512",level:3},{value:"Parameters",id:"parameters-91",level:4},{value:"Examples",id:"examples-150",level:4},{value:"sign_jwt_rs256",id:"sign_jwt_rs256",level:3},{value:"Parameters",id:"parameters-92",level:4},{value:"Examples",id:"examples-151",level:4},{value:"sign_jwt_rs384",id:"sign_jwt_rs384",level:3},{value:"Parameters",id:"parameters-93",level:4},{value:"Examples",id:"examples-152",level:4},{value:"sign_jwt_rs512",id:"sign_jwt_rs512",level:3},{value:"Parameters",id:"parameters-94",level:4},{value:"Examples",id:"examples-153",level:4},{value:"GeoIP",id:"geoip",level:2},{value:"geoip_anonymous_ip",id:"geoip_anonymous_ip",level:3},{value:"Parameters",id:"parameters-95",level:4},{value:"geoip_asn",id:"geoip_asn",level:3},{value:"Parameters",id:"parameters-96",level:4},{value:"geoip_city",id:"geoip_city",level:3},{value:"Parameters",id:"parameters-97",level:4},{value:"geoip_connection_type",id:"geoip_connection_type",level:3},{value:"Parameters",id:"parameters-98",level:4},{value:"geoip_country",id:"geoip_country",level:3},{value:"Parameters",id:"parameters-99",level:4},{value:"geoip_domain",id:"geoip_domain",level:3},{value:"Parameters",id:"parameters-100",level:4},{value:"geoip_enterprise",id:"geoip_enterprise",level:3},{value:"Parameters",id:"parameters-101",level:4},{value:"geoip_isp",id:"geoip_isp",level:3},{value:"Parameters",id:"parameters-102",level:4},{value:"Deprecated",id:"deprecated",level:2},{value:"format_timestamp",id:"format_timestamp",level:3},{value:"Parameters",id:"parameters-103",level:4},{value:"format_timestamp_strftime",id:"format_timestamp_strftime",level:3},{value:"Parameters",id:"parameters-104",level:4},{value:"format_timestamp_unix",id:"format_timestamp_unix",level:3},{value:"format_timestamp_unix_micro",id:"format_timestamp_unix_micro",level:3},{value:"format_timestamp_unix_milli",id:"format_timestamp_unix_milli",level:3},{value:"format_timestamp_unix_nano",id:"format_timestamp_unix_nano",level:3},{value:"parse_timestamp",id:"parse_timestamp",level:3},{value:"Parameters",id:"parameters-105",level:4},{value:"parse_timestamp_strptime",id:"parse_timestamp_strptime",level:3},{value:"Parameters",id:"parameters-106",level:4}];function c(e){const n={a:"a",admonition:"admonition",br:"br",code:"code",h2:"h2",h3:"h3",h4:"h4",h5:"h5",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.a)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.p,{children:"Methods provide most of the power in Bloblang as they allow you to augment values and can be added to any expression (including other methods):"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc.id = this.thing.id.string().catch(uuid_v4())\nroot.doc.reduced_nums = this.thing.nums.map_each(num -> if num < 10 {\n deleted()\n} else {\n num - 10\n})\nroot.has_good_taste = ["pikachu","mewtwo","magmar"].contains(this.user.fav_pokemon)\n'})}),"\n",(0,a.jsx)(n.p,{children:"Methods support both named and nameless style arguments:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_one = this.(bar | baz).trim().replace_all(old: "dog", new: "cat")\nroot.foo_two = this.(bar | baz).trim().replace_all("dog", "cat")\n'})}),"\n",(0,a.jsx)(n.h2,{id:"general",children:"General"}),"\n",(0,a.jsx)(n.h3,{id:"apply",children:(0,a.jsx)(n.code,{children:"apply"})}),"\n",(0,a.jsx)(n.p,{children:"Apply a declared mapping to a target value."}),"\n",(0,a.jsx)(n.h4,{id:"parameters",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"mapping"})})," The mapping to apply."]}),"\n",(0,a.jsx)(n.h4,{id:"examples",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'map thing {\n root.inner = this.first\n}\n\nroot.foo = this.doc.apply("thing")\n\n# In: {"doc":{"first":"hello world"}}\n# Out: {"foo":{"inner":"hello world"}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'map create_foo {\n root.name = "a foo"\n root.purpose = "to be a foo"\n}\n\nroot = this\nroot.foo = null.apply("create_foo")\n\n# In: {"id":"1234"}\n# Out: {"foo":{"name":"a foo","purpose":"to be a foo"},"id":"1234"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"catch",children:(0,a.jsx)(n.code,{children:"catch"})}),"\n",(0,a.jsx)(n.p,{children:"If the result of a target query fails (due to incorrect types, failed parsing, etc) the argument is returned instead."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-1",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"fallback"})})," A value to yield, or query to execute, if the target query fails."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-1",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root.doc.id = this.thing.id.string().catch(uuid_v4())\n"})}),"\n",(0,a.jsx)(n.p,{children:"The fallback argument can be a mapping, allowing you to capture the error string and yield structured data back."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.url = this.url.parse_url().catch(err -> {"error":err,"input":this.url})\n\n# In: {"url":"invalid % url"}\n# Out: {"url":{"error":"field `this.url`: parse \\"invalid %&\\": invalid URL escape \\"%&\\"","input":"invalid % url"}}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["When the input document is not structured attempting to reference structured fields with ",(0,a.jsx)(n.code,{children:"this"})," will result in an error. Therefore, a convenient way to delete non-structured data is with a catch."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.catch(deleted())\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {"doc":{"foo":"bar"}}\n\n# In: not structured data\n# Out: \n'})}),"\n",(0,a.jsx)(n.h3,{id:"exists",children:(0,a.jsx)(n.code,{children:"exists"})}),"\n",(0,a.jsxs)(n.p,{children:["Checks that a field, identified via a ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"dot path"}),", exists in an object."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-2",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"dot path"})," to a field."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-2",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.foo.exists("bar.baz")\n\n# In: {"foo":{"bar":{"baz":"yep, I exist"}}}\n# Out: {"result":true}\n\n# In: {"foo":{"bar":{}}}\n# Out: {"result":false}\n\n# In: {"foo":{}}\n# Out: {"result":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"from",children:(0,a.jsx)(n.code,{children:"from"})}),"\n",(0,a.jsxs)(n.p,{children:["Modifies a target query such that certain functions are executed from the perspective of another message in the batch. This allows you to mutate events based on the contents of other messages. Functions that support this behaviour are ",(0,a.jsx)(n.code,{children:"content"}),", ",(0,a.jsx)(n.code,{children:"json"})," and ",(0,a.jsx)(n.code,{children:"meta"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-3",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"index"})})," The message index to use as a perspective."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-3",children:"Examples"}),"\n",(0,a.jsxs)(n.p,{children:["For example, the following map extracts the contents of the JSON field ",(0,a.jsx)(n.code,{children:"foo"})," specifically from message index ",(0,a.jsx)(n.code,{children:"1"})," of a batch, effectively overriding the field ",(0,a.jsx)(n.code,{children:"foo"})," for all messages of a batch to that of message 1:"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this\nroot.foo = json("foo").from(1)\n'})}),"\n",(0,a.jsx)(n.h3,{id:"from_all",children:(0,a.jsx)(n.code,{children:"from_all"})}),"\n",(0,a.jsxs)(n.p,{children:["Modifies a target query such that certain functions are executed from the perspective of each message in the batch, and returns the set of results as an array. Functions that support this behaviour are ",(0,a.jsx)(n.code,{children:"content"}),", ",(0,a.jsx)(n.code,{children:"json"})," and ",(0,a.jsx)(n.code,{children:"meta"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-4",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this\nroot.foo_summed = json("foo").from_all().sum()\n'})}),"\n",(0,a.jsx)(n.h3,{id:"or",children:(0,a.jsx)(n.code,{children:"or"})}),"\n",(0,a.jsxs)(n.p,{children:["If the result of the target query fails or resolves to ",(0,a.jsx)(n.code,{children:"null"}),", returns the argument instead. This is an explicit method alternative to the coalesce pipe operator ",(0,a.jsx)(n.code,{children:"|"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-4",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"fallback"})})," A value to yield, or query to execute, if the target query fails or resolves to ",(0,a.jsx)(n.code,{children:"null"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-5",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root.doc.id = this.thing.id.or(uuid_v4())\n"})}),"\n",(0,a.jsx)(n.h2,{id:"string-manipulation",children:"String Manipulation"}),"\n",(0,a.jsx)(n.h3,{id:"capitalize",children:(0,a.jsx)(n.code,{children:"capitalize"})}),"\n",(0,a.jsx)(n.p,{children:"Takes a string value and returns a copy with all Unicode letters that begin words mapped to their Unicode title case."}),"\n",(0,a.jsx)(n.h4,{id:"examples-6",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.title = this.title.capitalize()\n\n# In: {"title":"the foo bar"}\n# Out: {"title":"The Foo Bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"compare_argon2",children:(0,a.jsx)(n.code,{children:"compare_argon2"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a string matches a hashed secret using Argon2."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-5",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"hashed_secret"})})," The hashed secret to compare with the input. This must be a fully-qualified string which encodes the Argon2 options used to generate the hash."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-7",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.match = this.secret.compare_argon2("$argon2id$v=19$m=4096,t=3,p=1$c2FsdHktbWNzYWx0ZmFjZQ$RMUMwgtS32/mbszd+ke4o4Ej1jFpYiUqY6MHWa69X7Y")\n\n# In: {"secret":"there-are-many-blobs-in-the-sea"}\n# Out: {"match":true}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.match = this.secret.compare_argon2("$argon2id$v=19$m=4096,t=3,p=1$c2FsdHktbWNzYWx0ZmFjZQ$RMUMwgtS32/mbszd+ke4o4Ej1jFpYiUqY6MHWa69X7Y")\n\n# In: {"secret":"will-i-ever-find-love"}\n# Out: {"match":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"compare_bcrypt",children:(0,a.jsx)(n.code,{children:"compare_bcrypt"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a string matches a hashed secret using bcrypt."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-6",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"hashed_secret"})})," The hashed secret value to compare with the input."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-8",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.match = this.secret.compare_bcrypt("$2y$10$Dtnt5NNzVtMCOZONT705tOcS8It6krJX8bEjnDJnwxiFKsz1C.3Ay")\n\n# In: {"secret":"there-are-many-blobs-in-the-sea"}\n# Out: {"match":true}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.match = this.secret.compare_bcrypt("$2y$10$Dtnt5NNzVtMCOZONT705tOcS8It6krJX8bEjnDJnwxiFKsz1C.3Ay")\n\n# In: {"secret":"will-i-ever-find-love"}\n# Out: {"match":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"contains",children:(0,a.jsx)(n.code,{children:"contains"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a string contains a substring and returns a boolean result."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-7",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," A value to test against elements of the target."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-9",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.has_foo = this.thing.contains("foo")\n\n# In: {"thing":"this foo that"}\n# Out: {"has_foo":true}\n\n# In: {"thing":"this bar that"}\n# Out: {"has_foo":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"escape_html",children:(0,a.jsx)(n.code,{children:"escape_html"})}),"\n",(0,a.jsxs)(n.p,{children:["Escapes a string so that special characters like ",(0,a.jsx)(n.code,{children:"<"})," to become ",(0,a.jsx)(n.code,{children:"<"}),". It escapes only five such characters: ",(0,a.jsx)(n.code,{children:"<"}),", ",(0,a.jsx)(n.code,{children:">"}),", ",(0,a.jsx)(n.code,{children:"&"}),", ",(0,a.jsx)(n.code,{children:"'"})," and ",(0,a.jsx)(n.code,{children:'"'})," so that it can be safely placed within an HTML entity."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-10",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.escaped = this.value.escape_html()\n\n# In: {"value":"foo & bar"}\n# Out: {"escaped":"foo & bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"escape_url_query",children:(0,a.jsx)(n.code,{children:"escape_url_query"})}),"\n",(0,a.jsx)(n.p,{children:"Escapes a string so that it can be safely placed within a URL query."}),"\n",(0,a.jsx)(n.h4,{id:"examples-11",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.escaped = this.value.escape_url_query()\n\n# In: {"value":"foo & bar"}\n# Out: {"escaped":"foo+%26+bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"filepath_join",children:(0,a.jsx)(n.code,{children:"filepath_join"})}),"\n",(0,a.jsx)(n.p,{children:"Joins an array of path elements into a single file path. The separator depends on the operating system of the machine."}),"\n",(0,a.jsx)(n.h4,{id:"examples-12",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.path = this.path_elements.filepath_join()\n\n# In: {"path_elements":["/foo/","bar.txt"]}\n# Out: {"path":"/foo/bar.txt"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"filepath_split",children:(0,a.jsx)(n.code,{children:"filepath_split"})}),"\n",(0,a.jsx)(n.p,{children:"Splits a file path immediately following the final Separator, separating it into a directory and file name component returned as a two element array of strings. If there is no Separator in the path, the first element will be empty and the second will contain the path. The separator depends on the operating system of the machine."}),"\n",(0,a.jsx)(n.h4,{id:"examples-13",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.path_sep = this.path.filepath_split()\n\n# In: {"path":"/foo/bar.txt"}\n# Out: {"path_sep":["/foo/","bar.txt"]}\n\n# In: {"path":"baz.txt"}\n# Out: {"path_sep":["","baz.txt"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"format",children:(0,a.jsx)(n.code,{children:"format"})}),"\n",(0,a.jsxs)(n.p,{children:["Use a value string as a format specifier in order to produce a new string, using any number of provided arguments. Please refer to the Go ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/fmt",children:[(0,a.jsx)(n.code,{children:"fmt"})," package documentation"]})," for the list of valid format verbs."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-14",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = "%s(%v): %v".format(this.name, this.age, this.fingers)\n\n# In: {"name":"lance","age":37,"fingers":13}\n# Out: {"foo":"lance(37): 13"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"has_prefix",children:(0,a.jsx)(n.code,{children:"has_prefix"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a string has a prefix argument and returns a bool."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-8",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," The string to test."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-15",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.t1 = this.v1.has_prefix("foo")\nroot.t2 = this.v2.has_prefix("foo")\n\n# In: {"v1":"foobar","v2":"barfoo"}\n# Out: {"t1":true,"t2":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"has_suffix",children:(0,a.jsx)(n.code,{children:"has_suffix"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a string has a suffix argument and returns a bool."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-9",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," The string to test."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-16",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.t1 = this.v1.has_suffix("foo")\nroot.t2 = this.v2.has_suffix("foo")\n\n# In: {"v1":"foobar","v2":"barfoo"}\n# Out: {"t1":false,"t2":true}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"index_of",children:(0,a.jsx)(n.code,{children:"index_of"})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the starting index of the argument substring in a string target, or ",(0,a.jsx)(n.code,{children:"-1"})," if the target doesn't contain the argument."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-10",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," A string to search for."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-17",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.thing.index_of("bar")\n\n# In: {"thing":"foobar"}\n# Out: {"index":3}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = content().index_of("meow")\n\n# In: the cat meowed, the dog woofed\n# Out: {"index":8}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"length",children:(0,a.jsx)(n.code,{children:"length"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the length of a string."}),"\n",(0,a.jsx)(n.h4,{id:"examples-18",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_len = this.foo.length()\n\n# In: {"foo":"hello world"}\n# Out: {"foo_len":11}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"lowercase",children:(0,a.jsx)(n.code,{children:"lowercase"})}),"\n",(0,a.jsx)(n.p,{children:"Convert a string value into lowercase."}),"\n",(0,a.jsx)(n.h4,{id:"examples-19",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.lowercase()\n\n# In: {"foo":"HELLO WORLD"}\n# Out: {"foo":"hello world"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"quote",children:(0,a.jsx)(n.code,{children:"quote"})}),"\n",(0,a.jsxs)(n.p,{children:["Quotes a target string using escape sequences (",(0,a.jsx)(n.code,{children:"\\t"}),", ",(0,a.jsx)(n.code,{children:"\\n"}),", ",(0,a.jsx)(n.code,{children:"\\xFF"}),", ",(0,a.jsx)(n.code,{children:"\\u0100"}),") for control characters and non-printable characters."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-20",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.quoted = this.thing.quote()\n\n# In: {"thing":"foo\\nbar"}\n# Out: {"quoted":"\\"foo\\\\nbar\\""}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"replace_all",children:(0,a.jsx)(n.code,{children:"replace_all"})}),"\n",(0,a.jsx)(n.p,{children:"Replaces all occurrences of the first argument in a target string with the second argument."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-11",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"old"})})," A string to match against.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"new"})})," A string to replace with."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-21",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.replace_all("foo","dog")\n\n# In: {"value":"The foo ate my homework"}\n# Out: {"new_value":"The dog ate my homework"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"replace_all_many",children:(0,a.jsx)(n.code,{children:"replace_all_many"})}),"\n",(0,a.jsxs)(n.p,{children:["For each pair of strings in an argument array, replaces all occurrences of the first item of the pair with the second. This is a more compact way of chaining a series of ",(0,a.jsx)(n.code,{children:"replace_all"})," methods."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-12",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"values"})})," An array of values, each even value will be replaced with the following odd value."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-22",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.replace_all_many([\n "", "<b>",\n "", "</b>",\n "", "<i>",\n "", "</i>",\n])\n\n# In: {"value":"HelloWorld"}\n# Out: {"new_value":"<i>Hello</i> <b>World</b>"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"reverse",children:(0,a.jsx)(n.code,{children:"reverse"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the target string in reverse order."}),"\n",(0,a.jsx)(n.h4,{id:"examples-23",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.reversed = this.thing.reverse()\n\n# In: {"thing":"backwards"}\n# Out: {"reversed":"sdrawkcab"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = content().reverse()\n\n# In: {"thing":"backwards"}\n# Out: }"sdrawkcab":"gniht"{\n'})}),"\n",(0,a.jsx)(n.h3,{id:"slice",children:(0,a.jsx)(n.code,{children:"slice"})}),"\n",(0,a.jsx)(n.p,{children:"Extract a slice from a string by specifying two indices, a low and high bound, which selects a half-open range that includes the first character, but excludes the last one. If the second index is omitted then it defaults to the length of the input sequence."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-13",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"low"})})," The low bound, which is the first element of the selection, or if negative selects from the end.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"high"})})," <(optional) integer> An optional high bound."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-24",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.beginning = this.value.slice(0, 2)\nroot.end = this.value.slice(4)\n\n# In: {"value":"foo bar"}\n# Out: {"beginning":"fo","end":"bar"}\n'})}),"\n",(0,a.jsx)(n.p,{children:"A negative low index can be used, indicating an offset from the end of the sequence. If the low index is greater than the length of the sequence then an empty result is returned."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.last_chunk = this.value.slice(-4)\nroot.the_rest = this.value.slice(0, -4)\n\n# In: {"value":"foo bar"}\n# Out: {"last_chunk":" bar","the_rest":"foo"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"slug",children:(0,a.jsx)(n.code,{children:"slug"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:['Creates a "slug" from a given string. Wraps the github.com/gosimple/slug package. See its ',(0,a.jsx)(n.a,{href:"https://pkg.go.dev/github.com/gosimple/slug",children:"docs"})," for more information."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.2.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-14",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"lang"})})," <(optional) string, default ",(0,a.jsx)(n.code,{children:'"en"'}),">"]}),"\n",(0,a.jsx)(n.h4,{id:"examples-25",children:"Examples"}),"\n",(0,a.jsx)(n.p,{children:"Creates a slug from an English string"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.slug = this.value.slug()\n\n# In: {"value":"Gopher & Bento"}\n# Out: {"slug":"gopher-and-bento"}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Creates a slug from a French string"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.slug = this.value.slug("fr")\n\n# In: {"value":"Gaufre & Poisson d\'Eau Profonde"}\n# Out: {"slug":"gaufre-et-poisson-deau-profonde"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"split",children:(0,a.jsx)(n.code,{children:"split"})}),"\n",(0,a.jsx)(n.p,{children:"Split a string value into an array of strings by splitting it on a string separator."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-15",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"delimiter"})})," The delimiter to split with."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-26",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.split(",")\n\n# In: {"value":"foo,bar,baz"}\n# Out: {"new_value":["foo","bar","baz"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"strip_html",children:(0,a.jsx)(n.code,{children:"strip_html"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to remove all HTML tags from a target string."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-16",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"preserve"})})," <(optional) array> An optional array of element types to preserve in the output."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-27",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.stripped = this.value.strip_html()\n\n# In: {"value":"
the plain old text
"}\n# Out: {"stripped":"the plain old text"}\n'})}),"\n",(0,a.jsx)(n.p,{children:"It's also possible to provide an explicit list of element types to preserve in the output."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.stripped = this.value.strip_html(["article"])\n\n# In: {"value":"
the plain old text
"}\n# Out: {"stripped":"the plain old text"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"trim",children:(0,a.jsx)(n.code,{children:"trim"})}),"\n",(0,a.jsx)(n.p,{children:"Remove all leading and trailing characters from a string that are contained within an argument cutset. If no arguments are provided then whitespace is removed."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-17",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"cutset"})})," <(optional) string> An optional string of characters to trim from the target value."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-28",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.title = this.title.trim("!?")\nroot.description = this.description.trim()\n\n# In: {"description":" something happened and its amazing! ","title":"!!!watch out!?"}\n# Out: {"description":"something happened and its amazing!","title":"watch out"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"trim_prefix",children:(0,a.jsx)(n.code,{children:"trim_prefix"})}),"\n",(0,a.jsx)(n.p,{children:"Remove the provided leading prefix substring from a string. If the string does not have the prefix substring, it is returned unchanged."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-18",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"prefix"})})," The leading prefix substring to trim from the string."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-29",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.name = this.name.trim_prefix("foobar_")\nroot.description = this.description.trim_prefix("foobar_")\n\n# In: {"description":"unchanged","name":"foobar_blobton"}\n# Out: {"description":"unchanged","name":"blobton"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"trim_suffix",children:(0,a.jsx)(n.code,{children:"trim_suffix"})}),"\n",(0,a.jsx)(n.p,{children:"Remove the provided trailing suffix substring from a string. If the string does not have the suffix substring, it is returned unchanged."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-19",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"suffix"})})," The trailing suffix substring to trim from the string."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-30",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.name = this.name.trim_suffix("_foobar")\nroot.description = this.description.trim_suffix("_foobar")\n\n# In: {"description":"unchanged","name":"blobton_foobar"}\n# Out: {"description":"unchanged","name":"blobton"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"unescape_html",children:(0,a.jsx)(n.code,{children:"unescape_html"})}),"\n",(0,a.jsxs)(n.p,{children:["Unescapes a string so that entities like ",(0,a.jsx)(n.code,{children:"<"})," become ",(0,a.jsx)(n.code,{children:"<"}),". It unescapes a larger range of entities than ",(0,a.jsx)(n.code,{children:"escape_html"})," escapes. For example, ",(0,a.jsx)(n.code,{children:"á"})," unescapes to ",(0,a.jsx)(n.code,{children:"\xe1"}),", as does ",(0,a.jsx)(n.code,{children:"á"})," and ",(0,a.jsx)(n.code,{children:"&xE1;"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-31",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.unescaped = this.value.unescape_html()\n\n# In: {"value":"foo & bar"}\n# Out: {"unescaped":"foo & bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"unescape_url_query",children:(0,a.jsx)(n.code,{children:"unescape_url_query"})}),"\n",(0,a.jsx)(n.p,{children:"Expands escape sequences from a URL query string."}),"\n",(0,a.jsx)(n.h4,{id:"examples-32",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.unescaped = this.value.unescape_url_query()\n\n# In: {"value":"foo+%26+bar"}\n# Out: {"unescaped":"foo & bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"unquote",children:(0,a.jsx)(n.code,{children:"unquote"})}),"\n",(0,a.jsxs)(n.p,{children:["Unquotes a target string, expanding any escape sequences (",(0,a.jsx)(n.code,{children:"\\t"}),", ",(0,a.jsx)(n.code,{children:"\\n"}),", ",(0,a.jsx)(n.code,{children:"\\xFF"}),", ",(0,a.jsx)(n.code,{children:"\\u0100"}),") for control characters and non-printable characters."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-33",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.unquoted = this.thing.unquote()\n\n# In: {"thing":"\\"foo\\\\nbar\\""}\n# Out: {"unquoted":"foo\\nbar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"uppercase",children:(0,a.jsx)(n.code,{children:"uppercase"})}),"\n",(0,a.jsx)(n.p,{children:"Convert a string value into uppercase."}),"\n",(0,a.jsx)(n.h4,{id:"examples-34",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.uppercase()\n\n# In: {"foo":"hello world"}\n# Out: {"foo":"HELLO WORLD"}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"regular-expressions",children:"Regular Expressions"}),"\n",(0,a.jsx)(n.h3,{id:"re_find_all",children:(0,a.jsx)(n.code,{children:"re_find_all"})}),"\n",(0,a.jsx)(n.p,{children:"Returns an array containing all successive matches of a regular expression in a string."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-20",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-35",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_all("a.")\n\n# In: {"value":"paranormal"}\n# Out: {"matches":["ar","an","al"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"re_find_all_object",children:(0,a.jsx)(n.code,{children:"re_find_all_object"})}),"\n",(0,a.jsx)(n.p,{children:"Returns an array of objects containing all matches of the regular expression and the matches of its subexpressions. The key of each match value is the name of the group when specified, otherwise it is the index of the matching group, starting with the expression as a whole at 0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-21",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-36",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_all_object("a(?Px*)b")\n\n# In: {"value":"-axxb-ab-"}\n# Out: {"matches":[{"0":"axxb","foo":"xx"},{"0":"ab","foo":""}]}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_all_object("(?m)(?P\\\\w+):\\\\s+(?P\\\\w+)$")\n\n# In: {"value":"option1: value1\\noption2: value2\\noption3: value3"}\n# Out: {"matches":[{"0":"option1: value1","key":"option1","value":"value1"},{"0":"option2: value2","key":"option2","value":"value2"},{"0":"option3: value3","key":"option3","value":"value3"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"re_find_all_submatch",children:(0,a.jsx)(n.code,{children:"re_find_all_submatch"})}),"\n",(0,a.jsx)(n.p,{children:"Returns an array of arrays containing all successive matches of the regular expression in a string and the matches, if any, of its subexpressions."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-22",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-37",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_all_submatch("a(x*)b")\n\n# In: {"value":"-axxb-ab-"}\n# Out: {"matches":[["axxb","xx"],["ab",""]]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"re_find_object",children:(0,a.jsx)(n.code,{children:"re_find_object"})}),"\n",(0,a.jsx)(n.p,{children:"Returns an object containing the first match of the regular expression and the matches of its subexpressions. The key of each match value is the name of the group when specified, otherwise it is the index of the matching group, starting with the expression as a whole at 0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-23",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-38",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_object("a(?Px*)b")\n\n# In: {"value":"-axxb-ab-"}\n# Out: {"matches":{"0":"axxb","foo":"xx"}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_find_object("(?P\\\\w+):\\\\s+(?P\\\\w+)")\n\n# In: {"value":"option1: value1"}\n# Out: {"matches":{"0":"option1: value1","key":"option1","value":"value1"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"re_match",children:(0,a.jsx)(n.code,{children:"re_match"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether a regular expression matches against any part of a string and returns a boolean."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-24",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-39",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.matches = this.value.re_match("[0-9]")\n\n# In: {"value":"there are 10 puppies"}\n# Out: {"matches":true}\n\n# In: {"value":"there are ten puppies"}\n# Out: {"matches":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"re_replace_all",children:(0,a.jsx)(n.code,{children:"re_replace_all"})}),"\n",(0,a.jsxs)(n.p,{children:["Replaces all occurrences of the argument regular expression in a string with a value. Inside the value $ signs are interpreted as submatch expansions, e.g. ",(0,a.jsx)(n.code,{children:"$1"})," represents the text of the first submatch."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-25",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"pattern"})})," The pattern to match against.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," The value to replace with."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-40",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.re_replace_all("ADD ([0-9]+)","+($1)")\n\n# In: {"value":"foo ADD 70"}\n# Out: {"new_value":"foo +(70)"}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"number-manipulation",children:"Number Manipulation"}),"\n",(0,a.jsx)(n.h3,{id:"abs",children:(0,a.jsx)(n.code,{children:"abs"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the absolute value of an int64 or float64 number. As a special case, when an integer is provided that is the minimum value it is converted to the maximum value."}),"\n",(0,a.jsx)(n.h4,{id:"examples-41",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.outs = this.ins.map_each(ele -> ele.abs())\n\n\n# In: {"ins":[9,-18,1.23,-4.56]}\n# Out: {"outs":[9,18,1.23,4.56]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ceil",children:(0,a.jsx)(n.code,{children:"ceil"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the least integer value greater than or equal to a number. If the resulting value fits within a 64-bit integer then that is returned, otherwise a new floating point number is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-42",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.ceil()\n\n# In: {"value":5.3}\n# Out: {"new_value":6}\n\n# In: {"value":-5.9}\n# Out: {"new_value":-5}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"float32",children:(0,a.jsx)(n.code,{children:"float32"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 32-bit floating point number, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 32-bit floating point number. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseFloat",children:[(0,a.jsx)(n.code,{children:"strconv.ParseFloat"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-43",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.out = this.in.float32()\n\n\n# In: {"in":"6.674282313423543523453425345e-11"}\n# Out: {"out":6.674283e-11}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"float64",children:(0,a.jsx)(n.code,{children:"float64"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 64-bit floating point number, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 64-bit floating point number. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseFloat",children:[(0,a.jsx)(n.code,{children:"strconv.ParseFloat"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-44",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.out = this.in.float64()\n\n\n# In: {"in":"6.674282313423543523453425345e-11"}\n# Out: {"out":6.674282313423544e-11}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"floor",children:(0,a.jsx)(n.code,{children:"floor"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the greatest integer value less than or equal to the target number. If the resulting value fits within a 64-bit integer then that is returned, otherwise a new floating point number is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-45",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.floor()\n\n# In: {"value":5.7}\n# Out: {"new_value":5}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"int16",children:(0,a.jsx)(n.code,{children:"int16"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 16-bit signed integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 16-bit signed integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-46",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.int16()\nroot.b = this.b.round().int16()\nroot.c = this.c.int16()\nroot.d = this.d.int16().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":-12}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.int16()\n\n\n# In: "0xDE"\n# Out: 222\n'})}),"\n",(0,a.jsx)(n.h3,{id:"int32",children:(0,a.jsx)(n.code,{children:"int32"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 32-bit signed integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 32-bit signed integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-47",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.int32()\nroot.b = this.b.round().int32()\nroot.c = this.c.int32()\nroot.d = this.d.int32().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":-12}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.int32()\n\n\n# In: "0xDEAD"\n# Out: 57005\n'})}),"\n",(0,a.jsx)(n.h3,{id:"int64",children:(0,a.jsx)(n.code,{children:"int64"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 64-bit signed integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 64-bit signed integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-48",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.int64()\nroot.b = this.b.round().int64()\nroot.c = this.c.int64()\nroot.d = this.d.int64().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":-12}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.int64()\n\n\n# In: "0xDEADBEEF"\n# Out: 3735928559\n'})}),"\n",(0,a.jsx)(n.h3,{id:"int8",children:(0,a.jsx)(n.code,{children:"int8"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 8-bit signed integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 8-bit signed integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-49",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.int8()\nroot.b = this.b.round().int8()\nroot.c = this.c.int8()\nroot.d = this.d.int8().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":-12}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.int8()\n\n\n# In: "0xD"\n# Out: 13\n'})}),"\n",(0,a.jsx)(n.h3,{id:"log",children:(0,a.jsx)(n.code,{children:"log"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the natural logarithm of a number."}),"\n",(0,a.jsx)(n.h4,{id:"examples-50",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.log().round()\n\n# In: {"value":1}\n# Out: {"new_value":0}\n\n# In: {"value":2.7183}\n# Out: {"new_value":1}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"log10",children:(0,a.jsx)(n.code,{children:"log10"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the decimal logarithm of a number."}),"\n",(0,a.jsx)(n.h4,{id:"examples-51",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.log10()\n\n# In: {"value":100}\n# Out: {"new_value":2}\n\n# In: {"value":1000}\n# Out: {"new_value":3}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"max",children:(0,a.jsx)(n.code,{children:"max"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the largest numerical value found within an array. All values must be numerical and the array must not be empty, otherwise an error is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-52",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.biggest = this.values.max()\n\n# In: {"values":[0,3,2.5,7,5]}\n# Out: {"biggest":7}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = [0,this.value].max()\n\n# In: {"value":-1}\n# Out: {"new_value":0}\n\n# In: {"value":7}\n# Out: {"new_value":7}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"min",children:(0,a.jsx)(n.code,{children:"min"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the smallest numerical value found within an array. All values must be numerical and the array must not be empty, otherwise an error is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-53",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.smallest = this.values.min()\n\n# In: {"values":[0,3,-2.5,7,5]}\n# Out: {"smallest":-2.5}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = [10,this.value].min()\n\n# In: {"value":2}\n# Out: {"new_value":2}\n\n# In: {"value":23}\n# Out: {"new_value":10}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"round",children:(0,a.jsx)(n.code,{children:"round"})}),"\n",(0,a.jsx)(n.p,{children:"Rounds numbers to the nearest integer, rounding half away from zero. If the resulting value fits within a 64-bit integer then that is returned, otherwise a new floating point number is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-54",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_value = this.value.round()\n\n# In: {"value":5.3}\n# Out: {"new_value":5}\n\n# In: {"value":5.9}\n# Out: {"new_value":6}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"uint16",children:(0,a.jsx)(n.code,{children:"uint16"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 16-bit unsigned integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 16-bit unsigned integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-55",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.uint16()\nroot.b = this.b.round().uint16()\nroot.c = this.c.uint16()\nroot.d = this.d.uint16().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":0}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.uint16()\n\n\n# In: "0xDE"\n# Out: 222\n'})}),"\n",(0,a.jsx)(n.h3,{id:"uint32",children:(0,a.jsx)(n.code,{children:"uint32"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 32-bit unsigned integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 32-bit unsigned integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-56",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.uint32()\nroot.b = this.b.round().uint32()\nroot.c = this.c.uint32()\nroot.d = this.d.uint32().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":0}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.uint32()\n\n\n# In: "0xDEAD"\n# Out: 57005\n'})}),"\n",(0,a.jsx)(n.h3,{id:"uint64",children:(0,a.jsx)(n.code,{children:"uint64"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 64-bit unsigned integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 64-bit unsigned integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-57",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.uint64()\nroot.b = this.b.round().uint64()\nroot.c = this.c.uint64()\nroot.d = this.d.uint64().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":0}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.uint64()\n\n\n# In: "0xDEADBEEF"\n# Out: 3735928559\n'})}),"\n",(0,a.jsx)(n.h3,{id:"uint8",children:(0,a.jsx)(n.code,{children:"uint8"})}),"\n",(0,a.jsx)(n.p,{children:"Converts a numerical type into a 8-bit unsigned integer, this is for advanced use cases where a specific data type is needed for a given component (such as the ClickHouse SQL driver)."}),"\n",(0,a.jsxs)(n.p,{children:["If the value is a string then an attempt will be made to parse it as a 8-bit unsigned integer. If the target value exceeds the capacity of an integer or contains decimal values then this method will throw an error. In order to convert a floating point number containing decimals first use ",(0,a.jsx)(n.a,{href:"#round",children:(0,a.jsx)(n.code,{children:".round()"})})," on the value. Please refer to the ",(0,a.jsxs)(n.a,{href:"https://pkg.go.dev/strconv#ParseInt",children:[(0,a.jsx)(n.code,{children:"strconv.ParseInt"})," documentation"]})," for details regarding the supported formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-58",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot.a = this.a.uint8()\nroot.b = this.b.round().uint8()\nroot.c = this.c.uint8()\nroot.d = this.d.uint8().catch(0)\n\n\n# In: {"a":12,"b":12.34,"c":"12","d":-12}\n# Out: {"a":12,"b":12,"c":12,"d":0}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'\nroot = this.uint8()\n\n\n# In: "0xD"\n# Out: 13\n'})}),"\n",(0,a.jsx)(n.h2,{id:"timestamp-manipulation",children:"Timestamp Manipulation"}),"\n",(0,a.jsx)(n.h3,{id:"parse_duration",children:(0,a.jsx)(n.code,{children:"parse_duration"})}),"\n",(0,a.jsx)(n.p,{children:'Attempts to parse a string as a duration and returns an integer of nanoseconds. A duration string is a possibly signed sequence of decimal numbers, each with an optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "\xb5s"), "ms", "s", "m", "h".'}),"\n",(0,a.jsx)(n.h4,{id:"examples-59",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.delay_for_ns = this.delay_for.parse_duration()\n\n# In: {"delay_for":"50us"}\n# Out: {"delay_for_ns":50000}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.delay_for_s = this.delay_for.parse_duration() / 1000000000\n\n# In: {"delay_for":"2h"}\n# Out: {"delay_for_s":7200}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_duration_iso8601",children:(0,a.jsx)(n.code,{children:"parse_duration_iso8601"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:'Attempts to parse a string using ISO-8601 rules as a duration and returns an integer of nanoseconds. A duration string is represented by the format "P[n]Y[n]M[n]DT[n]H[n]M[n]S" or "P[n]W". In these representations, the "[n]" is replaced by the value for each of the date and time elements that follow the "[n]". For example, "P3Y6M4DT12H30M5S" represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds". The last field of the format allows fractions with one decimal place, so "P3.5S" will return 3500000000ns. Any additional decimals will be truncated.'}),"\n",(0,a.jsx)(n.h4,{id:"examples-60",children:"Examples"}),"\n",(0,a.jsx)(n.p,{children:"Arbitrary ISO-8601 duration string to nanoseconds:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.delay_for_ns = this.delay_for.parse_duration_iso8601()\n\n# In: {"delay_for":"P3Y6M4DT12H30M5S"}\n# Out: {"delay_for_ns":110839937000000000}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Two hours ISO-8601 duration string to seconds:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.delay_for_s = this.delay_for.parse_duration_iso8601() / 1000000000\n\n# In: {"delay_for":"PT2H"}\n# Out: {"delay_for_s":7200}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Two and a half seconds ISO-8601 duration string to seconds:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.delay_for_s = this.delay_for.parse_duration_iso8601() / 1000000000\n\n# In: {"delay_for":"PT2.5S"}\n# Out: {"delay_for_s":2.5}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_add_iso8601",children:(0,a.jsx)(n.code,{children:"ts_add_iso8601"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Parse parameter string as ISO 8601 period and add it to value with high precision for units larger than an hour."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-26",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"duration"})})," Duration in ISO 8601 format"]}),"\n",(0,a.jsx)(n.h3,{id:"ts_format",children:(0,a.jsx)(n.code,{children:"ts_format"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to format a timestamp value as a string according to a specified format, or RFC 3339 by default. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format."}),"\n",(0,a.jsxs)(n.p,{children:["The output format is defined by showing how the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006, would be displayed if it were the value. For an alternative way to specify formats check out the ",(0,a.jsx)(n.a,{href:"#ts_strftime",children:(0,a.jsx)(n.code,{children:"ts_strftime"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-27",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The output format to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"tz"})})," <(optional) string> An optional timezone to use, otherwise the timezone of the input string is used, or in the case of unix timestamps the local timezone is used."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-61",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root.something_at = (this.created_at + 300).ts_format()\n"})}),"\n",(0,a.jsx)(n.p,{children:"An optional string argument can be used in order to specify the output format of the timestamp. The format is defined by showing how the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006, would be displayed if it were the value."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = (this.created_at + 300).ts_format("2006-Jan-02 15:04:05")\n'})}),"\n",(0,a.jsx)(n.p,{children:"A second optional string argument can also be used in order to specify a timezone, otherwise the timezone of the input string is used, or in the case of unix timestamps the local timezone is used."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = this.created_at.ts_format(format: "2006-Jan-02 15:04:05", tz: "UTC")\n\n# In: {"created_at":1597405526}\n# Out: {"something_at":"2020-Aug-14 11:45:26"}\n\n# In: {"created_at":"2020-08-14T11:50:26.371Z"}\n# Out: {"something_at":"2020-Aug-14 11:50:26"}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["And ",(0,a.jsx)(n.code,{children:"ts_format"})," supports up to nanosecond precision with floating point timestamp values."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = this.created_at.ts_format("2006-Jan-02 15:04:05.999999", "UTC")\n\n# In: {"created_at":1597405526.123456}\n# Out: {"something_at":"2020-Aug-14 11:45:26.123456"}\n\n# In: {"created_at":"2020-08-14T11:50:26.371Z"}\n# Out: {"something_at":"2020-Aug-14 11:50:26.371"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to parse a string as a timestamp following a specified format and outputs a timestamp, which can then be fed into methods such as ",(0,a.jsx)(n.a,{href:"#ts_format",children:(0,a.jsx)(n.code,{children:"ts_format"})}),"."]}),"\n",(0,a.jsxs)(n.p,{children:["The input format is defined by showing how the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006, would be displayed if it were the value. For an alternative way to specify formats check out the ",(0,a.jsx)(n.a,{href:"#ts_strptime",children:(0,a.jsx)(n.code,{children:"ts_strptime"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-28",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The format of the target string."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-62",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc.timestamp = this.doc.timestamp.ts_parse("2006-Jan-02")\n\n# In: {"doc":{"timestamp":"2020-Aug-14"}}\n# Out: {"doc":{"timestamp":"2020-08-14T00:00:00Z"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_round",children:(0,a.jsx)(n.code,{children:"ts_round"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the result of rounding a timestamp to the nearest multiple of the argument duration (nanoseconds). The rounding behavior for halfway values is to round up. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.2.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-29",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"duration"})})," A duration measured in nanoseconds to round by."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-63",children:"Examples"}),"\n",(0,a.jsxs)(n.p,{children:["Use the method ",(0,a.jsx)(n.code,{children:"parse_duration"})," to convert a duration string into an integer argument."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_hour = this.created_at.ts_round("1h".parse_duration())\n\n# In: {"created_at":"2020-08-14T05:54:23Z"}\n# Out: {"created_at_hour":"2020-08-14T06:00:00Z"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_strftime",children:(0,a.jsx)(n.code,{children:"ts_strftime"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to format a timestamp value as a string according to a specified strftime-compatible format. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-30",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The output format to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"tz"})})," <(optional) string> An optional timezone to use, otherwise the timezone of the input string is used."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-64",children:"Examples"}),"\n",(0,a.jsxs)(n.p,{children:["The format consists of zero or more conversion specifiers and ordinary characters (except ",(0,a.jsx)(n.code,{children:"%"}),"). All ordinary characters are copied to the output string without modification. Each conversion specification begins with ",(0,a.jsx)(n.code,{children:"%"})," character followed by the character that determines the behaviour of the specifier. Please refer to ",(0,a.jsx)(n.a,{href:"https://linux.die.net/man/3/strftime",children:"man 3 strftime"})," for the list of format specifiers."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = (this.created_at + 300).ts_strftime("%Y-%b-%d %H:%M:%S")\n'})}),"\n",(0,a.jsx)(n.p,{children:"A second optional string argument can also be used in order to specify a timezone, otherwise the timezone of the input string is used, or in the case of unix timestamps the local timezone is used."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = this.created_at.ts_strftime("%Y-%b-%d %H:%M:%S", "UTC")\n\n# In: {"created_at":1597405526}\n# Out: {"something_at":"2020-Aug-14 11:45:26"}\n\n# In: {"created_at":"2020-08-14T11:50:26.371Z"}\n# Out: {"something_at":"2020-Aug-14 11:50:26"}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["As an extension provided by the underlying formatting library, ",(0,a.jsx)(n.a,{href:"https://github.com/itchyny/timefmt-go",children:"itchyny/timefmt-go"}),", the ",(0,a.jsx)(n.code,{children:"%f"})," directive is supported for zero-padded microseconds, which originates from Python. Note that E and O modifier characters are not supported."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.something_at = this.created_at.ts_strftime("%Y-%b-%d %H:%M:%S.%f", "UTC")\n\n# In: {"created_at":1597405526}\n# Out: {"something_at":"2020-Aug-14 11:45:26.000000"}\n\n# In: {"created_at":"2020-08-14T11:50:26.371Z"}\n# Out: {"something_at":"2020-Aug-14 11:50:26.371000"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_strptime",children:(0,a.jsx)(n.code,{children:"ts_strptime"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to parse a string as a timestamp following a specified strptime-compatible format and outputs a timestamp, which can then be fed into ",(0,a.jsx)(n.a,{href:"#ts_format",children:(0,a.jsx)(n.code,{children:"ts_format"})}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-31",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The format of the target string."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-65",children:"Examples"}),"\n",(0,a.jsxs)(n.p,{children:["The format consists of zero or more conversion specifiers and ordinary characters (except ",(0,a.jsx)(n.code,{children:"%"}),"). All ordinary characters are copied to the output string without modification. Each conversion specification begins with a ",(0,a.jsx)(n.code,{children:"%"})," character followed by the character that determines the behaviour of the specifier. Please refer to ",(0,a.jsx)(n.a,{href:"https://linux.die.net/man/3/strptime",children:"man 3 strptime"})," for the list of format specifiers."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc.timestamp = this.doc.timestamp.ts_strptime("%Y-%b-%d")\n\n# In: {"doc":{"timestamp":"2020-Aug-14"}}\n# Out: {"doc":{"timestamp":"2020-08-14T00:00:00Z"}}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["As an extension provided by the underlying formatting library, ",(0,a.jsx)(n.a,{href:"https://github.com/itchyny/timefmt-go",children:"itchyny/timefmt-go"}),", the ",(0,a.jsx)(n.code,{children:"%f"})," directive is supported for zero-padded microseconds, which originates from Python. Note that E and O modifier characters are not supported."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc.timestamp = this.doc.timestamp.ts_strptime("%Y-%b-%d %H:%M:%S.%f")\n\n# In: {"doc":{"timestamp":"2020-Aug-14 11:50:26.371000"}}\n# Out: {"doc":{"timestamp":"2020-08-14T11:50:26.371Z"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_sub",children:(0,a.jsx)(n.code,{children:"ts_sub"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the difference in nanoseconds between the target timestamp (t1) and the timestamp provided as a parameter (t2). The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.23.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-32",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"t2"})})," The second timestamp to be subtracted from the method target."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-66",children:"Examples"}),"\n",(0,a.jsxs)(n.p,{children:["Use the ",(0,a.jsx)(n.code,{children:".abs()"})," method in order to calculate an absolute duration between two timestamps."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.between = this.started_at.ts_sub("2020-08-14T05:54:23Z").abs()\n\n# In: {"started_at":"2020-08-13T05:54:23Z"}\n# Out: {"between":86400000000000}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_sub_iso8601",children:(0,a.jsx)(n.code,{children:"ts_sub_iso8601"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Parse parameter string as ISO 8601 period and subtract it from value with high precision for units larger than an hour."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-33",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"duration"})})," Duration in ISO 8601 format"]}),"\n",(0,a.jsx)(n.h3,{id:"ts_tz",children:(0,a.jsx)(n.code,{children:"ts_tz"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the result of converting a timestamp to a specified timezone. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.3.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-34",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"tz"})}),' The timezone to change to. If set to "UTC" then the timezone will be UTC. If set to "Local" then the local timezone will be used. Otherwise, the argument is taken to be a location name corresponding to a file in the IANA Time Zone database, such as "America/New_York".']}),"\n",(0,a.jsx)(n.h4,{id:"examples-67",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_utc = this.created_at.ts_tz("UTC")\n\n# In: {"created_at":"2021-02-03T17:05:06+01:00"}\n# Out: {"created_at_utc":"2021-02-03T16:05:06Z"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_unix",children:(0,a.jsx)(n.code,{children:"ts_unix"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-68",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_unix = this.created_at.ts_unix()\n\n# In: {"created_at":"2009-11-10T23:00:00Z"}\n# Out: {"created_at_unix":1257894000}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_unix_micro",children:(0,a.jsx)(n.code,{children:"ts_unix_micro"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with microsecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-69",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_unix = this.created_at.ts_unix_micro()\n\n# In: {"created_at":"2009-11-10T23:00:00Z"}\n# Out: {"created_at_unix":1257894000000000}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_unix_milli",children:(0,a.jsx)(n.code,{children:"ts_unix_milli"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with millisecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-70",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_unix = this.created_at.ts_unix_milli()\n\n# In: {"created_at":"2009-11-10T23:00:00Z"}\n# Out: {"created_at_unix":1257894000000}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"ts_unix_nano",children:(0,a.jsx)(n.code,{children:"ts_unix_nano"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with nanosecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-71",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.created_at_unix = this.created_at.ts_unix_nano()\n\n# In: {"created_at":"2009-11-10T23:00:00Z"}\n# Out: {"created_at_unix":1257894000000000000}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"type-coercion",children:"Type Coercion"}),"\n",(0,a.jsx)(n.h3,{id:"bool",children:(0,a.jsx)(n.code,{children:"bool"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempt to parse a value into a boolean. An optional argument can be provided, in which case if the value cannot be parsed the argument will be returned instead. If the value is a number then any non-zero value will resolve to ",(0,a.jsx)(n.code,{children:"true"}),", if the value is a string then any of the following values are considered valid: ",(0,a.jsx)(n.code,{children:"1, t, T, TRUE, true, True, 0, f, F, FALSE"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-35",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"default"})})," <(optional) bool> An optional value to yield if the target cannot be parsed as a boolean."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-72",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root.foo = this.thing.bool()\nroot.bar = this.thing.bool(true)\n"})}),"\n",(0,a.jsx)(n.h3,{id:"bytes",children:(0,a.jsx)(n.code,{children:"bytes"})}),"\n",(0,a.jsx)(n.p,{children:"Marshal a value into a byte array. If the value is already a byte array it is unchanged."}),"\n",(0,a.jsx)(n.h4,{id:"examples-73",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.first_byte = this.name.bytes().index(0)\n\n# In: {"name":"foobar bazson"}\n# Out: {"first_byte":102}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"not_empty",children:(0,a.jsx)(n.code,{children:"not_empty"})}),"\n",(0,a.jsx)(n.p,{children:"Ensures that the given string, array or object value is not empty, and if so returns it, otherwise an error is returned."}),"\n",(0,a.jsx)(n.h4,{id:"examples-74",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.a = this.a.not_empty()\n\n# In: {"a":"foo"}\n# Out: {"a":"foo"}\n\n# In: {"a":""}\n# Out: Error("failed assignment (line 1): field `this.a`: string value is empty")\n\n# In: {"a":["foo","bar"]}\n# Out: {"a":["foo","bar"]}\n\n# In: {"a":[]}\n# Out: Error("failed assignment (line 1): field `this.a`: array value is empty")\n\n# In: {"a":{"b":"foo","c":"bar"}}\n# Out: {"a":{"b":"foo","c":"bar"}}\n\n# In: {"a":{}}\n# Out: Error("failed assignment (line 1): field `this.a`: object value is empty")\n'})}),"\n",(0,a.jsx)(n.h3,{id:"not_null",children:(0,a.jsx)(n.code,{children:"not_null"})}),"\n",(0,a.jsxs)(n.p,{children:["Ensures that the given value is not ",(0,a.jsx)(n.code,{children:"null"}),", and if so returns it, otherwise an error is returned."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-75",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.a = this.a.not_null()\n\n# In: {"a":"foobar","b":"barbaz"}\n# Out: {"a":"foobar"}\n\n# In: {"b":"barbaz"}\n# Out: Error("failed assignment (line 1): field `this.a`: value is null")\n'})}),"\n",(0,a.jsx)(n.h3,{id:"number",children:(0,a.jsx)(n.code,{children:"number"})}),"\n",(0,a.jsx)(n.p,{children:"Attempt to parse a value into a number. An optional argument can be provided, in which case if the value cannot be parsed into a number the argument will be returned instead."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-36",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"default"})})," <(optional) float> An optional value to yield if the target cannot be parsed as a number."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-76",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root.foo = this.thing.number() + 10\nroot.bar = this.thing.number(5) * 10\n"})}),"\n",(0,a.jsx)(n.h3,{id:"string",children:(0,a.jsx)(n.code,{children:"string"})}),"\n",(0,a.jsx)(n.p,{children:"Marshal a value into a string. If the value is already a string it is unchanged."}),"\n",(0,a.jsx)(n.h4,{id:"examples-77",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.nested_json = this.string()\n\n# In: {"foo":"bar"}\n# Out: {"nested_json":"{\\"foo\\":\\"bar\\"}"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.id = this.id.string()\n\n# In: {"id":228930314431312345}\n# Out: {"id":"228930314431312345"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"type",children:(0,a.jsx)(n.code,{children:"type"})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the type of a value as a string, providing one of the following values: ",(0,a.jsx)(n.code,{children:"string"}),", ",(0,a.jsx)(n.code,{children:"bytes"}),", ",(0,a.jsx)(n.code,{children:"number"}),", ",(0,a.jsx)(n.code,{children:"bool"}),", ",(0,a.jsx)(n.code,{children:"timestamp"}),", ",(0,a.jsx)(n.code,{children:"array"}),", ",(0,a.jsx)(n.code,{children:"object"})," or ",(0,a.jsx)(n.code,{children:"null"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-78",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.bar_type = this.bar.type()\nroot.foo_type = this.foo.type()\n\n# In: {"bar":10,"foo":"is a string"}\n# Out: {"bar_type":"number","foo_type":"string"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.type = this.type()\n\n# In: "foobar"\n# Out: {"type":"string"}\n\n# In: 666\n# Out: {"type":"number"}\n\n# In: false\n# Out: {"type":"bool"}\n\n# In: ["foo", "bar"]\n# Out: {"type":"array"}\n\n# In: {"foo": "bar"}\n# Out: {"type":"object"}\n\n# In: null\n# Out: {"type":"null"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.type = content().type()\n\n# In: foobar\n# Out: {"type":"bytes"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.type = this.ts_parse("2006-01-02").type()\n\n# In: "2022-06-06"\n# Out: {"type":"timestamp"}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"object--array-manipulation",children:"Object & Array Manipulation"}),"\n",(0,a.jsx)(n.h3,{id:"all",children:(0,a.jsx)(n.code,{children:"all"})}),"\n",(0,a.jsx)(n.p,{children:"Checks each element of an array against a query and returns true if all elements passed. An error occurs if the target is not an array, or if any element results in the provided query returning a non-boolean result. Returns false if the target array is empty."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-37",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"test"})})," A test query to apply to each element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-79",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.all_over_21 = this.patrons.all(patron -> patron.age >= 21)\n\n# In: {"patrons":[{"id":"1","age":18},{"id":"2","age":23}]}\n# Out: {"all_over_21":false}\n\n# In: {"patrons":[{"id":"1","age":45},{"id":"2","age":23}]}\n# Out: {"all_over_21":true}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"any",children:(0,a.jsx)(n.code,{children:"any"})}),"\n",(0,a.jsx)(n.p,{children:"Checks the elements of an array against a query and returns true if any element passes. An error occurs if the target is not an array, or if an element results in the provided query returning a non-boolean result. Returns false if the target array is empty."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-38",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"test"})})," A test query to apply to each element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-80",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.any_over_21 = this.patrons.any(patron -> patron.age >= 21)\n\n# In: {"patrons":[{"id":"1","age":18},{"id":"2","age":23}]}\n# Out: {"any_over_21":true}\n\n# In: {"patrons":[{"id":"1","age":10},{"id":"2","age":12}]}\n# Out: {"any_over_21":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"append",children:(0,a.jsx)(n.code,{children:"append"})}),"\n",(0,a.jsx)(n.p,{children:"Returns an array with new elements appended to the end."}),"\n",(0,a.jsx)(n.h4,{id:"examples-81",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.append("and", "this")\n\n# In: {"foo":["bar","baz"]}\n# Out: {"foo":["bar","baz","and","this"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"assign",children:(0,a.jsx)(n.code,{children:"assign"})}),"\n",(0,a.jsxs)(n.p,{children:["Merge a source object into an existing destination object. When a collision is found within the merged structures (both a source and destination object contain the same non-object keys) the value in the destination object will be overwritten by that of source object. In order to preserve both values on collision use the ",(0,a.jsx)(n.a,{href:"#merge",children:(0,a.jsx)(n.code,{children:"merge"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-39",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"with"})})," A value to merge the target value with."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-82",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.foo.assign(this.bar)\n\n# In: {"foo":{"first_name":"fooer","likes":"bars"},"bar":{"second_name":"barer","likes":"foos"}}\n# Out: {"first_name":"fooer","likes":"foos","second_name":"barer"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"collapse",children:(0,a.jsx)(n.code,{children:"collapse"})}),"\n",(0,a.jsx)(n.p,{children:"Collapse an array or object into an object of key/value pairs for each field, where the key is the full path of the structured field in dot path notation. Empty arrays an objects are ignored by default."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-40",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"include_empty"})})," Whether to include empty objects and arrays in the resulting object."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-83",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.collapse()\n\n# In: {"foo":[{"bar":"1"},{"bar":{}},{"bar":"2"},{"bar":[]}]}\n# Out: {"result":{"foo.0.bar":"1","foo.2.bar":"2"}}\n'})}),"\n",(0,a.jsx)(n.p,{children:"An optional boolean parameter can be set to true in order to include empty objects and arrays."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.collapse(include_empty: true)\n\n# In: {"foo":[{"bar":"1"},{"bar":{}},{"bar":"2"},{"bar":[]}]}\n# Out: {"result":{"foo.0.bar":"1","foo.1.bar":{},"foo.2.bar":"2","foo.3.bar":[]}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"concat",children:(0,a.jsx)(n.code,{children:"concat"})}),"\n",(0,a.jsx)(n.p,{children:"Concatenates an array value with one or more argument arrays."}),"\n",(0,a.jsx)(n.h4,{id:"examples-84",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.concat(this.bar, this.baz)\n\n# In: {"foo":["a","b"],"bar":["c"],"baz":["d","e","f"]}\n# Out: {"foo":["a","b","c","d","e","f"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"contains-1",children:(0,a.jsx)(n.code,{children:"contains"})}),"\n",(0,a.jsx)(n.p,{children:"Checks whether an array contains an element matching the argument, or an object contains a value matching the argument, and returns a boolean result. Numerical comparisons are made irrespective of the representation type (float versus integer)."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-41",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," A value to test against elements of the target."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-85",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.has_foo = this.thing.contains("foo")\n\n# In: {"thing":["this","foo","that"]}\n# Out: {"has_foo":true}\n\n# In: {"thing":["this","bar","that"]}\n# Out: {"has_foo":false}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.has_bar = this.thing.contains(20)\n\n# In: {"thing":[10.3,20.0,"huh",3]}\n# Out: {"has_bar":true}\n\n# In: {"thing":[2,3,40,67]}\n# Out: {"has_bar":false}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"diff",children:(0,a.jsx)(n.code,{children:"diff"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Create a diff by comparing the current value with the given one. Wraps the github.com/r3labs/diff/v3 package. See its ",(0,a.jsx)(n.a,{href:"https://pkg.go.dev/github.com/r3labs/diff/v3",children:"docs"})," for more information."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.25.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-42",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"other"})})," The value to compare against."]}),"\n",(0,a.jsx)(n.h3,{id:"enumerated",children:(0,a.jsx)(n.code,{children:"enumerated"})}),"\n",(0,a.jsxs)(n.p,{children:["Converts an array into a new array of objects, where each object has a field index containing the ",(0,a.jsx)(n.code,{children:"index"})," of the element and a field ",(0,a.jsx)(n.code,{children:"value"})," containing the original value of the element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-86",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.enumerated()\n\n# In: {"foo":["bar","baz"]}\n# Out: {"foo":[{"index":0,"value":"bar"},{"index":1,"value":"baz"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"explode",children:(0,a.jsx)(n.code,{children:"explode"})}),"\n",(0,a.jsxs)(n.p,{children:["Explodes an array or object at a ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"field path"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-43",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"dot path"})," to a field to explode."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-87",children:"Examples"}),"\n",(0,a.jsx)(n.h5,{id:"on-arrays",children:"On arrays"}),"\n",(0,a.jsx)(n.p,{children:"Exploding arrays results in an array containing elements matching the original document, where the target field of each element is an element of the exploded array:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.explode("value")\n\n# In: {"id":1,"value":["foo","bar","baz"]}\n# Out: [{"id":1,"value":"foo"},{"id":1,"value":"bar"},{"id":1,"value":"baz"}]\n'})}),"\n",(0,a.jsx)(n.h5,{id:"on-objects",children:"On objects"}),"\n",(0,a.jsx)(n.p,{children:"Exploding objects results in an object where the keys match the target object, and the values match the original document but with the target field replaced by the exploded value:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.explode("value")\n\n# In: {"id":1,"value":{"foo":2,"bar":[3,4],"baz":{"bev":5}}}\n# Out: {"bar":{"id":1,"value":[3,4]},"baz":{"id":1,"value":{"bev":5}},"foo":{"id":1,"value":2}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"filter",children:(0,a.jsx)(n.code,{children:"filter"})}),"\n",(0,a.jsxs)(n.p,{children:["Executes a mapping query argument for each element of an array or key/value pair of an object. If the query returns ",(0,a.jsx)(n.code,{children:"false"})," the item is removed from the resulting array or object. The item will also be removed if the query returns any non-boolean value."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-44",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"test"})})," A query to apply to each element, if this query resolves to any value other than a boolean ",(0,a.jsx)(n.code,{children:"true"})," the element will be removed from the result."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-88",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_nums = this.nums.filter(num -> num > 10)\n\n# In: {"nums":[3,11,4,17]}\n# Out: {"new_nums":[11,17]}\n'})}),"\n",(0,a.jsx)(n.h5,{id:"on-objects-1",children:"On objects"}),"\n",(0,a.jsxs)(n.p,{children:["When filtering objects the mapping query argument is provided a context with a field ",(0,a.jsx)(n.code,{children:"key"})," containing the value key, and a field ",(0,a.jsx)(n.code,{children:"value"})," containing the value."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_dict = this.dict.filter(item -> item.value.contains("foo"))\n\n# In: {"dict":{"first":"hello foo","second":"world","third":"this foo is great"}}\n# Out: {"new_dict":{"first":"hello foo","third":"this foo is great"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"find",children:(0,a.jsx)(n.code,{children:"find"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the index of the first occurrence of a value in an array. ",(0,a.jsx)(n.code,{children:"-1"})," is returned if there are no matches. Numerical comparisons are made irrespective of the representation type (float versus integer)."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-45",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," A value to find."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-89",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.find("bar")\n\n# In: ["foo", "bar", "baz"]\n# Out: {"index":1}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.things.find(this.goal)\n\n# In: {"goal":"bar","things":["foo", "bar", "baz"]}\n# Out: {"index":1}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"find_all",children:(0,a.jsx)(n.code,{children:"find_all"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Returns an array containing the indexes of all occurrences of a value in an array. An empty array is returned if there are no matches. Numerical comparisons are made irrespective of the representation type (float versus integer)."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-46",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"value"})})," A value to find."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-90",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.find_all("bar")\n\n# In: ["foo", "bar", "baz", "bar"]\n# Out: {"index":[1,3]}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.indexes = this.things.find_all(this.goal)\n\n# In: {"goal":"bar","things":["foo", "bar", "baz", "bar", "buz"]}\n# Out: {"indexes":[1,3]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"find_all_by",children:(0,a.jsx)(n.code,{children:"find_all_by"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns an array containing the indexes of all occurrences of an array where the provided query resolves to a boolean ",(0,a.jsx)(n.code,{children:"true"}),". An empty array is returned if there are no matches. Numerical comparisons are made irrespective of the representation type (float versus integer)."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-47",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query to execute for each element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-91",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.find_all_by(v -> v != "bar")\n\n# In: ["foo", "bar", "baz"]\n# Out: {"index":[0,2]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"find_by",children:(0,a.jsx)(n.code,{children:"find_by"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the index of the first occurrence of an array where the provided query resolves to a boolean ",(0,a.jsx)(n.code,{children:"true"}),". ",(0,a.jsx)(n.code,{children:"-1"})," is returned if there are no matches."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-48",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query to execute for each element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-92",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.index = this.find_by(v -> v != "bar")\n\n# In: ["foo", "bar", "baz"]\n# Out: {"index":0}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"flatten",children:(0,a.jsx)(n.code,{children:"flatten"})}),"\n",(0,a.jsx)(n.p,{children:"Iterates an array and any element that is itself an array is removed and has its elements inserted directly in the resulting array."}),"\n",(0,a.jsx)(n.h4,{id:"examples-93",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.flatten()\n\n# In: ["foo",["bar","baz"],"buz"]\n# Out: {"result":["foo","bar","baz","buz"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"fold",children:(0,a.jsx)(n.code,{children:"fold"})}),"\n",(0,a.jsxs)(n.p,{children:["Takes two arguments: an initial value, and a mapping query. For each element of an array the mapping context is an object with two fields ",(0,a.jsx)(n.code,{children:"tally"})," and ",(0,a.jsx)(n.code,{children:"value"}),", where ",(0,a.jsx)(n.code,{children:"tally"})," contains the current accumulated value and ",(0,a.jsx)(n.code,{children:"value"})," is the value of the current element. The mapping must return the result of adding the value to the tally."]}),"\n",(0,a.jsxs)(n.p,{children:["The first argument is the value that ",(0,a.jsx)(n.code,{children:"tally"})," will have on the first call."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-49",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"initial"})})," The initial value to start the fold with. For example, an empty object ",(0,a.jsx)(n.code,{children:"{}"}),", a zero count ",(0,a.jsx)(n.code,{children:"0"}),", or an empty string ",(0,a.jsx)(n.code,{children:'""'}),".",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query to apply for each element. The query is provided an object with two fields; ",(0,a.jsx)(n.code,{children:"tally"})," containing the current tally, and ",(0,a.jsx)(n.code,{children:"value"})," containing the value of the current element. The query should result in a new tally to be passed to the next element query."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-94",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.sum = this.foo.fold(0, item -> item.tally + item.value)\n\n# In: {"foo":[3,8,11]}\n# Out: {"sum":22}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.foo.fold("", item -> "%v%v".format(item.tally, item.value))\n\n# In: {"foo":["hello ", "world"]}\n# Out: {"result":"hello world"}\n'})}),"\n",(0,a.jsx)(n.p,{children:"You can use fold to merge an array of objects together:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.smoothie = this.fruits.fold({}, item -> item.tally.merge(item.value))\n\n# In: {"fruits":[{"apple":5},{"banana":3},{"orange":8}]}\n# Out: {"smoothie":{"apple":5,"banana":3,"orange":8}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"get",children:(0,a.jsx)(n.code,{children:"get"})}),"\n",(0,a.jsxs)(n.p,{children:["Extract a field value, identified via a ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"dot path"}),", from an object."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-50",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"dot path"})," identifying a field to obtain."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-95",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.foo.get(this.target)\n\n# In: {"foo":{"bar":"from bar","baz":"from baz"},"target":"bar"}\n# Out: {"result":"from bar"}\n\n# In: {"foo":{"bar":"from bar","baz":"from baz"},"target":"baz"}\n# Out: {"result":"from baz"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"index",children:(0,a.jsx)(n.code,{children:"index"})}),"\n",(0,a.jsx)(n.p,{children:"Extract an element from an array by an index. The index can be negative, and if so the element will be selected from the end counting backwards starting from -1. E.g. an index of -1 returns the last element, an index of -2 returns the element before the last, and so on."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-51",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"index"})})," The index to obtain from an array."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-96",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.last_name = this.names.index(-1)\n\n# In: {"names":["rachel","stevens"]}\n# Out: {"last_name":"stevens"}\n'})}),"\n",(0,a.jsx)(n.p,{children:"It is also possible to use this method on byte arrays, in which case the selected element will be returned as an integer."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.last_byte = this.name.bytes().index(-1)\n\n# In: {"name":"foobar bazson"}\n# Out: {"last_byte":110}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"join",children:(0,a.jsx)(n.code,{children:"join"})}),"\n",(0,a.jsx)(n.p,{children:"Join an array of strings with an optional delimiter into a single string."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-52",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"delimiter"})})," <(optional) string> An optional delimiter to add between each string."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-97",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.joined_words = this.words.join()\nroot.joined_numbers = this.numbers.map_each(this.string()).join(",")\n\n# In: {"words":["hello","world"],"numbers":[3,8,11]}\n# Out: {"joined_numbers":"3,8,11","joined_words":"helloworld"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"json_path",children:(0,a.jsx)(n.code,{children:"json_path"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Executes the given JSONPath expression on an object or array and returns the result. The JSONPath expression syntax can be found at ",(0,a.jsx)(n.a,{href:"https://goessner.net/articles/JsonPath/",children:"https://goessner.net/articles/JsonPath/"}),". For more complex logic, you can use Gval expressions (",(0,a.jsx)(n.a,{href:"https://github.com/PaesslerAG/gval",children:"https://github.com/PaesslerAG/gval"}),")."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-53",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"expression"})})," The JSONPath expression to execute."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-98",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.all_names = this.json_path("$..name")\n\n# In: {"name":"alice","foo":{"name":"bob"}}\n# Out: {"all_names":["alice","bob"]}\n\n# In: {"thing":["this","bar",{"name":"alice"}]}\n# Out: {"all_names":["alice"]}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.text_objects = this.json_path("$.body[?(@.type==\'text\')]")\n\n# In: {"body":[{"type":"image","id":"foo"},{"type":"text","id":"bar"}]}\n# Out: {"text_objects":[{"id":"bar","type":"text"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"json_schema",children:(0,a.jsx)(n.code,{children:"json_schema"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Checks a ",(0,a.jsx)(n.a,{href:"https://json-schema.org/",children:"JSON schema"})," against a value and returns the value if it matches or throws and error if it does not."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-54",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"schema"})})," The schema to check values against."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-99",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.json_schema("""{\n "type":"object",\n "properties":{\n "foo":{\n "type":"string"\n }\n }\n}""")\n\n# In: {"foo":"bar"}\n# Out: {"foo":"bar"}\n\n# In: {"foo":5}\n# Out: Error("failed assignment (line 1): field `this`: foo invalid type. expected: string, given: integer")\n'})}),"\n",(0,a.jsxs)(n.p,{children:["In order to load a schema from a file use the ",(0,a.jsx)(n.code,{children:"file"})," function."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.json_schema(file(env("BENTO_TEST_BLOBLANG_SCHEMA_FILE")))\n'})}),"\n",(0,a.jsx)(n.h3,{id:"key_values",children:(0,a.jsx)(n.code,{children:"key_values"})}),"\n",(0,a.jsxs)(n.p,{children:["Returns the key/value pairs of an object as an array, where each element is an object with a ",(0,a.jsx)(n.code,{children:"key"})," field and a ",(0,a.jsx)(n.code,{children:"value"})," field. The order of the resulting array will be random."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-100",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_key_values = this.foo.key_values().sort_by(pair -> pair.key)\n\n# In: {"foo":{"bar":1,"baz":2}}\n# Out: {"foo_key_values":[{"key":"bar","value":1},{"key":"baz","value":2}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"keys",children:(0,a.jsx)(n.code,{children:"keys"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the keys of an object as an array."}),"\n",(0,a.jsx)(n.h4,{id:"examples-101",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_keys = this.foo.keys()\n\n# In: {"foo":{"bar":1,"baz":2}}\n# Out: {"foo_keys":["bar","baz"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"length-1",children:(0,a.jsx)(n.code,{children:"length"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the length of an array or object (number of keys)."}),"\n",(0,a.jsx)(n.h4,{id:"examples-102",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_len = this.foo.length()\n\n# In: {"foo":["first","second"]}\n# Out: {"foo_len":2}\n\n# In: {"foo":{"first":"bar","second":"baz"}}\n# Out: {"foo_len":2}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"map_each",children:(0,a.jsx)(n.code,{children:"map_each"})}),"\n",(0,a.jsx)(n.h4,{id:"parameters-55",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query that will be used to map each element."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-103",children:"Examples"}),"\n",(0,a.jsx)(n.h5,{id:"on-arrays-1",children:"On arrays"}),"\n",(0,a.jsx)(n.p,{children:"Apply a mapping to each element of an array and replace the element with the result. Within the argument mapping the context is the value of the element being mapped."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_nums = this.nums.map_each(num -> if num < 10 {\n deleted()\n} else {\n num - 10\n})\n\n# In: {"nums":[3,11,4,17]}\n# Out: {"new_nums":[1,7]}\n'})}),"\n",(0,a.jsx)(n.h5,{id:"on-objects-2",children:"On objects"}),"\n",(0,a.jsxs)(n.p,{children:["Apply a mapping to each value of an object and replace the value with the result. Within the argument mapping the context is an object with a field ",(0,a.jsx)(n.code,{children:"key"})," containing the value key, and a field ",(0,a.jsx)(n.code,{children:"value"}),"."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_dict = this.dict.map_each(item -> item.value.uppercase())\n\n# In: {"dict":{"foo":"hello","bar":"world"}}\n# Out: {"new_dict":{"bar":"WORLD","foo":"HELLO"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"map_each_key",children:(0,a.jsx)(n.code,{children:"map_each_key"})}),"\n",(0,a.jsx)(n.p,{children:"Apply a mapping to each key of an object, and replace the key with the result, which must be a string."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-56",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query that will be used to map each key."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-104",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.new_dict = this.dict.map_each_key(key -> key.uppercase())\n\n# In: {"dict":{"keya":"hello","keyb":"world"}}\n# Out: {"new_dict":{"KEYA":"hello","KEYB":"world"}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.map_each_key(key -> if key.contains("kafka") { "_" + key })\n\n# In: {"amqp_key":"foo","kafka_key":"bar","kafka_topic":"baz"}\n# Out: {"_kafka_key":"bar","_kafka_topic":"baz","amqp_key":"foo"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"merge",children:(0,a.jsx)(n.code,{children:"merge"})}),"\n",(0,a.jsxs)(n.p,{children:["Merge a source object into an existing destination object. When a collision is found within the merged structures (both a source and destination object contain the same non-object keys) the result will be an array containing both values, where values that are already arrays will be expanded into the resulting array. In order to simply override destination fields on collision use the ",(0,a.jsx)(n.a,{href:"#assign",children:(0,a.jsx)(n.code,{children:"assign"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-57",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"with"})})," A value to merge the target value with."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-105",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.foo.merge(this.bar)\n\n# In: {"foo":{"first_name":"fooer","likes":"bars"},"bar":{"second_name":"barer","likes":"foos"}}\n# Out: {"first_name":"fooer","likes":["bars","foos"],"second_name":"barer"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"patch",children:(0,a.jsx)(n.code,{children:"patch"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Create a diff by comparing the current value with the given one. Wraps the github.com/r3labs/diff/v3 package. See its ",(0,a.jsx)(n.a,{href:"https://pkg.go.dev/github.com/r3labs/diff/v3",children:"docs"})," for more information."]}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version 4.25.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-58",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"changelog"})})," The changelog to apply."]}),"\n",(0,a.jsx)(n.h3,{id:"slice-1",children:(0,a.jsx)(n.code,{children:"slice"})}),"\n",(0,a.jsx)(n.p,{children:"Extract a slice from an array by specifying two indices, a low and high bound, which selects a half-open range that includes the first element, but excludes the last one. If the second index is omitted then it defaults to the length of the input sequence."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-59",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"low"})})," The low bound, which is the first element of the selection, or if negative selects from the end.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"high"})})," <(optional) integer> An optional high bound."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-106",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.beginning = this.value.slice(0, 2)\nroot.end = this.value.slice(4)\n\n# In: {"value":["foo","bar","baz","buz","bev"]}\n# Out: {"beginning":["foo","bar"],"end":["bev"]}\n'})}),"\n",(0,a.jsx)(n.p,{children:"A negative low index can be used, indicating an offset from the end of the sequence. If the low index is greater than the length of the sequence then an empty result is returned."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.last_chunk = this.value.slice(-2)\nroot.the_rest = this.value.slice(0, -2)\n\n# In: {"value":["foo","bar","baz","buz","bev"]}\n# Out: {"last_chunk":["buz","bev"],"the_rest":["foo","bar","baz"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sort",children:(0,a.jsx)(n.code,{children:"sort"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to sort the values of an array in increasing order. The type of all values must match in order for the ordering to succeed. Supports string and number values."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-60",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"compare"})})," <(optional) query expression> An optional query that should explicitly compare elements ",(0,a.jsx)(n.code,{children:"left"})," and ",(0,a.jsx)(n.code,{children:"right"})," and provide a boolean result."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-107",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.sorted = this.foo.sort()\n\n# In: {"foo":["bbb","ccc","aaa"]}\n# Out: {"sorted":["aaa","bbb","ccc"]}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["It's also possible to specify a mapping argument, which is provided an object context with fields ",(0,a.jsx)(n.code,{children:"left"})," and ",(0,a.jsx)(n.code,{children:"right"}),", the mapping must return a boolean indicating whether the ",(0,a.jsx)(n.code,{children:"left"})," value is less than ",(0,a.jsx)(n.code,{children:"right"}),". This allows you to sort arrays containing non-string or non-number values."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.sorted = this.foo.sort(item -> item.left.v < item.right.v)\n\n# In: {"foo":[{"id":"foo","v":"bbb"},{"id":"bar","v":"ccc"},{"id":"baz","v":"aaa"}]}\n# Out: {"sorted":[{"id":"baz","v":"aaa"},{"id":"foo","v":"bbb"},{"id":"bar","v":"ccc"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sort_by",children:(0,a.jsx)(n.code,{children:"sort_by"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to sort the elements of an array, in increasing order, by a value emitted by an argument query applied to each element. The type of all values must match in order for the ordering to succeed. Supports string and number values."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-61",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query"})})," A query to apply to each element that yields a value used for sorting."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-108",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.sorted = this.foo.sort_by(ele -> ele.id)\n\n# In: {"foo":[{"id":"bbb","message":"bar"},{"id":"aaa","message":"foo"},{"id":"ccc","message":"baz"}]}\n# Out: {"sorted":[{"id":"aaa","message":"foo"},{"id":"bbb","message":"bar"},{"id":"ccc","message":"baz"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"squash",children:(0,a.jsx)(n.code,{children:"squash"})}),"\n",(0,a.jsxs)(n.p,{children:["Squashes an array of objects into a single object, where key collisions result in the values being merged (following similar rules as the ",(0,a.jsx)(n.code,{children:".merge()"})," method)"]}),"\n",(0,a.jsx)(n.h4,{id:"examples-109",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.locations = this.locations.map_each(loc -> {loc.state: [loc.name]}).squash()\n\n# In: {"locations":[{"name":"Seattle","state":"WA"},{"name":"New York","state":"NY"},{"name":"Bellevue","state":"WA"},{"name":"Olympia","state":"WA"}]}\n# Out: {"locations":{"NY":["New York"],"WA":["Seattle","Bellevue","Olympia"]}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sum",children:(0,a.jsx)(n.code,{children:"sum"})}),"\n",(0,a.jsx)(n.p,{children:"Sum the numerical values of an array."}),"\n",(0,a.jsx)(n.h4,{id:"examples-110",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.sum = this.foo.sum()\n\n# In: {"foo":[3,8,4]}\n# Out: {"sum":15}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"unique",children:(0,a.jsx)(n.code,{children:"unique"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to remove duplicate values from an array. The array may contain a combination of different value types, but numbers and strings are checked separately (",(0,a.jsx)(n.code,{children:'"5"'})," is a different element to ",(0,a.jsx)(n.code,{children:"5"}),")."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-62",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"emit"})})," <(optional) query expression> An optional query that can be used in order to yield a value for each element to determine uniqueness."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-111",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.uniques = this.foo.unique()\n\n# In: {"foo":["a","b","a","c"]}\n# Out: {"uniques":["a","b","c"]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"values",children:(0,a.jsx)(n.code,{children:"values"})}),"\n",(0,a.jsx)(n.p,{children:"Returns the values of an object as an array. The order of the resulting array will be random."}),"\n",(0,a.jsx)(n.h4,{id:"examples-112",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_vals = this.foo.values().sort()\n\n# In: {"foo":{"bar":1,"baz":2}}\n# Out: {"foo_vals":[1,2]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"with",children:(0,a.jsx)(n.code,{children:"with"})}),"\n",(0,a.jsxs)(n.p,{children:["Returns an object where all but one or more ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"field path"})," arguments are removed. Each path specifies a specific field to be retained from the input object, allowing for nested fields."]}),"\n",(0,a.jsx)(n.p,{children:"If a key within a nested path does not exist then it is ignored."}),"\n",(0,a.jsx)(n.h4,{id:"examples-113",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.with("inner.a","inner.c","d")\n\n# In: {"inner":{"a":"first","b":"second","c":"third"},"d":"fourth","e":"fifth"}\n# Out: {"d":"fourth","inner":{"a":"first","c":"third"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"without",children:(0,a.jsx)(n.code,{children:"without"})}),"\n",(0,a.jsxs)(n.p,{children:["Returns an object where one or more ",(0,a.jsx)(n.a,{href:"/docs/configuration/field_paths",children:"field path"})," arguments are removed. Each path specifies a specific field to be deleted from the input object, allowing for nested fields."]}),"\n",(0,a.jsx)(n.p,{children:"If a key within a nested path does not exist or is not an object then it is not removed."}),"\n",(0,a.jsx)(n.h4,{id:"examples-114",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.without("inner.a","inner.c","d")\n\n# In: {"inner":{"a":"first","b":"second","c":"third"},"d":"fourth","e":"fifth"}\n# Out: {"e":"fifth","inner":{"b":"second"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"zip",children:(0,a.jsx)(n.code,{children:"zip"})}),"\n",(0,a.jsx)(n.p,{children:"Zip an array value with one or more argument arrays. Each array must match in length."}),"\n",(0,a.jsx)(n.h4,{id:"examples-115",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo = this.foo.zip(this.bar, this.baz)\n\n# In: {"foo":["a","b","c"],"bar":[1,2,3],"baz":[4,5,6]}\n# Out: {"foo":[["a",1,4],["b",2,5],["c",3,6]]}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"parsing",children:"Parsing"}),"\n",(0,a.jsx)(n.h3,{id:"bloblang",children:(0,a.jsx)(n.code,{children:"bloblang"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsxs)(n.p,{children:["Executes an argument Bloblang mapping on the target. This method can be used in order to execute dynamic mappings. Imports and functions that interact with the environment, such as ",(0,a.jsx)(n.code,{children:"file"})," and ",(0,a.jsx)(n.code,{children:"env"}),", or that access message information directly, such as ",(0,a.jsx)(n.code,{children:"content"})," or ",(0,a.jsx)(n.code,{children:"json"}),", are not enabled for dynamic Bloblang mappings."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-63",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"mapping"})})," The mapping to execute."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-116",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.body = this.body.bloblang(this.mapping)\n\n# In: {"body":{"foo":"hello world"},"mapping":"root.foo = this.foo.uppercase()"}\n# Out: {"body":{"foo":"HELLO WORLD"}}\n\n# In: {"body":{"foo":"hello world 2"},"mapping":"root.foo = this.foo.capitalize()"}\n# Out: {"body":{"foo":"Hello World 2"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"format_json",children:(0,a.jsx)(n.code,{children:"format_json"})}),"\n",(0,a.jsx)(n.admonition,{title:"BETA",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with it is found."})}),"\n",(0,a.jsx)(n.p,{children:"Serializes a target value into a pretty-printed JSON byte array (with 4 space indentation by default)."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-64",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"indent"})})," Indentation string. Each element in a JSON object or array will begin on a new, indented line followed by one or more copies of indent according to the indentation nesting.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"no_indent"})})," Disable indentation."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-117",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.doc.format_json()\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {\n# "foo": "bar"\n# }\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Pass a string to the ",(0,a.jsx)(n.code,{children:"indent"})," parameter in order to customise the indentation."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.format_json(" ")\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {\n# "doc": {\n# "foo": "bar"\n# }\n# }\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Use the ",(0,a.jsx)(n.code,{children:".string()"})," method in order to coerce the result into a string."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.format_json().string()\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {"doc":"{\\n \\"foo\\": \\"bar\\"\\n}"}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Set the ",(0,a.jsx)(n.code,{children:"no_indent"})," parameter to true to disable indentation. The result is equivalent to calling ",(0,a.jsx)(n.code,{children:"bytes()"}),"."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.doc.format_json(no_indent: true)\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {"foo":"bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"format_msgpack",children:(0,a.jsx)(n.code,{children:"format_msgpack"})}),"\n",(0,a.jsxs)(n.p,{children:["Formats data as a ",(0,a.jsx)(n.a,{href:"https://msgpack.org/",children:"MessagePack"})," message in bytes format."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-118",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.format_msgpack().encode("hex")\n\n# In: {"foo":"bar"}\n# Out: 81a3666f6fa3626172\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.encoded = this.format_msgpack().encode("base64")\n\n# In: {"foo":"bar"}\n# Out: {"encoded":"gaNmb2+jYmFy"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"format_xml",children:(0,a.jsx)(n.code,{children:"format_xml"})}),"\n",(0,a.jsx)(n.p,{children:"Serializes a target value into an XML byte array."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-65",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"indent"})})," Indentation string. Each element in an XML object or array will begin on a new, indented line followed by one or more copies of indent according to the indentation nesting.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"no_indent"})})," Disable indentation."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-119",children:"Examples"}),"\n",(0,a.jsx)(n.p,{children:"Serializes a target value into a pretty-printed XML byte array (with 4 space indentation by default)."}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.format_xml()\n\n# In: {"foo":{"bar":{"baz":"foo bar baz"}}}\n# Out: \n# \n# foo bar baz\n# \n# \n'})}),"\n",(0,a.jsxs)(n.p,{children:["Pass a string to the ",(0,a.jsx)(n.code,{children:"indent"})," parameter in order to customise the indentation."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.format_xml(" ")\n\n# In: {"foo":{"bar":{"baz":"foo bar baz"}}}\n# Out: \n# \n# foo bar baz\n# \n# \n'})}),"\n",(0,a.jsxs)(n.p,{children:["Use the ",(0,a.jsx)(n.code,{children:".string()"})," method in order to coerce the result into a string."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.format_xml("").string()\n\n# In: {"foo":{"bar":{"baz":"foo bar baz"}}}\n# Out: {"doc":"\\n\\nfoo bar baz\\n\\n"}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Set the ",(0,a.jsx)(n.code,{children:"no_indent"})," parameter to true to disable indentation."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.format_xml(no_indent: true)\n\n# In: {"foo":{"bar":{"baz":"foo bar baz"}}}\n# Out: foo bar baz\n'})}),"\n",(0,a.jsx)(n.h3,{id:"format_yaml",children:(0,a.jsx)(n.code,{children:"format_yaml"})}),"\n",(0,a.jsx)(n.p,{children:"Serializes a target value into a YAML byte array."}),"\n",(0,a.jsx)(n.h4,{id:"examples-120",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.doc.format_yaml()\n\n# In: {"doc":{"foo":"bar"}}\n# Out: foo: bar\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Use the ",(0,a.jsx)(n.code,{children:".string()"})," method in order to coerce the result into a string."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.format_yaml().string()\n\n# In: {"doc":{"foo":"bar"}}\n# Out: {"doc":"foo: bar\\n"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_csv",children:(0,a.jsx)(n.code,{children:"parse_csv"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to parse a string into an array of objects by following the CSV format described in RFC 4180."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-66",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"parse_header_row"})})," Whether to reference the first row as a header row. If set to true the output structure for messages will be an object where field keys are determined by the header row. Otherwise, the output will be an array of row arrays.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"delimiter"})})," The delimiter to use for splitting values in each record. It must be a single character.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"lazy_quotes"})})," If set to ",(0,a.jsx)(n.code,{children:"true"}),", a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-121",children:"Examples"}),"\n",(0,a.jsx)(n.p,{children:"Parses CSV data with a header row"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.orders = this.orders.parse_csv()\n\n# In: {"orders":"foo,bar\\nfoo 1,bar 1\\nfoo 2,bar 2"}\n# Out: {"orders":[{"bar":"bar 1","foo":"foo 1"},{"bar":"bar 2","foo":"foo 2"}]}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Parses CSV data without a header row"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.orders = this.orders.parse_csv(false)\n\n# In: {"orders":"foo 1,bar 1\\nfoo 2,bar 2"}\n# Out: {"orders":[["foo 1","bar 1"],["foo 2","bar 2"]]}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Parses CSV data delimited by dots"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.orders = this.orders.parse_csv(delimiter:".")\n\n# In: {"orders":"foo.bar\\nfoo 1.bar 1\\nfoo 2.bar 2"}\n# Out: {"orders":[{"bar":"bar 1","foo":"foo 1"},{"bar":"bar 2","foo":"foo 2"}]}\n'})}),"\n",(0,a.jsx)(n.p,{children:"Parses CSV data containing a quote in an unquoted field"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.orders = this.orders.parse_csv(lazy_quotes:true)\n\n# In: {"orders":"foo,bar\\nfoo 1,bar 1\\nfoo\\" \\"2,bar\\" \\"2"}\n# Out: {"orders":[{"bar":"bar 1","foo":"foo 1"},{"bar":"bar\\" \\"2","foo":"foo\\" \\"2"}]}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_form_url_encoded",children:(0,a.jsx)(n.code,{children:"parse_form_url_encoded"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to parse a url-encoded query string (from an x-www-form-urlencoded request body) and returns a structured result."}),"\n",(0,a.jsx)(n.h4,{id:"examples-122",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.values = this.body.parse_form_url_encoded()\n\n# In: {"body":"noise=meow&animal=cat&fur=orange&fur=fluffy"}\n# Out: {"values":{"animal":"cat","fur":["orange","fluffy"],"noise":"meow"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_json",children:(0,a.jsx)(n.code,{children:"parse_json"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to parse a string as a JSON document and returns the result."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-67",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"use_number"})})," <(optional) bool> An optional flag that when set makes parsing numbers as json.Number instead of the default float64."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-123",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_json()\n\n# In: {"doc":"{\\"foo\\":\\"bar\\"}"}\n# Out: {"doc":{"foo":"bar"}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_json(use_number: true)\n\n# In: {"doc":"{\\"foo\\":\\"11380878173205700000000000000000000000000000000\\"}"}\n# Out: {"doc":{"foo":"11380878173205700000000000000000000000000000000"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_msgpack",children:(0,a.jsx)(n.code,{children:"parse_msgpack"})}),"\n",(0,a.jsxs)(n.p,{children:["Parses a ",(0,a.jsx)(n.a,{href:"https://msgpack.org/",children:"MessagePack"})," message into a structured document."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-124",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = content().decode("hex").parse_msgpack()\n\n# In: 81a3666f6fa3626172\n# Out: {"foo":"bar"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.encoded.decode("base64").parse_msgpack()\n\n# In: {"encoded":"gaNmb2+jYmFy"}\n# Out: {"foo":"bar"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_parquet",children:(0,a.jsx)(n.code,{children:"parse_parquet"})}),"\n",(0,a.jsxs)(n.p,{children:["Decodes a ",(0,a.jsx)(n.a,{href:"https://parquet.apache.org/docs/",children:"Parquet file"})," into an array of objects, one for each row within the file."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-68",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"byte_array_as_string"})})," Deprecated: This parameter is no longer used."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-125",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:"root = content().parse_parquet()\n"})}),"\n",(0,a.jsx)(n.h3,{id:"parse_url",children:(0,a.jsx)(n.code,{children:"parse_url"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to parse a URL from a string value, returning a structured result that describes the various facets of the URL. The fields returned within the structured result roughly follow ",(0,a.jsx)(n.a,{href:"https://pkg.go.dev/net/url#URL",children:"https://pkg.go.dev/net/url#URL"}),", and may be expanded in future in order to present more information."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-126",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.foo_url = this.foo_url.parse_url()\n\n# In: {"foo_url":"https://warpstreamlabs.github.io/bento/docs/guides/bloblang/about"}\n# Out: {"foo_url":{"fragment":"","host":"warpstreamlabs.github.io","opaque":"","path":"/bento/docs/guides/bloblang/about","raw_fragment":"","raw_path":"","raw_query":"","scheme":"https"}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.username = this.url.parse_url().user.name | "unknown"\n\n# In: {"url":"amqp://foo:bar@127.0.0.1:5672/"}\n# Out: {"username":"foo"}\n\n# In: {"url":"redis://localhost:6379"}\n# Out: {"username":"unknown"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_xml",children:(0,a.jsx)(n.code,{children:"parse_xml"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to parse a string as an XML document and returns a structured result, where elements appear as keys of an object according to the following rules:"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:["If an element contains attributes they are parsed by prefixing a hyphen, ",(0,a.jsx)(n.code,{children:"-"}),", to the attribute label."]}),"\n",(0,a.jsxs)(n.li,{children:["If the element is a simple element and has attributes, the element value is given the key ",(0,a.jsx)(n.code,{children:"#text"}),"."]}),"\n",(0,a.jsx)(n.li,{children:"XML comments, directives, and process instructions are ignored."}),"\n",(0,a.jsx)(n.li,{children:"When elements are repeated the resulting JSON value is an array."}),"\n",(0,a.jsx)(n.li,{children:"If cast is true, try to cast values to numbers and booleans instead of returning strings."}),"\n"]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-69",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"cast"})})," <(optional) bool, default ",(0,a.jsx)(n.code,{children:"false"}),"> whether to try to cast values that are numbers and booleans to the right type."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-127",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_xml()\n\n# In: {"doc":"This is a titleThis is some content"}\n# Out: {"doc":{"root":{"content":"This is some content","title":"This is a title"}}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_xml(cast: false)\n\n# In: {"doc":"This is a title123True"}\n# Out: {"doc":{"root":{"bool":"True","number":{"#text":"123","-id":"99"},"title":"This is a title"}}}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_xml(cast: true)\n\n# In: {"doc":"This is a title123True"}\n# Out: {"doc":{"root":{"bool":true,"number":{"#text":123,"-id":99},"title":"This is a title"}}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_yaml",children:(0,a.jsx)(n.code,{children:"parse_yaml"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to parse a string as a single YAML document and returns the result."}),"\n",(0,a.jsx)(n.h4,{id:"examples-128",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.doc = this.doc.parse_yaml()\n\n# In: {"doc":"foo: bar"}\n# Out: {"doc":{"foo":"bar"}}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"encoding-and-encryption",children:"Encoding and Encryption"}),"\n",(0,a.jsx)(n.h3,{id:"compress",children:(0,a.jsx)(n.code,{children:"compress"})}),"\n",(0,a.jsx)(n.p,{children:"Compresses a string or byte array value according to a specified algorithm."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-70",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"algorithm"})})," One of ",(0,a.jsx)(n.code,{children:"flate"}),", ",(0,a.jsx)(n.code,{children:"gzip"}),", ",(0,a.jsx)(n.code,{children:"pgzip"}),", ",(0,a.jsx)(n.code,{children:"lz4"}),", ",(0,a.jsx)(n.code,{children:"snappy"}),", ",(0,a.jsx)(n.code,{children:"zlib"}),", ",(0,a.jsx)(n.code,{children:"zstd"}),".",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"level"})})," The level of compression to use. May not be applicable to all algorithms."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-129",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'let long_content = range(0, 1000).map_each(content()).join(" ")\nroot.a_len = $long_content.length()\nroot.b_len = $long_content.compress("gzip").length()\n\n\n# In: hello world this is some content\n# Out: {"a_len":32999,"b_len":161}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.compressed = content().compress("lz4").encode("base64")\n\n# In: hello world I love space\n# Out: {"compressed":"BCJNGGRwuRgAAIBoZWxsbyB3b3JsZCBJIGxvdmUgc3BhY2UAAAAAGoETLg=="}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"decode",children:(0,a.jsx)(n.code,{children:"decode"})}),"\n",(0,a.jsxs)(n.p,{children:["Decodes an encoded string target according to a chosen scheme and returns the result as a byte array. When mapping the result to a JSON field the value should be cast to a string using the method ",(0,a.jsx)(n.a,{href:"#string",children:(0,a.jsx)(n.code,{children:"string"})}),", or encoded using the method ",(0,a.jsx)(n.a,{href:"#encode",children:(0,a.jsx)(n.code,{children:"encode"})}),", otherwise it will be base64 encoded by default."]}),"\n",(0,a.jsxs)(n.p,{children:["Available schemes are: ",(0,a.jsx)(n.code,{children:"base64"}),", ",(0,a.jsx)(n.code,{children:"base64url"})," ",(0,a.jsx)(n.a,{href:"https://rfc-editor.org/rfc/rfc4648.html",children:"(RFC 4648 with padding characters)"}),", ",(0,a.jsx)(n.code,{children:"base64rawurl"})," ",(0,a.jsx)(n.a,{href:"https://rfc-editor.org/rfc/rfc4648.html",children:"(RFC 4648 without padding characters)"}),", ",(0,a.jsx)(n.code,{children:"hex"}),", ",(0,a.jsx)(n.code,{children:"ascii85"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-71",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"scheme"})})," The decoding scheme to use."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-130",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.decoded = this.value.decode("hex").string()\n\n# In: {"value":"68656c6c6f20776f726c64"}\n# Out: {"decoded":"hello world"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.encoded.decode("ascii85")\n\n# In: {"encoded":"FD,B0+DGm>FDl80Ci\\"A>F`)8BEckl6F`M&(+Cno&@/"}\n# Out: this is totally unstructured data\n'})}),"\n",(0,a.jsx)(n.h3,{id:"decompress",children:(0,a.jsx)(n.code,{children:"decompress"})}),"\n",(0,a.jsx)(n.p,{children:"Decompresses a string or byte array value according to a specified algorithm. The result of decompression"}),"\n",(0,a.jsx)(n.h4,{id:"parameters-72",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"algorithm"})})," One of ",(0,a.jsx)(n.code,{children:"gzip"}),", ",(0,a.jsx)(n.code,{children:"pgzip"}),", ",(0,a.jsx)(n.code,{children:"zlib"}),", ",(0,a.jsx)(n.code,{children:"bzip2"}),", ",(0,a.jsx)(n.code,{children:"flate"}),", ",(0,a.jsx)(n.code,{children:"snappy"}),", ",(0,a.jsx)(n.code,{children:"lz4"}),", ",(0,a.jsx)(n.code,{children:"zstd"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-131",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root = this.compressed.decode("base64").decompress("lz4")\n\n# In: {"compressed":"BCJNGGRwuRgAAIBoZWxsbyB3b3JsZCBJIGxvdmUgc3BhY2UAAAAAGoETLg=="}\n# Out: hello world I love space\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Use the ",(0,a.jsx)(n.code,{children:".string()"})," method in order to coerce the result into a string, this makes it possible to place the data within a JSON document without automatic base64 encoding."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.result = this.compressed.decode("base64").decompress("lz4").string()\n\n# In: {"compressed":"BCJNGGRwuRgAAIBoZWxsbyB3b3JsZCBJIGxvdmUgc3BhY2UAAAAAGoETLg=="}\n# Out: {"result":"hello world I love space"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"decrypt_aes",children:(0,a.jsx)(n.code,{children:"decrypt_aes"})}),"\n",(0,a.jsxs)(n.p,{children:["Decrypts an encrypted string or byte array target according to a chosen AES encryption method and returns the result as a byte array. The algorithms require a key and an initialization vector / nonce. Available schemes are: ",(0,a.jsx)(n.code,{children:"ctr"}),", ",(0,a.jsx)(n.code,{children:"ofb"}),", ",(0,a.jsx)(n.code,{children:"cbc"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-73",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"scheme"})})," The scheme to use for decryption, one of ",(0,a.jsx)(n.code,{children:"ctr"}),", ",(0,a.jsx)(n.code,{children:"ofb"}),", ",(0,a.jsx)(n.code,{children:"cbc"}),".",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"key"})})," A key to decrypt with.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"iv"})})," An initialization vector / nonce."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-132",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'let key = "2b7e151628aed2a6abf7158809cf4f3c".decode("hex")\nlet vector = "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff".decode("hex")\nroot.decrypted = this.value.decode("hex").decrypt_aes("ctr", $key, $vector).string()\n\n# In: {"value":"84e9b31ff7400bdf80be7254"}\n# Out: {"decrypted":"hello world!"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"encode",children:(0,a.jsx)(n.code,{children:"encode"})}),"\n",(0,a.jsxs)(n.p,{children:["Encodes a string or byte array target according to a chosen scheme and returns a string result. Available schemes are: ",(0,a.jsx)(n.code,{children:"base64"}),", ",(0,a.jsx)(n.code,{children:"base64url"})," ",(0,a.jsx)(n.a,{href:"https://rfc-editor.org/rfc/rfc4648.html",children:"(RFC 4648 with padding characters)"}),", ",(0,a.jsx)(n.code,{children:"base64rawurl"})," ",(0,a.jsx)(n.a,{href:"https://rfc-editor.org/rfc/rfc4648.html",children:"(RFC 4648 without padding characters)"}),", ",(0,a.jsx)(n.code,{children:"hex"}),", ",(0,a.jsx)(n.code,{children:"ascii85"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-74",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"scheme"})})," The encoding scheme to use."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-133",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.encoded = this.value.encode("hex")\n\n# In: {"value":"hello world"}\n# Out: {"encoded":"68656c6c6f20776f726c64"}\n'})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.encoded = content().encode("ascii85")\n\n# In: this is totally unstructured data\n# Out: {"encoded":"FD,B0+DGm>FDl80Ci\\"A>F`)8BEckl6F`M&(+Cno&@/"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"encrypt_aes",children:(0,a.jsx)(n.code,{children:"encrypt_aes"})}),"\n",(0,a.jsxs)(n.p,{children:["Encrypts a string or byte array target according to a chosen AES encryption method and returns a string result. The algorithms require a key and an initialization vector / nonce. Available schemes are: ",(0,a.jsx)(n.code,{children:"ctr"}),", ",(0,a.jsx)(n.code,{children:"ofb"}),", ",(0,a.jsx)(n.code,{children:"cbc"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-75",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"scheme"})})," The scheme to use for encryption, one of ",(0,a.jsx)(n.code,{children:"ctr"}),", ",(0,a.jsx)(n.code,{children:"ofb"}),", ",(0,a.jsx)(n.code,{children:"cbc"}),".",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"key"})})," A key to encrypt with.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"iv"})})," An initialization vector / nonce."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-134",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'let key = "2b7e151628aed2a6abf7158809cf4f3c".decode("hex")\nlet vector = "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff".decode("hex")\nroot.encrypted = this.value.encrypt_aes("ctr", $key, $vector).encode("hex")\n\n# In: {"value":"hello world!"}\n# Out: {"encrypted":"84e9b31ff7400bdf80be7254"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"hash",children:(0,a.jsx)(n.code,{children:"hash"})}),"\n",(0,a.jsxs)(n.p,{children:["Hashes a string or byte array according to a chosen algorithm and returns the result as a byte array. When mapping the result to a JSON field the value should be cast to a string using the method ",(0,a.jsx)(n.a,{href:"#string",children:(0,a.jsx)(n.code,{children:"string"})}),", or encoded using the method ",(0,a.jsx)(n.a,{href:"#encode",children:(0,a.jsx)(n.code,{children:"encode"})}),", otherwise it will be base64 encoded by default."]}),"\n",(0,a.jsxs)(n.p,{children:["Available algorithms are: ",(0,a.jsx)(n.code,{children:"hmac_sha1"}),", ",(0,a.jsx)(n.code,{children:"hmac_sha256"}),", ",(0,a.jsx)(n.code,{children:"hmac_sha512"}),", ",(0,a.jsx)(n.code,{children:"md5"}),", ",(0,a.jsx)(n.code,{children:"sha1"}),", ",(0,a.jsx)(n.code,{children:"sha256"}),", ",(0,a.jsx)(n.code,{children:"sha512"}),", ",(0,a.jsx)(n.code,{children:"xxhash64"}),", ",(0,a.jsx)(n.code,{children:"crc32"}),"."]}),"\n",(0,a.jsxs)(n.p,{children:["The following algorithms require a key, which is specified as a second argument: ",(0,a.jsx)(n.code,{children:"hmac_sha1"}),", ",(0,a.jsx)(n.code,{children:"hmac_sha256"}),", ",(0,a.jsx)(n.code,{children:"hmac_sha512"}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-76",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"algorithm"})})," The hasing algorithm to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"key"})})," <(optional) string> An optional key to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"polynomial"})})," An optional polynomial key to use when selecting the ",(0,a.jsx)(n.code,{children:"crc32"})," algorithm, otherwise ignored. Options are ",(0,a.jsx)(n.code,{children:"IEEE"})," (default), ",(0,a.jsx)(n.code,{children:"Castagnoli"})," and ",(0,a.jsx)(n.code,{children:"Koopman"})]}),"\n",(0,a.jsx)(n.h4,{id:"examples-135",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.h1 = this.value.hash("sha1").encode("hex")\nroot.h2 = this.value.hash("hmac_sha1","static-key").encode("hex")\n\n# In: {"value":"hello world"}\n# Out: {"h1":"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed","h2":"d87e5f068fa08fe90bb95bc7c8344cb809179d76"}\n'})}),"\n",(0,a.jsxs)(n.p,{children:["The ",(0,a.jsx)(n.code,{children:"crc32"})," algorithm supports options for the polynomial."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.h1 = this.value.hash(algorithm: "crc32", polynomial: "Castagnoli").encode("hex")\nroot.h2 = this.value.hash(algorithm: "crc32", polynomial: "Koopman").encode("hex")\n\n# In: {"value":"hello world"}\n# Out: {"h1":"c99465aa","h2":"df373d3c"}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"json-web-tokens",children:"JSON Web Tokens"}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_es256",children:(0,a.jsx)(n.code,{children:"parse_jwt_es256"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with ES256. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-77",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The ES256 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-136",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_es256("""-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEGtLqIBePHmIhQcf0JLgc+F/4W/oI\ndp0Gta53G35VerNDgUUXmp78J2kfh4qLdh0XtmOMI587tCaqjvDAXfs//w==\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.GIRajP9JJbpTlqSCdNEz4qpQkRvzX4Q51YnTwVyxLDM9tKjR_a8ggHWn9CWj7KG0x8J56OWtmUxn112SRTZVhQ"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_es384",children:(0,a.jsx)(n.code,{children:"parse_jwt_es384"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with ES384. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-78",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The ES384 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-137",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_es384("""-----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAERoz74/B6SwmLhs8X7CWhnrWyRrB13AuU\n8OYeqy0qHRu9JWNw8NIavqpTmu6XPT4xcFanYjq8FbeuM11eq06C52mNmS4LLwzA\n2imlFEgn85bvJoC3bnkuq4mQjwt9VxdH\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.H2HBSlrvQBaov2tdreGonbBexxtQB-xzaPL4-tNQZ6TVh7VH8VBcSwcWHYa1lBAHmdsKOFcB2Wk0SB7QWeGT3ptSgr-_EhDMaZ8bA5spgdpq5DsKfaKHrd7DbbQlmxNq"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_es512",children:(0,a.jsx)(n.code,{children:"parse_jwt_es512"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with ES512. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-79",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The ES512 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-138",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_es512("""-----BEGIN PUBLIC KEY-----\nMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAkHLdts9P56fFkyhpYQ31M/Stwt3w\nvpaxhlfudxnXgTO1IP4RQRgryRxZ19EUzhvWDcG3GQIckoNMY5PelsnCGnIBT2Xh\n9NQkjWF5K6xS4upFsbGSAwQ+GIyyk5IPJ2LHgOyMSCVh5gRZXV3CZLzXujx/umC9\nUeYyTt05zRRWuD+p5bY=\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.ACrpLuU7TKpAnncDCpN9m85nkL55MJ45NFOBl6-nEXmNT1eIxWjiP4pwWVbFH9et_BgN14119jbL_KqEJInPYc9nAXC6dDLq0aBU-dalvNl4-O5YWpP43-Y-TBGAsWnbMTrchILJ4-AEiICe73Ck5yWPleKg9c3LtkEFWfGs7BoPRguZ"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_hs256",children:(0,a.jsx)(n.code,{children:"parse_jwt_hs256"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with HS256. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-80",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The HS256 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-139",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_hs256("""dont-tell-anyone""")\n\n# In: {"signed":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.YwXOM8v3gHVWcQRRRQc_zDlhmLnM62fwhFYGpiA0J1A"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_hs384",children:(0,a.jsx)(n.code,{children:"parse_jwt_hs384"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with HS384. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-81",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The HS384 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-140",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_hs384("""dont-tell-anyone""")\n\n# In: {"signed":"eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.2Y8rf_ijwN4t8hOGGViON_GrirLkCQVbCOuax6EoZ3nluX0tCGezcJxbctlIfsQ2"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_hs512",children:(0,a.jsx)(n.code,{children:"parse_jwt_hs512"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with HS512. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-82",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The HS512 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-141",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_hs512("""dont-tell-anyone""")\n\n# In: {"signed":"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.utRb0urG6LGGyranZJVo5Dk0Fns1QNcSUYPN0TObQ-YzsGGB8jrxHwM5NAJccjJZzKectEUqmmKCaETZvuX4Fg"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_rs256",children:(0,a.jsx)(n.code,{children:"parse_jwt_rs256"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with RS256. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-83",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The RS256 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-142",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_rs256("""-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/ibN8r68pLMR6gRzg4S\n8v8l6Q7yi8qURjkEbcNeM1rkokC7xh0I4JVTwxYSVv/JIW8qJdyspl5NIfuAVi32\nWfKvSAs+NIs+DMsNPYw3yuQals4AX8hith1YDvYpr8SD44jxhz/DR9lYKZFGhXGB\n+7NqQ7vpTWp3BceLYocazWJgusZt7CgecIq57ycM5hjM93BvlrUJ8nQ1a46wfL/8\nCy4P0et70hzZrsjjN41KFhKY0iUwlyU41yEiDHvHDDsTMBxAZosWjSREGfJL6Mfp\nXOInTHs/Gg6DZMkbxjQu6L06EdJ+Q/NwglJdAXM7Zo9rNELqRig6DdvG5JesdMsO\n+QIDAQAB\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.b0lH3jEupZZ4zoaly4Y_GCvu94HH6UKdKY96zfGNsIkPZpQLHIkZ7jMWlLlNOAd8qXlsBGP_i8H2qCKI4zlWJBGyPZgxXDzNRPVrTDfFpn4t4nBcA1WK2-ntXP3ehQxsaHcQU8Z_nsogId7Pme5iJRnoHWEnWtbwz5DLSXL3ZZNnRdrHM9MdI7QSDz9mojKDCaMpGN9sG7Xl-tGdBp1XzXuUOzG8S03mtZ1IgVR1uiBL2N6oohHIAunk8DIAmNWI-zgycTgzUGU7mvPkKH43qO8Ua1-13tCUBKKa8VxcotZ67Mxm1QAvBGoDnTKwWMwghLzs6d6WViXQg6eWlJcpBA"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_rs384",children:(0,a.jsx)(n.code,{children:"parse_jwt_rs384"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with RS384. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-84",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The RS384 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-143",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_rs384("""-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/ibN8r68pLMR6gRzg4S\n8v8l6Q7yi8qURjkEbcNeM1rkokC7xh0I4JVTwxYSVv/JIW8qJdyspl5NIfuAVi32\nWfKvSAs+NIs+DMsNPYw3yuQals4AX8hith1YDvYpr8SD44jxhz/DR9lYKZFGhXGB\n+7NqQ7vpTWp3BceLYocazWJgusZt7CgecIq57ycM5hjM93BvlrUJ8nQ1a46wfL/8\nCy4P0et70hzZrsjjN41KFhKY0iUwlyU41yEiDHvHDDsTMBxAZosWjSREGfJL6Mfp\nXOInTHs/Gg6DZMkbxjQu6L06EdJ+Q/NwglJdAXM7Zo9rNELqRig6DdvG5JesdMsO\n+QIDAQAB\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.orcXYBcjVE5DU7mvq4KKWFfNdXR4nEY_xupzWoETRpYmQZIozlZnM_nHxEk2dySvpXlAzVm7kgOPK2RFtGlOVaNRIa3x-pMMr-bhZTno4L8Hl4sYxOks3bWtjK7wql4uqUbqThSJB12psAXw2-S-I_FMngOPGIn4jDT9b802ottJSvTpXcy0-eKTjrV2PSkRRu-EYJh0CJZW55MNhqlt6kCGhAXfbhNazN3ASX-dmpd_JixyBKphrngr_zRA-FCn_Xf3QQDA-5INopb4Yp5QiJ7UxVqQEKI80X_JvJqz9WE1qiAw8pq5-xTen1t7zTP-HT1NbbD3kltcNa3G8acmNg"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"parse_jwt_rs512",children:(0,a.jsx)(n.code,{children:"parse_jwt_rs512"})}),"\n",(0,a.jsx)(n.p,{children:"Parses a claims object from a JWT string encoded with RS512. This method does not validate JWT claims."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-85",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The RS512 secret that was used for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-144",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.claims = this.signed.parse_jwt_rs512("""-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/ibN8r68pLMR6gRzg4S\n8v8l6Q7yi8qURjkEbcNeM1rkokC7xh0I4JVTwxYSVv/JIW8qJdyspl5NIfuAVi32\nWfKvSAs+NIs+DMsNPYw3yuQals4AX8hith1YDvYpr8SD44jxhz/DR9lYKZFGhXGB\n+7NqQ7vpTWp3BceLYocazWJgusZt7CgecIq57ycM5hjM93BvlrUJ8nQ1a46wfL/8\nCy4P0et70hzZrsjjN41KFhKY0iUwlyU41yEiDHvHDDsTMBxAZosWjSREGfJL6Mfp\nXOInTHs/Gg6DZMkbxjQu6L06EdJ+Q/NwglJdAXM7Zo9rNELqRig6DdvG5JesdMsO\n+QIDAQAB\n-----END PUBLIC KEY-----""")\n\n# In: {"signed":"eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.rsMp_X5HMrUqKnZJIxo27aAoscovRA6SSQYR9rq7pifIj0YHXxMyNyOBDGnvVALHKTi25VUGHpfNUW0VVMmae0A4t_ObNU6hVZHguWvetKZZq4FZpW1lgWHCMqgPGwT5_uOqwYCH6r8tJuZT3pqXeL0CY4putb1AN2w6CVp620nh3l8d3XWb4jaifycd_4CEVCqHuWDmohfug4VhmoVKlIXZkYoAQowgHlozATDssBSWdYtv107Wd2AzEoiXPu6e3pflsuXULlyqQnS4ELEKPYThFLafh1NqvZDPddqozcPZ-iODBW-xf3A4DYDdivnMYLrh73AZOGHexxu8ay6nDA"}\n# Out: {"claims":{"iat":1516239022,"mood":"Disdainful","sub":"1234567890"}}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_es256",children:(0,a.jsx)(n.code,{children:"sign_jwt_es256"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using ES256."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-86",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-145",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_es256("""-----BEGIN EC PRIVATE KEY-----\n... signature data ...\n-----END EC PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.-8LrOdkEiv_44ADWW08lpbq41ZmHCel58NMORPq1q4Dyw0zFhqDVLrRoSvCvuyyvgXAFb9IHfR-9MlJ_2ShA9A"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_es384",children:(0,a.jsx)(n.code,{children:"sign_jwt_es384"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using ES384."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-87",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-146",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_es384("""-----BEGIN EC PRIVATE KEY-----\n... signature data ...\n-----END EC PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.8FmTKH08dl7dyxrNu0rmvhegiIBCy-O9cddGco2e9lpZtgv5mS5qHgPkgBC5eRw1d7SRJsHwHZeehzdqT5Ba7aZJIhz9ds0sn37YQ60L7jT0j2gxCzccrt4kECHnUnLw"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_es512",children:(0,a.jsx)(n.code,{children:"sign_jwt_es512"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using ES512."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.20.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-88",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-147",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_es512("""-----BEGIN EC PRIVATE KEY-----\n... signature data ...\n-----END EC PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.AQbEWymoRZxDJEJtKSFFG2k2VbDCTYSuBwAZyMqexCspr3If8aERTVGif8HXG3S7TzMBCCzxkcKr3eIU441l3DlpAMNfQbkcOlBqMvNBn-CX481WyKf3K5rFHQ-6wRonz05aIsWAxCDvAozI_9J0OWllxdQ2MBAuTPbPJ38OqXsYkCQs"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_hs256",children:(0,a.jsx)(n.code,{children:"sign_jwt_hs256"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using HS256."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-89",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-148",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_hs256("""dont-tell-anyone""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.hUl-nngPMY_3h9vveWJUPsCcO5PeL6k9hWLnMYeFbFQ"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_hs384",children:(0,a.jsx)(n.code,{children:"sign_jwt_hs384"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using HS384."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-90",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-149",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_hs384("""dont-tell-anyone""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.zGYLr83aToon1efUNq-hw7XgT20lPvZb8sYei8x6S6mpHwb433SJdXJXx0Oio8AZ"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_hs512",children:(0,a.jsx)(n.code,{children:"sign_jwt_hs512"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using HS512."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.12.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-91",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-150",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_hs512("""dont-tell-anyone""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyMTIzIn0.zBNR9o_6EDwXXKkpKLNJhG26j8Dc-mV-YahBwmEdCrmiWt5les8I9rgmNlWIowpq6Yxs4kLNAdFhqoRz3NXT3w"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_rs256",children:(0,a.jsx)(n.code,{children:"sign_jwt_rs256"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using RS256."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.18.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-92",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-151",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_rs256("""-----BEGIN RSA PRIVATE KEY-----\n... signature data ...\n-----END RSA PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.b0lH3jEupZZ4zoaly4Y_GCvu94HH6UKdKY96zfGNsIkPZpQLHIkZ7jMWlLlNOAd8qXlsBGP_i8H2qCKI4zlWJBGyPZgxXDzNRPVrTDfFpn4t4nBcA1WK2-ntXP3ehQxsaHcQU8Z_nsogId7Pme5iJRnoHWEnWtbwz5DLSXL3ZZNnRdrHM9MdI7QSDz9mojKDCaMpGN9sG7Xl-tGdBp1XzXuUOzG8S03mtZ1IgVR1uiBL2N6oohHIAunk8DIAmNWI-zgycTgzUGU7mvPkKH43qO8Ua1-13tCUBKKa8VxcotZ67Mxm1QAvBGoDnTKwWMwghLzs6d6WViXQg6eWlJcpBA"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_rs384",children:(0,a.jsx)(n.code,{children:"sign_jwt_rs384"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using RS384."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.18.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-93",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-152",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_rs384("""-----BEGIN RSA PRIVATE KEY-----\n... signature data ...\n-----END RSA PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.orcXYBcjVE5DU7mvq4KKWFfNdXR4nEY_xupzWoETRpYmQZIozlZnM_nHxEk2dySvpXlAzVm7kgOPK2RFtGlOVaNRIa3x-pMMr-bhZTno4L8Hl4sYxOks3bWtjK7wql4uqUbqThSJB12psAXw2-S-I_FMngOPGIn4jDT9b802ottJSvTpXcy0-eKTjrV2PSkRRu-EYJh0CJZW55MNhqlt6kCGhAXfbhNazN3ASX-dmpd_JixyBKphrngr_zRA-FCn_Xf3QQDA-5INopb4Yp5QiJ7UxVqQEKI80X_JvJqz9WE1qiAw8pq5-xTen1t7zTP-HT1NbbD3kltcNa3G8acmNg"}\n'})}),"\n",(0,a.jsx)(n.h3,{id:"sign_jwt_rs512",children:(0,a.jsx)(n.code,{children:"sign_jwt_rs512"})}),"\n",(0,a.jsx)(n.p,{children:"Hash and sign an object representing JSON Web Token (JWT) claims using RS512."}),"\n",(0,a.jsx)(n.p,{children:"Introduced in version v4.18.0."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-94",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"signing_secret"})})," The secret to use for signing the token."]}),"\n",(0,a.jsx)(n.h4,{id:"examples-153",children:"Examples"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-coffee",children:'root.signed = this.claims.sign_jwt_rs512("""-----BEGIN RSA PRIVATE KEY-----\n... signature data ...\n-----END RSA PRIVATE KEY-----""")\n\n# In: {"claims":{"sub":"user123"}}\n# Out: {"signed":"eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1MTYyMzkwMjIsIm1vb2QiOiJEaXNkYWluZnVsIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.rsMp_X5HMrUqKnZJIxo27aAoscovRA6SSQYR9rq7pifIj0YHXxMyNyOBDGnvVALHKTi25VUGHpfNUW0VVMmae0A4t_ObNU6hVZHguWvetKZZq4FZpW1lgWHCMqgPGwT5_uOqwYCH6r8tJuZT3pqXeL0CY4putb1AN2w6CVp620nh3l8d3XWb4jaifycd_4CEVCqHuWDmohfug4VhmoVKlIXZkYoAQowgHlozATDssBSWdYtv107Wd2AzEoiXPu6e3pflsuXULlyqQnS4ELEKPYThFLafh1NqvZDPddqozcPZ-iODBW-xf3A4DYDdivnMYLrh73AZOGHexxu8ay6nDA"}\n'})}),"\n",(0,a.jsx)(n.h2,{id:"geoip",children:"GeoIP"}),"\n",(0,a.jsx)(n.h3,{id:"geoip_anonymous_ip",children:(0,a.jsx)(n.code,{children:"geoip_anonymous_ip"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the anonymous IP associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-95",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_asn",children:(0,a.jsx)(n.code,{children:"geoip_asn"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the ASN associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-96",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_city",children:(0,a.jsx)(n.code,{children:"geoip_city"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the city associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-97",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_connection_type",children:(0,a.jsx)(n.code,{children:"geoip_connection_type"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the connection type associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-98",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_country",children:(0,a.jsx)(n.code,{children:"geoip_country"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the country associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-99",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_domain",children:(0,a.jsx)(n.code,{children:"geoip_domain"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the domain associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-100",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_enterprise",children:(0,a.jsx)(n.code,{children:"geoip_enterprise"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the enterprise associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-101",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h3,{id:"geoip_isp",children:(0,a.jsx)(n.code,{children:"geoip_isp"})}),"\n",(0,a.jsx)(n.admonition,{title:"EXPERIMENTAL",type:"caution",children:(0,a.jsx)(n.p,{children:"This method is experimental and therefore breaking changes could be made to it outside of major version releases."})}),"\n",(0,a.jsxs)(n.p,{children:["Looks up an IP address against a ",(0,a.jsx)(n.a,{href:"https://www.maxmind.com/en/home",children:"MaxMind database file"})," and, if found, returns an object describing the ISP associated with it."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-102",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"path"})})," A path to an mmdb (maxmind) file."]}),"\n",(0,a.jsx)(n.h2,{id:"deprecated",children:"Deprecated"}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp",children:(0,a.jsx)(n.code,{children:"format_timestamp"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to format a timestamp value as a string according to a specified format, or RFC 3339 by default. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format."}),"\n",(0,a.jsxs)(n.p,{children:["The output format is defined by showing how the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006, would be displayed if it were the value. For an alternative way to specify formats check out the ",(0,a.jsx)(n.a,{href:"#ts_strftime",children:(0,a.jsx)(n.code,{children:"ts_strftime"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-103",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The output format to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"tz"})})," <(optional) string> An optional timezone to use, otherwise the timezone of the input string is used, or in the case of unix timestamps the local timezone is used."]}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp_strftime",children:(0,a.jsx)(n.code,{children:"format_timestamp_strftime"})}),"\n",(0,a.jsx)(n.p,{children:"Attempts to format a timestamp value as a string according to a specified strftime-compatible format. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format."}),"\n",(0,a.jsx)(n.h4,{id:"parameters-104",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The output format to use.",(0,a.jsx)(n.br,{}),"\n",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"tz"})})," <(optional) string> An optional timezone to use, otherwise the timezone of the input string is used."]}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp_unix",children:(0,a.jsx)(n.code,{children:"format_timestamp_unix"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp_unix_micro",children:(0,a.jsx)(n.code,{children:"format_timestamp_unix_micro"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with microsecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp_unix_milli",children:(0,a.jsx)(n.code,{children:"format_timestamp_unix_milli"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with millisecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h3,{id:"format_timestamp_unix_nano",children:(0,a.jsx)(n.code,{children:"format_timestamp_unix_nano"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to format a timestamp value as a unix timestamp with nanosecond precision. Timestamp values can either be a numerical unix time in seconds (with up to nanosecond precision via decimals), or a string in RFC 3339 format. The ",(0,a.jsx)(n.a,{href:"#ts_parse",children:(0,a.jsx)(n.code,{children:"ts_parse"})})," method can be used in order to parse different timestamp formats."]}),"\n",(0,a.jsx)(n.h3,{id:"parse_timestamp",children:(0,a.jsx)(n.code,{children:"parse_timestamp"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to parse a string as a timestamp following a specified format and outputs a timestamp, which can then be fed into methods such as ",(0,a.jsx)(n.a,{href:"#ts_format",children:(0,a.jsx)(n.code,{children:"ts_format"})}),"."]}),"\n",(0,a.jsxs)(n.p,{children:["The input format is defined by showing how the reference time, defined to be Mon Jan 2 15:04:05 -0700 MST 2006, would be displayed if it were the value. For an alternative way to specify formats check out the ",(0,a.jsx)(n.a,{href:"#ts_strptime",children:(0,a.jsx)(n.code,{children:"ts_strptime"})})," method."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-105",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The format of the target string."]}),"\n",(0,a.jsx)(n.h3,{id:"parse_timestamp_strptime",children:(0,a.jsx)(n.code,{children:"parse_timestamp_strptime"})}),"\n",(0,a.jsxs)(n.p,{children:["Attempts to parse a string as a timestamp following a specified strptime-compatible format and outputs a timestamp, which can then be fed into ",(0,a.jsx)(n.a,{href:"#ts_format",children:(0,a.jsx)(n.code,{children:"ts_format"})}),"."]}),"\n",(0,a.jsx)(n.h4,{id:"parameters-106",children:"Parameters"}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"format"})})," The format of the target string."]})]})}function h(e={}){const{wrapper:n}={...(0,r.a)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(c,{...e})}):c(e)}},5162:function(e,n,s){s.d(n,{Z:function(){return t}});s(7294);var a=s(6010),r={tabItem:"tabItem_Ymn6"},i=s(5893);function t(e){let{children:n,hidden:s,className:t}=e;return(0,i.jsx)("div",{role:"tabpanel",className:(0,a.Z)(r.tabItem,t),hidden:s,children:n})}},4866:function(e,n,s){s.d(n,{Z:function(){return y}});var a=s(7294),r=s(6010),i=s(2466),t=s(6550),l=s(469),o=s(1980),d=s(7392),c=s(12);function h(e){var n,s;return null!=(n=null==(s=a.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,a.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:s.filter(Boolean))?n:[]}function m(e){const{values:n,children:s}=e;return(0,a.useMemo)((()=>{const e=null!=n?n:function(e){return h(e).map((e=>{let{props:{value:n,label:s,attributes:a,default:r}}=e;return{value:n,label:s,attributes:a,default:r}}))}(s);return function(e){const n=(0,d.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error('Docusaurus error: Duplicate values "'+n.map((e=>e.value)).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[n,s])}function u(e){let{value:n,tabValues:s}=e;return s.some((e=>e.value===n))}function p(e){let{queryString:n=!1,groupId:s}=e;const r=(0,t.k6)(),i=function(e){let{queryString:n=!1,groupId:s}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!s)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=s?s:null}({queryString:n,groupId:s});return[(0,o._X)(i),(0,a.useCallback)((e=>{if(!i)return;const n=new URLSearchParams(r.location.search);n.set(i,e),r.replace({...r.location,search:n.toString()})}),[i,r])]}function x(e){const{defaultValue:n,queryString:s=!1,groupId:r}=e,i=m(e),[t,o]=(0,a.useState)((()=>function(e){var n;let{defaultValue:s,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(s){if(!u({value:s,tabValues:a}))throw new Error('Docusaurus error: The has a defaultValue "'+s+'" but none of its children has the corresponding value. Available values are: '+a.map((e=>e.value)).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return s}const r=null!=(n=a.find((e=>e.default)))?n:a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:i}))),[d,h]=p({queryString:s,groupId:r}),[x,j]=function(e){let{groupId:n}=e;const s=function(e){return e?"docusaurus.tab."+e:null}(n),[r,i]=(0,c.Nk)(s);return[r,(0,a.useCallback)((e=>{s&&i.set(e)}),[s,i])]}({groupId:r}),f=(()=>{const e=null!=d?d:x;return u({value:e,tabValues:i})?e:null})();(0,l.Z)((()=>{f&&o(f)}),[f]);return{selectedValue:t,selectValue:(0,a.useCallback)((e=>{if(!u({value:e,tabValues:i}))throw new Error("Can't select invalid tab value="+e);o(e),h(e),j(e)}),[h,j,i]),tabValues:i}}var j=s(2389),f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"},g=s(5893);function v(e){let{className:n,block:s,selectedValue:a,selectValue:t,tabValues:l}=e;const o=[],{blockElementScrollPositionUntilNextRender:d}=(0,i.o5)(),c=e=>{const n=e.currentTarget,s=o.indexOf(n),r=l[s].value;r!==a&&(d(n),t(r))},h=e=>{var n;let s=null;switch(e.key){case"Enter":c(e);break;case"ArrowRight":{var a;const n=o.indexOf(e.currentTarget)+1;s=null!=(a=o[n])?a:o[0];break}case"ArrowLeft":{var r;const n=o.indexOf(e.currentTarget)-1;s=null!=(r=o[n])?r:o[o.length-1];break}}null==(n=s)||n.focus()};return(0,g.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.Z)("tabs",{"tabs--block":s},n),children:l.map((e=>{let{value:n,label:s,attributes:i}=e;return(0,g.jsx)("li",{role:"tab",tabIndex:a===n?0:-1,"aria-selected":a===n,ref:e=>o.push(e),onKeyDown:h,onClick:c,...i,className:(0,r.Z)("tabs__item",f.tabItem,null==i?void 0:i.className,{"tabs__item--active":a===n}),children:null!=s?s:n},n)}))})}function b(e){let{lazy:n,children:s,selectedValue:r}=e;const i=(Array.isArray(s)?s:[s]).filter(Boolean);if(n){const e=i.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return(0,g.jsx)("div",{className:"margin-top--md",children:i.map(((e,n)=>(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==r})))})}function _(e){const n=x(e);return(0,g.jsxs)("div",{className:(0,r.Z)("tabs-container",f.tabList),children:[(0,g.jsx)(v,{...e,...n}),(0,g.jsx)(b,{...e,...n})]})}function y(e){const n=(0,j.Z)();return(0,g.jsx)(_,{...e,children:h(e.children)},String(n))}},1151:function(e,n,s){s.d(n,{Z:function(){return l},a:function(){return t}});var a=s(7294);const r={},i=a.createContext(r);function t(e){const n=a.useContext(i);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:t(e.components),a.createElement(i.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/runtime~main.007dcf62.js b/assets/js/runtime~main.e0b0d61e.js
similarity index 99%
rename from assets/js/runtime~main.007dcf62.js
rename to assets/js/runtime~main.e0b0d61e.js
index e4084ffbd..03fff6879 100644
--- a/assets/js/runtime~main.007dcf62.js
+++ b/assets/js/runtime~main.e0b0d61e.js
@@ -1 +1 @@
-!function(){"use strict";var e,f,c,a,d,b={},t={};function n(e){var f=t[e];if(void 0!==f)return f.exports;var c=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(c.exports,c,c.exports,n),c.loaded=!0,c.exports}n.m=b,n.c=t,e=[],n.O=function(f,c,a,d){if(!c){var b=1/0;for(u=0;u=d)&&Object.keys(n.O).every((function(e){return n.O[e](c[r])}))?c.splice(r--,1):(t=!1,d0&&e[u-1][2]>d;u--)e[u]=e[u-1];e[u]=[c,a,d]},n.n=function(e){var f=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(f,{a:f}),f},c=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},n.t=function(e,a){if(1&a&&(e=this(e)),8&a)return e;if("object"==typeof e&&e){if(4&a&&e.__esModule)return e;if(16&a&&"function"==typeof e.then)return e}var d=Object.create(null);n.r(d);var b={};f=f||[null,c({}),c([]),c(c)];for(var t=2&a&&e;"object"==typeof t&&!~f.indexOf(t);t=c(t))Object.getOwnPropertyNames(t).forEach((function(f){b[f]=function(){return e[f]}}));return b.default=function(){return e},n.d(d,b),d},n.d=function(e,f){for(var c in f)n.o(f,c)&&!n.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:f[c]})},n.f={},n.e=function(e){return Promise.all(Object.keys(n.f).reduce((function(f,c){return n.f[c](e,f),f}),[]))},n.u=function(e){return"assets/js/"+({38:"593e3d17",53:"935f2afb",81:"9511b460",87:"3346f707",109:"eb14bb1d",114:"550ac06d",130:"8642d0fe",138:"2af85716",146:"b81b70d9",196:"125c4e73",224:"102ce242",359:"51be690a",360:"80083b95",372:"44784db5",383:"e26df8c9",470:"39934418",487:"691f6464",507:"ea6996c9",566:"aa7ce867",580:"361295e3",601:"c9733294",632:"42aa6ab9",711:"6cfd6aae",858:"ea2d0cc6",875:"b13639db",943:"7b974807",1116:"e9aa5b7d",1180:"a45ecd1a",1286:"5ece72d8",1297:"20aab3e6",1325:"681adb9a",1378:"494f4017",1417:"c99c4f6a",1467:"5f7282db",1503:"3a675de0",1550:"d663de72",1575:"d0789ff6",1597:"cb21496c",1611:"ab301f96",1630:"f3864634",1652:"71bb6b0f",1685:"9043e287",1720:"f0ff6bff",1753:"c8fdef9c",1795:"b8ad7af9",1842:"731ef028",1854:"e1b0930f",1855:"f984ca53",1859:"79a110bc",1916:"3900062e",1923:"6445e868",1929:"4a443c4a",2043:"011a01a2",2092:"1511c23b",2115:"1893d819",2199:"21c85eed",2214:"605b42b1",2219:"cb790ce6",2225:"721990ef",2255:"30e2a167",2260:"aaba7f6d",2310:"4e1e514d",2347:"79041677",2426:"c9782de7",2448:"d8db9dc0",2452:"91660ff7",2502:"cfdc1bb7",2510:"7de6ea50",2519:"9ca68ea8",2561:"d7055e90",2562:"7164b691",2589:"c89cea99",2599:"03145cb2",2616:"2f3848f6",2647:"1d4c9227",2665:"073df7ff",2672:"4fd42ee2",2676:"251c2055",2694:"aac3703f",2722:"483e6bed",2726:"65320741",2776:"6e46ced1",2791:"12dd5a91",2806:"97a04f60",2854:"76f7255c",2875:"4f53f760",2925:"4349e440",2928:"6589e7f2",2930:"1fa725a4",2934:"e4361e7a",2956:"0689cb0a",2966:"8580b4ce",3018:"4a23c531",3030:"30b8d3f5",3043:"505d59da",3131:"a623da89",3140:"307add7d",3151:"0db03f02",3168:"de8b023c",3199:"53a6c9c9",3216:"7c64f97b",3237:"1df93b7f",3301:"2448a21c",3334:"0821f604",3360:"398d81a1",3479:"d754fdc4",3535:"d0edb5e1",3631:"f3ae8aef",3651:"dd5911b7",3659:"69aef373",3691:"b20f6a84",3724:"3b24f12f",3738:"eb935c78",3786:"23c18cfc",3794:"7004b5d1",3798:"04919c1b",3829:"b5d4cdf3",3910:"219bdeda",3919:"abd32be0",3928:"52855da5",3929:"5dfe613e",4027:"24ab5e7b",4029:"6c8b7945",4031:"f604c338",4034:"2ebefae8",4036:"075cca06",4131:"dcdc097b",4190:"189b8c09",4310:"efab2287",4319:"612ee9fa",4333:"1d772982",4368:"a94703ab",4377:"34c11e60",4450:"035bca1b",4470:"db1bf1d3",4508:"d205c89c",4520:"598cd9e3",4535:"076132ed",4537:"7704f94f",4549:"520ef43a",4561:"b8cb9144",4562:"974ef434",4588:"2caeea88",4655:"8f03d47b",4681:"e8f893a7",4683:"74af385f",4688:"d81c3ac9",4775:"24a8ea12",4809:"4532254e",4882:"92da86ad",4890:"a8889ce5",4928:"417bf617",4955:"04f6b7af",4956:"7211bada",4979:"1989f1c6",5019:"3289ca38",5060:"8b4bdd85",5122:"80380353",5266:"58645046",5330:"884cbdb0",5379:"79e765c8",5402:"107e3afd",5414:"a23f2895",5561:"9c6101f6",5582:"e7c1f4ee",5600:"3f490ee5",5629:"f9191101",5658:"6f414f3d",5735:"c8e73f71",5752:"2083716c",5762:"77d49312",5763:"08930f93",5806:"0e403d31",5852:"7b3319b5",5948:"98de2b62",6061:"3c8843b2",6086:"c1728e0e",6239:"93b48af4",6276:"4726af8a",6319:"4cc73723",6335:"01e79fed",6341:"3399393e",6355:"167872ca",6406:"3b86a701",6407:"7e386127",6408:"47ea764a",6534:"adc3deb0",6535:"3d8d21df",6596:"8698d004",6622:"0bfa356a",6664:"0aea07c5",6689:"9d11cbd2",6702:"9548b670",6742:"0f160cf9",6751:"5485c912",6763:"b78be08e",6771:"ef7a3c8c",6781:"68b22ca0",6816:"4d4b49b3",6821:"13701011",6827:"cf851438",6849:"57b59cd4",6875:"d6e1bcc9",6898:"8f7acc98",6956:"7633020e",7036:"4221a5ff",7059:"96ed8793",7146:"f1265c3f",7184:"49190057",7232:"90234c9f",7240:"d686c9b7",7307:"82219508",7312:"196e3dee",7323:"1ed3e5ad",7386:"6d0ec584",7414:"96d29cd4",7418:"474a32f7",7496:"df0f20b2",7514:"3b81dd09",7530:"fba6569d",7536:"6dc847f4",7554:"2f01e1a1",7601:"a9cf72dc",7647:"b109b856",7691:"f535d6e5",7716:"07179f9d",7770:"1653b2d4",7793:"7301aa34",7803:"2633e5cb",7831:"441c7763",7840:"b6363123",7871:"d11f1e13",7901:"698d895b",7918:"17896441",7920:"1a4e3797",7922:"48b68960",8055:"d17ce6fe",8069:"f5ad8c97",8127:"1a9e55f2",8128:"6c5e4987",8140:"2e74e035",8155:"fa36e4cc",8188:"879eaf60",8254:"22fc6b4f",8291:"5f04fac0",8319:"08e4fb2d",8355:"91963207",8440:"c22b3ee9",8518:"a7bd4aaa",8546:"e16a314b",8581:"af9df32f",8585:"a61b8d12",8598:"01d1663b",8615:"24c69c3e",8623:"2f1a66dd",8627:"b558252b",8652:"1c1fc734",8676:"21e5198e",8738:"6734fb5f",8778:"58bf167f",8802:"24b1a95f",8860:"2a7f0e35",8864:"f66f8ee6",8908:"25303002",8952:"e25f56d4",8990:"ff456143",9023:"ed373e40",9069:"f3e68499",9075:"64e9e2d2",9096:"15eb3fb4",9100:"9d8f28d7",9145:"213250ef",9148:"76d41498",9166:"4a99326c",9170:"bfe1d6a6",9172:"b1eb4383",9232:"d343614b",9267:"a6f6c398",9331:"0d9c1c13",9338:"314d58c0",9348:"a0c5fe0d",9362:"8e9b3539",9403:"9f847698",9404:"4312cf3a",9412:"202fb120",9469:"6ad8c8c6",9538:"40ffa2ae",9590:"1cda8207",9628:"39e5b9db",9661:"5e95c892",9665:"58457576",9720:"4a80ac8b",9723:"02112b29",9738:"f0c401af",9831:"c0ee22c5",9835:"9301ebc9",9840:"6873e560",9863:"a3cf776f",9906:"4ac72d28",9910:"dd485f94",9946:"4fd7e673"}[e]||e)+"."+{38:"31c5d52e",53:"db22c260",81:"da982ca4",87:"cac55d4e",109:"0aab2086",114:"bccfba54",130:"99bff160",138:"7e4d801d",146:"75cdf81c",196:"6c8087b5",224:"2f33c8b2",359:"c5375726",360:"fd289761",372:"cc0237b0",383:"1ed6bdbf",470:"0f031db2",487:"3e03ff18",507:"33734a6f",566:"636e3f42",580:"11d57223",601:"acdbd62c",632:"d1bb3d70",711:"ed5233e7",858:"f7038774",875:"b68194cb",943:"fbe1e618",1116:"01b3c66f",1180:"07878f01",1286:"094e674a",1297:"a4b9f1c6",1325:"1388fd11",1378:"4b2386cb",1417:"368237e4",1426:"7d4e37f9",1467:"29e8eef0",1503:"4f68332f",1550:"2c240c91",1575:"4ecd8d1f",1597:"8311b5de",1611:"68834fcd",1630:"8dc90a0f",1652:"f632bdcd",1685:"ead711c0",1720:"afd8de22",1753:"2ed0cda7",1795:"7dc7ecd8",1842:"2958e208",1854:"614abad2",1855:"17ec1969",1859:"140d6c34",1916:"45b58805",1923:"9c096f84",1929:"81177887",2043:"5058e684",2092:"b2921ba3",2115:"cc850e92",2199:"fd8b84c3",2214:"d8d902bb",2219:"782c82d3",2225:"efc2c0cd",2255:"ca8f5505",2260:"b5f54508",2310:"c85c4008",2347:"a8d48aa9",2426:"3bf37848",2448:"e0148389",2452:"5f768986",2502:"c50fd484",2510:"ab816058",2519:"1b3807c0",2561:"e520bc2d",2562:"aa29e3cb",2589:"e90c4a4c",2599:"4694c081",2616:"fe2655a3",2647:"fc2917c8",2665:"42d8c20d",2672:"8d949023",2676:"9336dd6d",2694:"205a702e",2722:"489e8c93",2726:"3629cda6",2776:"61eafb21",2791:"1d5ac7e1",2806:"04e52f5a",2854:"1737d2fa",2875:"c621f493",2925:"bc822847",2928:"f3f82f6a",2930:"02270bfc",2934:"334dd466",2956:"5ab071f4",2966:"2ee86f53",3018:"ac9f215b",3030:"ee701d08",3043:"fb1dd6c1",3131:"ca098a18",3140:"3f2a0943",3151:"c4de2997",3168:"c0724665",3199:"4be32b8a",3216:"eb8684a7",3237:"7098f913",3301:"59423c67",3334:"1c7cd039",3360:"960c5a14",3479:"d4c77e85",3535:"9c6c09e5",3631:"791e518d",3651:"86c9f770",3659:"3ea5c50a",3691:"994b2f84",3724:"1b0f6a4a",3738:"8ae6b2db",3786:"561f2708",3794:"31f03ed1",3798:"c0535e6c",3829:"d2d990be",3910:"6d2063fb",3919:"10b14290",3928:"07d6de4b",3929:"af40197a",4006:"58b358fd",4027:"4979dbdc",4029:"66df4a03",4031:"fc81b3c5",4034:"8a41c49f",4036:"ebac71c9",4131:"a898cb71",4190:"6a662274",4310:"2ca240fb",4319:"cf2ac1d5",4333:"548db107",4368:"d09f393c",4377:"89e96996",4450:"eca9b49d",4470:"6b57e5a5",4508:"e6ca65f9",4520:"f57c6fc5",4535:"beedb4ac",4537:"df167264",4549:"23c3bd87",4561:"ce1d95d0",4562:"ce51da2a",4588:"35b81879",4655:"999537c0",4681:"e9618a3b",4683:"c6956293",4688:"79475ed3",4775:"38465f41",4809:"80c60c8f",4882:"0268dc7e",4890:"04cb2058",4928:"c7dc7825",4955:"bc1b3f69",4956:"0e3a41f0",4979:"dc4b304c",5019:"50b556c4",5060:"ca6b3f15",5122:"443e376a",5266:"0cfd5e88",5330:"943004fd",5379:"115624d9",5402:"1cf72588",5414:"ed3879a3",5561:"43188102",5582:"b64f0311",5600:"576933d6",5629:"3e486bb6",5658:"4d15c58b",5735:"a442d086",5752:"23211013",5762:"5bd6dbea",5763:"dda58760",5806:"5e2c1628",5852:"77972bd8",5948:"398152e6",6061:"39e848d1",6086:"d1067318",6239:"6f5dc1fb",6276:"310cd0a4",6319:"6d50d562",6335:"28088f0c",6341:"a265c6df",6355:"8ff73b0a",6406:"e5074fae",6407:"205163a6",6408:"0fa6ca33",6534:"f7c5ceb4",6535:"bb9af20f",6596:"4e9f1b57",6622:"115b1697",6664:"4f71a189",6689:"eda3f785",6702:"9a69936e",6742:"b592dcb7",6751:"4c71c6a0",6763:"6e47b224",6771:"2518018c",6781:"e7dcaf18",6816:"b8da0e2e",6821:"a33dcfd8",6827:"13529d9a",6849:"7254cb42",6875:"7f7d038e",6898:"f57952a1",6945:"e474515b",6956:"bfad3c2e",7036:"ac58a112",7059:"414d5187",7116:"65e35c24",7146:"da90a8ba",7184:"eecfd549",7232:"bf6e2491",7240:"0c9da84f",7307:"5df9b8b8",7312:"d976c738",7323:"0eb94004",7386:"3b233d1e",7414:"de964aa2",7418:"b54ae6cd",7496:"ab3cd7fb",7514:"a7532441",7530:"82267005",7536:"c4afc8ee",7554:"4d3cffb9",7601:"14402e5c",7647:"6ab651b6",7691:"614a286b",7716:"d741b22d",7770:"af88de19",7793:"adc73351",7803:"ed4362bb",7831:"bdf85db6",7840:"29cc18c2",7871:"723e05a2",7901:"19396a74",7918:"0df06486",7920:"c9068681",7922:"a8656105",8055:"bd8ebac3",8069:"2ec1817e",8071:"a170c922",8127:"8680e74e",8128:"791c33ef",8140:"ebf543cc",8155:"183cc6a7",8188:"b5887546",8254:"fa22eabc",8291:"9129fa4c",8319:"00600bf6",8355:"cf8c3b38",8440:"3f098ea7",8518:"50c1f7c5",8546:"4945b488",8581:"e1610644",8585:"d9a87102",8598:"521ef87f",8615:"dd109ed8",8623:"7f4e7f9f",8627:"cdf49c69",8652:"75ac845f",8676:"f35557fb",8738:"2543967c",8778:"f845aa96",8802:"be49045a",8860:"6f9bbb48",8864:"f09d6d76",8894:"279dae41",8908:"f901cc6d",8952:"5280a13d",8990:"2ef080c9",9023:"ee21572e",9069:"21db1a98",9075:"8e52d65b",9096:"459571cf",9100:"f3d91ab7",9145:"280bb3c6",9148:"40379c6e",9166:"c0673661",9170:"c951c29d",9172:"dfd2005c",9232:"be14abb6",9267:"0ca34ea0",9286:"f46074fb",9326:"92ec8e27",9331:"3f32b367",9338:"d2ec36ed",9348:"726cdbb5",9362:"2e6d087f",9403:"152a20db",9404:"9863792e",9412:"4740bbe3",9469:"e04c3850",9538:"0d36b3a6",9590:"b49728f6",9628:"4564651b",9661:"c22760f1",9665:"f9d02c74",9720:"0ece45a9",9723:"65ef4ce3",9738:"eac23d90",9831:"887c61f4",9835:"2a3193e5",9840:"337f67d5",9863:"499e2c3e",9906:"bbfb92fd",9910:"ba0b4e88",9946:"30d237b1"}[e]+".js"},n.miniCssF=function(e){},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,f){return Object.prototype.hasOwnProperty.call(e,f)},a={},d="bento:",n.l=function(e,f,c,b){if(a[e])a[e].push(f);else{var t,r;if(void 0!==c)for(var o=document.getElementsByTagName("script"),u=0;u=d)&&Object.keys(n.O).every((function(e){return n.O[e](c[r])}))?c.splice(r--,1):(t=!1,d