@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
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import{a,o as c,b as h,w as n,g as e,e as r,B as t}from"./runtime-core.esm-bundler.b1f35d24.js";const d={class:"markdown-body"},u=t("This guide explains how to install the "),p=e("em",null,"Development",-1),_=t(" version of Directus locally so that you can work on the platform\u2019s source code. To install the "),m=e("em",null,"Production",-1),g=t(" version locally, please follow to our "),f=t("standard installation guides"),b=t("."),y=e("div",{class:"tip hint"},[e("div",{class:"hint-title"},"Minimum Requirements"),e("p",null,[t("You will need to have "),e("a",{href:"https://nodejs.org/en/download/current/",target:"_blank",rel:"noopener noreferrer"},"the latest version of Node"),t(" to "),e("em",null,"build"),t(" a Development version of Directus.")]),e("p",null,[t("You can use the JavaScript tool manager "),e("a",{href:"https://volta.sh/",target:"_blank",rel:"noopener noreferrer"},"volta"),t(" to automatically install the current node and npm versions.")])],-1),k=e("h2",{id:"1.-fork-the-directus-repository",tabindex:"-1"},[t("1. Fork the Directus repository "),e("a",{class:"header-anchor",href:"#1.-fork-the-directus-repository"},"#")],-1),v=e("p",null,[t("Go to the "),e("a",{href:"https://github.com/directus/directus",target:"_blank",rel:"noopener noreferrer"},"repository"),t(" and fork it to your GitHub account. A fork is your copy of the Directus repository. Forking the repository allows you to freely experiment with changes without affecting the original project.")],-1),w=e("h2",{id:"2.-clone-from-your-repository",tabindex:"-1"},[t("2. Clone from your repository "),e("a",{class:"header-anchor",href:"#2.-clone-from-your-repository"},"#")],-1),x=e("pre",null,[e("code",{class:"language-bash"},[t("git "),e("span",{class:"hljs-built_in"},"clone"),t(` git@github.com:YOUR-USERNAME/directus.git
|
|
2
|
-
`)])],-1),j=e("h2",{id:"3.-make-a-new-branch",tabindex:"-1"},[t("3. Make a new branch "),e("a",{class:"header-anchor",href:"#3.-make-a-new-branch"},"#")],-1),T=e("pre",null,[e("code",{class:"language-bash"},`git checkout -b YOUR-BRANCH-NAME
|
|
3
|
-
`)],-1),A=e("h2",{id:"4.-install-the-dependencies-and-build-the-project",tabindex:"-1"},[t("4. Install the dependencies and build the project "),e("a",{class:"header-anchor",href:"#4.-install-the-dependencies-and-build-the-project"},"#")],-1),D=e("pre",null,[e("code",{class:"language-bash"},`npm install
|
|
4
|
-
npm run build
|
|
5
|
-
`)],-1),C=e("h2",{id:"5.-create-a-.env-file",tabindex:"-1"},[t("5. Create a "),e("code",null,".env"),t(" file "),e("a",{class:"header-anchor",href:"#5.-create-a-.env-file"},"#")],-1),R=e("p",null,[t("Create an "),e("code",null,".env"),t(" file under the "),e("code",null,"api"),t(" folder using vars from the online "),e("a",{href:"https://docs.directus.io/self-hosted/config-options/",target:"_blank",rel:"noopener noreferrer"},"config help")],-1),E=e("h2",{id:"6.-initialize-the-database",tabindex:"-1"},[t("6. Initialize the database "),e("a",{class:"header-anchor",href:"#6.-initialize-the-database"},"#")],-1),F=e("p",null,"For this step, you\u2019ll need to already have a SQL database up-and-running, except if you\u2019re using the SQLite driver, which will create the database (file) for you.",-1),N=e("p",null,"To start the initialization run the following command:",-1),S=e("pre",null,[e("code",{class:"language-bash"},[e("span",{class:"hljs-comment"},"# From within the root of the project"),t(`
|
|
6
|
-
npm run cli bootstrap
|
|
7
|
-
|
|
8
|
-
`),e("span",{class:"hljs-comment"},"# For SQLite you need to run the command in the 'api' context (to ensure the database file is created in the right directory)"),t(`
|
|
9
|
-
npm run cli bootstrap --workspace=api
|
|
10
|
-
`)])],-1),B=e("p",null,"This will set-up the required tables for Directus and make sure all the migrations have run.",-1),I=e("h2",{id:"7.-start-the-development-server",tabindex:"-1"},[t("7. Start the development server "),e("a",{class:"header-anchor",href:"#7.-start-the-development-server"},"#")],-1),L=e("p",null,[t("First you need to choose what packages you want to work on. Then, you should run the "),e("code",null,"dev"),t(" script on that package. You can see their names and list of scripts in their related "),e("code",null,"package.json"),t(". Example of running APP:")],-1),M=e("pre",null,[e("code",{class:"language-bash"},`npm run dev -w @directus/app
|
|
11
|
-
`)],-1),Y=e("p",null,"If you want to work on multiple packages at once, you should create a new instance of your terminal for each package: Example of running Api, App:",-1),q=e("table",null,[e("tr",null,[e("th",null," Terminal 1 [Api] "),e("th",null," Terminal 2 [App] ")]),e("tr",null,[e("td",null,[e("pre",null,[e("code",{class:"language-bash"},`npm run dev -w directus
|
|
12
|
-
`)])]),e("td",null,[e("pre",null,[e("code",{class:"language-bash"},`npm run dev -w @directus/app
|
|
13
|
-
`)])])])],-1),z=e("hr",null,null,-1),H=e("p",null,[t("To work on the Documentation (public website version), you should navigate to the "),e("code",null,"docs"),t(" directory and run the following command:")],-1),G=e("pre",null,[e("code",{class:"language-bash"},`npm install
|
|
14
|
-
`)],-1),P=e("sup",null,"\u2139 This is necessary because the way vue-server-renderer imports vue",-1),Q=e("p",null,"Then you should run",-1),U=e("pre",null,[e("code",{class:"language-bash"},`npm run dev:site
|
|
15
|
-
`)],-1),V=e("div",{class:"tip hint"},[e("p",null,"If you encounter errors during this installation process, make sure your node version meets the minimum requirements")],-1),O=e("h2",{id:"8.-make-your-fixes%2Fchanges",tabindex:"-1"},[t("8. Make your fixes/changes "),e("a",{class:"header-anchor",href:"#8.-make-your-fixes%2Fchanges"},"#")],-1),J=t("At this point you are ready to start working on Directus! Before diving in however, it\u2019s worth reading through the introduction to "),W=t("Contributing"),K=t("."),X=e("div",{class:"tip hint"},[e("div",{class:"hint-title"},"Debugging"),e("p",null,[t("Check our Wiki for a "),e("a",{href:"https://github.com/directus/directus/wiki/debugging",target:"_blank",rel:"noopener noreferrer"},"guide"),t(" on debugging the app and api.")])],-1),Z=e("h2",{id:"9.-running-tests",tabindex:"-1"},[t("9. Running tests "),e("a",{class:"header-anchor",href:"#9.-running-tests"},"#")],-1),$=e("p",null,"Tests run automatically through GitHub Actions. However you may wish to run the tests locally especially when you write tests.",-1),ee=e("p",null,[t("Install "),e("a",{href:"https://docs.docker.com/get-docker/",target:"_blank",rel:"noopener noreferrer"},"Docker"),t(" and ensure that the service is running.")],-1),te=e("pre",null,[e("code",{class:"language-bash"},[e("span",{class:"hljs-comment"},"# Ensure that you are testing on the lastest codebase"),t(`
|
|
16
|
-
npm run build
|
|
17
|
-
|
|
18
|
-
`),e("span",{class:"hljs-comment"},"# Clean up in case you ran the tests before"),t(`
|
|
19
|
-
docker compose -f tests/docker-compose.yml down -v
|
|
20
|
-
|
|
21
|
-
`),e("span",{class:"hljs-comment"},"# Start the necessary containers"),t(`
|
|
22
|
-
docker compose -f tests/docker-compose.yml up -d --`),e("span",{class:"hljs-built_in"},"wait"),t(`
|
|
23
|
-
|
|
24
|
-
`),e("span",{class:"hljs-comment"},"# Run the tests"),t(`
|
|
25
|
-
npm run `),e("span",{class:"hljs-built_in"},"test"),t(`:e2e
|
|
26
|
-
`)])],-1),re="Running Locally",ie=!1,le={name:"running-locally",setup(ne,{expose:i}){const o={title:"Running Locally",modularExtension:!1};return i({frontmatter:o}),(oe,se)=>{const s=a("router-link"),l=a("docs-wrapper");return c(),h(l,{frontmatter:o},{default:n(()=>[e("div",d,[e("blockquote",null,[e("p",null,[u,p,_,m,g,r(s,{to:"/docs/self-hosted/installation/"},{default:n(()=>[f]),_:1}),b])]),y,k,v,w,x,j,T,A,D,C,R,E,F,N,S,B,I,L,M,Y,q,z,H,G,P,Q,U,V,O,e("p",null,[J,r(s,{to:"/docs/contributing/introduction"},{default:n(()=>[W]),_:1}),K]),X,Z,$,ee,te])]),_:1})}}};export{le as default,ie as modularExtension,re as title};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as U}from"./index.02dcddad.entry.js";function D(u,x){return x.forEach(function(t){t&&typeof t!="string"&&!Array.isArray(t)&&Object.keys(t).forEach(function(a){if(a!=="default"&&!(a in u)){var l=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(u,a,l.get?l:{enumerable:!0,get:function(){return t[a]}})}})}),Object.freeze(Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}))}var M={exports:{}};(function(u,x){(function(t){t(U.exports)})(function(t){t.defineMode("scheme",function(){var a="builtin",l="comment",v="string",f="atom",b="number",y="bracket",N=2;function w(e){for(var i={},n=e.split(" "),c=0;c<n.length;++c)i[n[c]]=!0;return i}var k=w("\u03BB case-lambda call/cc class cond-expand define-class define-values exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax define-macro defmacro delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"),C=w("define let letrec let* lambda define-macro defmacro let-syntax letrec-syntax let-values let*-values define-syntax syntax-rules define-values when unless");function O(e,i,n){this.indent=e,this.type=i,this.prev=n}function s(e,i,n){e.indentStack=new O(i,n,e.indentStack)}function Q(e){e.indentStack=e.indentStack.prev}var _=new RegExp(/^(?:[-+]i|[-+][01]+#*(?:\/[01]+#*)?i|[-+]?[01]+#*(?:\/[01]+#*)?@[-+]?[01]+#*(?:\/[01]+#*)?|[-+]?[01]+#*(?:\/[01]+#*)?[-+](?:[01]+#*(?:\/[01]+#*)?)?i|[-+]?[01]+#*(?:\/[01]+#*)?)(?=[()\s;"]|$)/i),I=new RegExp(/^(?:[-+]i|[-+][0-7]+#*(?:\/[0-7]+#*)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?@[-+]?[0-7]+#*(?:\/[0-7]+#*)?|[-+]?[0-7]+#*(?:\/[0-7]+#*)?[-+](?:[0-7]+#*(?:\/[0-7]+#*)?)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?)(?=[()\s;"]|$)/i),$=new RegExp(/^(?:[-+]i|[-+][\da-f]+#*(?:\/[\da-f]+#*)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?@[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?[-+](?:[\da-f]+#*(?:\/[\da-f]+#*)?)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?)(?=[()\s;"]|$)/i),j=new RegExp(/^(?:[-+]i|[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)i|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)@[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)?i|(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*))(?=[()\s;"]|$)/i);function R(e){return e.match(_)}function A(e){return e.match(I)}function p(e,i){return i===!0&&e.backUp(1),e.match(j)}function B(e){return e.match($)}return{startState:function(){return{indentStack:null,indentation:0,mode:!1,sExprComment:!1,sExprQuote:!1}},token:function(e,i){if(i.indentStack==null&&e.sol()&&(i.indentation=e.indentation()),e.eatSpace())return null;var n=null;switch(i.mode){case"string":for(var o,c=!1;(o=e.next())!=null;){if(o=='"'&&!c){i.mode=!1;break}c=!c&&o=="\\"}n=v;break;case"comment":for(var o,E=!1;(o=e.next())!=null;){if(o=="#"&&E){i.mode=!1;break}E=o=="|"}n=l;break;case"s-expr-comment":if(i.mode=!1,e.peek()=="("||e.peek()=="[")i.sExprComment=0;else{e.eatWhile(/[^\s\(\)\[\]]/),n=l;break}default:var r=e.next();if(r=='"')i.mode="string",n=v;else if(r=="'")e.peek()=="("||e.peek()=="["?(typeof i.sExprQuote!="number"&&(i.sExprQuote=0),n=f):(e.eatWhile(/[\w_\-!$%&*+\.\/:<=>?@\^~]/),n=f);else if(r=="#")if(e.eat("|"))i.mode="comment",n=l;else if(e.eat(/[tf]/i))n=f;else if(e.eat(";"))i.mode="s-expr-comment",n=l;else{var d=null,m=!1,S=!0;e.eat(/[ei]/i)?m=!0:e.backUp(1),e.match(/^#b/i)?d=R:e.match(/^#o/i)?d=A:e.match(/^#x/i)?d=B:e.match(/^#d/i)?d=p:e.match(/^[-+0-9.]/,!1)?(S=!1,d=p):m||e.eat("#"),d!=null&&(S&&!m&&e.match(/^#[ei]/i),d(e)&&(n=b))}else if(/^[-+0-9.]/.test(r)&&p(e,!0))n=b;else if(r==";")e.skipToEnd(),n=l;else if(r=="("||r=="["){for(var h="",g=e.column(),q;(q=e.eat(/[^\s\(\[\;\)\]]/))!=null;)h+=q;h.length>0&&C.propertyIsEnumerable(h)?s(i,g+N,r):(e.eatSpace(),e.eol()||e.peek()==";"?s(i,g+1,r):s(i,g+e.current().length,r)),e.backUp(e.current().length-1),typeof i.sExprComment=="number"&&i.sExprComment++,typeof i.sExprQuote=="number"&&i.sExprQuote++,n=y}else r==")"||r=="]"?(n=y,i.indentStack!=null&&i.indentStack.type==(r==")"?"(":"[")&&(Q(i),typeof i.sExprComment=="number"&&--i.sExprComment==0&&(n=l,i.sExprComment=!1),typeof i.sExprQuote=="number"&&--i.sExprQuote==0&&(n=f,i.sExprQuote=!1))):(e.eatWhile(/[\w_\-!$%&*+\.\/:<=>?@\^~]/),k&&k.propertyIsEnumerable(e.current())?n=a:n="variable")}return typeof i.sExprComment=="number"?l:typeof i.sExprQuote=="number"?f:n},indent:function(e){return e.indentStack==null?e.indentation:e.indentStack.indent},closeBrackets:{pairs:'()[]{}""'},lineComment:";;"}}),t.defineMIME("text/x-scheme","scheme")})})();var K=M.exports,z=D({__proto__:null,default:K},[M.exports]);export{z as s};
|
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
import{a as l,o as r,b as h,w as t,g as s,e as o,B as e}from"./runtime-core.esm-bundler.b1f35d24.js";const d={class:"markdown-body"},p=s("blockquote",null,[s("p",null,[e("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"),e(" for transport and "),s("code",null,"localStorage"),e(" 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"},[e("Installation "),s("a",{class:"header-anchor",href:"#installation"},"#")],-1),m=s("pre",null,[s("code",{class:"language-bash"},`npm install @directus/sdk
|
|
2
|
-
`)],-1),_=s("h2",{id:"usage",tabindex:"-1"},[e("Usage "),s("a",{class:"header-anchor",href:"#usage"},"#")],-1),g=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"import"),e(" { Directus } "),s("span",{class:"hljs-keyword"},"from"),e(),s("span",{class:"hljs-string"},"'@directus/sdk'"),e(`;
|
|
3
|
-
|
|
4
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" directus = "),s("span",{class:"hljs-keyword"},"new"),e(" Directus("),s("span",{class:"hljs-string"},"'http://directus.example.com'"),e(`);
|
|
5
|
-
|
|
6
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-keyword"},"function"),e(),s("span",{class:"hljs-title"},"start"),e("("),s("span",{class:"hljs-params"}),e(") ")]),e(`{
|
|
7
|
-
`),s("span",{class:"hljs-comment"},"// We don't need to authenticate if data is public"),e(`
|
|
8
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" publicData = "),s("span",{class:"hljs-keyword"},"await"),e(" directus.items("),s("span",{class:"hljs-string"},"'public'"),e(").readByQuery({ "),s("span",{class:"hljs-attr"},"meta"),e(": "),s("span",{class:"hljs-string"},"'total_count'"),e(` });
|
|
9
|
-
|
|
10
|
-
`),s("span",{class:"hljs-built_in"},"console"),e(`.log({
|
|
11
|
-
`),s("span",{class:"hljs-attr"},"items"),e(`: publicData.data,
|
|
12
|
-
`),s("span",{class:"hljs-attr"},"total"),e(`: publicData.meta.total_count,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
`),s("span",{class:"hljs-comment"},"// But, we need to authenticate if data is private"),e(`
|
|
16
|
-
`),s("span",{class:"hljs-keyword"},"let"),e(" authenticated = "),s("span",{class:"hljs-literal"},"false"),e(`;
|
|
17
|
-
|
|
18
|
-
`),s("span",{class:"hljs-comment"},"// Try to authenticate with token if exists"),e(`
|
|
19
|
-
`),s("span",{class:"hljs-keyword"},"await"),e(` directus.auth
|
|
20
|
-
.refresh()
|
|
21
|
-
.then(`),s("span",{class:"hljs-function"},"() =>"),e(` {
|
|
22
|
-
authenticated = `),s("span",{class:"hljs-literal"},"true"),e(`;
|
|
23
|
-
})
|
|
24
|
-
.catch(`),s("span",{class:"hljs-function"},"() =>"),e(` {});
|
|
25
|
-
|
|
26
|
-
`),s("span",{class:"hljs-comment"},"// Let's login in case we don't have token or it is invalid / expired"),e(`
|
|
27
|
-
`),s("span",{class:"hljs-keyword"},"while"),e(` (!authenticated) {
|
|
28
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" email = "),s("span",{class:"hljs-built_in"},"window"),e(".prompt("),s("span",{class:"hljs-string"},"'Email:'"),e(`);
|
|
29
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" password = "),s("span",{class:"hljs-built_in"},"window"),e(".prompt("),s("span",{class:"hljs-string"},"'Password:'"),e(`);
|
|
30
|
-
|
|
31
|
-
`),s("span",{class:"hljs-keyword"},"await"),e(` directus.auth
|
|
32
|
-
.login({ email, password })
|
|
33
|
-
.then(`),s("span",{class:"hljs-function"},"() =>"),e(` {
|
|
34
|
-
authenticated = `),s("span",{class:"hljs-literal"},"true"),e(`;
|
|
35
|
-
})
|
|
36
|
-
.catch(`),s("span",{class:"hljs-function"},"() =>"),e(` {
|
|
37
|
-
`),s("span",{class:"hljs-built_in"},"window"),e(".alert("),s("span",{class:"hljs-string"},"'Invalid credentials'"),e(`);
|
|
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"),e(`
|
|
42
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" privateData = "),s("span",{class:"hljs-keyword"},"await"),e(" directus.items("),s("span",{class:"hljs-string"},"'privateData'"),e(").readByQuery({ "),s("span",{class:"hljs-attr"},"meta"),e(": "),s("span",{class:"hljs-string"},"'total_count'"),e(` });
|
|
43
|
-
|
|
44
|
-
`),s("span",{class:"hljs-built_in"},"console"),e(`.log({
|
|
45
|
-
`),s("span",{class:"hljs-attr"},"items"),e(`: privateData.data,
|
|
46
|
-
`),s("span",{class:"hljs-attr"},"total"),e(`: privateData.meta.total_count,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
start();
|
|
51
|
-
`)])],-1),f=s("h2",{id:"typescript",tabindex:"-1"},[e("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"),e(` BlogPost = {
|
|
52
|
-
`),s("span",{class:"hljs-attr"},"id"),e(`: ID;
|
|
53
|
-
title: `),s("span",{class:"hljs-built_in"},"string"),e(`;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
`),s("span",{class:"hljs-keyword"},"type"),e(` BlogSettings = {
|
|
57
|
-
`),s("span",{class:"hljs-attr"},"display_promotions"),e(": "),s("span",{class:"hljs-built_in"},"boolean"),e(`;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
`),s("span",{class:"hljs-keyword"},"type"),e(` MyCollections = {
|
|
61
|
-
`),s("span",{class:"hljs-attr"},"posts"),e(`: BlogPost;
|
|
62
|
-
settings: BlogSettings;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
`),s("span",{class:"hljs-comment"},"// This is how you feed custom type information to Directus."),e(`
|
|
66
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" directus = "),s("span",{class:"hljs-keyword"},"new"),e(" Directus<MyCollections>("),s("span",{class:"hljs-string"},"'http://url'"),e(`);
|
|
67
|
-
|
|
68
|
-
`),s("span",{class:"hljs-comment"},"// ..."),e(`
|
|
69
|
-
|
|
70
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" post = "),s("span",{class:"hljs-keyword"},"await"),e(" directus.items("),s("span",{class:"hljs-string"},"'posts'"),e(").readOne("),s("span",{class:"hljs-number"},"1"),e(`);
|
|
71
|
-
`),s("span",{class:"hljs-comment"},"// typeof(post) is a partial BlogPost object"),e(`
|
|
72
|
-
|
|
73
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" settings = "),s("span",{class:"hljs-keyword"},"await"),e(" posts.singleton("),s("span",{class:"hljs-string"},"'settings'"),e(`).read();
|
|
74
|
-
`),s("span",{class:"hljs-comment"},"// typeof(settings) is a partial BlogSettings object"),e(`
|
|
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"),e(" { Directus } "),s("span",{class:"hljs-keyword"},"from"),e(),s("span",{class:"hljs-string"},"'@directus/sdk'"),e(`;
|
|
76
|
-
|
|
77
|
-
`),s("span",{class:"hljs-comment"},"// Custom fields added to Directus user collection."),e(`
|
|
78
|
-
`),s("span",{class:"hljs-keyword"},"type"),e(` UserType = {
|
|
79
|
-
`),s("span",{class:"hljs-attr"},"level"),e(": "),s("span",{class:"hljs-built_in"},"number"),e(`;
|
|
80
|
-
experience: `),s("span",{class:"hljs-built_in"},"number"),e(`;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
`),s("span",{class:"hljs-keyword"},"type"),e(` CustomTypes = {
|
|
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
|
-
*/`),e(`
|
|
90
|
-
`),s("span",{class:"hljs-attr"},"directus_users"),e(`: UserType;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" directus = "),s("span",{class:"hljs-keyword"},"new"),e(" Directus<CustomTypes>("),s("span",{class:"hljs-string"},"'https://api.example.com'"),e(`);
|
|
94
|
-
|
|
95
|
-
`),s("span",{class:"hljs-keyword"},"await"),e(` directus.auth.login({
|
|
96
|
-
`),s("span",{class:"hljs-attr"},"email"),e(": "),s("span",{class:"hljs-string"},"'admin@example.com'"),e(`,
|
|
97
|
-
`),s("span",{class:"hljs-attr"},"password"),e(": "),s("span",{class:"hljs-string"},"'password'"),e(`,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" me = "),s("span",{class:"hljs-keyword"},"await"),e(` directus.users.me.read();
|
|
101
|
-
`),s("span",{class:"hljs-comment"},"// typeof me = partial DirectusUser & UserType;"),e(`
|
|
102
|
-
|
|
103
|
-
`),s("span",{class:"hljs-comment"},"// OK"),e(`
|
|
104
|
-
me.level = `),s("span",{class:"hljs-number"},"42"),e(`;
|
|
105
|
-
|
|
106
|
-
`),s("span",{class:"hljs-comment"},'// Error TS2322: Type "string" is not assignable to type "number".'),e(`
|
|
107
|
-
me.experience = `),s("span",{class:"hljs-string"},"'high'"),e(`;
|
|
108
|
-
`)])],-1),S=s("h2",{id:"reference",tabindex:"-1"},[e("Reference "),s("a",{class:"header-anchor",href:"#reference"},"#")],-1),D=s("h3",{id:"constructor",tabindex:"-1"},[e("Constructor "),s("a",{class:"header-anchor",href:"#constructor"},"#")],-1),T=s("p",null,[e("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")]),e(".")],-1),I=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"import"),e(" { Directus } "),s("span",{class:"hljs-keyword"},"from"),e(),s("span",{class:"hljs-string"},"'@directus/sdk'"),e(`;
|
|
109
|
-
|
|
110
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" directus = "),s("span",{class:"hljs-keyword"},"new"),e(` Directus(url, init);
|
|
111
|
-
`)])],-1),A=s("ul",null,[s("li",null,[s("p",null,[s("code",null,"url"),e(" [required] "),s("em",null,"String"),e(" - 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"),e(" [optional] "),s("em",null,"Object"),e(" - 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"),e(" [optional] "),s("em",null,"Object"),e(" - Defines settings you want to customize regarding "),s("a",{href:"#auth"},"authentication"),e(". The possible options are:")]),s("ul",null,[s("li",null,[s("p",null,[s("code",null,"mode"),e(" [optional] "),s("em",null,"String"),e(" - Defines the mode you want to use for authentication. It can be "),s("code",null,"'cookie'"),e(" for cookies or "),s("code",null,"'json'"),e(" for JWT. Defaults to "),s("code",null,"'cookie'"),e(" on browsers and "),s("code",null,"'json'"),e(" 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"),e(" [optional] "),s("em",null,"Boolean"),e(" - Tells SDK if it should handle refresh tokens automatically. Defaults to "),s("code",null,"true"),e(".")])]),s("li",null,[s("p",null,[s("code",null,"msRefreshBeforeExpires"),e(" [optional] "),s("em",null,"Number"),e(" - When "),s("code",null,"autoRefresh"),e(" is enabled, this tells how many milliseconds before the refresh token expires and needs to be refreshed. Defaults to "),s("code",null,"30000"),e(".")])]),s("li",null,[s("p",null,[s("code",null,"staticToken"),e(" [optional] "),s("em",null,"String"),e(" - Defines the static token to use. It is not compatible with the options above since it does not refresh. Defaults to "),s("code",null,"''"),e(" (no static token).")])])])])]),s("a",{name:"options.storage"}),s("ul",null,[s("li",null,[s("p",null,[s("code",null,"storage"),e(" [optional] "),s("em",null,"Object"),e(" - Defines settings you want to customize regarding "),s("a",{href:"#storage"},"storage"),e(".")]),s("a",{name:"options.storage.prefix"}),s("ul",null,[s("li",null,[s("code",null,"prefix"),e(" [optional] "),s("em",null,"String"),e(" - 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,"''"),e(" (no prefix).")]),s("li",null,[s("code",null,"mode"),e(" [optional] "),s("em",null,"String"),e(" - Defines the storage location to be used to save tokens. Allowed values are "),s("code",null,"LocalStorage"),e(" and "),s("code",null,"MemoryStorage"),e(". Defaults to "),s("code",null,"LocalStorage"),e(" on browsers and "),s("code",null,"MemoryStorage"),e(" on Node.js. The mode "),s("code",null,"LocalStorage"),e(" is not compatible with Node.js.")])])])]),s("a",{name:"options.transport"}),s("ul",null,[s("li",null,[s("code",null,"transport"),e(" [optional] "),s("em",null,"Object"),e(" - Defines settings you want to customize regarding "),s("a",{href:"#transport"},"transport"),e(". "),s("ul",null,[s("li",null,[s("code",null,"params"),e(" [optional] "),s("em",null,"Object"),e(" - Defines an object with keys and values to be passed as additional query string.")]),s("li",null,[s("code",null,"headers"),e(" [optional] "),s("em",null,"Object"),e(" - Defines an object with keys and values to be passed as additional headers.")]),s("li",null,[s("code",null,"onUploadProgress"),e(" [optional] "),s("em",null,[e("(event: "),s("a",{href:"https://developer.mozilla.org/en-US/docs/Web/API/ProgressEvent",target:"_blank",rel:"noopener noreferrer"},"ProgressEvent"),e(" => void)")]),e(" - Defines a callback function to indicate the upload progress.")])])])])])],-1),R=s("h2",{id:"auth",tabindex:"-1"},[e("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"},[e("Custom Implementation "),s("a",{class:"header-anchor",href:"#custom-implementation"},"#")],-1),M=s("p",null,[e("It is possible to provide a custom implementation by extending "),s("code",null,"IAuth"),e(". 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"),e(" { IAuth, Directus } "),s("span",{class:"hljs-keyword"},"from"),e(),s("span",{class:"hljs-string"},"'@directus/sdk'"),e(`;
|
|
112
|
-
|
|
113
|
-
`),s("span",{class:"hljs-class"},[s("span",{class:"hljs-keyword"},"class"),e(),s("span",{class:"hljs-title"},"MyAuth"),e(),s("span",{class:"hljs-keyword"},"extends"),e(),s("span",{class:"hljs-title"},"IAuth"),e()]),e(`{
|
|
114
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"login"),e("("),s("span",{class:"hljs-params"}),e(")")]),e(` {
|
|
115
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(" { "),s("span",{class:"hljs-attr"},"access_token"),e(": "),s("span",{class:"hljs-string"},"''"),e(", "),s("span",{class:"hljs-attr"},"expires"),e(": "),s("span",{class:"hljs-number"},"0"),e(` };
|
|
116
|
-
}
|
|
117
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"logout"),e("("),s("span",{class:"hljs-params"}),e(")")]),e(` {}
|
|
118
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"refresh"),e("("),s("span",{class:"hljs-params"}),e(")")]),e(` {
|
|
119
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(" { "),s("span",{class:"hljs-attr"},"access_token"),e(": "),s("span",{class:"hljs-string"},"''"),e(", "),s("span",{class:"hljs-attr"},"expires"),e(": "),s("span",{class:"hljs-number"},"0"),e(` };
|
|
120
|
-
}
|
|
121
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"static"),e("("),s("span",{class:"hljs-params"}),e(")")]),e(` {
|
|
122
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(),s("span",{class:"hljs-literal"},"true"),e(`;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" directus = "),s("span",{class:"hljs-keyword"},"new"),e(" Directus("),s("span",{class:"hljs-string"},"'http://directus.example.com'"),e(", { "),s("span",{class:"hljs-attr"},"auth"),e(": "),s("span",{class:"hljs-keyword"},"new"),e(` MyAuth() });
|
|
127
|
-
`)])],-1),O=s("h3",{id:"directus-implementation",tabindex:"-1"},[e("Directus Implementation "),s("a",{class:"header-anchor",href:"#directus-implementation"},"#")],-1),P=s("p",null,[e("By default, Directus creates an instance of "),s("code",null,"Auth"),e(" which handles refresh tokens automatically. Check "),s("a",{href:"#options.auth"},[s("code",null,"options.auth")]),e(" to see the available settings.")],-1),U=s("h3",{id:"get-current-token",tabindex:"-1"},[e("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"),e(` token = directus.auth.token;
|
|
128
|
-
`)])],-1),N=s("h3",{id:"login",tabindex:"-1"},[e("Login "),s("a",{class:"header-anchor",href:"#login"},"#")],-1),F=s("h4",{id:"with-credentials",tabindex:"-1"},[e("With credentials "),s("a",{class:"header-anchor",href:"#with-credentials"},"#")],-1),K=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` directus.auth.login({
|
|
129
|
-
`),s("span",{class:"hljs-attr"},"email"),e(": "),s("span",{class:"hljs-string"},"'admin@example.com'"),e(`,
|
|
130
|
-
`),s("span",{class:"hljs-attr"},"password"),e(": "),s("span",{class:"hljs-string"},"'d1r3ctu5'"),e(`,
|
|
131
|
-
});
|
|
132
|
-
`)])],-1),L=s("h4",{id:"with-static-tokens",tabindex:"-1"},[e("With static tokens "),s("a",{class:"header-anchor",href:"#with-static-tokens"},"#")],-1),W=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.auth.static("),s("span",{class:"hljs-string"},"'static_token'"),e(`);
|
|
133
|
-
`)])],-1),J=s("h3",{id:"refresh-auth-token",tabindex:"-1"},[e("Refresh Auth Token "),s("a",{class:"header-anchor",href:"#refresh-auth-token"},"#")],-1),H=s("p",null,[e("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")]),e(" to "),s("code",null,"false"),e(".")],-1),V=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` directus.auth.refresh();
|
|
134
|
-
`)])],-1),z={class:"tip hint"},G=s("div",{class:"hint-title"},"Developing Locally",-1),Y=e("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 "),Q=e("disable secure cookies"),$=e("."),X=s("h3",{id:"logout",tabindex:"-1"},[e("Logout "),s("a",{class:"header-anchor",href:"#logout"},"#")],-1),Z=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` directus.auth.logout();
|
|
135
|
-
`)])],-1),ss=s("h3",{id:"request-a-password-reset",tabindex:"-1"},[e("Request a Password Reset "),s("a",{class:"header-anchor",href:"#request-a-password-reset"},"#")],-1),es=s("p",null,[e("By default, the address defined in "),s("code",null,"PUBLIC_URL"),e(" on "),s("code",null,".env"),e(" file is used for the link to the reset password page sent in the email:")],-1),ts=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.auth.password.request("),s("span",{class:"hljs-string"},"'admin@example.com'"),e(`);
|
|
136
|
-
`)])],-1),as=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"),e(` directus.auth.password.request(
|
|
137
|
-
`),s("span",{class:"hljs-string"},"'admin@example.com'"),e(`,
|
|
138
|
-
`),s("span",{class:"hljs-string"},"'https://myapp.com'"),e(),s("span",{class:"hljs-comment"},"// In this case, the link will be https://myapp.com?token=FEE0A..."),e(`
|
|
139
|
-
);
|
|
140
|
-
`)])],-1),ls=s("h3",{id:"reset-a-password",tabindex:"-1"},[e("Reset a Password "),s("a",{class:"header-anchor",href:"#reset-a-password"},"#")],-1),os=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.auth.password.reset("),s("span",{class:"hljs-string"},"'abc.def.ghi'"),e(", "),s("span",{class:"hljs-string"},"'n3w-p455w0rd'"),e(`);
|
|
141
|
-
`)])],-1),is=s("p",null,[e("Note: The token passed in the first parameter is sent in an email to the user when using "),s("code",null,"request()")],-1),cs=s("h2",{id:"transport",tabindex:"-1"},[e("Transport "),s("a",{class:"header-anchor",href:"#transport"},"#")],-1),rs=s("p",null,"The transport object abstracts how you communicate with Directus. Transports can be customized to use different HTTP libraries for example.",-1),hs=s("h3",{id:"custom-implementation-1",tabindex:"-1"},[e("Custom Implementation "),s("a",{class:"header-anchor",href:"#custom-implementation-1"},"#")],-1),ds=s("p",null,[e("It is possible to provide a custom implementation by extending "),s("code",null,"ITransport"),e(". While, this could be useful for advanced usage, it is not needed for most use-cases.")],-1),ps=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"import"),e(" { ITransport, Directus } "),s("span",{class:"hljs-keyword"},"from"),e(),s("span",{class:"hljs-string"},"'@directus/sdk'"),e(`;
|
|
142
|
-
|
|
143
|
-
`),s("span",{class:"hljs-class"},[s("span",{class:"hljs-keyword"},"class"),e(),s("span",{class:"hljs-title"},"MyTransport"),e(),s("span",{class:"hljs-keyword"},"extends"),e(),s("span",{class:"hljs-title"},"ITransport"),e()]),e(`{
|
|
144
|
-
`),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"buildResponse"),e("("),s("span",{class:"hljs-params"}),e(")")]),e(` {
|
|
145
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(` {
|
|
146
|
-
`),s("span",{class:"hljs-attr"},"raw"),e(": "),s("span",{class:"hljs-string"},"''"),e(`,
|
|
147
|
-
`),s("span",{class:"hljs-attr"},"data"),e(`: {},
|
|
148
|
-
`),s("span",{class:"hljs-attr"},"status"),e(": "),s("span",{class:"hljs-number"},"0"),e(`,
|
|
149
|
-
`),s("span",{class:"hljs-attr"},"headers"),e(`: {},
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"get"),e("("),s("span",{class:"hljs-params"},"path, options"),e(")")]),e(` {
|
|
154
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(),s("span",{class:"hljs-built_in"},"this"),e(`.buildResponse();
|
|
155
|
-
}
|
|
156
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"head"),e("("),s("span",{class:"hljs-params"},"path, options"),e(")")]),e(` {
|
|
157
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(),s("span",{class:"hljs-built_in"},"this"),e(`.buildResponse();
|
|
158
|
-
}
|
|
159
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"options"),e("("),s("span",{class:"hljs-params"},"path, options"),e(")")]),e(` {
|
|
160
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(),s("span",{class:"hljs-built_in"},"this"),e(`.buildResponse();
|
|
161
|
-
}
|
|
162
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"delete"),e("("),s("span",{class:"hljs-params"},"path, data, options"),e(")")]),e(` {
|
|
163
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(),s("span",{class:"hljs-built_in"},"this"),e(`.buildResponse();
|
|
164
|
-
}
|
|
165
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"post"),e("("),s("span",{class:"hljs-params"},"path, data, options"),e(")")]),e(` {
|
|
166
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(),s("span",{class:"hljs-built_in"},"this"),e(`.buildResponse();
|
|
167
|
-
}
|
|
168
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"put"),e("("),s("span",{class:"hljs-params"},"path, data, options"),e(")")]),e(` {
|
|
169
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(),s("span",{class:"hljs-built_in"},"this"),e(`.buildResponse();
|
|
170
|
-
}
|
|
171
|
-
`),s("span",{class:"hljs-keyword"},"async"),e(),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"patch"),e("("),s("span",{class:"hljs-params"},"path, data, options"),e(")")]),e(` {
|
|
172
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(),s("span",{class:"hljs-built_in"},"this"),e(`.buildResponse();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" directus = "),s("span",{class:"hljs-keyword"},"new"),e(" Directus("),s("span",{class:"hljs-string"},"'http://directus.example.com'"),e(", { "),s("span",{class:"hljs-attr"},"transport"),e(": "),s("span",{class:"hljs-keyword"},"new"),e(` MyTransport() });
|
|
177
|
-
`)])],-1),us=s("h3",{id:"directus-implementation-1",tabindex:"-1"},[e("Directus Implementation "),s("a",{class:"header-anchor",href:"#directus-implementation-1"},"#")],-1),js=s("p",null,[e("By default, Directus creates an instance of "),s("code",null,"Transport"),e(" which handles requests automatically. Check "),s("a",{href:"#options.transport"},[s("code",null,"options.transport")]),e(" to see the available settings.")],-1),ms=s("p",null,[e("To make HTTP requests SDK uses "),s("code",null,"axios"),e(" 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"),e(").")],-1),_s=s("h2",{id:"storage",tabindex:"-1"},[e("Storage "),s("a",{class:"header-anchor",href:"#storage"},"#")],-1),gs=s("p",null,"The storage is used to load and save token information.",-1),fs=s("h3",{id:"custom-implementation-2",tabindex:"-1"},[e("Custom Implementation "),s("a",{class:"header-anchor",href:"#custom-implementation-2"},"#")],-1),ys=s("p",null,[e("It is possible to provide a custom implementation by extending "),s("code",null,"BaseStorage"),e(". While, this could be useful for advanced usage, it is not needed for most use-cases.")],-1),ws=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"import"),e(" { BaseStorage, Directus } "),s("span",{class:"hljs-keyword"},"from"),e(),s("span",{class:"hljs-string"},"'@directus/sdk'"),e(`;
|
|
178
|
-
|
|
179
|
-
`),s("span",{class:"hljs-class"},[s("span",{class:"hljs-keyword"},"class"),e(),s("span",{class:"hljs-title"},"SessionStorage"),e(),s("span",{class:"hljs-keyword"},"extends"),e(),s("span",{class:"hljs-title"},"BaseStorage"),e()]),e(`{
|
|
180
|
-
`),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"get"),e("("),s("span",{class:"hljs-params"},"key"),e(")")]),e(` {
|
|
181
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(` sessionStorage.getItem(key);
|
|
182
|
-
}
|
|
183
|
-
`),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"set"),e("("),s("span",{class:"hljs-params"},"key, value"),e(")")]),e(` {
|
|
184
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(` sessionStorage.setItem(key, value);
|
|
185
|
-
}
|
|
186
|
-
`),s("span",{class:"hljs-function"},[s("span",{class:"hljs-title"},"delete"),e("("),s("span",{class:"hljs-params"},"key"),e(")")]),e(` {
|
|
187
|
-
`),s("span",{class:"hljs-keyword"},"return"),e(` sessionStorage.removeItem(key);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" directus = "),s("span",{class:"hljs-keyword"},"new"),e(" Directus("),s("span",{class:"hljs-string"},"'http://directus.example.com'"),e(", { "),s("span",{class:"hljs-attr"},"storage"),e(": "),s("span",{class:"hljs-keyword"},"new"),e(` SessionStorage() });
|
|
192
|
-
`)])],-1),bs=s("h3",{id:"directus-implementation-2",tabindex:"-1"},[e("Directus Implementation "),s("a",{class:"header-anchor",href:"#directus-implementation-2"},"#")],-1),ks=s("p",null,[e("By default, Directus creates an instance of "),s("code",null,"Storage"),e(" which handles store information automatically. Check "),s("a",{href:"#options.storage"},[s("code",null,"options.storage")]),e(" to see the available settings.")],-1),vs=s("p",null,[e("SDK uses "),s("code",null,"localStorage"),e(" 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")]),e(". The "),s("code",null,"LocalStorage"),e(" is only available on browsers and the "),s("code",null,"MemoryStorage"),e(" is not persistent, i.e., once you leave the tab or quit the process, you will need to authenticate again.")],-1),xs=s("p",null,[e("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")]),e(" for each one.")],-1),Ss=s("h2",{id:"items",tabindex:"-1"},[e("Items "),s("a",{class:"header-anchor",href:"#items"},"#")],-1),Ds=s("p",null,[e("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"),e(" function. The following examples will use the "),s("code",null,"Article"),e(" type.")],-1),Ts=s("blockquote",null,[s("p",null,"JavaScript")],-1),Is=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-comment"},"// import { Directus, ID } from '@directus/sdk';"),e(`
|
|
193
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" { Directus } = "),s("span",{class:"hljs-built_in"},"require"),e("("),s("span",{class:"hljs-string"},"'@directus/sdk'"),e(`);
|
|
194
|
-
|
|
195
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" directus = "),s("span",{class:"hljs-keyword"},"new"),e(" Directus("),s("span",{class:"hljs-string"},"'http://directus.example.com'"),e(`);
|
|
196
|
-
|
|
197
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" articles = directus.items("),s("span",{class:"hljs-string"},"'articles'"),e(`);
|
|
198
|
-
`)])],-1),As=s("blockquote",null,[s("p",null,"TypeScript")],-1),Rs=s("pre",null,[s("code",{class:"language-ts"},[s("span",{class:"hljs-keyword"},"import"),e(" { Directus, ID } "),s("span",{class:"hljs-keyword"},"from"),e(),s("span",{class:"hljs-string"},"'@directus/sdk'"),e(`;
|
|
199
|
-
|
|
200
|
-
`),s("span",{class:"hljs-comment"},"// Map your collection structure based on its fields."),e(`
|
|
201
|
-
`),s("span",{class:"hljs-keyword"},"type"),e(` Article = {
|
|
202
|
-
`),s("span",{class:"hljs-attr"},"id"),e(`: ID;
|
|
203
|
-
title: `),s("span",{class:"hljs-built_in"},"string"),e(`;
|
|
204
|
-
body: `),s("span",{class:"hljs-built_in"},"string"),e(`;
|
|
205
|
-
published: `),s("span",{class:"hljs-built_in"},"boolean"),e(`;
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
`),s("span",{class:"hljs-comment"},"// Map your collections to its respective types. The SDK will"),e(`
|
|
209
|
-
`),s("span",{class:"hljs-comment"},"// infer its types based on usage later."),e(`
|
|
210
|
-
`),s("span",{class:"hljs-keyword"},"type"),e(` MyBlog = {
|
|
211
|
-
`),s("span",{class:"hljs-comment"},"// [collection_name]: typescript_type"),e(`
|
|
212
|
-
`),s("span",{class:"hljs-attr"},"articles"),e(`: Article;
|
|
213
|
-
|
|
214
|
-
`),s("span",{class:"hljs-comment"},"// You can also extend Directus collection. The naming has"),e(`
|
|
215
|
-
`),s("span",{class:"hljs-comment"},"// to match a Directus system collection and it will be merged"),e(`
|
|
216
|
-
`),s("span",{class:"hljs-comment"},"// into the system spec."),e(`
|
|
217
|
-
directus_users: {
|
|
218
|
-
`),s("span",{class:"hljs-attr"},"bio"),e(": "),s("span",{class:"hljs-built_in"},"string"),e(`;
|
|
219
|
-
};
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
`),s("span",{class:"hljs-comment"},"// Let the SDK know about your collection types."),e(`
|
|
223
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" directus = "),s("span",{class:"hljs-keyword"},"new"),e(" Directus<MyBlog>("),s("span",{class:"hljs-string"},"'https://directus.myblog.com'"),e(`);
|
|
224
|
-
|
|
225
|
-
`),s("span",{class:"hljs-comment"},'// typeof(article) is a partial "Article"'),e(`
|
|
226
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" article = "),s("span",{class:"hljs-keyword"},"await"),e(" directus.items("),s("span",{class:"hljs-string"},"'articles'"),e(").readOne("),s("span",{class:"hljs-number"},"10"),e(`);
|
|
227
|
-
|
|
228
|
-
`),s("span",{class:"hljs-comment"},'// Error TS2322: "hello" is not assignable to type "boolean".'),e(`
|
|
229
|
-
`),s("span",{class:"hljs-comment"},"// post.published = 'hello';"),e(`
|
|
230
|
-
`)])],-1),qs=s("h3",{id:"create-single-item",tabindex:"-1"},[e("Create Single Item "),s("a",{class:"header-anchor",href:"#create-single-item"},"#")],-1),Bs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` articles.createOne({
|
|
231
|
-
`),s("span",{class:"hljs-attr"},"title"),e(": "),s("span",{class:"hljs-string"},"'My New Article'"),e(`,
|
|
232
|
-
});
|
|
233
|
-
`)])],-1),Ms=s("h3",{id:"create-multiple-items",tabindex:"-1"},[e("Create Multiple Items "),s("a",{class:"header-anchor",href:"#create-multiple-items"},"#")],-1),Cs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` articles.createMany([
|
|
234
|
-
{
|
|
235
|
-
`),s("span",{class:"hljs-attr"},"title"),e(": "),s("span",{class:"hljs-string"},"'My First Article'"),e(`,
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
`),s("span",{class:"hljs-attr"},"title"),e(": "),s("span",{class:"hljs-string"},"'My Second Article'"),e(`,
|
|
239
|
-
},
|
|
240
|
-
]);
|
|
241
|
-
`)])],-1),Os=s("h3",{id:"read-by-query",tabindex:"-1"},[e("Read By Query "),s("a",{class:"header-anchor",href:"#read-by-query"},"#")],-1),Ps=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` articles.readByQuery({
|
|
242
|
-
`),s("span",{class:"hljs-attr"},"search"),e(": "),s("span",{class:"hljs-string"},"'Directus'"),e(`,
|
|
243
|
-
`),s("span",{class:"hljs-attr"},"filter"),e(`: {
|
|
244
|
-
`),s("span",{class:"hljs-attr"},"date_published"),e(`: {
|
|
245
|
-
`),s("span",{class:"hljs-attr"},"_gte"),e(": "),s("span",{class:"hljs-string"},"'$NOW'"),e(`,
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
`)])],-1),Us=s("h3",{id:"read-all",tabindex:"-1"},[e("Read All "),s("a",{class:"header-anchor",href:"#read-all"},"#")],-1),Es=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` articles.readByQuery({
|
|
250
|
-
`),s("span",{class:"hljs-comment"},"// By default API limits results to 100."),e(`
|
|
251
|
-
`),s("span",{class:"hljs-comment"},"// With -1, it will return all results, but it may lead to performance degradation"),e(`
|
|
252
|
-
`),s("span",{class:"hljs-comment"},"// for large result sets."),e(`
|
|
253
|
-
`),s("span",{class:"hljs-attr"},"limit"),e(": -"),s("span",{class:"hljs-number"},"1"),e(`,
|
|
254
|
-
});
|
|
255
|
-
`)])],-1),Ns=s("h3",{id:"read-single-item",tabindex:"-1"},[e("Read Single Item "),s("a",{class:"header-anchor",href:"#read-single-item"},"#")],-1),Fs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" articles.readOne("),s("span",{class:"hljs-number"},"15"),e(`);
|
|
256
|
-
`)])],-1),Ks=s("p",null,"Supports optional query:",-1),Ls=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" articles.readOne("),s("span",{class:"hljs-number"},"15"),e(`, {
|
|
257
|
-
`),s("span",{class:"hljs-attr"},"fields"),e(": ["),s("span",{class:"hljs-string"},"'title'"),e(`],
|
|
258
|
-
});
|
|
259
|
-
`)])],-1),Ws=s("h3",{id:"read-multiple-items",tabindex:"-1"},[e("Read Multiple Items "),s("a",{class:"header-anchor",href:"#read-multiple-items"},"#")],-1),Js=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" articles.readMany(["),s("span",{class:"hljs-number"},"15"),e(", "),s("span",{class:"hljs-number"},"16"),e(", "),s("span",{class:"hljs-number"},"17"),e(`]);
|
|
260
|
-
`)])],-1),Hs=s("p",null,"Supports optional query:",-1),Vs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" articles.readMany(["),s("span",{class:"hljs-number"},"15"),e(", "),s("span",{class:"hljs-number"},"16"),e(", "),s("span",{class:"hljs-number"},"17"),e(`], {
|
|
261
|
-
`),s("span",{class:"hljs-attr"},"fields"),e(": ["),s("span",{class:"hljs-string"},"'title'"),e(`],
|
|
262
|
-
});
|
|
263
|
-
`)])],-1),zs=s("h3",{id:"update-single-item",tabindex:"-1"},[e("Update Single Item "),s("a",{class:"header-anchor",href:"#update-single-item"},"#")],-1),Gs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" articles.updateOne("),s("span",{class:"hljs-number"},"15"),e(`, {
|
|
264
|
-
`),s("span",{class:"hljs-attr"},"title"),e(": "),s("span",{class:"hljs-string"},"'This articles now has a different title'"),e(`,
|
|
265
|
-
});
|
|
266
|
-
`)])],-1),Ys=s("p",null,"Supports optional query:",-1),Qs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` articles.updateOne(
|
|
267
|
-
`),s("span",{class:"hljs-number"},"42"),e(`,
|
|
268
|
-
{
|
|
269
|
-
`),s("span",{class:"hljs-attr"},"title"),e(": "),s("span",{class:"hljs-string"},"'This articles now has a similar title'"),e(`,
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
`),s("span",{class:"hljs-attr"},"fields"),e(": ["),s("span",{class:"hljs-string"},"'title'"),e(`],
|
|
273
|
-
}
|
|
274
|
-
);
|
|
275
|
-
`)])],-1),$s=s("h3",{id:"update-multiple-items",tabindex:"-1"},[e("Update Multiple Items "),s("a",{class:"header-anchor",href:"#update-multiple-items"},"#")],-1),Xs=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" articles.updateMany(["),s("span",{class:"hljs-number"},"15"),e(", "),s("span",{class:"hljs-number"},"42"),e(`], {
|
|
276
|
-
`),s("span",{class:"hljs-attr"},"title"),e(": "),s("span",{class:"hljs-string"},"'Both articles now have the same title'"),e(`,
|
|
277
|
-
});
|
|
278
|
-
`)])],-1),Zs=s("p",null,"Supports optional query:",-1),se=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` articles.updateMany(
|
|
279
|
-
[`),s("span",{class:"hljs-number"},"15"),e(", "),s("span",{class:"hljs-number"},"42"),e(`],
|
|
280
|
-
{
|
|
281
|
-
`),s("span",{class:"hljs-attr"},"title"),e(": "),s("span",{class:"hljs-string"},"'Both articles now have the same title'"),e(`,
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
`),s("span",{class:"hljs-attr"},"fields"),e(": ["),s("span",{class:"hljs-string"},"'title'"),e(`],
|
|
285
|
-
}
|
|
286
|
-
);
|
|
287
|
-
`)])],-1),ee=s("h3",{id:"delete",tabindex:"-1"},[e("Delete "),s("a",{class:"header-anchor",href:"#delete"},"#")],-1),te=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-comment"},"// One"),e(`
|
|
288
|
-
`),s("span",{class:"hljs-keyword"},"await"),e(" articles.deleteOne("),s("span",{class:"hljs-number"},"15"),e(`);
|
|
289
|
-
|
|
290
|
-
`),s("span",{class:"hljs-comment"},"// Multiple"),e(`
|
|
291
|
-
`),s("span",{class:"hljs-keyword"},"await"),e(" articles.deleteMany(["),s("span",{class:"hljs-number"},"15"),e(", "),s("span",{class:"hljs-number"},"42"),e(`]);
|
|
292
|
-
`)])],-1),ae=s("h3",{id:"request-parameter-overrides",tabindex:"-1"},[e("Request Parameter Overrides "),s("a",{class:"header-anchor",href:"#request-parameter-overrides"},"#")],-1),ne=s("p",null,[e("To override any of the axios request parameters, provide an additional parameter with a "),s("code",null,"requestOptions"),e(" object:")],-1),le=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` articles.createOne(
|
|
293
|
-
{ `),s("span",{class:"hljs-attr"},"title"),e(": "),s("span",{class:"hljs-string"},"'example'"),e(` },
|
|
294
|
-
{ `),s("span",{class:"hljs-attr"},"fields"),e(": ["),s("span",{class:"hljs-string"},"'id'"),e(`] },
|
|
295
|
-
{
|
|
296
|
-
`),s("span",{class:"hljs-attr"},"requestOptions"),e(`: {
|
|
297
|
-
`),s("span",{class:"hljs-attr"},"headers"),e(`: {
|
|
298
|
-
`),s("span",{class:"hljs-string"},"'X-My-Custom-Header'"),e(": "),s("span",{class:"hljs-string"},"'example'"),e(`,
|
|
299
|
-
},
|
|
300
|
-
},
|
|
301
|
-
}
|
|
302
|
-
);
|
|
303
|
-
`)])],-1),oe=s("h2",{id:"activity",tabindex:"-1"},[e("Activity "),s("a",{class:"header-anchor",href:"#activity"},"#")],-1),ie=s("pre",null,[s("code",{class:"language-js"},`directus.activity;
|
|
304
|
-
`)],-1),ce=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_activity")'),e(".")],-1),re=s("h2",{id:"comments",tabindex:"-1"},[e("Comments "),s("a",{class:"header-anchor",href:"#comments"},"#")],-1),he=s("pre",null,[s("code",{class:"language-js"},`directus.comments;
|
|
305
|
-
`)],-1),de=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_comments")'),e(".")],-1),pe=s("h2",{id:"collections",tabindex:"-1"},[e("Collections "),s("a",{class:"header-anchor",href:"#collections"},"#")],-1),ue=s("pre",null,[s("code",{class:"language-js"},`directus.collections;
|
|
306
|
-
`)],-1),je=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_collections")'),e(".")],-1),me=s("h2",{id:"fields",tabindex:"-1"},[e("Fields "),s("a",{class:"header-anchor",href:"#fields"},"#")],-1),_e=s("pre",null,[s("code",{class:"language-js"},`directus.fields;
|
|
307
|
-
`)],-1),ge=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_fields")'),e(".")],-1),fe=s("h2",{id:"files",tabindex:"-1"},[e("Files "),s("a",{class:"header-anchor",href:"#files"},"#")],-1),ye=s("pre",null,[s("code",{class:"language-js"},`directus.files;
|
|
308
|
-
`)],-1),we=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_files")'),e(".")],-1),be=s("h3",{id:"uploading-a-file",tabindex:"-1"},[e("Uploading a file "),s("a",{class:"header-anchor",href:"#uploading-a-file"},"#")],-1),ke=s("p",null,[e("To upload a file you will need to send a "),s("code",null,"multipart/form-data"),e(" as body. On browser side you do so:")],-1),ve=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-comment"},"/* index.js */"),e(`
|
|
309
|
-
`),s("span",{class:"hljs-keyword"},"import"),e(" { Directus } "),s("span",{class:"hljs-keyword"},"from"),e(),s("span",{class:"hljs-string"},"'https://unpkg.com/@directus/sdk@latest/dist/sdk.esm.min.js'"),e(`;
|
|
310
|
-
|
|
311
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" directus = "),s("span",{class:"hljs-keyword"},"new"),e(" Directus("),s("span",{class:"hljs-string"},"'http://localhost:8055'"),e(`, {
|
|
312
|
-
`),s("span",{class:"hljs-attr"},"auth"),e(`: {
|
|
313
|
-
`),s("span",{class:"hljs-attr"},"staticToken"),e(": "),s("span",{class:"hljs-string"},"'STATIC_TOKEN'"),e(", "),s("span",{class:"hljs-comment"},"// If you want to use a static token, otherwise check below how you can use email and password."),e(`
|
|
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"),e(`
|
|
318
|
-
|
|
319
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" form = "),s("span",{class:"hljs-built_in"},"document"),e(".querySelector("),s("span",{class:"hljs-string"},"'#upload-file'"),e(`);
|
|
320
|
-
|
|
321
|
-
`),s("span",{class:"hljs-keyword"},"if"),e(" (form && form "),s("span",{class:"hljs-keyword"},"instanceof"),e(` HTMLFormElement) {
|
|
322
|
-
form.addEventListener(`),s("span",{class:"hljs-string"},"'submit'"),e(", "),s("span",{class:"hljs-keyword"},"async"),e(` (event) => {
|
|
323
|
-
event.preventDefault();
|
|
324
|
-
|
|
325
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" form = "),s("span",{class:"hljs-keyword"},"new"),e(` FormData(event.target);
|
|
326
|
-
`),s("span",{class:"hljs-keyword"},"await"),e(` directus.files.createOne(form);
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
`)])],-1),xe=s("pre",null,[s("code",{class:"language-html"},[s("span",{class:"hljs-comment"},"<!-- index.html -->"),e(`
|
|
330
|
-
`),s("span",{class:"hljs-tag"},[e("<"),s("span",{class:"hljs-name"},"head"),e(">")]),s("span",{class:"hljs-tag"},[e("</"),s("span",{class:"hljs-name"},"head"),e(">")]),e(`
|
|
331
|
-
`),s("span",{class:"hljs-tag"},[e("<"),s("span",{class:"hljs-name"},"body"),e(">")]),e(`
|
|
332
|
-
`),s("span",{class:"hljs-tag"},[e("<"),s("span",{class:"hljs-name"},"form"),e(),s("span",{class:"hljs-attr"},"id"),e("="),s("span",{class:"hljs-string"},'"upload-file"'),e(">")]),e(`
|
|
333
|
-
`),s("span",{class:"hljs-tag"},[e("<"),s("span",{class:"hljs-name"},"input"),e(),s("span",{class:"hljs-attr"},"type"),e("="),s("span",{class:"hljs-string"},'"text"'),e(),s("span",{class:"hljs-attr"},"name"),e("="),s("span",{class:"hljs-string"},'"title"'),e(" />")]),e(`
|
|
334
|
-
`),s("span",{class:"hljs-tag"},[e("<"),s("span",{class:"hljs-name"},"input"),e(),s("span",{class:"hljs-attr"},"type"),e("="),s("span",{class:"hljs-string"},'"file"'),e(),s("span",{class:"hljs-attr"},"name"),e("="),s("span",{class:"hljs-string"},'"file"'),e(" />")]),e(`
|
|
335
|
-
`),s("span",{class:"hljs-tag"},[e("<"),s("span",{class:"hljs-name"},"button"),e(">")]),e("Send"),s("span",{class:"hljs-tag"},[e("</"),s("span",{class:"hljs-name"},"button"),e(">")]),e(`
|
|
336
|
-
`),s("span",{class:"hljs-tag"},[e("</"),s("span",{class:"hljs-name"},"form"),e(">")]),e(`
|
|
337
|
-
`),s("span",{class:"hljs-tag"},[e("<"),s("span",{class:"hljs-name"},"script"),e(),s("span",{class:"hljs-attr"},"src"),e("="),s("span",{class:"hljs-string"},'"/index.js"'),e(),s("span",{class:"hljs-attr"},"type"),e("="),s("span",{class:"hljs-string"},'"module"'),e(">")]),s("span",{class:"hljs-tag"},[e("</"),s("span",{class:"hljs-name"},"script"),e(">")]),e(`
|
|
338
|
-
`),s("span",{class:"hljs-tag"},[e("</"),s("span",{class:"hljs-name"},"body"),e(">")]),e(`
|
|
339
|
-
`),s("span",{class:"hljs-tag"},[e("</"),s("span",{class:"hljs-name"},"html"),e(">")]),e(`
|
|
340
|
-
`)])],-1),Se=s("h4",{id:"nodejs-usage",tabindex:"-1"},[e("NodeJS usage "),s("a",{class:"header-anchor",href:"#nodejs-usage"},"#")],-1),De=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),Te=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"import"),e(" { Directus } "),s("span",{class:"hljs-keyword"},"from"),e(),s("span",{class:"hljs-string"},"'https://unpkg.com/@directus/sdk@latest/dist/sdk.esm.min.js'"),e(`;
|
|
341
|
-
|
|
342
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" directus = "),s("span",{class:"hljs-keyword"},"new"),e(" Directus("),s("span",{class:"hljs-string"},"'http://localhost:8055'"),e(`, {
|
|
343
|
-
`),s("span",{class:"hljs-attr"},"auth"),e(`: {
|
|
344
|
-
`),s("span",{class:"hljs-attr"},"staticToken"),e(": "),s("span",{class:"hljs-string"},"'STATIC_TOKEN'"),e(", "),s("span",{class:"hljs-comment"},"// If you want to use a static token, otherwise check below how you can use email and password."),e(`
|
|
345
|
-
},
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" form = "),s("span",{class:"hljs-keyword"},"new"),e(` FormData();
|
|
349
|
-
form.append(`),s("span",{class:"hljs-string"},'"file"'),e(", fs.createReadStream("),s("span",{class:"hljs-string"},'"./to_upload.jpeg"'),e(`));
|
|
350
|
-
|
|
351
|
-
`),s("span",{class:"hljs-keyword"},"const"),e(" fileId = "),s("span",{class:"hljs-keyword"},"await"),e(` directus.files.createOne(form, {}, {
|
|
352
|
-
`),s("span",{class:"hljs-attr"},"requestOptions"),e(`: {
|
|
353
|
-
`),s("span",{class:"hljs-attr"},"headers"),e(`: {
|
|
354
|
-
...form.getHeaders()
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
);
|
|
358
|
-
`)])],-1),Ie=s("h3",{id:"importing-a-file",tabindex:"-1"},[e("Importing a file "),s("a",{class:"header-anchor",href:"#importing-a-file"},"#")],-1),Ae=e("Example of "),Re=e("importing a file from a URL"),qe=e(":"),Be=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` directus.files.import({
|
|
359
|
-
`),s("span",{class:"hljs-attr"},"url"),e(": "),s("span",{class:"hljs-string"},"'http://www.example.com/example-image.jpg'"),e(`,
|
|
360
|
-
});
|
|
361
|
-
`)])],-1),Me=s("p",null,"Example of importing file with custom data:",-1),Ce=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` directus.files.import({
|
|
362
|
-
`),s("span",{class:"hljs-attr"},"url"),e(": "),s("span",{class:"hljs-string"},"'http://www.example.com/example-image.jpg'"),e(`,
|
|
363
|
-
`),s("span",{class:"hljs-attr"},"data"),e(`: {
|
|
364
|
-
`),s("span",{class:"hljs-attr"},"title"),e(": "),s("span",{class:"hljs-string"},"'My Custom File'"),e(`,
|
|
365
|
-
},
|
|
366
|
-
});
|
|
367
|
-
`)])],-1),Oe=s("h2",{id:"folders",tabindex:"-1"},[e("Folders "),s("a",{class:"header-anchor",href:"#folders"},"#")],-1),Pe=s("pre",null,[s("code",{class:"language-js"},`directus.folders;
|
|
368
|
-
`)],-1),Ue=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_folders")'),e(".")],-1),Ee=s("h2",{id:"permissions",tabindex:"-1"},[e("Permissions "),s("a",{class:"header-anchor",href:"#permissions"},"#")],-1),Ne=s("pre",null,[s("code",{class:"language-js"},`directus.permissions;
|
|
369
|
-
`)],-1),Fe=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_permissions")'),e(".")],-1),Ke=s("h2",{id:"presets",tabindex:"-1"},[e("Presets "),s("a",{class:"header-anchor",href:"#presets"},"#")],-1),Le=s("pre",null,[s("code",{class:"language-js"},`directus.presets;
|
|
370
|
-
`)],-1),We=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_presets")'),e(".")],-1),Je=s("h2",{id:"relations",tabindex:"-1"},[e("Relations "),s("a",{class:"header-anchor",href:"#relations"},"#")],-1),He=s("pre",null,[s("code",{class:"language-js"},`directus.relations;
|
|
371
|
-
`)],-1),Ve=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_relations")'),e(".")],-1),ze=s("h2",{id:"revisions",tabindex:"-1"},[e("Revisions "),s("a",{class:"header-anchor",href:"#revisions"},"#")],-1),Ge=s("pre",null,[s("code",{class:"language-js"},`directus.revisions;
|
|
372
|
-
`)],-1),Ye=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_revisions")'),e(".")],-1),Qe=s("h2",{id:"roles",tabindex:"-1"},[e("Roles "),s("a",{class:"header-anchor",href:"#roles"},"#")],-1),$e=s("pre",null,[s("code",{class:"language-js"},`directus.roles;
|
|
373
|
-
`)],-1),Xe=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_roles")'),e(".")],-1),Ze=s("h2",{id:"settings",tabindex:"-1"},[e("Settings "),s("a",{class:"header-anchor",href:"#settings"},"#")],-1),st=s("pre",null,[s("code",{class:"language-js"},`directus.settings;
|
|
374
|
-
`)],-1),et=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_settings")'),e(".")],-1),tt=s("h2",{id:"server",tabindex:"-1"},[e("Server "),s("a",{class:"header-anchor",href:"#server"},"#")],-1),at=s("h3",{id:"ping-the-server",tabindex:"-1"},[e("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"),e(` directus.server.ping();
|
|
375
|
-
`)])],-1),lt=s("h3",{id:"get-server%2Fproject-info",tabindex:"-1"},[e("Get Server/Project Info "),s("a",{class:"header-anchor",href:"#get-server%2Fproject-info"},"#")],-1),ot=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` directus.server.info();
|
|
376
|
-
`)])],-1),it=s("h2",{id:"users",tabindex:"-1"},[e("Users "),s("a",{class:"header-anchor",href:"#users"},"#")],-1),ct=s("pre",null,[s("code",{class:"language-js"},`directus.users;
|
|
377
|
-
`)],-1),rt=s("p",null,[e("Same methods as "),s("code",null,'directus.items("directus_users")'),e(", and:")],-1),ht=s("h3",{id:"invite-a-new-user",tabindex:"-1"},[e("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"),e(" directus.users.invites.send("),s("span",{class:"hljs-string"},"'admin@example.com'"),e(", "),s("span",{class:"hljs-string"},"'fe38136e-52f7-4622-8498-112b8a32a1e2'"),e(`);
|
|
378
|
-
`)])],-1),pt=s("p",null,"The second parameter is the role of the user",-1),ut=s("h3",{id:"accept-a-user-invite",tabindex:"-1"},[e("Accept a User Invite "),s("a",{class:"header-anchor",href:"#accept-a-user-invite"},"#")],-1),jt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.users.invites.accept("),s("span",{class:"hljs-string"},"'<accept-token>'"),e(", "),s("span",{class:"hljs-string"},"'n3w-p455w0rd'"),e(`);
|
|
379
|
-
`)])],-1),mt=s("p",null,"The provided token is sent to the user\u2019s email",-1),_t=s("h3",{id:"enable-two-factor-authentication",tabindex:"-1"},[e("Enable Two-Factor Authentication "),s("a",{class:"header-anchor",href:"#enable-two-factor-authentication"},"#")],-1),gt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.users.tfa.enable("),s("span",{class:"hljs-string"},"'my-password'"),e(`);
|
|
380
|
-
`)])],-1),ft=s("h3",{id:"disable-two-factor-authentication",tabindex:"-1"},[e("Disable Two-Factor Authentication "),s("a",{class:"header-anchor",href:"#disable-two-factor-authentication"},"#")],-1),yt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.users.tfa.disable("),s("span",{class:"hljs-string"},"'691402'"),e(`);
|
|
381
|
-
`)])],-1),wt=s("h3",{id:"get-the-current-user",tabindex:"-1"},[e("Get the Current User "),s("a",{class:"header-anchor",href:"#get-the-current-user"},"#")],-1),bt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` directus.users.me.read();
|
|
382
|
-
`)])],-1),kt=s("p",null,"Supports optional query:",-1),vt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` directus.users.me.read({
|
|
383
|
-
`),s("span",{class:"hljs-attr"},"fields"),e(": ["),s("span",{class:"hljs-string"},"'last_access'"),e(`],
|
|
384
|
-
});
|
|
385
|
-
`)])],-1),xt=s("h3",{id:"update-the-current-users",tabindex:"-1"},[e("Update the Current Users "),s("a",{class:"header-anchor",href:"#update-the-current-users"},"#")],-1),St=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.users.me.update({ "),s("span",{class:"hljs-attr"},"first_name"),e(": "),s("span",{class:"hljs-string"},"'Admin'"),e(` });
|
|
386
|
-
`)])],-1),Dt=s("p",null,"Supports optional query:",-1),Tt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.users.me.update({ "),s("span",{class:"hljs-attr"},"first_name"),e(": "),s("span",{class:"hljs-string"},"'Admin'"),e(" }, { "),s("span",{class:"hljs-attr"},"fields"),e(": ["),s("span",{class:"hljs-string"},"'last_access'"),e(`] });
|
|
387
|
-
`)])],-1),It=s("h2",{id:"utils",tabindex:"-1"},[e("Utils "),s("a",{class:"header-anchor",href:"#utils"},"#")],-1),At=s("h3",{id:"get-a-random-string",tabindex:"-1"},[e("Get a Random String "),s("a",{class:"header-anchor",href:"#get-a-random-string"},"#")],-1),Rt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(` directus.utils.random.string();
|
|
388
|
-
`)])],-1),qt=s("p",null,[e("Supports an optional "),s("code",null,"length"),e(" (defaults to 32):")],-1),Bt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.utils.random.string("),s("span",{class:"hljs-number"},"50"),e(`);
|
|
389
|
-
`)])],-1),Mt=s("h3",{id:"generate-a-hash-for-a-given-value",tabindex:"-1"},[e("Generate a Hash for a Given Value "),s("a",{class:"header-anchor",href:"#generate-a-hash-for-a-given-value"},"#")],-1),Ct=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.utils.hash.generate("),s("span",{class:"hljs-string"},"'My String'"),e(`);
|
|
390
|
-
`)])],-1),Ot=s("h3",{id:"verify-if-a-hash-is-valid",tabindex:"-1"},[e("Verify if a Hash is Valid "),s("a",{class:"header-anchor",href:"#verify-if-a-hash-is-valid"},"#")],-1),Pt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.utils.hash.verify("),s("span",{class:"hljs-string"},"'My String'"),e(", "),s("span",{class:"hljs-string"},"'$argon2i$v=19$m=4096,t=3,p=1$A5uogJh'"),e(`);
|
|
391
|
-
`)])],-1),Ut=s("h3",{id:"sort-items-in-a-collection",tabindex:"-1"},[e("Sort Items in a Collection "),s("a",{class:"header-anchor",href:"#sort-items-in-a-collection"},"#")],-1),Et=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.utils.sort("),s("span",{class:"hljs-string"},"'articles'"),e(", "),s("span",{class:"hljs-number"},"15"),e(", "),s("span",{class:"hljs-number"},"42"),e(`);
|
|
392
|
-
`)])],-1),Nt=s("p",null,[e("This will move item "),s("code",null,"15"),e(" to the position of item "),s("code",null,"42"),e(", and move everything in between one \u201Cslot\u201D up.")],-1),Ft=s("h3",{id:"revert-to-a-previous-revision",tabindex:"-1"},[e("Revert to a Previous Revision "),s("a",{class:"header-anchor",href:"#revert-to-a-previous-revision"},"#")],-1),Kt=s("pre",null,[s("code",{class:"language-js"},[s("span",{class:"hljs-keyword"},"await"),e(" directus.utils.revert("),s("span",{class:"hljs-number"},"451"),e(`);
|
|
393
|
-
`)])],-1),Lt=s("p",null,"Note: The key passed is the primary key of the revision you\u2019d like to apply.",-1),Wt=s("hr",null,null,-1),Gt="JavaScript SDK",Yt=!1,Qt={name:"sdk",setup(Jt,{expose:i}){const a={title:"JavaScript SDK",modularExtension:!1};return i({frontmatter:a}),(Ht,Vt)=>{const n=l("router-link"),c=l("docs-wrapper");return r(),h(c,{frontmatter:a},{default:t(()=>[s("div",d,[p,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,s("div",z,[G,s("p",null,[Y,o(n,{to:"/docs/self-hosted/config-options/#security"},{default:t(()=>[Q]),_:1}),$])]),X,Z,ss,es,ts,as,ns,ls,os,is,cs,rs,hs,ds,ps,us,js,ms,_s,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,se,ee,te,ae,ne,le,oe,ie,ce,re,he,de,pe,ue,je,me,_e,ge,fe,ye,we,be,ke,ve,xe,Se,De,Te,Ie,s("p",null,[Ae,o(n,{to:"/docs/reference/files/#import-a-file"},{default:t(()=>[Re]),_:1}),qe]),Be,Me,Ce,Oe,Pe,Ue,Ee,Ne,Fe,Ke,Le,We,Je,He,Ve,ze,Ge,Ye,Qe,$e,Xe,Ze,st,et,tt,at,nt,lt,ot,it,ct,rt,ht,dt,pt,ut,jt,mt,_t,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])]),_:1})}}};export{Qt as default,Yt as modularExtension,Gt as title};
|