@directus/app 9.14.1 → 9.14.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/@directus_extensions-sdk.118c3166.entry.js +1 -0
- package/dist/assets/{accounts.40ab36c1.js → accounts.d4221901.js} +1 -1
- package/dist/assets/{active-line.b531d8e7.js → active-line.5b9f7d21.js} +1 -1
- package/dist/assets/{activity-log.9449feec.js → activity-log.0479877c.js} +1 -1
- package/dist/assets/activity.941cbf2b.js +80 -0
- package/dist/assets/{af.b15e3fdc.js → af.ffe603d7.js} +0 -0
- package/dist/assets/{apl.091e05c0.js → apl.38b1f117.js} +1 -1
- package/dist/assets/ar-SA.52ee85f9.js +1 -0
- package/dist/assets/{ar-dz.5481d0db.js → ar-dz.923ce4b9.js} +0 -0
- package/dist/assets/{ar-kw.77cb7412.js → ar-kw.7f81a6f6.js} +0 -0
- package/dist/assets/{ar-ly.d2852686.js → ar-ly.eeb6eb8f.js} +0 -0
- package/dist/assets/{ar-ma.6b2052c4.js → ar-ma.edaad637.js} +0 -0
- package/dist/assets/{ar-sa.0ce4896b.js → ar-sa.a955cf78.js} +0 -0
- package/dist/assets/{ar-tn.0075ee1e.js → ar-tn.0bd79035.js} +0 -0
- package/dist/assets/{ar.01c8813a.js → ar.dfbee566.js} +0 -0
- package/dist/assets/{architecture.9e90b6f3.js → architecture.ddda2484.js} +1 -1
- package/dist/assets/{asciiarmor.72b1d474.js → asciiarmor.de2f91d3.js} +1 -1
- package/dist/assets/{asn.1.64b438d1.js → asn.1.2671e5d6.js} +1 -1
- package/dist/assets/{asterisk.2d23826f.js → asterisk.265fd20b.js} +1 -1
- package/dist/assets/authentication.d5cd539e.js +73 -0
- package/dist/assets/{autorefresh.65071be2.js → autorefresh.d7b5f888.js} +1 -1
- package/dist/assets/{aws.6652a1fd.js → aws.65b39fe1.js} +1 -1
- package/dist/assets/{az.839e5437.js → az.ac368cbb.js} +0 -0
- package/dist/assets/{backing-directus.02c28d29.js → backing-directus.2809dd5a.js} +1 -1
- package/dist/assets/{bg.71bbc37d.js → bg.63a91564.js} +0 -0
- package/dist/assets/{bn.28eb3677.js → bn.a1d9b410.js} +0 -0
- package/dist/assets/{brainfuck.cb084ebc.js → brainfuck.b5c5b4d3.js} +1 -1
- package/dist/assets/{bs.b0570362.js → bs.92a16737.js} +0 -0
- package/dist/assets/{ca.d17b0b48.js → ca.31d0764d.js} +0 -0
- package/dist/assets/{cli.863ef0d2.js → cli.6ee7cfc0.js} +1 -1
- package/dist/assets/{cli.6e61515e.js → cli.fce4fcbe.js} +2 -2
- package/dist/assets/{clike.c67024f2.js → clike.f961e135.js} +1 -1
- package/dist/assets/{clojure.4409f83f.js → clojure.4dd0505f.js} +1 -1
- package/dist/assets/{cloudron.a348537b.js → cloudron.735aeaf5.js} +1 -1
- package/dist/assets/{cmake.2f7d66e8.js → cmake.ed515b1b.js} +1 -1
- package/dist/assets/{cobol.1d3d945c.js → cobol.fc02ebc2.js} +1 -1
- package/dist/assets/codebase-overview.3de1bbdc.js +1 -0
- package/dist/assets/{coffeescript.7dbfeb38.js → coffeescript.4cf3e4f3.js} +1 -1
- package/dist/assets/collections.11aae4a8.js +106 -0
- package/dist/assets/{collections.60e4b448.js → collections.e06a8b1f.js} +1 -1
- package/dist/assets/{commonlisp.79d346a3.js → commonlisp.725a0889.js} +1 -1
- package/dist/assets/{config-options.8e2d8e17.js → config-options.9b79feaf.js} +15 -15
- package/dist/assets/{content.003d7d7c.js → content.07b42fc5.js} +1 -1
- package/dist/assets/creating-extensions.054f4231.js +13 -0
- package/dist/assets/{crystal.6f97295f.js → crystal.de3725fb.js} +1 -1
- package/dist/assets/cs-CZ.5045b098.js +1 -0
- package/dist/assets/{cs.23d06f43.js → cs.021e612f.js} +0 -0
- package/dist/assets/{css.87d5fc8d.js → css.98183349.js} +1 -1
- package/dist/assets/{cy.3b5a8132.js → cy.abf1b7d8.js} +0 -0
- package/dist/assets/{cypher.b46e268d.js → cypher.c571b7dd.js} +1 -1
- package/dist/assets/{d.0277a0cc.js → d.0053cf91.js} +1 -1
- package/dist/assets/{da.18bc0ec4.js → da.230eee14.js} +0 -0
- package/dist/assets/{dart.fd756766.js → dart.62f7758b.js} +1 -1
- package/dist/assets/{data-model.086edd1e.js → data-model.eb5f7e27.js} +1 -1
- package/dist/assets/{data-sharing.27afa5ee.js → data-sharing.8b80b0f4.js} +1 -1
- package/dist/assets/de-DE.5535b278.js +1 -0
- package/dist/assets/{de-at.a1f7dd1d.js → de-at.9a82fa84.js} +0 -0
- package/dist/assets/{de.a8c4aad1.js → de.1f4f2676.js} +0 -0
- package/dist/assets/{diff.1ed63843.js → diff.6acd273a.js} +1 -1
- package/dist/assets/{digitalocean-app-platform.aff2a50b.js → digitalocean-app-platform.62c81303.js} +1 -1
- package/dist/assets/{display-templates.d8e93a19.js → display-templates.2bbee0eb.js} +1 -1
- package/dist/assets/{displays.e528abde.js → displays.037994a0.js} +9 -9
- package/dist/assets/{django.afa30018.js → django.98a7f8f7.js} +1 -1
- package/dist/assets/{docker.6f265c46.js → docker.1f4e694b.js} +1 -1
- package/dist/assets/{dockerfile.91c6378e.js → dockerfile.4721ec68.js} +1 -1
- package/dist/assets/{documentation.ad1fdaf2.js → documentation.60e724e3.js} +1 -1
- package/dist/assets/{dtd.8b391952.js → dtd.1a26b16b.js} +1 -1
- package/dist/assets/{dylan.5532ec69.js → dylan.27c31fbb.js} +1 -1
- package/dist/assets/{ebnf.f179e348.js → ebnf.5a331186.js} +1 -1
- package/dist/assets/{ecl.a37bdc2f.js → ecl.5288ac09.js} +1 -1
- package/dist/assets/{eiffel.883e1bfb.js → eiffel.d48a1fb6.js} +1 -1
- package/dist/assets/el-GR.60ea8245.js +1 -0
- package/dist/assets/{el.fd48dbad.js → el.d2f58204.js} +0 -0
- package/dist/assets/{elm.c40484aa.js → elm.5525d8fa.js} +1 -1
- package/dist/assets/{email-templates.2bdb87a6.js → email-templates.062d08d1.js} +1 -1
- package/dist/assets/{en-au.1268cbf1.js → en-au.c1303a25.js} +0 -0
- package/dist/assets/{en-gb.0165e0db.js → en-gb.e85a2393.js} +0 -0
- package/dist/assets/{en-nz.01361cd3.js → en-nz.e8e12a64.js} +0 -0
- package/dist/assets/endpoints.b6214ea4.js +27 -0
- package/dist/assets/{eo.7ba085ab.js → eo.af51bcc8.js} +0 -0
- package/dist/assets/{erlang.60963eb0.js → erlang.acb354b6.js} +1 -1
- package/dist/assets/es-419.ca94d216.js +1 -0
- package/dist/assets/es-CL.ae584c00.js +1 -0
- package/dist/assets/es-MX.059cc750.js +1 -0
- package/dist/assets/{es-us.8d0a5dcc.js → es-us.2395a850.js} +0 -0
- package/dist/assets/{es.33209895.js → es.90080285.js} +0 -0
- package/dist/assets/{et.d879b698.js → et.b4d59d2c.js} +0 -0
- package/dist/assets/{eu.bfb2c22e.js → eu.85a86bfb.js} +0 -0
- package/dist/assets/{extensions.8d3df212.js → extensions.0f9a4545.js} +1 -1
- package/dist/assets/{fa.d9f705ee.js → fa.b477e584.js} +0 -0
- package/dist/assets/{factor.6c5ee333.js → factor.74747951.js} +1 -1
- package/dist/assets/faq.c134fb00.js +2 -0
- package/dist/assets/{fcl.8e18cfdc.js → fcl.76ae408d.js} +1 -1
- package/dist/assets/{fi.5a2e9662.js → fi.7a66a1a3.js} +0 -0
- package/dist/assets/fields.2c2cc037.js +135 -0
- package/dist/assets/{file-library.a4de4015.js → file-library.92f387e2.js} +1 -1
- package/dist/assets/files.1d250203.js +189 -0
- package/dist/assets/filter-rules.6cc70dd4.js +76 -0
- package/dist/assets/{filters.2cb82fd9.js → filters.0ef5a5ed.js} +1 -1
- package/dist/assets/{flows.f378a262.js → flows.03ed1b32.js} +15 -15
- package/dist/assets/flows.19c6599f.js +172 -0
- package/dist/assets/{folders.fa66a5ce.js → folders.e417fd8b.js} +33 -33
- package/dist/assets/forth.7ddbc993.js +1 -0
- package/dist/assets/{fortran.ac24d46b.js → fortran.d23e51d4.js} +1 -1
- package/dist/assets/fr-CA.6b485ca2.js +1 -0
- package/dist/assets/{fr-ca.cd8c81b9.js → fr-ca.d550f5bd.js} +0 -0
- package/dist/assets/{fr-ch.d9522a23.js → fr-ch.96feab2f.js} +0 -0
- package/dist/assets/{fr.56b3c7ac.js → fr.cc2f5568.js} +0 -0
- package/dist/assets/{gas.f99de41f.js → gas.b4331512.js} +1 -1
- package/dist/assets/{gcp.6c61b39e.js → gcp.293edb91.js} +1 -1
- package/dist/assets/{gfm.c3250bc4.js → gfm.9d7d842c.js} +1 -1
- package/dist/assets/{gherkin.dd3614b2.js → gherkin.a2d07b4b.js} +1 -1
- package/dist/assets/{github-ci.04483301.js → github-ci.20236bca.js} +1 -1
- package/dist/assets/{gl.addde635.js → gl.1bee5350.js} +0 -0
- package/dist/assets/{glossary.6efd77ad.js → glossary.26a7ec6d.js} +1 -1
- package/dist/assets/{glossary.485603d9.js → glossary.c947165b.js} +1 -1
- package/dist/assets/go.6ecfe8d8.js +1 -0
- package/dist/assets/{groovy.d1f3a61a.js → groovy.494f3e93.js} +1 -1
- package/dist/assets/{haml.a346df44.js → haml.1f9900d3.js} +1 -1
- package/dist/assets/{handlebars.a4eff81f.js → handlebars.9bc2d0c9.js} +1 -1
- package/dist/assets/{haskell-literate.57a5243e.js → haskell-literate.5435a3e9.js} +1 -1
- package/dist/assets/{haskell.3acf2710.js → haskell.fc63f26c.js} +1 -1
- package/dist/assets/{haxe.bdf5968b.js → haxe.94355408.js} +1 -1
- package/dist/assets/{he.343cc1d8.js → he.6f56199f.js} +0 -0
- package/dist/assets/{hi.b7726273.js → hi.1ebe75fb.js} +0 -0
- package/dist/assets/hooks.619f1e3f.js +60 -0
- package/dist/assets/{hr.2709fc3c.js → hr.d0e09cc1.js} +0 -0
- package/dist/assets/{htmlembedded.03cf45db.js → htmlembedded.6ebc575e.js} +1 -1
- package/dist/assets/{htmlmixed.987f61e9.js → htmlmixed.fddfb235.js} +1 -1
- package/dist/assets/{http.a4c95466.js → http.de052b25.js} +1 -1
- package/dist/assets/{hu.ec48b74d.js → hu.971007ac.js} +0 -0
- package/dist/assets/{hy-am.30c58054.js → hy-am.b000430d.js} +0 -0
- package/dist/assets/{id.08bda718.js → id.1d3fb755.js} +0 -0
- package/dist/assets/{idl.2fcbfa33.js → idl.87aed386.js} +1 -1
- package/dist/assets/{iis.e068f41a.js → iis.28211ce4.js} +3 -3
- package/dist/assets/{import-export.d334c127.js → import-export.34657c23.js} +1 -1
- package/dist/assets/{index.fa57ca3f.js → index.01a3b92d.js} +1 -1
- package/dist/assets/index.04f4681f.js +1 -0
- package/dist/assets/{index.bce5f50d.js → index.062b5c4e.js} +1 -1
- package/dist/assets/{index.55a12dfb.js → index.0659d17a.js} +1 -1
- package/dist/assets/{index.b67f8116.js → index.0b930698.js} +1 -1
- package/dist/assets/{index.c35b11e6.js → index.107979f6.js} +1 -1
- package/dist/assets/{index.627523d7.js → index.172f9ed4.js} +1 -1
- package/dist/assets/{index.b43832c6.js → index.19099a8f.js} +1 -1
- package/dist/assets/{index.456ff0bd.js → index.201cdc9c.js} +1 -1
- package/dist/assets/{index.cc6496a8.js → index.243aba72.js} +1 -1
- package/dist/assets/{index.a5d15d7f.js → index.2451efbb.js} +1 -1
- package/dist/assets/{index.5f5bf5b9.js → index.2598162d.js} +1 -1
- package/dist/assets/{index.ebb444cf.js → index.2799a3fe.js} +1 -1
- package/dist/assets/{index.28aa754b.js → index.28d160f6.js} +1 -1
- package/dist/assets/{index.e3dcc63c.js → index.2aaac8bd.js} +1 -1
- package/dist/assets/{index.ef3faba8.js → index.2e81f792.js} +1 -1
- package/dist/assets/{index.2598f40b.js → index.2ef6ea17.js} +1 -1
- package/dist/assets/{index.ffc6c203.js → index.2f10fad2.js} +1 -1
- package/dist/assets/{index.56188e3b.js → index.3fc8253a.js} +1 -1
- package/dist/assets/{index.98713a56.js → index.46f1f69a.js} +1 -1
- package/dist/assets/{index.663b73a9.js → index.476a4006.js} +1 -1
- package/dist/assets/{index.d0fe3776.js → index.4d7f8516.js} +1 -1
- package/dist/assets/{index.2926879f.js → index.51da8268.js} +1 -1
- package/dist/assets/{index.4ef25ded.js → index.552cd104.js} +1 -1
- package/dist/assets/{index.5c54c17f.js → index.55a57945.js} +1 -1
- package/dist/assets/{index.16acfb90.js → index.55f95a2f.js} +1 -1
- package/dist/assets/{index.e6715953.js → index.5cee23da.js} +1 -1
- package/dist/assets/{index.cef58c9b.js → index.60e074b9.js} +1 -1
- package/dist/assets/{index.4fbaebb7.js → index.61092ae0.js} +1 -1
- package/dist/assets/{index.c9fb33ab.js → index.610f817e.js} +1 -1
- package/dist/assets/{index.a71fa74c.js → index.632970d8.js} +1 -1
- package/dist/assets/{index.14c720ba.js → index.640cb361.js} +1 -1
- package/dist/assets/{index.0e101049.js → index.64d37708.js} +1 -1
- package/dist/assets/{index.0295bc4b.js → index.65c58270.js} +1 -1
- package/dist/assets/{index.4100d6f0.js → index.6a44e176.js} +1 -1
- package/dist/assets/{index.55d799e2.js → index.6ff4b32e.js} +0 -0
- package/dist/assets/{index.bfd23a9c.js → index.70c01091.js} +1 -1
- package/dist/assets/{index.a8aa4628.js → index.733f5f4d.js} +1 -1
- package/dist/assets/{index.402d83c0.js → index.74e00be8.js} +1 -1
- package/dist/assets/{index.7fd5e2a0.js → index.76fb5db6.js} +1 -1
- package/dist/assets/{index.2ec06d14.js → index.777553ca.js} +1 -1
- package/dist/assets/{index.7b2f54b1.js → index.7993990d.js} +1 -1
- package/dist/assets/{index.af021d8a.js → index.7aa33ef4.js} +1 -1
- package/dist/assets/{index.6bebaca7.js → index.7b1ae0e3.js} +1 -1
- package/dist/assets/{index.1b3cf886.js → index.7c229bc2.js} +1 -1
- package/dist/assets/{index.b5ed5076.js → index.7c8f7bca.js} +1 -1
- package/dist/assets/{index.9b60cfa4.js → index.7fee55e4.js} +1 -1
- package/dist/assets/{index.d653bbf2.js → index.84179c87.js} +1 -1
- package/dist/assets/{index.4e2109fe.js → index.8849b22a.js} +1 -1
- package/dist/assets/{index.07257d01.js → index.888b390d.js} +1 -1
- package/dist/assets/{index.10f90411.js → index.899d7ee6.js} +1 -1
- package/dist/assets/{index.20b34242.js → index.903dc700.js} +1 -1
- package/dist/assets/{index.175a81f8.js → index.90f3c017.js} +1 -1
- package/dist/assets/index.917a76e9.entry.js +3403 -0
- package/dist/assets/{index.98ee194a.js → index.91fbefea.js} +1 -1
- package/dist/assets/index.9335a1f8.css +1 -0
- package/dist/assets/{index.94cf6fb4.js → index.998500ca.js} +1 -1
- package/dist/assets/{index.8493b2e7.js → index.9ac7a0ad.js} +1 -1
- package/dist/assets/{index.3d4cd218.js → index.9c1c3dcb.js} +1 -1
- package/dist/assets/{index.1b44d300.js → index.9f57589f.js} +1 -1
- package/dist/assets/{index.a9faa4e8.js → index.a0faf01e.js} +1 -1
- package/dist/assets/{index.60d33aa1.js → index.a2d2ff92.js} +1 -1
- package/dist/assets/{index.77260d1d.js → index.a3a6d636.js} +1 -1
- package/dist/assets/{index.1a65b37a.js → index.a8265354.js} +1 -1
- package/dist/assets/{index.93059741.js → index.a968c50b.js} +1 -1
- package/dist/assets/{index.7fe984e4.js → index.a977949d.js} +1 -1
- package/dist/assets/{index.ee22568a.js → index.ad338b08.js} +1 -1
- package/dist/assets/{index.c5266851.js → index.ad869bd2.js} +1 -1
- package/dist/assets/{index.c2e6211e.js → index.b22c6489.js} +1 -1
- package/dist/assets/{index.399c0d62.js → index.b62592c3.js} +1 -1
- package/dist/assets/{index.d8fe2ade.js → index.ba2729bd.js} +1 -1
- package/dist/assets/{index.d9285c22.js → index.c1fc17bc.js} +1 -1
- package/dist/assets/{index.85b9f847.js → index.c62ebcc5.js} +1 -1
- package/dist/assets/{index.cda6c2d6.js → index.c859516b.js} +1 -1
- package/dist/assets/{index.a40592f5.js → index.ca7fad51.js} +1 -1
- package/dist/assets/index.d3abd983.js +1 -0
- package/dist/assets/index.d87c135a.js +26 -0
- package/dist/assets/{index.6f497914.css → index.dbec7bd8.css} +1 -1
- package/dist/assets/{index.8a9f2874.js → index.df853543.js} +1 -1
- package/dist/assets/{index.3eda79ec.js → index.dff2a130.js} +1 -1
- package/dist/assets/{index.dc71b91a.js → index.e000ab7f.js} +0 -0
- package/dist/assets/{index.b702042e.js → index.e003b179.js} +1 -1
- package/dist/assets/{index.a3e085ea.js → index.e0295cb0.js} +1 -1
- package/dist/assets/{index.43fa9898.js → index.e282364f.js} +1 -1
- package/dist/assets/{index.a9b73f2c.js → index.e95f45d7.js} +1 -1
- package/dist/assets/{index.6f0b7179.js → index.e975fc43.js} +1 -1
- package/dist/assets/{index.7f906cfe.js → index.f1e5bfe4.js} +1 -1
- package/dist/assets/{index.7249f524.js → index.f3a47a7c.js} +1 -1
- package/dist/assets/{index.d060d5f6.js → index.f6326954.js} +1 -1
- package/dist/assets/{index.eedadecd.js → index.fc01b28f.js} +1 -1
- package/dist/assets/{index.c6e501ec.js → index.fe5f6362.js} +1 -1
- package/dist/assets/{input-rich-text-html.172a38cb.css → input-rich-text-html.0cdbc326.css} +1 -1
- package/dist/assets/{input-rich-text-html.75413785.js → input-rich-text-html.e69dfa94.js} +33 -33
- package/dist/assets/{insights.b3ba896c.js → insights.9f2c43c6.js} +1 -1
- package/dist/assets/{installation.2025f88b.js → installation.76fec85e.js} +1 -1
- package/dist/assets/{interfaces.606c790c.js → interfaces.a65a79df.js} +8 -8
- package/dist/assets/{introduction.527c3465.js → introduction.32669a19.js} +1 -1
- package/dist/assets/{introduction.41a72fb0.js → introduction.e626ca8d.js} +1 -1
- package/dist/assets/{introduction.ecd17b88.js → introduction.e73b1c6c.js} +1 -1
- package/dist/assets/introduction.eda1c2c4.js +90 -0
- package/dist/assets/{is.b36ebc71.js → is.655c0831.js} +0 -0
- package/dist/assets/it-IT.c08c5546.js +1 -0
- package/dist/assets/{it.3cadf6ad.js → it.fca4d703.js} +0 -0
- package/dist/assets/{items.d1f658a9.js → items.ee26fa45.js} +1 -1
- package/dist/assets/items.f5cdbca8.js +136 -0
- package/dist/assets/{ja.df6f4b08.js → ja.0d51d279.js} +0 -0
- package/dist/assets/{javascript-hint.db799360.js → javascript-hint.d74b2cdb.js} +1 -1
- package/dist/assets/{javascript.46c46918.js → javascript.b2307aa3.js} +1 -1
- package/dist/assets/{jinja2.71e29364.js → jinja2.4886bfd6.js} +1 -1
- package/dist/assets/{jsonlint.e8823cb8.js → jsonlint.aae0c1e4.js} +0 -0
- package/dist/assets/{jsx.9ae3ca09.js → jsx.8937d19d.js} +1 -1
- package/dist/assets/{julia.8b46f23e.js → julia.a7a31ee0.js} +1 -1
- package/dist/assets/{ka.805bf11c.js → ka.b19061bf.js} +0 -0
- package/dist/assets/{kk.a6e57d44.js → kk.f9f646d6.js} +0 -0
- package/dist/assets/{ko.08fe68a9.js → ko.bb48e2f9.js} +0 -0
- package/dist/assets/{layouts.0aa8d645.js → layouts.e590b93d.js} +9 -9
- package/dist/assets/{layouts.14b157dc.js → layouts.fc5fee9f.js} +1 -1
- package/dist/assets/{lb.e01f5df5.js → lb.7e51ca06.js} +0 -0
- package/dist/assets/{livescript.1c767a4c.js → livescript.9a710f73.js} +1 -1
- package/dist/assets/{localization.c89061c7.js → localization.998790e9.js} +1 -1
- package/dist/assets/{lt.0d291ae5.js → lt.90e26dcd.js} +0 -0
- package/dist/assets/{lua.42e69aa3.js → lua.d236c940.js} +1 -1
- package/dist/assets/{lv.00399f94.js → lv.c48afa11.js} +0 -0
- package/dist/assets/manual.363297f0.js +12 -0
- package/dist/assets/{mark-selection.16acf9dc.js → mark-selection.cb7787e2.js} +1 -1
- package/dist/assets/{match-highlighter.8f0791ef.js → match-highlighter.450b65c5.js} +1 -1
- package/dist/assets/{mathematica.6d38a8bc.js → mathematica.f8910884.js} +1 -1
- package/dist/assets/{mbox.04641caf.js → mbox.18380965.js} +1 -1
- package/dist/assets/migrations.5af99cef.js +19 -0
- package/dist/assets/{mirc.a748cdbe.js → mirc.31870a2d.js} +1 -1
- package/dist/assets/{mk.5d734698.js → mk.f9301845.js} +0 -0
- package/dist/assets/{mllike.78996bae.js → mllike.0e1e0100.js} +1 -1
- package/dist/assets/{modelica.e521b192.js → modelica.7ecb8aeb.js} +1 -1
- package/dist/assets/{modules.9b5ee510.js → modules.2403c678.js} +8 -8
- package/dist/assets/{ms.d459f765.js → ms.bea4163e.js} +0 -0
- package/dist/assets/{mscgen.4b8f9009.js → mscgen.c34e85a5.js} +1 -1
- package/dist/assets/{multiplex.c8ef0fcd.js → multiplex.225aced9.js} +1 -1
- package/dist/assets/{mumps.44c6f7dd.js → mumps.7a0dbb45.js} +1 -1
- package/dist/assets/{nb.a3febc82.js → nb.2f4ab1ed.js} +0 -0
- package/dist/assets/{ne.afdfe3bf.js → ne.62693259.js} +0 -0
- package/dist/assets/{nginx.0aef90d9.js → nginx.1bc410b6.js} +1 -1
- package/dist/assets/{nl.12cdd5b8.js → nl.a58ee8a1.js} +0 -0
- package/dist/assets/{nn.535723b4.js → nn.97ead2b5.js} +0 -0
- package/dist/assets/notifications.152d86b7.js +153 -0
- package/dist/assets/{nsis.21597a35.js → nsis.04a63636.js} +1 -1
- package/dist/assets/{ntriples.a9ce3eee.js → ntriples.0d5ceb8c.js} +1 -1
- package/dist/assets/{octave.e4e6969c.js → octave.ce59fab4.js} +1 -1
- package/dist/assets/operations.9b3b2514.js +169 -0
- package/dist/assets/{operations.46679bea.js → operations.f00b8c11.js} +1 -1
- package/dist/assets/{overlay.725bd47b.js → overlay.7f8598fd.js} +1 -1
- package/dist/assets/{overview.3616b560.js → overview.288d5f54.js} +1 -1
- package/dist/assets/{overview.6438dc44.js → overview.c3e64ee1.js} +1 -1
- package/dist/assets/{overview.3c9f8f3d.js → overview.d2dd9f17.js} +1 -1
- package/dist/assets/{oz.439981ca.js → oz.7763d971.js} +1 -1
- package/dist/assets/{panels.570ee526.js → panels.f1f6334b.js} +7 -7
- package/dist/assets/{pascal.e63a97cf.js → pascal.fa5fc379.js} +1 -1
- package/dist/assets/{pegjs.9b76593b.js → pegjs.5286f797.js} +1 -1
- package/dist/assets/{perl.e5aa6f87.js → perl.7bceb7a2.js} +1 -1
- package/dist/assets/permissions.de41ff3d.js +178 -0
- package/dist/assets/{php.d553fa6c.js → php.fc781bce.js} +1 -1
- package/dist/assets/{pig.657ad6df.js → pig.a02372ee.js} +1 -1
- package/dist/assets/{pinia.256cc3da.entry.js → pinia.b8e2dbe3.entry.js} +1 -1
- package/dist/assets/pl-PL.6e87b518.js +1 -0
- package/dist/assets/{pl.86440e6e.js → pl.0bbdb5d7.js} +0 -0
- package/dist/assets/plesk.0ef5ab4c.js +27 -0
- package/dist/assets/{powershell.d67ba3f4.js → powershell.5a697151.js} +1 -1
- package/dist/assets/{presets-bookmarks.522baf53.js → presets-bookmarks.5ef79225.js} +1 -1
- package/dist/assets/presets.db317f9f.js +164 -0
- package/dist/assets/project-settings.e940a11b.js +1 -0
- package/dist/assets/{projects.1ea6a392.js → projects.5cc2ad0c.js} +1 -1
- package/dist/assets/{properties.da88b13f.js → properties.7b2f128a.js} +1 -1
- package/dist/assets/{protobuf.4d5afee3.js → protobuf.4e0b6dfc.js} +1 -1
- package/dist/assets/pt-BR.02851ce6.js +1 -0
- package/dist/assets/{pt-PT.fae0fcc3.js → pt-PT.f5bc9b8e.js} +1 -1
- package/dist/assets/{pt-br.cc4b694f.js → pt-br.ce7dbf21.js} +0 -0
- package/dist/assets/{pt.73886c02.js → pt.0d25d212.js} +0 -0
- package/dist/assets/{pug.3f42b721.js → pug.4829baa5.js} +1 -1
- package/dist/assets/{puppet.c79d85fc.js → puppet.0cc3dfc6.js} +1 -1
- package/dist/assets/{python.d6ada07e.js → python.97758a3a.js} +1 -1
- package/dist/assets/{q.1a68bd88.js → q.f7c0a7a0.js} +1 -1
- package/dist/assets/{query.8abea6de.js → query.f187b00c.js} +40 -40
- package/dist/assets/{quickstart.75164dd7.js → quickstart.62cbd1cd.js} +8 -8
- package/dist/assets/quickstart.8d5c02c2.js +20 -0
- package/dist/assets/{r.0c2eb3c2.js → r.65bf4228.js} +1 -1
- package/dist/assets/relations.a37c187d.js +115 -0
- package/dist/assets/{relationships.cbc9b1c5.js → relationships.5cda18e3.js} +1 -1
- package/dist/assets/{resources.25cb1e34.js → resources.540de098.js} +1 -1
- package/dist/assets/revisions.e044726e.js +40 -0
- package/dist/assets/{ro.c45ba3d9.js → ro.b6bf02de.js} +0 -0
- package/dist/assets/roles.83da9d9c.js +171 -0
- package/dist/assets/{rpm.bf07aaab.js → rpm.4485b248.js} +1 -1
- package/dist/assets/{rst.00e6f3ec.js → rst.9bf2ecf3.js} +1 -1
- package/dist/assets/ru-RU.1807a64c.js +1 -0
- package/dist/assets/{ru.638f4fa4.js → ru.ff0e24aa.js} +0 -0
- package/dist/assets/{ruby.a058e7d1.js → ruby.3f0bf45a.js} +1 -1
- package/dist/assets/running-locally.31538f1b.js +27 -0
- package/dist/assets/{runtime-core.esm-bundler.b1f35d24.js → runtime-core.esm-bundler.e3d5f5b7.js} +1 -1
- package/dist/assets/{rust.f7ca883b.js → rust.4520397b.js} +1 -1
- package/dist/assets/{sas.f9db0ec1.js → sas.94641767.js} +1 -1
- package/dist/assets/{sass.6c26d08e.js → sass.ebdaaefc.js} +1 -1
- package/dist/assets/scheme.9d08c24e.js +1 -0
- package/dist/assets/sdk.297840b0.js +393 -0
- package/dist/assets/{security.1963da73.js → security.c18b2f34.js} +1 -1
- package/dist/assets/server.d8bb0f4c.js +114 -0
- package/dist/assets/settings.65d8a9b5.js +51 -0
- package/dist/assets/{settings.a02abd85.js → settings.6c879748.js} +1 -1
- package/dist/assets/{shell.b593f3c7.js → shell.9d77a8b4.js} +1 -1
- package/dist/assets/{show-hint.252396d2.js → show-hint.0e85091b.js} +1 -1
- package/dist/assets/{sieve.b20bbc45.js → sieve.0bb4a673.js} +1 -1
- package/dist/assets/simple.1606e663.js +1 -0
- package/dist/assets/{sk.883343ad.js → sk.ff92f7ac.js} +0 -0
- package/dist/assets/{sl.9c1d7271.js → sl.29a98aa1.js} +0 -0
- package/dist/assets/{slim.2a6f8eee.js → slim.87008de5.js} +1 -1
- package/dist/assets/{smalltalk.9bee6f9b.js → smalltalk.fe7d0a09.js} +1 -1
- package/dist/assets/{smarty.be5c58b8.js → smarty.fefb4633.js} +1 -1
- package/dist/assets/solr.3d0019cc.js +1 -0
- package/dist/assets/{soy.0ff77af9.js → soy.ca07f4e2.js} +1 -1
- package/dist/assets/{sparql.9f5e3d7d.js → sparql.5d956528.js} +1 -1
- package/dist/assets/{spreadsheet.062b3700.js → spreadsheet.5beb51ed.js} +1 -1
- package/dist/assets/{sq.94f802c2.js → sq.74e96d5e.js} +0 -0
- package/dist/assets/{sql.a5128e43.js → sql.6d3b3091.js} +1 -1
- package/dist/assets/{sr-cyrl.cf2bde33.js → sr-cyrl.02689042.js} +0 -0
- package/dist/assets/{sr.ae9ed7f6.js → sr.d758ce65.js} +0 -0
- package/dist/assets/{sso-examples.048b39c5.js → sso-examples.a785e77c.js} +1 -1
- package/dist/assets/{sso.70be105f.js → sso.36061e28.js} +6 -6
- package/dist/assets/{stex.0331c80e.js → stex.0fe2ac60.js} +1 -1
- package/dist/assets/{stylus.6423d65d.js → stylus.e000276e.js} +1 -1
- package/dist/assets/{support.fce2dba5.js → support.a149b5a4.js} +1 -1
- package/dist/assets/{sv.4d9818be.js → sv.424581fc.js} +0 -0
- package/dist/assets/{swift.979a2826.js → swift.486a5a13.js} +1 -1
- package/dist/assets/{ta-in.58b9457c.js → ta-in.266b59a6.js} +0 -0
- package/dist/assets/{tcl.fa1b798c.js → tcl.b3e3538d.js} +1 -1
- package/dist/assets/{teams.44eb670e.js → teams.86e324d5.js} +1 -1
- package/dist/assets/{textile.9dbd9b93.js → textile.b258ec97.js} +1 -1
- package/dist/assets/{th.2e10ae87.js → th.503d2b5a.js} +0 -0
- package/dist/assets/{themes.e4a7762f.js → themes.3d8b2b78.js} +4 -4
- package/dist/assets/{tiddlywiki.fb030aa9.js → tiddlywiki.f7d8e471.js} +1 -1
- package/dist/assets/{tiki.2e2e82c0.js → tiki.70203351.js} +1 -1
- package/dist/assets/{toml.0c911c34.js → toml.86996664.js} +1 -1
- package/dist/assets/{tornado.466faa98.js → tornado.95569557.js} +1 -1
- package/dist/assets/{tr.56778c02.js → tr.5f7e8301.js} +0 -0
- package/dist/assets/{translation-strings.4ed25965.js → translation-strings.2d32b80f.js} +1 -1
- package/dist/assets/{translations.cf2353ca.js → translations.9a0e8cc4.js} +1 -1
- package/dist/assets/{triggers.05092cdf.js → triggers.49fa8cca.js} +1 -1
- package/dist/assets/{troff.398ba40d.js → troff.e305afe5.js} +1 -1
- package/dist/assets/{ttcn-cfg.7c37ebe0.js → ttcn-cfg.befad34e.js} +1 -1
- package/dist/assets/{ttcn.58e768c8.js → ttcn.3f026b3f.js} +1 -1
- package/dist/assets/{turtle.2b65ee77.js → turtle.0a719577.js} +1 -1
- package/dist/assets/{twig.0cf35761.js → twig.473996c3.js} +1 -1
- package/dist/assets/ubuntu.bd27c73d.js +11 -0
- package/dist/assets/{ug.6363a215.js → ug.b3647d71.js} +0 -0
- package/dist/assets/{uk.5a9060bd.js → uk.d81573f6.js} +0 -0
- package/dist/assets/{upgrades-migrations.9218bbe9.js → upgrades-migrations.e91a553b.js} +1 -1
- package/dist/assets/use-sync.138c50b0.js +28 -0
- package/dist/assets/{user-directory.3daaa818.js → user-directory.8d94737c.js} +1 -1
- package/dist/assets/{users-roles-permissions.6e18f7ca.js → users-roles-permissions.d63af527.js} +1 -1
- package/dist/assets/users.9e656e05.js +252 -0
- package/dist/assets/utilities.4a346b3b.js +74 -0
- package/dist/assets/{uz.687d7fbd.js → uz.d1d62588.js} +0 -0
- package/dist/assets/{vb.269200a5.js → vb.34ccd0bd.js} +1 -1
- package/dist/assets/{vbscript.b9c30330.js → vbscript.1e31724d.js} +1 -1
- package/dist/assets/{velocity.a54e5f76.js → velocity.3076e2d2.js} +1 -1
- package/dist/assets/{verilog.fd6a1be7.js → verilog.d290c732.js} +1 -1
- package/dist/assets/{vhdl.846afe81.js → vhdl.bc9a1438.js} +1 -1
- package/dist/assets/{vi.2bf54ce7.js → vi.7af054bb.js} +0 -0
- package/dist/assets/{vue-i18n.ecb0af35.entry.js → vue-i18n.3cc3a25f.entry.js} +1 -1
- package/dist/assets/{vue-router.8987d576.entry.js → vue-router.1ad5ff1f.entry.js} +2 -2
- package/dist/assets/{vue.74e2af44.js → vue.08b7467a.js} +1 -1
- package/dist/assets/{vue.1f4d921a.entry.js → vue.f73b7cd5.entry.js} +1 -1
- package/dist/assets/{vue.runtime.esm-bundler.ac4ff7af.js → vue.runtime.esm-bundler.ee2a778f.js} +1 -1
- package/dist/assets/{wast.38b3f34b.js → wast.96359ee5.js} +1 -1
- package/dist/assets/{webhooks.01ddb390.js → webhooks.235f76fb.js} +1 -1
- package/dist/assets/webhooks.256ac76b.js +147 -0
- package/dist/assets/{webidl.481665e3.js → webidl.9f8f6f0f.js} +1 -1
- package/dist/assets/{xquery.e254ba63.js → xquery.0ea30239.js} +1 -1
- package/dist/assets/{yacas.fc329640.js → yacas.6a86aa92.js} +1 -1
- package/dist/assets/{yaml-frontmatter.84cccda6.js → yaml-frontmatter.d4e317c1.js} +1 -1
- package/dist/assets/{yaml.3a95e8e9.js → yaml.3914e7da.js} +1 -1
- package/dist/assets/{z80.691a0cb9.js → z80.f974aea9.js} +1 -1
- package/dist/assets/zh-CN.5f89875e.js +1 -0
- package/dist/assets/{zh-cn.aac76920.js → zh-cn.fea96989.js} +0 -0
- package/dist/assets/{zh-tw.d89266cf.js → zh-tw.31f5361f.js} +0 -0
- package/dist/index.html +8 -8
- package/package.json +133 -119
- package/dist/assets/@directus_extensions-sdk.016f1070.entry.js +0 -1
- package/dist/assets/activity.fbd319d5.js +0 -80
- package/dist/assets/ar-SA.215069dc.js +0 -1
- package/dist/assets/authentication.bc20bce5.js +0 -73
- package/dist/assets/avatar-placeholder.446bf113.svg +0 -6
- package/dist/assets/codebase-overview.b46635f9.js +0 -1
- package/dist/assets/collections.80e4a52c.js +0 -106
- package/dist/assets/creating-extensions.9a98925a.js +0 -11
- package/dist/assets/cs-CZ.a3c83b73.js +0 -1
- package/dist/assets/de-DE.350023db.js +0 -1
- package/dist/assets/el-GR.103ebf8d.js +0 -1
- package/dist/assets/endpoints.2c9172db.js +0 -27
- package/dist/assets/es-419.10094709.js +0 -1
- package/dist/assets/es-CL.7f44ec7c.js +0 -1
- package/dist/assets/es-MX.17370b17.js +0 -1
- package/dist/assets/faq.63c79c18.js +0 -2
- package/dist/assets/fields.715d4591.js +0 -135
- package/dist/assets/files.7c2ccfe2.js +0 -189
- package/dist/assets/filter-rules.056b97be.js +0 -76
- package/dist/assets/flows.38f60cc8.js +0 -172
- package/dist/assets/forth.5d8db187.js +0 -1
- package/dist/assets/fr-CA.0e824ae4.js +0 -1
- package/dist/assets/go.18ea1afe.js +0 -1
- package/dist/assets/hooks.f7efe9af.js +0 -60
- package/dist/assets/index.02dcddad.entry.js +0 -3402
- package/dist/assets/index.087465cd.css +0 -1
- package/dist/assets/index.4254793b.js +0 -26
- package/dist/assets/index.63d1f569.js +0 -1
- package/dist/assets/introduction.5566b96e.js +0 -90
- package/dist/assets/it-IT.58422a56.js +0 -1
- package/dist/assets/items.d9c6a0b4.js +0 -136
- package/dist/assets/manual.20d730b3.js +0 -12
- package/dist/assets/migrations.f13ec64d.js +0 -19
- package/dist/assets/notifications.674ee6f9.js +0 -153
- package/dist/assets/operations.9995851b.js +0 -169
- package/dist/assets/permissions.768d1878.js +0 -178
- package/dist/assets/pl-PL.80cfbed6.js +0 -1
- package/dist/assets/plesk.b0ee9a9a.js +0 -27
- package/dist/assets/presets.d902ebfa.js +0 -164
- package/dist/assets/project-settings.1f95b799.js +0 -1
- package/dist/assets/pt-BR.40750500.js +0 -1
- package/dist/assets/quickstart.9985cb15.js +0 -20
- package/dist/assets/relations.9011b2b5.js +0 -115
- package/dist/assets/revisions.c90ecb76.js +0 -40
- package/dist/assets/roles.22f7aa37.js +0 -171
- package/dist/assets/ru-RU.35703ea4.js +0 -1
- package/dist/assets/running-locally.ce0a8200.js +0 -26
- package/dist/assets/scheme.b19aee0d.js +0 -1
- package/dist/assets/sdk.916109ed.js +0 -393
- package/dist/assets/server.afec52fc.js +0 -114
- package/dist/assets/settings.835be62f.js +0 -51
- package/dist/assets/simple.8b298831.js +0 -1
- package/dist/assets/solr.49b61be0.js +0 -1
- package/dist/assets/ubuntu.35dc97df.js +0 -11
- package/dist/assets/use-sync.c0f4dfab.js +0 -28
- package/dist/assets/users.4f11a7c5.js +0 -252
- package/dist/assets/utilities.0e0d0ace.js +0 -74
- package/dist/assets/webhooks.00ee297b.js +0 -147
- package/dist/assets/zh-CN.432cf71e.js +0 -1
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import{a as n,o as r,b as h,w as t,g as s,e as o,B as a}from"./runtime-core.esm-bundler.e3d5f5b7.js";const p={class:"markdown-body"},d=s("blockquote",null,[s("p",null,[a("The JS SDK provides an intuitive interface for the Directus API from within a JavaScript-powered project (browsers and Node.js). The default implementation uses "),s("a",{href:"https://npmjs.com/axios",target:"_blank",rel:"noopener noreferrer"},"Axios"),a(" for transport and "),s("code",null,"localStorage"),a(" for storing state.")])],-1),u=s("p",null,[s("div",{class:"table-of-contents"},[s("ul",null,[s("li",null,[s("a",{href:"#installation"},"Installation ")]),s("li",null,[s("a",{href:"#usage"},"Usage ")]),s("li",null,[s("a",{href:"#typescript"},"TypeScript ")]),s("li",null,[s("a",{href:"#reference"},"Reference ")]),s("li",null,[s("a",{href:"#auth"},"Auth ")]),s("li",null,[s("a",{href:"#transport"},"Transport ")]),s("li",null,[s("a",{href:"#storage"},"Storage ")]),s("li",null,[s("a",{href:"#items"},"Items ")]),s("li",null,[s("a",{href:"#activity"},"Activity ")]),s("li",null,[s("a",{href:"#comments"},"Comments ")]),s("li",null,[s("a",{href:"#collections"},"Collections ")]),s("li",null,[s("a",{href:"#fields"},"Fields ")]),s("li",null,[s("a",{href:"#files"},"Files ")]),s("li",null,[s("a",{href:"#folders"},"Folders ")]),s("li",null,[s("a",{href:"#permissions"},"Permissions ")]),s("li",null,[s("a",{href:"#presets"},"Presets ")]),s("li",null,[s("a",{href:"#relations"},"Relations ")]),s("li",null,[s("a",{href:"#revisions"},"Revisions ")]),s("li",null,[s("a",{href:"#roles"},"Roles ")]),s("li",null,[s("a",{href:"#settings"},"Settings ")]),s("li",null,[s("a",{href:"#server"},"Server ")]),s("li",null,[s("a",{href:"#users"},"Users ")]),s("li",null,[s("a",{href:"#utils"},"Utils ")])])])],-1),j=s("h2",{id:"installation",tabindex:"-1"},[a("Installation "),s("a",{class:"header-anchor",href:"#installation"},"#")],-1),_=s("pre",null,[s("code",{class:"language-bash"},`npm install @directus/sdk
|
|
2
|
+
`)],-1),m=s("h2",{id:"usage",tabindex:"-1"},[a("Usage "),s("a",{class:"header-anchor",href:"#usage"},"#")],-1),g=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"import"),a(" { "),s("span",{class:"hljs-title class_"},"Directus"),a(" } "),s("span",{class:"hljs-keyword"},"from"),a(),s("span",{class:"hljs-string"},"'@directus/sdk'"),a(`;
|
|
3
|
+
|
|
4
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" directus = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"Directus"),a("("),s("span",{class:"hljs-string"},"'http://directus.example.com'"),a(`);
|
|
5
|
+
|
|
6
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-keyword"},"function"),a(),s("span",{class:"hljs-title function_"},"start"),a("("),s("span",{class:"hljs-params"}),a(`) {
|
|
7
|
+
`),s("span",{class:"hljs-comment"},"// We don't need to authenticate if data is public"),a(`
|
|
8
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" publicData = "),s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-title function_"},"items"),a("("),s("span",{class:"hljs-string"},"'public'"),a(")."),s("span",{class:"hljs-title function_"},"readByQuery"),a("({ "),s("span",{class:"hljs-attr"},"meta"),a(": "),s("span",{class:"hljs-string"},"'total_count'"),a(` });
|
|
9
|
+
|
|
10
|
+
`),s("span",{class:"hljs-variable language_"},"console"),a("."),s("span",{class:"hljs-title function_"},"log"),a(`({
|
|
11
|
+
`),s("span",{class:"hljs-attr"},"items"),a(": publicData."),s("span",{class:"hljs-property"},"data"),a(`,
|
|
12
|
+
`),s("span",{class:"hljs-attr"},"total"),a(": publicData."),s("span",{class:"hljs-property"},"meta"),a("."),s("span",{class:"hljs-property"},"total_count"),a(`,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
`),s("span",{class:"hljs-comment"},"// But, we need to authenticate if data is private"),a(`
|
|
16
|
+
`),s("span",{class:"hljs-keyword"},"let"),a(" authenticated = "),s("span",{class:"hljs-literal"},"false"),a(`;
|
|
17
|
+
|
|
18
|
+
`),s("span",{class:"hljs-comment"},"// Try to authenticate with token if exists"),a(`
|
|
19
|
+
`),s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"auth"),a(`
|
|
20
|
+
.`),s("span",{class:"hljs-title function_"},"refresh"),a(`()
|
|
21
|
+
.`),s("span",{class:"hljs-title function_"},"then"),a("("),s("span",{class:"hljs-function"},"() =>"),a(` {
|
|
22
|
+
authenticated = `),s("span",{class:"hljs-literal"},"true"),a(`;
|
|
23
|
+
})
|
|
24
|
+
.`),s("span",{class:"hljs-title function_"},"catch"),a("("),s("span",{class:"hljs-function"},"() =>"),a(` {});
|
|
25
|
+
|
|
26
|
+
`),s("span",{class:"hljs-comment"},"// Let's login in case we don't have token or it is invalid / expired"),a(`
|
|
27
|
+
`),s("span",{class:"hljs-keyword"},"while"),a(` (!authenticated) {
|
|
28
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" email = "),s("span",{class:"hljs-variable language_"},"window"),a("."),s("span",{class:"hljs-title function_"},"prompt"),a("("),s("span",{class:"hljs-string"},"'Email:'"),a(`);
|
|
29
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" password = "),s("span",{class:"hljs-variable language_"},"window"),a("."),s("span",{class:"hljs-title function_"},"prompt"),a("("),s("span",{class:"hljs-string"},"'Password:'"),a(`);
|
|
30
|
+
|
|
31
|
+
`),s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"auth"),a(`
|
|
32
|
+
.`),s("span",{class:"hljs-title function_"},"login"),a(`({ email, password })
|
|
33
|
+
.`),s("span",{class:"hljs-title function_"},"then"),a("("),s("span",{class:"hljs-function"},"() =>"),a(` {
|
|
34
|
+
authenticated = `),s("span",{class:"hljs-literal"},"true"),a(`;
|
|
35
|
+
})
|
|
36
|
+
.`),s("span",{class:"hljs-title function_"},"catch"),a("("),s("span",{class:"hljs-function"},"() =>"),a(` {
|
|
37
|
+
`),s("span",{class:"hljs-variable language_"},"window"),a("."),s("span",{class:"hljs-title function_"},"alert"),a("("),s("span",{class:"hljs-string"},"'Invalid credentials'"),a(`);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
`),s("span",{class:"hljs-comment"},"// After authentication, we can fetch the private data in case the user has access to it"),a(`
|
|
42
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" privateData = "),s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-title function_"},"items"),a("("),s("span",{class:"hljs-string"},"'privateData'"),a(")."),s("span",{class:"hljs-title function_"},"readByQuery"),a("({ "),s("span",{class:"hljs-attr"},"meta"),a(": "),s("span",{class:"hljs-string"},"'total_count'"),a(` });
|
|
43
|
+
|
|
44
|
+
`),s("span",{class:"hljs-variable language_"},"console"),a("."),s("span",{class:"hljs-title function_"},"log"),a(`({
|
|
45
|
+
`),s("span",{class:"hljs-attr"},"items"),a(": privateData."),s("span",{class:"hljs-property"},"data"),a(`,
|
|
46
|
+
`),s("span",{class:"hljs-attr"},"total"),a(": privateData."),s("span",{class:"hljs-property"},"meta"),a("."),s("span",{class:"hljs-property"},"total_count"),a(`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
`),s("span",{class:"hljs-title function_"},"start"),a(`();
|
|
51
|
+
`)])],-1),f=s("h2",{id:"typescript",tabindex:"-1"},[a("TypeScript "),s("a",{class:"header-anchor",href:"#typescript"},"#")],-1),y=s("p",null,"Version >= 4.1",-1),w=s("p",null,"Although it\u2019s not required, it is recommended to use Typescript to have an easy development experience. This allows more detailed IDE suggestions for return types, sorting, filtering, etc.",-1),b=s("p",null,"To feed the SDK with your current schema, you need to pass it on the constructor.",-1),k=s("pre",null,[s("code",{class:"language-ts"},[s("span",{class:"hljs-keyword"},"type"),a(),s("span",{class:"hljs-title class_"},"BlogPost"),a(` = {
|
|
52
|
+
`),s("span",{class:"hljs-attr"},"id"),a(": "),s("span",{class:"hljs-variable constant_"},"ID"),a(`;
|
|
53
|
+
`),s("span",{class:"hljs-attr"},"title"),a(": "),s("span",{class:"hljs-built_in"},"string"),a(`;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
`),s("span",{class:"hljs-keyword"},"type"),a(),s("span",{class:"hljs-title class_"},"BlogSettings"),a(` = {
|
|
57
|
+
`),s("span",{class:"hljs-attr"},"display_promotions"),a(": "),s("span",{class:"hljs-built_in"},"boolean"),a(`;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
`),s("span",{class:"hljs-keyword"},"type"),a(),s("span",{class:"hljs-title class_"},"MyCollections"),a(` = {
|
|
61
|
+
`),s("span",{class:"hljs-attr"},"posts"),a(": "),s("span",{class:"hljs-title class_"},"BlogPost"),a(`;
|
|
62
|
+
`),s("span",{class:"hljs-attr"},"settings"),a(": "),s("span",{class:"hljs-title class_"},"BlogSettings"),a(`;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
`),s("span",{class:"hljs-comment"},"// This is how you feed custom type information to Directus."),a(`
|
|
66
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" directus = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"Directus"),a("<"),s("span",{class:"hljs-title class_"},"MyCollections"),a(">("),s("span",{class:"hljs-string"},"'http://url'"),a(`);
|
|
67
|
+
|
|
68
|
+
`),s("span",{class:"hljs-comment"},"// ..."),a(`
|
|
69
|
+
|
|
70
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" post = "),s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-title function_"},"items"),a("("),s("span",{class:"hljs-string"},"'posts'"),a(")."),s("span",{class:"hljs-title function_"},"readOne"),a("("),s("span",{class:"hljs-number"},"1"),a(`);
|
|
71
|
+
`),s("span",{class:"hljs-comment"},"// typeof(post) is a partial BlogPost object"),a(`
|
|
72
|
+
|
|
73
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" settings = "),s("span",{class:"hljs-keyword"},"await"),a(" posts."),s("span",{class:"hljs-title function_"},"singleton"),a("("),s("span",{class:"hljs-string"},"'settings'"),a(")."),s("span",{class:"hljs-title function_"},"read"),a(`();
|
|
74
|
+
`),s("span",{class:"hljs-comment"},"// typeof(settings) is a partial BlogSettings object"),a(`
|
|
75
|
+
`)])],-1),v=s("p",null,"You can also extend the Directus system type information by providing type information for system collections as well.",-1),x=s("pre",null,[s("code",{class:"language-ts"},[s("span",{class:"hljs-keyword"},"import"),a(" { "),s("span",{class:"hljs-title class_"},"Directus"),a(" } "),s("span",{class:"hljs-keyword"},"from"),a(),s("span",{class:"hljs-string"},"'@directus/sdk'"),a(`;
|
|
76
|
+
|
|
77
|
+
`),s("span",{class:"hljs-comment"},"// Custom fields added to Directus user collection."),a(`
|
|
78
|
+
`),s("span",{class:"hljs-keyword"},"type"),a(),s("span",{class:"hljs-title class_"},"UserType"),a(` = {
|
|
79
|
+
`),s("span",{class:"hljs-attr"},"level"),a(": "),s("span",{class:"hljs-built_in"},"number"),a(`;
|
|
80
|
+
`),s("span",{class:"hljs-attr"},"experience"),a(": "),s("span",{class:"hljs-built_in"},"number"),a(`;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
`),s("span",{class:"hljs-keyword"},"type"),a(),s("span",{class:"hljs-title class_"},"CustomTypes"),a(` = {
|
|
84
|
+
`),s("span",{class:"hljs-comment"},`/*
|
|
85
|
+
This type will be merged with Directus user type.
|
|
86
|
+
It's important that the naming matches a directus
|
|
87
|
+
collection name exactly. Typos won't get caught here
|
|
88
|
+
since SDK will assume it's a custom user collection.
|
|
89
|
+
*/`),a(`
|
|
90
|
+
`),s("span",{class:"hljs-attr"},"directus_users"),a(": "),s("span",{class:"hljs-title class_"},"UserType"),a(`;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" directus = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"Directus"),a("<"),s("span",{class:"hljs-title class_"},"CustomTypes"),a(">("),s("span",{class:"hljs-string"},"'https://api.example.com'"),a(`);
|
|
94
|
+
|
|
95
|
+
`),s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"auth"),a("."),s("span",{class:"hljs-title function_"},"login"),a(`({
|
|
96
|
+
`),s("span",{class:"hljs-attr"},"email"),a(": "),s("span",{class:"hljs-string"},"'admin@example.com'"),a(`,
|
|
97
|
+
`),s("span",{class:"hljs-attr"},"password"),a(": "),s("span",{class:"hljs-string"},"'password'"),a(`,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" me = "),s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"users"),a("."),s("span",{class:"hljs-property"},"me"),a("."),s("span",{class:"hljs-title function_"},"read"),a(`();
|
|
101
|
+
`),s("span",{class:"hljs-comment"},"// typeof me = partial DirectusUser & UserType;"),a(`
|
|
102
|
+
|
|
103
|
+
`),s("span",{class:"hljs-comment"},"// OK"),a(`
|
|
104
|
+
me.`),s("span",{class:"hljs-property"},"level"),a(" = "),s("span",{class:"hljs-number"},"42"),a(`;
|
|
105
|
+
|
|
106
|
+
`),s("span",{class:"hljs-comment"},'// Error TS2322: Type "string" is not assignable to type "number".'),a(`
|
|
107
|
+
me.`),s("span",{class:"hljs-property"},"experience"),a(" = "),s("span",{class:"hljs-string"},"'high'"),a(`;
|
|
108
|
+
`)])],-1),S=s("h2",{id:"reference",tabindex:"-1"},[a("Reference "),s("a",{class:"header-anchor",href:"#reference"},"#")],-1),D=s("h3",{id:"constructor",tabindex:"-1"},[a("Constructor "),s("a",{class:"header-anchor",href:"#constructor"},"#")],-1),T=s("p",null,[a("This is the starting point to use the SDK. You need to create an instance and invoke methods from it. In most cases a single instance is sufficient, but in case you need more, you need to define "),s("a",{href:"#options.storage.prefix"},[s("code",null,"options.storage.prefix")]),a(".")],-1),I=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"import"),a(" { "),s("span",{class:"hljs-title class_"},"Directus"),a(" } "),s("span",{class:"hljs-keyword"},"from"),a(),s("span",{class:"hljs-string"},"'@directus/sdk'"),a(`;
|
|
109
|
+
|
|
110
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" directus = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"Directus"),a(`(url, init);
|
|
111
|
+
`)])],-1),A=s("ul",null,[s("li",null,[s("p",null,[s("code",null,"url"),a(" [required] "),s("em",null,"String"),a(" - A string pointing to your Directus instance. E.g. "),s("code",null,"https://admin.directus.io")]),s("a",{name:"options"})]),s("li",null,[s("p",null,[s("code",null,"init"),a(" [optional] "),s("em",null,"Object"),a(" - Define settings that you want to customize .The possible options are:")]),s("a",{name:"options.auth"}),s("ul",null,[s("li",null,[s("p",null,[s("code",null,"auth"),a(" [optional] "),s("em",null,"Object"),a(" - Defines settings you want to customize regarding "),s("a",{href:"#auth"},"authentication"),a(". The possible options are:")]),s("ul",null,[s("li",null,[s("p",null,[s("code",null,"mode"),a(" [optional] "),s("em",null,"String"),a(" - Defines the mode you want to use for authentication. It can be "),s("code",null,"'cookie'"),a(" for cookies or "),s("code",null,"'json'"),a(" for JWT. Defaults to "),s("code",null,"'cookie'"),a(" on browsers and "),s("code",null,"'json'"),a(" otherwise. We recommend using cookies when possible to prevent any kind of attacks, mostly XSS.")]),s("a",{name:"options.auth.autoRefresh"})]),s("li",null,[s("p",null,[s("code",null,"autoRefresh"),a(" [optional] "),s("em",null,"Boolean"),a(" - Tells SDK if it should handle refresh tokens automatically. Defaults to "),s("code",null,"true"),a(".")])]),s("li",null,[s("p",null,[s("code",null,"msRefreshBeforeExpires"),a(" [optional] "),s("em",null,"Number"),a(" - When "),s("code",null,"autoRefresh"),a(" is enabled, this tells how many milliseconds before the refresh token expires and needs to be refreshed. Defaults to "),s("code",null,"30000"),a(".")])]),s("li",null,[s("p",null,[s("code",null,"staticToken"),a(" [optional] "),s("em",null,"String"),a(" - Defines the static token to use. It is not compatible with the options above since it does not refresh. Defaults to "),s("code",null,"''"),a(" (no static token).")])])])])]),s("a",{name:"options.storage"}),s("ul",null,[s("li",null,[s("p",null,[s("code",null,"storage"),a(" [optional] "),s("em",null,"Object"),a(" - Defines settings you want to customize regarding "),s("a",{href:"#storage"},"storage"),a(".")]),s("a",{name:"options.storage.prefix"}),s("ul",null,[s("li",null,[s("code",null,"prefix"),a(" [optional] "),s("em",null,"String"),a(" - Defines the tokens prefix tokens that are saved. This should be fulfilled with different values when using multiple instances of SDK. Defaults to "),s("code",null,"''"),a(" (no prefix).")]),s("li",null,[s("code",null,"mode"),a(" [optional] "),s("em",null,"String"),a(" - Defines the storage location to be used to save tokens. Allowed values are "),s("code",null,"LocalStorage"),a(" and "),s("code",null,"MemoryStorage"),a(". Defaults to "),s("code",null,"LocalStorage"),a(" on browsers and "),s("code",null,"MemoryStorage"),a(" on Node.js. The mode "),s("code",null,"LocalStorage"),a(" is not compatible with Node.js.")])])])]),s("a",{name:"options.transport"}),s("ul",null,[s("li",null,[s("code",null,"transport"),a(" [optional] "),s("em",null,"Object"),a(" - Defines settings you want to customize regarding "),s("a",{href:"#transport"},"transport"),a(". "),s("ul",null,[s("li",null,[s("code",null,"params"),a(" [optional] "),s("em",null,"Object"),a(" - Defines an object with keys and values to be passed as additional query string.")]),s("li",null,[s("code",null,"headers"),a(" [optional] "),s("em",null,"Object"),a(" - Defines an object with keys and values to be passed as additional headers.")]),s("li",null,[s("code",null,"onUploadProgress"),a(" [optional] "),s("em",null,[a("(event: "),s("a",{href:"https://developer.mozilla.org/en-US/docs/Web/API/ProgressEvent",target:"_blank",rel:"noopener noreferrer"},"ProgressEvent"),a(" => void)")]),a(" - Defines a callback function to indicate the upload progress.")])])])])])],-1),R=s("h2",{id:"auth",tabindex:"-1"},[a("Auth "),s("a",{class:"header-anchor",href:"#auth"},"#")],-1),q=s("p",null,"Defines how authentication is handled by the SDK.",-1),B=s("h3",{id:"custom-implementation",tabindex:"-1"},[a("Custom Implementation "),s("a",{class:"header-anchor",href:"#custom-implementation"},"#")],-1),M=s("p",null,[a("It is possible to provide a custom implementation by extending "),s("code",null,"IAuth"),a(". While this could be useful for advanced usage, most use-cases do not need it.")],-1),C=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"import"),a(" { "),s("span",{class:"hljs-title class_"},"IAuth"),a(", "),s("span",{class:"hljs-title class_"},"Directus"),a(" } "),s("span",{class:"hljs-keyword"},"from"),a(),s("span",{class:"hljs-string"},"'@directus/sdk'"),a(`;
|
|
112
|
+
|
|
113
|
+
`),s("span",{class:"hljs-keyword"},"class"),a(),s("span",{class:"hljs-title class_"},"MyAuth"),a(),s("span",{class:"hljs-keyword"},"extends"),a(),s("span",{class:"hljs-title class_ inherited__"},"IAuth"),a(` {
|
|
114
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-title function_"},"login"),a("("),s("span",{class:"hljs-params"}),a(`) {
|
|
115
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(" { "),s("span",{class:"hljs-attr"},"access_token"),a(": "),s("span",{class:"hljs-string"},"''"),a(", "),s("span",{class:"hljs-attr"},"expires"),a(": "),s("span",{class:"hljs-number"},"0"),a(` };
|
|
116
|
+
}
|
|
117
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-title function_"},"logout"),a("("),s("span",{class:"hljs-params"}),a(`) {}
|
|
118
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-title function_"},"refresh"),a("("),s("span",{class:"hljs-params"}),a(`) {
|
|
119
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(" { "),s("span",{class:"hljs-attr"},"access_token"),a(": "),s("span",{class:"hljs-string"},"''"),a(", "),s("span",{class:"hljs-attr"},"expires"),a(": "),s("span",{class:"hljs-number"},"0"),a(` };
|
|
120
|
+
}
|
|
121
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-title function_"},"static"),a("("),s("span",{class:"hljs-params"}),a(`) {
|
|
122
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(),s("span",{class:"hljs-literal"},"true"),a(`;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" directus = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"Directus"),a("("),s("span",{class:"hljs-string"},"'http://directus.example.com'"),a(", { "),s("span",{class:"hljs-attr"},"auth"),a(": "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"MyAuth"),a(`() });
|
|
127
|
+
`)])],-1),O=s("h3",{id:"directus-implementation",tabindex:"-1"},[a("Directus Implementation "),s("a",{class:"header-anchor",href:"#directus-implementation"},"#")],-1),P=s("p",null,[a("By default, Directus creates an instance of "),s("code",null,"Auth"),a(" which handles refresh tokens automatically. Check "),s("a",{href:"#options.auth"},[s("code",null,"options.auth")]),a(" to see the available settings.")],-1),U=s("h3",{id:"get-current-token",tabindex:"-1"},[a("Get current token "),s("a",{class:"header-anchor",href:"#get-current-token"},"#")],-1),E=s("pre",null,[s("code",{class:"language-ts"},[s("span",{class:"hljs-keyword"},"const"),a(" token = "),s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"auth"),a("."),s("span",{class:"hljs-property"},"token"),a(`;
|
|
128
|
+
`)])],-1),N=s("div",{class:"warning hint"},[s("div",{class:"hint-title"},"Async"),s("p",null,[a("Reading the token is an asynchronous getter. This makes sure that any currently active "),s("code",null,"refresh"),a(" calls are being awaited before the current token is returned.")])],-1),F=s("h3",{id:"login",tabindex:"-1"},[a("Login "),s("a",{class:"header-anchor",href:"#login"},"#")],-1),K=s("h4",{id:"with-credentials",tabindex:"-1"},[a("With credentials "),s("a",{class:"header-anchor",href:"#with-credentials"},"#")],-1),L=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"auth"),a("."),s("span",{class:"hljs-title function_"},"login"),a(`({
|
|
129
|
+
`),s("span",{class:"hljs-attr"},"email"),a(": "),s("span",{class:"hljs-string"},"'admin@example.com'"),a(`,
|
|
130
|
+
`),s("span",{class:"hljs-attr"},"password"),a(": "),s("span",{class:"hljs-string"},"'d1r3ctu5'"),a(`,
|
|
131
|
+
});
|
|
132
|
+
`)])],-1),W=s("h4",{id:"with-static-tokens",tabindex:"-1"},[a("With static tokens "),s("a",{class:"header-anchor",href:"#with-static-tokens"},"#")],-1),J=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"auth"),a("."),s("span",{class:"hljs-title function_"},"static"),a("("),s("span",{class:"hljs-string"},"'static_token'"),a(`);
|
|
133
|
+
`)])],-1),H=s("h3",{id:"refresh-auth-token",tabindex:"-1"},[a("Refresh Auth Token "),s("a",{class:"header-anchor",href:"#refresh-auth-token"},"#")],-1),V=s("p",null,[a("By default, Directus will handle token refreshes. Although, you can handle this behaviour manually by setting "),s("a",{href:"#options.auth.autoRefresh"},[s("code",null,"autoRefresh")]),a(" to "),s("code",null,"false"),a(".")],-1),z=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"auth"),a("."),s("span",{class:"hljs-title function_"},"refresh"),a(`();
|
|
134
|
+
`)])],-1),G={class:"tip hint"},Y=s("div",{class:"hint-title"},"Developing Locally",-1),Q=a("If you\u2019re developing locally, you might not be able to refresh your auth token automatically in all browsers. This is because the default auth configuration requires secure cookies to be set, and not all browsers allow this for localhost. You can use a browser which does support this such as Firefox, or "),$=a("disable secure cookies"),X=a("."),Z=s("h3",{id:"logout",tabindex:"-1"},[a("Logout "),s("a",{class:"header-anchor",href:"#logout"},"#")],-1),ss=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"auth"),a("."),s("span",{class:"hljs-title function_"},"logout"),a(`();
|
|
135
|
+
`)])],-1),as=s("h3",{id:"request-a-password-reset",tabindex:"-1"},[a("Request a Password Reset "),s("a",{class:"header-anchor",href:"#request-a-password-reset"},"#")],-1),ts=s("p",null,[a("By default, the address defined in "),s("code",null,"PUBLIC_URL"),a(" on "),s("code",null,".env"),a(" file is used for the link to the reset password page sent in the email:")],-1),es=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"auth"),a("."),s("span",{class:"hljs-property"},"password"),a("."),s("span",{class:"hljs-title function_"},"request"),a("("),s("span",{class:"hljs-string"},"'admin@example.com'"),a(`);
|
|
136
|
+
`)])],-1),ls=s("p",null,"But a custom address can be passed as second argument:",-1),ns=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"auth"),a("."),s("span",{class:"hljs-property"},"password"),a("."),s("span",{class:"hljs-title function_"},"request"),a(`(
|
|
137
|
+
`),s("span",{class:"hljs-string"},"'admin@example.com'"),a(`,
|
|
138
|
+
`),s("span",{class:"hljs-string"},"'https://myapp.com'"),a(),s("span",{class:"hljs-comment"},"// In this case, the link will be https://myapp.com?token=FEE0A..."),a(`
|
|
139
|
+
);
|
|
140
|
+
`)])],-1),os=s("h3",{id:"reset-a-password",tabindex:"-1"},[a("Reset a Password "),s("a",{class:"header-anchor",href:"#reset-a-password"},"#")],-1),cs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"auth"),a("."),s("span",{class:"hljs-property"},"password"),a("."),s("span",{class:"hljs-title function_"},"reset"),a("("),s("span",{class:"hljs-string"},"'abc.def.ghi'"),a(", "),s("span",{class:"hljs-string"},"'n3w-p455w0rd'"),a(`);
|
|
141
|
+
`)])],-1),is=s("p",null,[a("Note: The token passed in the first parameter is sent in an email to the user when using "),s("code",null,"request()")],-1),rs=s("h2",{id:"transport",tabindex:"-1"},[a("Transport "),s("a",{class:"header-anchor",href:"#transport"},"#")],-1),hs=s("p",null,"The transport object abstracts how you communicate with Directus. Transports can be customized to use different HTTP libraries for example.",-1),ps=s("h3",{id:"custom-implementation-1",tabindex:"-1"},[a("Custom Implementation "),s("a",{class:"header-anchor",href:"#custom-implementation-1"},"#")],-1),ds=s("p",null,[a("It is possible to provide a custom implementation by extending "),s("code",null,"ITransport"),a(". While, this could be useful for advanced usage, it is not needed for most use-cases.")],-1),us=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"import"),a(" { "),s("span",{class:"hljs-title class_"},"ITransport"),a(", "),s("span",{class:"hljs-title class_"},"Directus"),a(" } "),s("span",{class:"hljs-keyword"},"from"),a(),s("span",{class:"hljs-string"},"'@directus/sdk'"),a(`;
|
|
142
|
+
|
|
143
|
+
`),s("span",{class:"hljs-keyword"},"class"),a(),s("span",{class:"hljs-title class_"},"MyTransport"),a(),s("span",{class:"hljs-keyword"},"extends"),a(),s("span",{class:"hljs-title class_ inherited__"},"ITransport"),a(` {
|
|
144
|
+
`),s("span",{class:"hljs-title function_"},"buildResponse"),a("("),s("span",{class:"hljs-params"}),a(`) {
|
|
145
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(` {
|
|
146
|
+
`),s("span",{class:"hljs-attr"},"raw"),a(": "),s("span",{class:"hljs-string"},"''"),a(`,
|
|
147
|
+
`),s("span",{class:"hljs-attr"},"data"),a(`: {},
|
|
148
|
+
`),s("span",{class:"hljs-attr"},"status"),a(": "),s("span",{class:"hljs-number"},"0"),a(`,
|
|
149
|
+
`),s("span",{class:"hljs-attr"},"headers"),a(`: {},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-title function_"},"get"),a("("),s("span",{class:"hljs-params"},"path, options"),a(`) {
|
|
154
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(),s("span",{class:"hljs-variable language_"},"this"),a("."),s("span",{class:"hljs-title function_"},"buildResponse"),a(`();
|
|
155
|
+
}
|
|
156
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-title function_"},"head"),a("("),s("span",{class:"hljs-params"},"path, options"),a(`) {
|
|
157
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(),s("span",{class:"hljs-variable language_"},"this"),a("."),s("span",{class:"hljs-title function_"},"buildResponse"),a(`();
|
|
158
|
+
}
|
|
159
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-title function_"},"options"),a("("),s("span",{class:"hljs-params"},"path, options"),a(`) {
|
|
160
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(),s("span",{class:"hljs-variable language_"},"this"),a("."),s("span",{class:"hljs-title function_"},"buildResponse"),a(`();
|
|
161
|
+
}
|
|
162
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-title function_"},"delete"),a("("),s("span",{class:"hljs-params"},"path, data, options"),a(`) {
|
|
163
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(),s("span",{class:"hljs-variable language_"},"this"),a("."),s("span",{class:"hljs-title function_"},"buildResponse"),a(`();
|
|
164
|
+
}
|
|
165
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-title function_"},"post"),a("("),s("span",{class:"hljs-params"},"path, data, options"),a(`) {
|
|
166
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(),s("span",{class:"hljs-variable language_"},"this"),a("."),s("span",{class:"hljs-title function_"},"buildResponse"),a(`();
|
|
167
|
+
}
|
|
168
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-title function_"},"put"),a("("),s("span",{class:"hljs-params"},"path, data, options"),a(`) {
|
|
169
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(),s("span",{class:"hljs-variable language_"},"this"),a("."),s("span",{class:"hljs-title function_"},"buildResponse"),a(`();
|
|
170
|
+
}
|
|
171
|
+
`),s("span",{class:"hljs-keyword"},"async"),a(),s("span",{class:"hljs-title function_"},"patch"),a("("),s("span",{class:"hljs-params"},"path, data, options"),a(`) {
|
|
172
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(),s("span",{class:"hljs-variable language_"},"this"),a("."),s("span",{class:"hljs-title function_"},"buildResponse"),a(`();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" directus = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"Directus"),a("("),s("span",{class:"hljs-string"},"'http://directus.example.com'"),a(", { "),s("span",{class:"hljs-attr"},"transport"),a(": "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"MyTransport"),a(`() });
|
|
177
|
+
`)])],-1),js=s("h3",{id:"directus-implementation-1",tabindex:"-1"},[a("Directus Implementation "),s("a",{class:"header-anchor",href:"#directus-implementation-1"},"#")],-1),_s=s("p",null,[a("By default, Directus creates an instance of "),s("code",null,"Transport"),a(" which handles requests automatically. Check "),s("a",{href:"#options.transport"},[s("code",null,"options.transport")]),a(" to see the available settings.")],-1),ms=s("p",null,[a("To make HTTP requests SDK uses "),s("code",null,"axios"),a(" so it is compatible in both browsers and Node.js. Also, it is possible to handle upload progress (a downside of "),s("code",null,"fetch"),a(").")],-1),gs=s("h2",{id:"storage",tabindex:"-1"},[a("Storage "),s("a",{class:"header-anchor",href:"#storage"},"#")],-1),fs=s("p",null,"The storage is used to load and save token information.",-1),ys=s("h3",{id:"custom-implementation-2",tabindex:"-1"},[a("Custom Implementation "),s("a",{class:"header-anchor",href:"#custom-implementation-2"},"#")],-1),ws=s("p",null,[a("It is possible to provide a custom implementation by extending "),s("code",null,"BaseStorage"),a(". While, this could be useful for advanced usage, it is not needed for most use-cases.")],-1),bs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"import"),a(" { "),s("span",{class:"hljs-title class_"},"BaseStorage"),a(", "),s("span",{class:"hljs-title class_"},"Directus"),a(" } "),s("span",{class:"hljs-keyword"},"from"),a(),s("span",{class:"hljs-string"},"'@directus/sdk'"),a(`;
|
|
178
|
+
|
|
179
|
+
`),s("span",{class:"hljs-keyword"},"class"),a(),s("span",{class:"hljs-title class_"},"SessionStorage"),a(),s("span",{class:"hljs-keyword"},"extends"),a(),s("span",{class:"hljs-title class_ inherited__"},"BaseStorage"),a(` {
|
|
180
|
+
`),s("span",{class:"hljs-title function_"},"get"),a("("),s("span",{class:"hljs-params"},"key"),a(`) {
|
|
181
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(" sessionStorage."),s("span",{class:"hljs-title function_"},"getItem"),a(`(key);
|
|
182
|
+
}
|
|
183
|
+
`),s("span",{class:"hljs-title function_"},"set"),a("("),s("span",{class:"hljs-params"},"key, value"),a(`) {
|
|
184
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(" sessionStorage."),s("span",{class:"hljs-title function_"},"setItem"),a(`(key, value);
|
|
185
|
+
}
|
|
186
|
+
`),s("span",{class:"hljs-title function_"},"delete"),a("("),s("span",{class:"hljs-params"},"key"),a(`) {
|
|
187
|
+
`),s("span",{class:"hljs-keyword"},"return"),a(" sessionStorage."),s("span",{class:"hljs-title function_"},"removeItem"),a(`(key);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" directus = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"Directus"),a("("),s("span",{class:"hljs-string"},"'http://directus.example.com'"),a(", { "),s("span",{class:"hljs-attr"},"storage"),a(": "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"SessionStorage"),a(`() });
|
|
192
|
+
`)])],-1),ks=s("h3",{id:"directus-implementation-2",tabindex:"-1"},[a("Directus Implementation "),s("a",{class:"header-anchor",href:"#directus-implementation-2"},"#")],-1),vs=s("p",null,[a("By default, Directus creates an instance of "),s("code",null,"Storage"),a(" which handles store information automatically. Check "),s("a",{href:"#options.storage"},[s("code",null,"options.storage")]),a(" to see the available settings.")],-1),xs=s("p",null,[a("SDK uses "),s("code",null,"localStorage"),a(" on browsers and the memory itself on Node.js to save tokens. This behavior can be configured in "),s("a",{href:"#options.storage.mode"},[s("code",null,"options.storage.mode")]),a(". The "),s("code",null,"LocalStorage"),a(" is only available on browsers and the "),s("code",null,"MemoryStorage"),a(" is not persistent, i.e., once you leave the tab or quit the process, you will need to authenticate again.")],-1),Ss=s("p",null,[a("If you want to use multiple instances of the SDK you should set a different "),s("a",{href:"#options.storage.prefix"},[s("code",null,"prefix")]),a(" for each one.")],-1),Ds=s("h2",{id:"items",tabindex:"-1"},[a("Items "),s("a",{class:"header-anchor",href:"#items"},"#")],-1),Ts=s("p",null,[a("You can get an instance of the item handler by providing the collection (and type, in the case of TypeScript) to the "),s("code",null,"items"),a(" function. The following examples will use the "),s("code",null,"Article"),a(" type.")],-1),Is=s("blockquote",null,[s("p",null,"JavaScript")],-1),As=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-comment"},"// import { Directus, ID } from '@directus/sdk';"),a(`
|
|
193
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" { "),s("span",{class:"hljs-title class_"},"Directus"),a(" } = "),s("span",{class:"hljs-built_in"},"require"),a("("),s("span",{class:"hljs-string"},"'@directus/sdk'"),a(`);
|
|
194
|
+
|
|
195
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" directus = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"Directus"),a("("),s("span",{class:"hljs-string"},"'http://directus.example.com'"),a(`);
|
|
196
|
+
|
|
197
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" articles = directus."),s("span",{class:"hljs-title function_"},"items"),a("("),s("span",{class:"hljs-string"},"'articles'"),a(`);
|
|
198
|
+
`)])],-1),Rs=s("blockquote",null,[s("p",null,"TypeScript")],-1),qs=s("pre",null,[s("code",{class:"language-ts"},[s("span",{class:"hljs-keyword"},"import"),a(" { "),s("span",{class:"hljs-title class_"},"Directus"),a(", "),s("span",{class:"hljs-variable constant_"},"ID"),a(" } "),s("span",{class:"hljs-keyword"},"from"),a(),s("span",{class:"hljs-string"},"'@directus/sdk'"),a(`;
|
|
199
|
+
|
|
200
|
+
`),s("span",{class:"hljs-comment"},"// Map your collection structure based on its fields."),a(`
|
|
201
|
+
`),s("span",{class:"hljs-keyword"},"type"),a(),s("span",{class:"hljs-title class_"},"Article"),a(` = {
|
|
202
|
+
`),s("span",{class:"hljs-attr"},"id"),a(": "),s("span",{class:"hljs-variable constant_"},"ID"),a(`;
|
|
203
|
+
`),s("span",{class:"hljs-attr"},"title"),a(": "),s("span",{class:"hljs-built_in"},"string"),a(`;
|
|
204
|
+
`),s("span",{class:"hljs-attr"},"body"),a(": "),s("span",{class:"hljs-built_in"},"string"),a(`;
|
|
205
|
+
`),s("span",{class:"hljs-attr"},"published"),a(": "),s("span",{class:"hljs-built_in"},"boolean"),a(`;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
`),s("span",{class:"hljs-comment"},"// Map your collections to its respective types. The SDK will"),a(`
|
|
209
|
+
`),s("span",{class:"hljs-comment"},"// infer its types based on usage later."),a(`
|
|
210
|
+
`),s("span",{class:"hljs-keyword"},"type"),a(),s("span",{class:"hljs-title class_"},"MyBlog"),a(` = {
|
|
211
|
+
`),s("span",{class:"hljs-comment"},"// [collection_name]: typescript_type"),a(`
|
|
212
|
+
`),s("span",{class:"hljs-attr"},"articles"),a(": "),s("span",{class:"hljs-title class_"},"Article"),a(`;
|
|
213
|
+
|
|
214
|
+
`),s("span",{class:"hljs-comment"},"// You can also extend Directus collection. The naming has"),a(`
|
|
215
|
+
`),s("span",{class:"hljs-comment"},"// to match a Directus system collection and it will be merged"),a(`
|
|
216
|
+
`),s("span",{class:"hljs-comment"},"// into the system spec."),a(`
|
|
217
|
+
`),s("span",{class:"hljs-attr"},"directus_users"),a(`: {
|
|
218
|
+
`),s("span",{class:"hljs-attr"},"bio"),a(": "),s("span",{class:"hljs-built_in"},"string"),a(`;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
`),s("span",{class:"hljs-comment"},"// Let the SDK know about your collection types."),a(`
|
|
223
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" directus = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"Directus"),a("<"),s("span",{class:"hljs-title class_"},"MyBlog"),a(">("),s("span",{class:"hljs-string"},"'https://directus.myblog.com'"),a(`);
|
|
224
|
+
|
|
225
|
+
`),s("span",{class:"hljs-comment"},'// typeof(article) is a partial "Article"'),a(`
|
|
226
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" article = "),s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-title function_"},"items"),a("("),s("span",{class:"hljs-string"},"'articles'"),a(")."),s("span",{class:"hljs-title function_"},"readOne"),a("("),s("span",{class:"hljs-number"},"10"),a(`);
|
|
227
|
+
|
|
228
|
+
`),s("span",{class:"hljs-comment"},'// Error TS2322: "hello" is not assignable to type "boolean".'),a(`
|
|
229
|
+
`),s("span",{class:"hljs-comment"},"// post.published = 'hello';"),a(`
|
|
230
|
+
`)])],-1),Bs=s("h3",{id:"create-single-item",tabindex:"-1"},[a("Create Single Item "),s("a",{class:"header-anchor",href:"#create-single-item"},"#")],-1),Ms=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"createOne"),a(`({
|
|
231
|
+
`),s("span",{class:"hljs-attr"},"title"),a(": "),s("span",{class:"hljs-string"},"'My New Article'"),a(`,
|
|
232
|
+
});
|
|
233
|
+
`)])],-1),Cs=s("h3",{id:"create-multiple-items",tabindex:"-1"},[a("Create Multiple Items "),s("a",{class:"header-anchor",href:"#create-multiple-items"},"#")],-1),Os=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"createMany"),a(`([
|
|
234
|
+
{
|
|
235
|
+
`),s("span",{class:"hljs-attr"},"title"),a(": "),s("span",{class:"hljs-string"},"'My First Article'"),a(`,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
`),s("span",{class:"hljs-attr"},"title"),a(": "),s("span",{class:"hljs-string"},"'My Second Article'"),a(`,
|
|
239
|
+
},
|
|
240
|
+
]);
|
|
241
|
+
`)])],-1),Ps=s("h3",{id:"read-by-query",tabindex:"-1"},[a("Read By Query "),s("a",{class:"header-anchor",href:"#read-by-query"},"#")],-1),Us=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"readByQuery"),a(`({
|
|
242
|
+
`),s("span",{class:"hljs-attr"},"search"),a(": "),s("span",{class:"hljs-string"},"'Directus'"),a(`,
|
|
243
|
+
`),s("span",{class:"hljs-attr"},"filter"),a(`: {
|
|
244
|
+
`),s("span",{class:"hljs-attr"},"date_published"),a(`: {
|
|
245
|
+
`),s("span",{class:"hljs-attr"},"_gte"),a(": "),s("span",{class:"hljs-string"},"'$NOW'"),a(`,
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
`)])],-1),Es=s("h3",{id:"read-all",tabindex:"-1"},[a("Read All "),s("a",{class:"header-anchor",href:"#read-all"},"#")],-1),Ns=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"readByQuery"),a(`({
|
|
250
|
+
`),s("span",{class:"hljs-comment"},"// By default API limits results to 100."),a(`
|
|
251
|
+
`),s("span",{class:"hljs-comment"},"// With -1, it will return all results, but it may lead to performance degradation"),a(`
|
|
252
|
+
`),s("span",{class:"hljs-comment"},"// for large result sets."),a(`
|
|
253
|
+
`),s("span",{class:"hljs-attr"},"limit"),a(": -"),s("span",{class:"hljs-number"},"1"),a(`,
|
|
254
|
+
});
|
|
255
|
+
`)])],-1),Fs=s("h3",{id:"read-single-item",tabindex:"-1"},[a("Read Single Item "),s("a",{class:"header-anchor",href:"#read-single-item"},"#")],-1),Ks=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"readOne"),a("("),s("span",{class:"hljs-number"},"15"),a(`);
|
|
256
|
+
`)])],-1),Ls=s("p",null,"Supports optional query:",-1),Ws=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"readOne"),a("("),s("span",{class:"hljs-number"},"15"),a(`, {
|
|
257
|
+
`),s("span",{class:"hljs-attr"},"fields"),a(": ["),s("span",{class:"hljs-string"},"'title'"),a(`],
|
|
258
|
+
});
|
|
259
|
+
`)])],-1),Js=s("h3",{id:"read-multiple-items",tabindex:"-1"},[a("Read Multiple Items "),s("a",{class:"header-anchor",href:"#read-multiple-items"},"#")],-1),Hs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"readMany"),a("(["),s("span",{class:"hljs-number"},"15"),a(", "),s("span",{class:"hljs-number"},"16"),a(", "),s("span",{class:"hljs-number"},"17"),a(`]);
|
|
260
|
+
`)])],-1),Vs=s("p",null,"Supports optional query:",-1),zs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"readMany"),a("(["),s("span",{class:"hljs-number"},"15"),a(", "),s("span",{class:"hljs-number"},"16"),a(", "),s("span",{class:"hljs-number"},"17"),a(`], {
|
|
261
|
+
`),s("span",{class:"hljs-attr"},"fields"),a(": ["),s("span",{class:"hljs-string"},"'title'"),a(`],
|
|
262
|
+
});
|
|
263
|
+
`)])],-1),Gs=s("h3",{id:"update-single-item",tabindex:"-1"},[a("Update Single Item "),s("a",{class:"header-anchor",href:"#update-single-item"},"#")],-1),Ys=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"updateOne"),a("("),s("span",{class:"hljs-number"},"15"),a(`, {
|
|
264
|
+
`),s("span",{class:"hljs-attr"},"title"),a(": "),s("span",{class:"hljs-string"},"'This articles now has a different title'"),a(`,
|
|
265
|
+
});
|
|
266
|
+
`)])],-1),Qs=s("p",null,"Supports optional query:",-1),$s=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"updateOne"),a(`(
|
|
267
|
+
`),s("span",{class:"hljs-number"},"42"),a(`,
|
|
268
|
+
{
|
|
269
|
+
`),s("span",{class:"hljs-attr"},"title"),a(": "),s("span",{class:"hljs-string"},"'This articles now has a similar title'"),a(`,
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
`),s("span",{class:"hljs-attr"},"fields"),a(": ["),s("span",{class:"hljs-string"},"'title'"),a(`],
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
`)])],-1),Xs=s("h3",{id:"update-multiple-items",tabindex:"-1"},[a("Update Multiple Items "),s("a",{class:"header-anchor",href:"#update-multiple-items"},"#")],-1),Zs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"updateMany"),a("(["),s("span",{class:"hljs-number"},"15"),a(", "),s("span",{class:"hljs-number"},"42"),a(`], {
|
|
276
|
+
`),s("span",{class:"hljs-attr"},"title"),a(": "),s("span",{class:"hljs-string"},"'Both articles now have the same title'"),a(`,
|
|
277
|
+
});
|
|
278
|
+
`)])],-1),sa=s("p",null,"Supports optional query:",-1),aa=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"updateMany"),a(`(
|
|
279
|
+
[`),s("span",{class:"hljs-number"},"15"),a(", "),s("span",{class:"hljs-number"},"42"),a(`],
|
|
280
|
+
{
|
|
281
|
+
`),s("span",{class:"hljs-attr"},"title"),a(": "),s("span",{class:"hljs-string"},"'Both articles now have the same title'"),a(`,
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
`),s("span",{class:"hljs-attr"},"fields"),a(": ["),s("span",{class:"hljs-string"},"'title'"),a(`],
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
`)])],-1),ta=s("h3",{id:"delete",tabindex:"-1"},[a("Delete "),s("a",{class:"header-anchor",href:"#delete"},"#")],-1),ea=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-comment"},"// One"),a(`
|
|
288
|
+
`),s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"deleteOne"),a("("),s("span",{class:"hljs-number"},"15"),a(`);
|
|
289
|
+
|
|
290
|
+
`),s("span",{class:"hljs-comment"},"// Multiple"),a(`
|
|
291
|
+
`),s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"deleteMany"),a("(["),s("span",{class:"hljs-number"},"15"),a(", "),s("span",{class:"hljs-number"},"42"),a(`]);
|
|
292
|
+
`)])],-1),la=s("h3",{id:"request-parameter-overrides",tabindex:"-1"},[a("Request Parameter Overrides "),s("a",{class:"header-anchor",href:"#request-parameter-overrides"},"#")],-1),na=s("p",null,[a("To override any of the axios request parameters, provide an additional parameter with a "),s("code",null,"requestOptions"),a(" object:")],-1),oa=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" articles."),s("span",{class:"hljs-title function_"},"createOne"),a(`(
|
|
293
|
+
{ `),s("span",{class:"hljs-attr"},"title"),a(": "),s("span",{class:"hljs-string"},"'example'"),a(` },
|
|
294
|
+
{ `),s("span",{class:"hljs-attr"},"fields"),a(": ["),s("span",{class:"hljs-string"},"'id'"),a(`] },
|
|
295
|
+
{
|
|
296
|
+
`),s("span",{class:"hljs-attr"},"requestOptions"),a(`: {
|
|
297
|
+
`),s("span",{class:"hljs-attr"},"headers"),a(`: {
|
|
298
|
+
`),s("span",{class:"hljs-string"},"'X-My-Custom-Header'"),a(": "),s("span",{class:"hljs-string"},"'example'"),a(`,
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
}
|
|
302
|
+
);
|
|
303
|
+
`)])],-1),ca=s("h2",{id:"activity",tabindex:"-1"},[a("Activity "),s("a",{class:"header-anchor",href:"#activity"},"#")],-1),ia=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"activity"),a(`;
|
|
304
|
+
`)])],-1),ra=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_activity")'),a(".")],-1),ha=s("h2",{id:"comments",tabindex:"-1"},[a("Comments "),s("a",{class:"header-anchor",href:"#comments"},"#")],-1),pa=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"comments"),a(`;
|
|
305
|
+
`)])],-1),da=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_comments")'),a(".")],-1),ua=s("h2",{id:"collections",tabindex:"-1"},[a("Collections "),s("a",{class:"header-anchor",href:"#collections"},"#")],-1),ja=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"collections"),a(`;
|
|
306
|
+
`)])],-1),_a=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_collections")'),a(".")],-1),ma=s("h2",{id:"fields",tabindex:"-1"},[a("Fields "),s("a",{class:"header-anchor",href:"#fields"},"#")],-1),ga=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"fields"),a(`;
|
|
307
|
+
`)])],-1),fa=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_fields")'),a(".")],-1),ya=s("h2",{id:"files",tabindex:"-1"},[a("Files "),s("a",{class:"header-anchor",href:"#files"},"#")],-1),wa=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"files"),a(`;
|
|
308
|
+
`)])],-1),ba=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_files")'),a(".")],-1),ka=s("h3",{id:"uploading-a-file",tabindex:"-1"},[a("Uploading a file "),s("a",{class:"header-anchor",href:"#uploading-a-file"},"#")],-1),va=s("p",null,[a("To upload a file you will need to send a "),s("code",null,"multipart/form-data"),a(" as body. On browser side you do so:")],-1),xa=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-comment"},"/* index.js */"),a(`
|
|
309
|
+
`),s("span",{class:"hljs-keyword"},"import"),a(" { "),s("span",{class:"hljs-title class_"},"Directus"),a(" } "),s("span",{class:"hljs-keyword"},"from"),a(),s("span",{class:"hljs-string"},"'https://unpkg.com/@directus/sdk@latest/dist/sdk.esm.min.js'"),a(`;
|
|
310
|
+
|
|
311
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" directus = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"Directus"),a("("),s("span",{class:"hljs-string"},"'http://localhost:8055'"),a(`, {
|
|
312
|
+
`),s("span",{class:"hljs-attr"},"auth"),a(`: {
|
|
313
|
+
`),s("span",{class:"hljs-attr"},"staticToken"),a(": "),s("span",{class:"hljs-string"},"'STATIC_TOKEN'"),a(", "),s("span",{class:"hljs-comment"},"// If you want to use a static token, otherwise check below how you can use email and password."),a(`
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
`),s("span",{class:"hljs-comment"},"// await directus.auth.login({ email, password }) // If you want to use email and password. You should remove the staticToken above"),a(`
|
|
318
|
+
|
|
319
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" form = "),s("span",{class:"hljs-variable language_"},"document"),a("."),s("span",{class:"hljs-title function_"},"querySelector"),a("("),s("span",{class:"hljs-string"},"'#upload-file'"),a(`);
|
|
320
|
+
|
|
321
|
+
`),s("span",{class:"hljs-keyword"},"if"),a(" (form && form "),s("span",{class:"hljs-keyword"},"instanceof"),a(),s("span",{class:"hljs-title class_"},"HTMLFormElement"),a(`) {
|
|
322
|
+
form.`),s("span",{class:"hljs-title function_"},"addEventListener"),a("("),s("span",{class:"hljs-string"},"'submit'"),a(", "),s("span",{class:"hljs-keyword"},"async"),a(` (event) => {
|
|
323
|
+
event.`),s("span",{class:"hljs-title function_"},"preventDefault"),a(`();
|
|
324
|
+
|
|
325
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" form = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"FormData"),a("(event."),s("span",{class:"hljs-property"},"target"),a(`);
|
|
326
|
+
`),s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"files"),a("."),s("span",{class:"hljs-title function_"},"createOne"),a(`(form);
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
`)])],-1),Sa=s("pre",null,[s("code",{class:"language-html"},[s("span",{class:"hljs-comment"},"<!-- index.html -->"),a(`
|
|
330
|
+
`),s("span",{class:"hljs-tag"},[a("<"),s("span",{class:"hljs-name"},"head"),a(">")]),s("span",{class:"hljs-tag"},[a("</"),s("span",{class:"hljs-name"},"head"),a(">")]),a(`
|
|
331
|
+
`),s("span",{class:"hljs-tag"},[a("<"),s("span",{class:"hljs-name"},"body"),a(">")]),a(`
|
|
332
|
+
`),s("span",{class:"hljs-tag"},[a("<"),s("span",{class:"hljs-name"},"form"),a(),s("span",{class:"hljs-attr"},"id"),a("="),s("span",{class:"hljs-string"},'"upload-file"'),a(">")]),a(`
|
|
333
|
+
`),s("span",{class:"hljs-tag"},[a("<"),s("span",{class:"hljs-name"},"input"),a(),s("span",{class:"hljs-attr"},"type"),a("="),s("span",{class:"hljs-string"},'"text"'),a(),s("span",{class:"hljs-attr"},"name"),a("="),s("span",{class:"hljs-string"},'"title"'),a(" />")]),a(`
|
|
334
|
+
`),s("span",{class:"hljs-tag"},[a("<"),s("span",{class:"hljs-name"},"input"),a(),s("span",{class:"hljs-attr"},"type"),a("="),s("span",{class:"hljs-string"},'"file"'),a(),s("span",{class:"hljs-attr"},"name"),a("="),s("span",{class:"hljs-string"},'"file"'),a(" />")]),a(`
|
|
335
|
+
`),s("span",{class:"hljs-tag"},[a("<"),s("span",{class:"hljs-name"},"button"),a(">")]),a("Send"),s("span",{class:"hljs-tag"},[a("</"),s("span",{class:"hljs-name"},"button"),a(">")]),a(`
|
|
336
|
+
`),s("span",{class:"hljs-tag"},[a("</"),s("span",{class:"hljs-name"},"form"),a(">")]),a(`
|
|
337
|
+
`),s("span",{class:"hljs-tag"},[a("<"),s("span",{class:"hljs-name"},"script"),a(),s("span",{class:"hljs-attr"},"src"),a("="),s("span",{class:"hljs-string"},'"/index.js"'),a(),s("span",{class:"hljs-attr"},"type"),a("="),s("span",{class:"hljs-string"},'"module"'),a(">")]),s("span",{class:"hljs-tag"},[a("</"),s("span",{class:"hljs-name"},"script"),a(">")]),a(`
|
|
338
|
+
`),s("span",{class:"hljs-tag"},[a("</"),s("span",{class:"hljs-name"},"body"),a(">")]),a(`
|
|
339
|
+
`),s("span",{class:"hljs-tag"},[a("</"),s("span",{class:"hljs-name"},"html"),a(">")]),a(`
|
|
340
|
+
`)])],-1),Da=s("h4",{id:"nodejs-usage",tabindex:"-1"},[a("NodeJS usage "),s("a",{class:"header-anchor",href:"#nodejs-usage"},"#")],-1),Ta=s("p",null,"When uploading a file from a NodeJS environment, you\u2019ll have to override the headers to ensure the correct boundary is set:",-1),Ia=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"import"),a(" { "),s("span",{class:"hljs-title class_"},"Directus"),a(" } "),s("span",{class:"hljs-keyword"},"from"),a(),s("span",{class:"hljs-string"},"'https://unpkg.com/@directus/sdk@latest/dist/sdk.esm.min.js'"),a(`;
|
|
341
|
+
|
|
342
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" directus = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"Directus"),a("("),s("span",{class:"hljs-string"},"'http://localhost:8055'"),a(`, {
|
|
343
|
+
`),s("span",{class:"hljs-attr"},"auth"),a(`: {
|
|
344
|
+
`),s("span",{class:"hljs-attr"},"staticToken"),a(": "),s("span",{class:"hljs-string"},"'STATIC_TOKEN'"),a(", "),s("span",{class:"hljs-comment"},"// If you want to use a static token, otherwise check below how you can use email and password."),a(`
|
|
345
|
+
},
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" form = "),s("span",{class:"hljs-keyword"},"new"),a(),s("span",{class:"hljs-title class_"},"FormData"),a(`();
|
|
349
|
+
form.`),s("span",{class:"hljs-title function_"},"append"),a("("),s("span",{class:"hljs-string"},'"file"'),a(", fs."),s("span",{class:"hljs-title function_"},"createReadStream"),a("("),s("span",{class:"hljs-string"},'"./to_upload.jpeg"'),a(`));
|
|
350
|
+
|
|
351
|
+
`),s("span",{class:"hljs-keyword"},"const"),a(" fileId = "),s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"files"),a("."),s("span",{class:"hljs-title function_"},"createOne"),a(`(form, {}, {
|
|
352
|
+
`),s("span",{class:"hljs-attr"},"requestOptions"),a(`: {
|
|
353
|
+
`),s("span",{class:"hljs-attr"},"headers"),a(`: {
|
|
354
|
+
...form.`),s("span",{class:"hljs-title function_"},"getHeaders"),a(`()
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
);
|
|
358
|
+
`)])],-1),Aa=s("h3",{id:"importing-a-file",tabindex:"-1"},[a("Importing a file "),s("a",{class:"header-anchor",href:"#importing-a-file"},"#")],-1),Ra=a("Example of "),qa=a("importing a file from a URL"),Ba=a(":"),Ma=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"files"),a("."),s("span",{class:"hljs-title function_"},"import"),a(`({
|
|
359
|
+
`),s("span",{class:"hljs-attr"},"url"),a(": "),s("span",{class:"hljs-string"},"'http://www.example.com/example-image.jpg'"),a(`,
|
|
360
|
+
});
|
|
361
|
+
`)])],-1),Ca=s("p",null,"Example of importing file with custom data:",-1),Oa=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"files"),a("."),s("span",{class:"hljs-title function_"},"import"),a(`({
|
|
362
|
+
`),s("span",{class:"hljs-attr"},"url"),a(": "),s("span",{class:"hljs-string"},"'http://www.example.com/example-image.jpg'"),a(`,
|
|
363
|
+
`),s("span",{class:"hljs-attr"},"data"),a(`: {
|
|
364
|
+
`),s("span",{class:"hljs-attr"},"title"),a(": "),s("span",{class:"hljs-string"},"'My Custom File'"),a(`,
|
|
365
|
+
},
|
|
366
|
+
});
|
|
367
|
+
`)])],-1),Pa=s("h2",{id:"folders",tabindex:"-1"},[a("Folders "),s("a",{class:"header-anchor",href:"#folders"},"#")],-1),Ua=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"folders"),a(`;
|
|
368
|
+
`)])],-1),Ea=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_folders")'),a(".")],-1),Na=s("h2",{id:"permissions",tabindex:"-1"},[a("Permissions "),s("a",{class:"header-anchor",href:"#permissions"},"#")],-1),Fa=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"permissions"),a(`;
|
|
369
|
+
`)])],-1),Ka=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_permissions")'),a(".")],-1),La=s("h2",{id:"presets",tabindex:"-1"},[a("Presets "),s("a",{class:"header-anchor",href:"#presets"},"#")],-1),Wa=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"presets"),a(`;
|
|
370
|
+
`)])],-1),Ja=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_presets")'),a(".")],-1),Ha=s("h2",{id:"relations",tabindex:"-1"},[a("Relations "),s("a",{class:"header-anchor",href:"#relations"},"#")],-1),Va=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"relations"),a(`;
|
|
371
|
+
`)])],-1),za=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_relations")'),a(".")],-1),Ga=s("h2",{id:"revisions",tabindex:"-1"},[a("Revisions "),s("a",{class:"header-anchor",href:"#revisions"},"#")],-1),Ya=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"revisions"),a(`;
|
|
372
|
+
`)])],-1),Qa=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_revisions")'),a(".")],-1),$a=s("h2",{id:"roles",tabindex:"-1"},[a("Roles "),s("a",{class:"header-anchor",href:"#roles"},"#")],-1),Xa=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"roles"),a(`;
|
|
373
|
+
`)])],-1),Za=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_roles")'),a(".")],-1),st=s("h2",{id:"settings",tabindex:"-1"},[a("Settings "),s("a",{class:"header-anchor",href:"#settings"},"#")],-1),at=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"settings"),a(`;
|
|
374
|
+
`)])],-1),tt=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_settings")'),a(".")],-1),et=s("h2",{id:"server",tabindex:"-1"},[a("Server "),s("a",{class:"header-anchor",href:"#server"},"#")],-1),lt=s("h3",{id:"ping-the-server",tabindex:"-1"},[a("Ping the Server "),s("a",{class:"header-anchor",href:"#ping-the-server"},"#")],-1),nt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"server"),a("."),s("span",{class:"hljs-title function_"},"ping"),a(`();
|
|
375
|
+
`)])],-1),ot=s("h3",{id:"get-server%2Fproject-info",tabindex:"-1"},[a("Get Server/Project Info "),s("a",{class:"header-anchor",href:"#get-server%2Fproject-info"},"#")],-1),ct=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"server"),a("."),s("span",{class:"hljs-title function_"},"info"),a(`();
|
|
376
|
+
`)])],-1),it=s("h2",{id:"users",tabindex:"-1"},[a("Users "),s("a",{class:"header-anchor",href:"#users"},"#")],-1),rt=s("pre",null,[s("code",{class:"language-js"},[a("directus."),s("span",{class:"hljs-property"},"users"),a(`;
|
|
377
|
+
`)])],-1),ht=s("p",null,[a("Same methods as "),s("code",null,'directus.items("directus_users")'),a(", and:")],-1),pt=s("h3",{id:"invite-a-new-user",tabindex:"-1"},[a("Invite a New User "),s("a",{class:"header-anchor",href:"#invite-a-new-user"},"#")],-1),dt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"users"),a("."),s("span",{class:"hljs-property"},"invites"),a("."),s("span",{class:"hljs-title function_"},"send"),a("("),s("span",{class:"hljs-string"},"'admin@example.com'"),a(", "),s("span",{class:"hljs-string"},"'fe38136e-52f7-4622-8498-112b8a32a1e2'"),a(`);
|
|
378
|
+
`)])],-1),ut=s("p",null,"The second parameter is the role of the user",-1),jt=s("h3",{id:"accept-a-user-invite",tabindex:"-1"},[a("Accept a User Invite "),s("a",{class:"header-anchor",href:"#accept-a-user-invite"},"#")],-1),_t=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"users"),a("."),s("span",{class:"hljs-property"},"invites"),a("."),s("span",{class:"hljs-title function_"},"accept"),a("("),s("span",{class:"hljs-string"},"'<accept-token>'"),a(", "),s("span",{class:"hljs-string"},"'n3w-p455w0rd'"),a(`);
|
|
379
|
+
`)])],-1),mt=s("p",null,"The provided token is sent to the user\u2019s email",-1),gt=s("h3",{id:"enable-two-factor-authentication",tabindex:"-1"},[a("Enable Two-Factor Authentication "),s("a",{class:"header-anchor",href:"#enable-two-factor-authentication"},"#")],-1),ft=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"users"),a("."),s("span",{class:"hljs-property"},"tfa"),a("."),s("span",{class:"hljs-title function_"},"enable"),a("("),s("span",{class:"hljs-string"},"'my-password'"),a(`);
|
|
380
|
+
`)])],-1),yt=s("h3",{id:"disable-two-factor-authentication",tabindex:"-1"},[a("Disable Two-Factor Authentication "),s("a",{class:"header-anchor",href:"#disable-two-factor-authentication"},"#")],-1),wt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"users"),a("."),s("span",{class:"hljs-property"},"tfa"),a("."),s("span",{class:"hljs-title function_"},"disable"),a("("),s("span",{class:"hljs-string"},"'691402'"),a(`);
|
|
381
|
+
`)])],-1),bt=s("h3",{id:"get-the-current-user",tabindex:"-1"},[a("Get the Current User "),s("a",{class:"header-anchor",href:"#get-the-current-user"},"#")],-1),kt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"users"),a("."),s("span",{class:"hljs-property"},"me"),a("."),s("span",{class:"hljs-title function_"},"read"),a(`();
|
|
382
|
+
`)])],-1),vt=s("p",null,"Supports optional query:",-1),xt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"users"),a("."),s("span",{class:"hljs-property"},"me"),a("."),s("span",{class:"hljs-title function_"},"read"),a(`({
|
|
383
|
+
`),s("span",{class:"hljs-attr"},"fields"),a(": ["),s("span",{class:"hljs-string"},"'last_access'"),a(`],
|
|
384
|
+
});
|
|
385
|
+
`)])],-1),St=s("h3",{id:"update-the-current-users",tabindex:"-1"},[a("Update the Current Users "),s("a",{class:"header-anchor",href:"#update-the-current-users"},"#")],-1),Dt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"users"),a("."),s("span",{class:"hljs-property"},"me"),a("."),s("span",{class:"hljs-title function_"},"update"),a("({ "),s("span",{class:"hljs-attr"},"first_name"),a(": "),s("span",{class:"hljs-string"},"'Admin'"),a(` });
|
|
386
|
+
`)])],-1),Tt=s("p",null,"Supports optional query:",-1),It=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"users"),a("."),s("span",{class:"hljs-property"},"me"),a("."),s("span",{class:"hljs-title function_"},"update"),a("({ "),s("span",{class:"hljs-attr"},"first_name"),a(": "),s("span",{class:"hljs-string"},"'Admin'"),a(" }, { "),s("span",{class:"hljs-attr"},"fields"),a(": ["),s("span",{class:"hljs-string"},"'last_access'"),a(`] });
|
|
387
|
+
`)])],-1),At=s("h2",{id:"utils",tabindex:"-1"},[a("Utils "),s("a",{class:"header-anchor",href:"#utils"},"#")],-1),Rt=s("h3",{id:"get-a-random-string",tabindex:"-1"},[a("Get a Random String "),s("a",{class:"header-anchor",href:"#get-a-random-string"},"#")],-1),qt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"utils"),a("."),s("span",{class:"hljs-property"},"random"),a("."),s("span",{class:"hljs-title function_"},"string"),a(`();
|
|
388
|
+
`)])],-1),Bt=s("p",null,[a("Supports an optional "),s("code",null,"length"),a(" (defaults to 32):")],-1),Mt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"utils"),a("."),s("span",{class:"hljs-property"},"random"),a("."),s("span",{class:"hljs-title function_"},"string"),a("("),s("span",{class:"hljs-number"},"50"),a(`);
|
|
389
|
+
`)])],-1),Ct=s("h3",{id:"generate-a-hash-for-a-given-value",tabindex:"-1"},[a("Generate a Hash for a Given Value "),s("a",{class:"header-anchor",href:"#generate-a-hash-for-a-given-value"},"#")],-1),Ot=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"utils"),a("."),s("span",{class:"hljs-property"},"hash"),a("."),s("span",{class:"hljs-title function_"},"generate"),a("("),s("span",{class:"hljs-string"},"'My String'"),a(`);
|
|
390
|
+
`)])],-1),Pt=s("h3",{id:"verify-if-a-hash-is-valid",tabindex:"-1"},[a("Verify if a Hash is Valid "),s("a",{class:"header-anchor",href:"#verify-if-a-hash-is-valid"},"#")],-1),Ut=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"utils"),a("."),s("span",{class:"hljs-property"},"hash"),a("."),s("span",{class:"hljs-title function_"},"verify"),a("("),s("span",{class:"hljs-string"},"'My String'"),a(", "),s("span",{class:"hljs-string"},"'$argon2i$v=19$m=4096,t=3,p=1$A5uogJh'"),a(`);
|
|
391
|
+
`)])],-1),Et=s("h3",{id:"sort-items-in-a-collection",tabindex:"-1"},[a("Sort Items in a Collection "),s("a",{class:"header-anchor",href:"#sort-items-in-a-collection"},"#")],-1),Nt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"utils"),a("."),s("span",{class:"hljs-title function_"},"sort"),a("("),s("span",{class:"hljs-string"},"'articles'"),a(", "),s("span",{class:"hljs-number"},"15"),a(", "),s("span",{class:"hljs-number"},"42"),a(`);
|
|
392
|
+
`)])],-1),Ft=s("p",null,[a("This will move item "),s("code",null,"15"),a(" to the position of item "),s("code",null,"42"),a(", and move everything in between one \u201Cslot\u201D up.")],-1),Kt=s("h3",{id:"revert-to-a-previous-revision",tabindex:"-1"},[a("Revert to a Previous Revision "),s("a",{class:"header-anchor",href:"#revert-to-a-previous-revision"},"#")],-1),Lt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),a(" directus."),s("span",{class:"hljs-property"},"utils"),a("."),s("span",{class:"hljs-title function_"},"revert"),a("("),s("span",{class:"hljs-number"},"451"),a(`);
|
|
393
|
+
`)])],-1),Wt=s("p",null,"Note: The key passed is the primary key of the revision you\u2019d like to apply.",-1),Jt=s("hr",null,null,-1),Yt="JavaScript SDK",Qt=!1,$t={name:"sdk",setup(Ht,{expose:c}){const e={title:"JavaScript SDK",modularExtension:!1};return c({frontmatter:e}),(Vt,zt)=>{const l=n("router-link"),i=n("docs-wrapper");return r(),h(i,{frontmatter:e},{default:t(()=>[s("div",p,[d,u,j,_,m,g,f,y,w,b,k,v,x,S,D,T,I,A,R,q,B,M,C,O,P,U,E,N,F,K,L,W,J,H,V,z,s("div",G,[Y,s("p",null,[Q,o(l,{to:"/docs/self-hosted/config-options/#security"},{default:t(()=>[$]),_:1}),X])]),Z,ss,as,ts,es,ls,ns,os,cs,is,rs,hs,ps,ds,us,js,_s,ms,gs,fs,ys,ws,bs,ks,vs,xs,Ss,Ds,Ts,Is,As,Rs,qs,Bs,Ms,Cs,Os,Ps,Us,Es,Ns,Fs,Ks,Ls,Ws,Js,Hs,Vs,zs,Gs,Ys,Qs,$s,Xs,Zs,sa,aa,ta,ea,la,na,oa,ca,ia,ra,ha,pa,da,ua,ja,_a,ma,ga,fa,ya,wa,ba,ka,va,xa,Sa,Da,Ta,Ia,Aa,s("p",null,[Ra,o(l,{to:"/docs/reference/files/#import-a-file"},{default:t(()=>[qa]),_:1}),Ba]),Ma,Ca,Oa,Pa,Ua,Ea,Na,Fa,Ka,La,Wa,Ja,Ha,Va,za,Ga,Ya,Qa,$a,Xa,Za,st,at,tt,et,lt,nt,ot,ct,it,rt,ht,pt,dt,ut,jt,_t,mt,gt,ft,yt,wt,bt,kt,vt,xt,St,Dt,Tt,It,At,Rt,qt,Bt,Mt,Ct,Ot,Pt,Ut,Et,Nt,Ft,Kt,Lt,Wt,Jt])]),_:1})}}};export{$t as default,Qt as modularExtension,Yt as title};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i,o as n,b as c,w as d,g as e,B as a}from"./runtime-core.esm-bundler.
|
|
1
|
+
import{a as i,o as n,b as c,w as d,g as e,B as a}from"./runtime-core.esm-bundler.e3d5f5b7.js";const o=e("div",{class:"markdown-body"},[e("blockquote",null,[e("p",null,"TK")]),e("h2",{id:"https",tabindex:"-1"},[a("HTTPS "),e("a",{class:"header-anchor",href:"#https"},"#")]),e("h2",{id:"password-salting%2Fhashing%2Falgorithm-%26-password-policy",tabindex:"-1"},[a("Password Salting/Hashing/Algorithm & Password Policy "),e("a",{class:"header-anchor",href:"#password-salting%2Fhashing%2Falgorithm-%26-password-policy"},"#")]),e("h2",{id:"static-tokens",tabindex:"-1"},[a("Static Tokens "),e("a",{class:"header-anchor",href:"#static-tokens"},"#")]),e("h2",{id:"encrypted-fields-%26-encrypted-database",tabindex:"-1"},[a("Encrypted Fields & Encrypted Database "),e("a",{class:"header-anchor",href:"#encrypted-fields-%26-encrypted-database"},"#")]),e("h2",{id:"private-file-links",tabindex:"-1"},[a("Private File Links "),e("a",{class:"header-anchor",href:"#private-file-links"},"#")]),e("h2",{id:"mfa-(required)-%26-sso",tabindex:"-1"},[a("MFA (Required) & SSO "),e("a",{class:"header-anchor",href:"#mfa-(required)-%26-sso"},"#")]),e("h2",{id:"granular-access-control-%26-ip-white-listing-%26-app-access",tabindex:"-1"},[a("Granular Access Control & IP WHite-Listing & App Access "),e("a",{class:"header-anchor",href:"#granular-access-control-%26-ip-white-listing-%26-app-access"},"#")]),e("h2",{id:"rate-limiting",tabindex:"-1"},[a("Rate Limiting "),e("a",{class:"header-anchor",href:"#rate-limiting"},"#")]),e("h2",{id:"encrypted",tabindex:"-1"},[a("Encrypted "),e("a",{class:"header-anchor",href:"#encrypted"},"#")]),e("h2",{id:"parameterized-database-queries",tabindex:"-1"},[a("Parameterized Database Queries "),e("a",{class:"header-anchor",href:"#parameterized-database-queries"},"#")])],-1),m="Security",u=!1,b={name:"security",setup(h,{expose:t}){const s={title:"Security",modularExtension:!1};return t({frontmatter:s}),(l,p)=>{const r=i("docs-wrapper");return n(),c(r,{frontmatter:s},{default:d(()=>[o]),_:1})}}};export{b as default,u as modularExtension,m as title};
|