@directus/app 9.12.2 → 9.14.1
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/accounts.40ab36c1.js +1 -0
- package/dist/assets/{active-line.ff3bc705.js → active-line.b531d8e7.js} +1 -1
- package/dist/assets/activity-log.9449feec.js +1 -0
- package/dist/assets/activity.fbd319d5.js +80 -0
- package/dist/assets/{apl.cc4825c6.js → apl.091e05c0.js} +1 -1
- package/dist/assets/ar-SA.215069dc.js +1 -0
- package/dist/assets/architecture.9e90b6f3.js +1 -0
- package/dist/assets/{asciiarmor.30bbdfc8.js → asciiarmor.72b1d474.js} +1 -1
- package/dist/assets/{asn.1.499e838e.js → asn.1.64b438d1.js} +1 -1
- package/dist/assets/{asterisk.a2fa7dc3.js → asterisk.2d23826f.js} +1 -1
- package/dist/assets/authentication.bc20bce5.js +73 -0
- package/dist/assets/{autorefresh.d36f34c8.js → autorefresh.65071be2.js} +1 -1
- package/dist/assets/aws.6652a1fd.js +1 -0
- package/dist/assets/backing-directus.02c28d29.js +1 -0
- package/dist/assets/bg-BG.9288ea83.js +1 -0
- package/dist/assets/bn-IN.4127b7a4.js +1 -0
- package/dist/assets/{br-FR.1ad76918.js → br-FR.d3564938.js} +1 -1
- package/dist/assets/{brainfuck.dab31c46.js → brainfuck.cb084ebc.js} +1 -1
- package/dist/assets/{ca-ES.365a1fc4.js → ca-ES.f3dfdef6.js} +1 -1
- package/dist/assets/cli.6e61515e.js +19 -0
- package/dist/assets/cli.863ef0d2.js +4 -0
- package/dist/assets/{clike.7aacd908.js → clike.c67024f2.js} +1 -1
- package/dist/assets/{clojure.c8d9937a.js → clojure.4409f83f.js} +1 -1
- package/dist/assets/cloudron.a348537b.js +1 -0
- package/dist/assets/{cmake.e0408576.js → cmake.2f7d66e8.js} +1 -1
- package/dist/assets/{cobol.86241640.js → cobol.1d3d945c.js} +1 -1
- package/dist/assets/codebase-overview.b46635f9.js +1 -0
- package/dist/assets/{coffeescript.6090d9e8.js → coffeescript.7dbfeb38.js} +1 -1
- package/dist/assets/collections.60e4b448.js +2 -0
- package/dist/assets/collections.80e4a52c.js +106 -0
- package/dist/assets/{commonlisp.eb3c5619.js → commonlisp.79d346a3.js} +1 -1
- package/dist/assets/config-options.8e2d8e17.js +138 -0
- package/dist/assets/content.003d7d7c.js +1 -0
- package/dist/assets/creating-extensions.9a98925a.js +11 -0
- package/dist/assets/{crystal.01db8e68.js → crystal.6f97295f.js} +1 -1
- package/dist/assets/cs-CZ.a3c83b73.js +1 -0
- package/dist/assets/{css.b1894218.js → css.87d5fc8d.js} +1 -1
- package/dist/assets/{cypher.c0cbf899.js → cypher.b46e268d.js} +1 -1
- package/dist/assets/{d.54d4201d.js → d.0277a0cc.js} +1 -1
- package/dist/assets/{da-DK.88f53a7d.js → da-DK.3c379038.js} +1 -1
- package/dist/assets/{dart.2218881c.js → dart.fd756766.js} +1 -1
- package/dist/assets/data-model.086edd1e.js +1 -0
- package/dist/assets/data-sharing.27afa5ee.js +1 -0
- package/dist/assets/de-DE.350023db.js +1 -0
- package/dist/assets/{diff.d7f03886.js → diff.1ed63843.js} +1 -1
- package/dist/assets/digitalocean-app-platform.aff2a50b.js +3 -0
- package/dist/assets/display-templates.d8e93a19.js +1 -0
- package/dist/assets/displays.e528abde.js +49 -0
- package/dist/assets/{django.913379d3.js → django.afa30018.js} +1 -1
- package/dist/assets/{docker.e1bb4205.js → docker.6f265c46.js} +7 -7
- package/dist/assets/{dockerfile.9c7cf88b.js → dockerfile.91c6378e.js} +1 -1
- package/dist/assets/documentation.ad1fdaf2.js +1 -0
- package/dist/assets/{dtd.dbc97bdb.js → dtd.8b391952.js} +1 -1
- package/dist/assets/{dylan.0c2df43b.js → dylan.5532ec69.js} +1 -1
- package/dist/assets/{ebnf.4c778620.js → ebnf.f179e348.js} +1 -1
- package/dist/assets/{ecl.778611ac.js → ecl.a37bdc2f.js} +1 -1
- package/dist/assets/{eiffel.2a73cd14.js → eiffel.883e1bfb.js} +1 -1
- package/dist/assets/{el-GR.98199dde.js → el-GR.103ebf8d.js} +1 -1
- package/dist/assets/{elm.90002323.js → elm.c40484aa.js} +1 -1
- package/dist/assets/email-templates.2bdb87a6.js +2 -0
- package/dist/assets/{en-CA.58d818b8.js → en-CA.9ad3a3ab.js} +1 -1
- package/dist/assets/{en-GB.74320d21.js → en-GB.c55341c7.js} +1 -1
- package/dist/assets/endpoints.2c9172db.js +27 -0
- package/dist/assets/{erlang.c8e3989e.js → erlang.60963eb0.js} +1 -1
- package/dist/assets/es-419.10094709.js +1 -0
- package/dist/assets/es-CL.7f44ec7c.js +1 -0
- package/dist/assets/es-ES.3ff9088e.js +1 -0
- package/dist/assets/es-MX.17370b17.js +1 -0
- package/dist/assets/{et-EE.9e35920e.js → et-EE.fb46a361.js} +1 -1
- package/dist/assets/extensions.8d3df212.js +12 -0
- package/dist/assets/{fa-IR.f3dc75f9.js → fa-IR.b864f77c.js} +1 -1
- package/dist/assets/{factor.a2db9c26.js → factor.6c5ee333.js} +1 -1
- package/dist/assets/faq.63c79c18.js +2 -0
- package/dist/assets/{fcl.02d85986.js → fcl.8e18cfdc.js} +1 -1
- package/dist/assets/{fi-FI.42afdce0.js → fi-FI.14f31cb4.js} +1 -1
- package/dist/assets/fields.715d4591.js +135 -0
- package/dist/assets/file-library.a4de4015.js +1 -0
- package/dist/assets/files.7c2ccfe2.js +189 -0
- package/dist/assets/filter-rules.056b97be.js +76 -0
- package/dist/assets/filters.2cb82fd9.js +1 -0
- package/dist/assets/flows.38f60cc8.js +172 -0
- package/dist/assets/flows.f378a262.js +15 -0
- package/dist/assets/{fo-FO.ffe478b0.js → fo-FO.cc444b75.js} +1 -1
- package/dist/assets/folders.fa66a5ce.js +132 -0
- package/dist/assets/{forth.725698ea.js → forth.5d8db187.js} +1 -1
- package/dist/assets/{fortran.e9ba7b47.js → fortran.ac24d46b.js} +1 -1
- package/dist/assets/{fr-CA.caa3fc8d.js → fr-CA.0e824ae4.js} +1 -1
- package/dist/assets/fr-FR.77a5277c.js +1 -0
- package/dist/assets/{gas.25b17a72.js → gas.f99de41f.js} +1 -1
- package/dist/assets/gcp.6c61b39e.js +60 -0
- package/dist/assets/{gfm.a7b6e273.js → gfm.c3250bc4.js} +1 -1
- package/dist/assets/{gherkin.1db310b6.js → gherkin.dd3614b2.js} +1 -1
- package/dist/assets/github-ci.04483301.js +2 -0
- package/dist/assets/glossary.485603d9.js +1 -0
- package/dist/assets/glossary.6efd77ad.js +1 -0
- package/dist/assets/{go.a0c64ca2.js → go.18ea1afe.js} +1 -1
- package/dist/assets/{groovy.b0ac2a1f.js → groovy.d1f3a61a.js} +1 -1
- package/dist/assets/{haml.233c9608.js → haml.a346df44.js} +1 -1
- package/dist/assets/{handlebars.b13fc00f.js → handlebars.a4eff81f.js} +1 -1
- package/dist/assets/{haskell-literate.af8f88ee.js → haskell-literate.57a5243e.js} +1 -1
- package/dist/assets/{haskell.adcf73db.js → haskell.3acf2710.js} +1 -1
- package/dist/assets/{haxe.f1a75c2e.js → haxe.bdf5968b.js} +1 -1
- package/dist/assets/{hi-IN.36e79faa.js → hi-IN.c0703db5.js} +1 -1
- package/dist/assets/hooks.f7efe9af.js +60 -0
- package/dist/assets/{hr-HR.b1e41c07.js → hr-HR.467388ee.js} +1 -1
- package/dist/assets/{htmlembedded.145e9718.js → htmlembedded.03cf45db.js} +1 -1
- package/dist/assets/{htmlmixed.6794685c.js → htmlmixed.987f61e9.js} +1 -1
- package/dist/assets/{http.5bb61ef1.js → http.a4c95466.js} +1 -1
- package/dist/assets/{hu-HU.9c7ec38f.js → hu-HU.47ab36e8.js} +1 -1
- package/dist/assets/id-ID.8089647c.js +1 -0
- package/dist/assets/{idl.f52ce6c3.js → idl.2fcbfa33.js} +1 -1
- package/dist/assets/iis.e068f41a.js +24 -0
- package/dist/assets/import-export.d334c127.js +2 -0
- package/dist/assets/{index.133de9ba.entry.js → index.02dcddad.entry.js} +222 -226
- package/dist/assets/index.087465cd.css +1 -0
- package/dist/assets/index.4254793b.js +26 -0
- package/dist/assets/{index.895a297f.css → index.6f497914.css} +1 -1
- package/dist/assets/{input-rich-text-html.817ccf8b.css → input-rich-text-html.172a38cb.css} +1 -1
- package/dist/assets/{input-rich-text-html.e9e92552.js → input-rich-text-html.75413785.js} +47 -47
- package/dist/assets/insights.b3ba896c.js +2 -0
- package/dist/assets/installation.2025f88b.js +1 -0
- package/dist/assets/interfaces.606c790c.js +46 -0
- package/dist/assets/introduction.41a72fb0.js +1 -0
- package/dist/assets/introduction.527c3465.js +4 -0
- package/dist/assets/introduction.5566b96e.js +90 -0
- package/dist/assets/introduction.ecd17b88.js +1 -0
- package/dist/assets/it-IT.58422a56.js +1 -0
- package/dist/assets/items.d1f658a9.js +1 -0
- package/dist/assets/items.d9c6a0b4.js +136 -0
- package/dist/assets/ja-JP.84597497.js +1 -0
- package/dist/assets/{javascript-hint.d8a99d8e.js → javascript-hint.db799360.js} +1 -1
- package/dist/assets/{javascript.357d6ab4.js → javascript.46c46918.js} +1 -1
- package/dist/assets/{jinja2.64181acd.js → jinja2.71e29364.js} +1 -1
- package/dist/assets/{jsx.ba14fb9d.js → jsx.9ae3ca09.js} +1 -1
- package/dist/assets/{julia.06a9ee42.js → julia.8b46f23e.js} +1 -1
- package/dist/assets/{ko-KR.5a129780.js → ko-KR.9056bd31.js} +1 -1
- package/dist/assets/{ku-TR.9eee23ff.js → ku-TR.3a07a57e.js} +1 -1
- package/dist/assets/layouts.0aa8d645.js +54 -0
- package/dist/assets/layouts.14b157dc.js +1 -0
- package/dist/assets/{livescript.687f6ca6.js → livescript.1c767a4c.js} +1 -1
- package/dist/assets/localization.c89061c7.js +1 -0
- package/dist/assets/{lt-LT.772aac6e.js → lt-LT.f2d719ff.js} +1 -1
- package/dist/assets/{lua.40597bfe.js → lua.42e69aa3.js} +1 -1
- package/dist/assets/manual.20d730b3.js +12 -0
- package/dist/assets/{mark-selection.feeab6e5.js → mark-selection.16acf9dc.js} +1 -1
- package/dist/assets/{match-highlighter.8afd3316.js → match-highlighter.8f0791ef.js} +1 -1
- package/dist/assets/{mathematica.6569f1d2.js → mathematica.6d38a8bc.js} +1 -1
- package/dist/assets/{mbox.d8c16b77.js → mbox.04641caf.js} +1 -1
- package/dist/assets/migrations.f13ec64d.js +19 -0
- package/dist/assets/{mirc.5f909857.js → mirc.a748cdbe.js} +1 -1
- package/dist/assets/{mllike.393c4525.js → mllike.78996bae.js} +1 -1
- package/dist/assets/{mn-MN.ae109212.js → mn-MN.c504a096.js} +1 -1
- package/dist/assets/{modelica.1180cc4d.js → modelica.e521b192.js} +1 -1
- package/dist/assets/modules.9b5ee510.js +69 -0
- package/dist/assets/{ms-MY.e50ff23a.js → ms-MY.e6553dad.js} +1 -1
- package/dist/assets/{mscgen.429d47df.js → mscgen.4b8f9009.js} +1 -1
- package/dist/assets/{multiplex.23c498d1.js → multiplex.c8ef0fcd.js} +1 -1
- package/dist/assets/{mumps.f94bba13.js → mumps.44c6f7dd.js} +1 -1
- package/dist/assets/{nginx.72bf7bab.js → nginx.0aef90d9.js} +1 -1
- package/dist/assets/{nl-NL.b57de112.js → nl-NL.2f00af44.js} +1 -1
- package/dist/assets/{no-NO.79458b78.js → no-NO.59f9d425.js} +1 -1
- package/dist/assets/notifications.674ee6f9.js +153 -0
- package/dist/assets/{nsis.68fe2711.js → nsis.21597a35.js} +1 -1
- package/dist/assets/{ntriples.964a7402.js → ntriples.a9ce3eee.js} +1 -1
- package/dist/assets/{octave.26aad7e7.js → octave.e4e6969c.js} +1 -1
- package/dist/assets/operations.46679bea.js +1 -0
- package/dist/assets/operations.9995851b.js +169 -0
- package/dist/assets/{overlay.b4b97f23.js → overlay.725bd47b.js} +1 -1
- package/dist/assets/overview.3616b560.js +1 -0
- package/dist/assets/overview.3c9f8f3d.js +1 -0
- package/dist/assets/overview.6438dc44.js +1 -0
- package/dist/assets/{oz.1076911f.js → oz.439981ca.js} +1 -1
- package/dist/assets/panels.570ee526.js +65 -0
- package/dist/assets/{pascal.8ad1e64f.js → pascal.e63a97cf.js} +1 -1
- package/dist/assets/{pegjs.c362f9d1.js → pegjs.9b76593b.js} +1 -1
- package/dist/assets/{perl.afe37b4f.js → perl.e5aa6f87.js} +1 -1
- package/dist/assets/permissions.768d1878.js +178 -0
- package/dist/assets/{php.2fcb5b78.js → php.d553fa6c.js} +1 -1
- package/dist/assets/{pig.1047d3c6.js → pig.657ad6df.js} +1 -1
- package/dist/assets/pl-PL.80cfbed6.js +1 -0
- package/dist/assets/plesk.b0ee9a9a.js +27 -0
- package/dist/assets/{powershell.a493c1a9.js → powershell.d67ba3f4.js} +1 -1
- package/dist/assets/presets-bookmarks.522baf53.js +1 -0
- package/dist/assets/presets.d902ebfa.js +164 -0
- package/dist/assets/project-settings.1f95b799.js +1 -0
- package/dist/assets/projects.1ea6a392.js +1 -0
- package/dist/assets/{properties.2ccd56b8.js → properties.da88b13f.js} +1 -1
- package/dist/assets/{protobuf.a0e463a0.js → protobuf.4d5afee3.js} +1 -1
- package/dist/assets/pt-BR.40750500.js +1 -0
- package/dist/assets/pt-PT.fae0fcc3.js +1 -0
- package/dist/assets/{pug.3909bb70.js → pug.3f42b721.js} +1 -1
- package/dist/assets/{puppet.298e3717.js → puppet.c79d85fc.js} +1 -1
- package/dist/assets/{python.099f62ce.js → python.d6ada07e.js} +1 -1
- package/dist/assets/{q.64763e8e.js → q.1a68bd88.js} +1 -1
- package/dist/assets/query.8abea6de.js +152 -0
- package/dist/assets/quickstart.75164dd7.js +9 -0
- package/dist/assets/quickstart.9985cb15.js +20 -0
- package/dist/assets/{r.f2c0470b.js → r.0c2eb3c2.js} +1 -1
- package/dist/assets/relations.9011b2b5.js +115 -0
- package/dist/assets/relationships.cbc9b1c5.js +55 -0
- package/dist/assets/resources.25cb1e34.js +1 -0
- package/dist/assets/revisions.c90ecb76.js +40 -0
- package/dist/assets/{ro-RO.5161835a.js → ro-RO.a1adfb6a.js} +1 -1
- package/dist/assets/roles.22f7aa37.js +171 -0
- package/dist/assets/{rpm.cf84a89e.js → rpm.bf07aaab.js} +1 -1
- package/dist/assets/{rst.26def927.js → rst.00e6f3ec.js} +1 -1
- package/dist/assets/{ru-RU.94a64be6.js → ru-RU.35703ea4.js} +1 -1
- package/dist/assets/{ruby.5fdee9b4.js → ruby.a058e7d1.js} +1 -1
- package/dist/assets/running-locally.ce0a8200.js +26 -0
- package/dist/assets/{rust.ab31720a.js → rust.f7ca883b.js} +1 -1
- package/dist/assets/{sas.d35671d3.js → sas.f9db0ec1.js} +1 -1
- package/dist/assets/{sass.be16b14c.js → sass.6c26d08e.js} +1 -1
- package/dist/assets/{scheme.da057889.js → scheme.b19aee0d.js} +1 -1
- package/dist/assets/sdk.916109ed.js +393 -0
- package/dist/assets/security.1963da73.js +1 -0
- package/dist/assets/server.afec52fc.js +114 -0
- package/dist/assets/settings.835be62f.js +51 -0
- package/dist/assets/settings.a02abd85.js +1 -0
- package/dist/assets/{shell.ba07ff2f.js → shell.b593f3c7.js} +1 -1
- package/dist/assets/{show-hint.4c3405db.js → show-hint.252396d2.js} +1 -1
- package/dist/assets/{sieve.9a88af42.js → sieve.b20bbc45.js} +1 -1
- package/dist/assets/{simple.306c97cf.js → simple.8b298831.js} +1 -1
- package/dist/assets/{sl-SI.719d987e.js → sl-SI.632899f8.js} +1 -1
- package/dist/assets/{slim.11e72018.js → slim.2a6f8eee.js} +1 -1
- package/dist/assets/{smalltalk.802facc0.js → smalltalk.9bee6f9b.js} +1 -1
- package/dist/assets/{smarty.410c0c8d.js → smarty.be5c58b8.js} +1 -1
- package/dist/assets/{solr.43e14cbf.js → solr.49b61be0.js} +1 -1
- package/dist/assets/{soy.18418f41.js → soy.0ff77af9.js} +1 -1
- package/dist/assets/{sparql.5169332f.js → sparql.9f5e3d7d.js} +1 -1
- package/dist/assets/{spreadsheet.2a7e9b13.js → spreadsheet.062b3700.js} +1 -1
- package/dist/assets/{sql.53c1d1ba.js → sql.a5128e43.js} +1 -1
- package/dist/assets/{sr-CS.c513578f.js → sr-CS.2e5b18be.js} +1 -1
- package/dist/assets/{sso-examples.b52061be.js → sso-examples.048b39c5.js} +12 -12
- package/dist/assets/sso.70be105f.js +22 -0
- package/dist/assets/{stex.7c4e0033.js → stex.0331c80e.js} +1 -1
- package/dist/assets/{stylus.dfe1c737.js → stylus.6423d65d.js} +1 -1
- package/dist/assets/support.fce2dba5.js +1 -0
- package/dist/assets/{sv-SE.a70fd097.js → sv-SE.d485ddd3.js} +1 -1
- package/dist/assets/{swift.e9cb43f5.js → swift.979a2826.js} +1 -1
- package/dist/assets/{tcl.7cc3bef5.js → tcl.fa1b798c.js} +1 -1
- package/dist/assets/teams.44eb670e.js +1 -0
- package/dist/assets/{textile.353c8497.js → textile.9dbd9b93.js} +1 -1
- package/dist/assets/{th-TH.bdbc4a8c.js → th-TH.1e9ab13f.js} +1 -1
- package/dist/assets/themes.e4a7762f.js +5 -0
- package/dist/assets/{tiddlywiki.f4ebe8db.js → tiddlywiki.fb030aa9.js} +1 -1
- package/dist/assets/{tiki.95dd78e4.js → tiki.2e2e82c0.js} +1 -1
- package/dist/assets/{toml.f50bb93a.js → toml.0c911c34.js} +1 -1
- package/dist/assets/{tornado.3e0cfd8c.js → tornado.466faa98.js} +1 -1
- package/dist/assets/tr-TR.feb24957.js +1 -0
- package/dist/assets/translation-strings.4ed25965.js +1 -0
- package/dist/assets/translations.cf2353ca.js +1 -0
- package/dist/assets/triggers.05092cdf.js +1 -0
- package/dist/assets/{troff.a2834e8f.js → troff.398ba40d.js} +1 -1
- package/dist/assets/{ttcn-cfg.447f138c.js → ttcn-cfg.7c37ebe0.js} +1 -1
- package/dist/assets/{ttcn.7d877404.js → ttcn.58e768c8.js} +1 -1
- package/dist/assets/{turtle.3b4898fd.js → turtle.2b65ee77.js} +1 -1
- package/dist/assets/{twig.53dd7cbe.js → twig.0cf35761.js} +1 -1
- package/dist/assets/ubuntu.35dc97df.js +11 -0
- package/dist/assets/uk-UA.0e92f9a4.js +1 -0
- package/dist/assets/upgrades-migrations.9218bbe9.js +1 -0
- package/dist/assets/use-sync.c0f4dfab.js +7 -7
- package/dist/assets/user-directory.3daaa818.js +1 -0
- package/dist/assets/users-roles-permissions.6e18f7ca.js +1 -0
- package/dist/assets/users.4f11a7c5.js +252 -0
- package/dist/assets/utilities.0e0d0ace.js +74 -0
- package/dist/assets/{vb.c3313898.js → vb.269200a5.js} +1 -1
- package/dist/assets/{vbscript.0b106bed.js → vbscript.b9c30330.js} +1 -1
- package/dist/assets/{velocity.c20bb29d.js → velocity.a54e5f76.js} +1 -1
- package/dist/assets/{verilog.2f6698b4.js → verilog.fd6a1be7.js} +1 -1
- package/dist/assets/{vhdl.6127eef7.js → vhdl.846afe81.js} +1 -1
- package/dist/assets/{vi-VN.7478a743.js → vi-VN.3e9c985f.js} +1 -1
- package/dist/assets/{vue.bb756ea0.js → vue.74e2af44.js} +1 -1
- package/dist/assets/{wast.66661aa3.js → wast.38b3f34b.js} +1 -1
- package/dist/assets/webhooks.00ee297b.js +147 -0
- package/dist/assets/webhooks.01ddb390.js +1 -0
- package/dist/assets/{webidl.0a42319e.js → webidl.481665e3.js} +1 -1
- package/dist/assets/{xquery.44dd200c.js → xquery.e254ba63.js} +1 -1
- package/dist/assets/{yacas.6f3863db.js → yacas.fc329640.js} +1 -1
- package/dist/assets/{yaml-frontmatter.42fca60b.js → yaml-frontmatter.84cccda6.js} +1 -1
- package/dist/assets/{yaml.d85fc2b2.js → yaml.3a95e8e9.js} +1 -1
- package/dist/assets/{z80.2bbe85a7.js → z80.691a0cb9.js} +1 -1
- package/dist/assets/zh-CN.432cf71e.js +1 -0
- package/dist/assets/zh-TW.cac20c88.js +1 -0
- package/dist/index.html +2 -2
- package/package.json +10 -7
- package/dist/assets/accounts.08433099.js +0 -1
- package/dist/assets/activity-log.496fa2f2.css +0 -1
- package/dist/assets/activity-log.fd558c9b.js +0 -1
- package/dist/assets/activity.0def80ca.js +0 -80
- package/dist/assets/ar-SA.1a6c2c65.js +0 -1
- package/dist/assets/architecture.6e6f13a7.js +0 -1
- package/dist/assets/authentication.a6f04750.js +0 -73
- package/dist/assets/aws.3b1c64af.js +0 -1
- package/dist/assets/backing-directus.0003d237.js +0 -1
- package/dist/assets/bg-BG.749c86ae.js +0 -1
- package/dist/assets/bn-IN.1385676c.js +0 -1
- package/dist/assets/cli.5153aa86.js +0 -4
- package/dist/assets/cli.e8e2526b.js +0 -19
- package/dist/assets/cloudron.53c430b8.js +0 -1
- package/dist/assets/codebase-overview.e9df94fc.js +0 -1
- package/dist/assets/collections.2453db3a.js +0 -106
- package/dist/assets/collections.aa896b3f.js +0 -2
- package/dist/assets/config-options.b1233b4b.js +0 -138
- package/dist/assets/content.1b1e95cf.js +0 -1
- package/dist/assets/creating-extensions.bfd7c57c.js +0 -11
- package/dist/assets/cs-CZ.6910228b.js +0 -1
- package/dist/assets/data-model.0e360572.js +0 -1
- package/dist/assets/data-sharing.da96e52e.js +0 -1
- package/dist/assets/de-DE.a4271e4f.js +0 -1
- package/dist/assets/digitalocean-app-platform.3412cb40.js +0 -3
- package/dist/assets/display-templates.915c0c5b.js +0 -1
- package/dist/assets/displays.99989c6d.js +0 -49
- package/dist/assets/documentation.788d4998.js +0 -1
- package/dist/assets/email-templates.1f5ac335.js +0 -2
- package/dist/assets/endpoints.aaac7c81.js +0 -27
- package/dist/assets/es-419.aa0bf259.js +0 -1
- package/dist/assets/es-CL.e42c6c3c.js +0 -1
- package/dist/assets/es-ES.5c7e9438.js +0 -1
- package/dist/assets/es-MX.b9c72674.js +0 -1
- package/dist/assets/extensions.34c12005.js +0 -12
- package/dist/assets/faq.89e68608.js +0 -2
- package/dist/assets/fields.54985585.js +0 -135
- package/dist/assets/file-library.b55c53fe.js +0 -1
- package/dist/assets/files.064d5a35.js +0 -187
- package/dist/assets/filter-rules.aec0af01.js +0 -76
- package/dist/assets/filters.3db1b044.js +0 -1
- package/dist/assets/flows.22228af1.js +0 -172
- package/dist/assets/flows.3ea1b90f.js +0 -15
- package/dist/assets/folders.0024d3d3.js +0 -132
- package/dist/assets/fr-FR.615da1bd.js +0 -1
- package/dist/assets/gcp.627205b5.js +0 -60
- package/dist/assets/github-ci.abd39dcc.js +0 -2
- package/dist/assets/glossary.312e2401.js +0 -1
- package/dist/assets/glossary.75ca2027.js +0 -1
- package/dist/assets/hooks.eda18b02.js +0 -60
- package/dist/assets/id-ID.a0052c00.js +0 -1
- package/dist/assets/iis.109e5a8a.js +0 -24
- package/dist/assets/import-export.3da878a4.js +0 -2
- package/dist/assets/index.55cf7b0a.js +0 -26
- package/dist/assets/index.ef58525d.css +0 -1
- package/dist/assets/insights.c8ed7c1c.js +0 -1
- package/dist/assets/installation.78c6d9f6.js +0 -1
- package/dist/assets/interfaces.9e145c45.js +0 -46
- package/dist/assets/introduction.2e6f5c1d.js +0 -90
- package/dist/assets/introduction.78a2a844.js +0 -4
- package/dist/assets/introduction.8a589eb0.js +0 -1
- package/dist/assets/introduction.fd7c08ac.js +0 -1
- package/dist/assets/it-IT.7b7f58ec.js +0 -1
- package/dist/assets/items.4205dfa0.js +0 -136
- package/dist/assets/items.64ed9295.js +0 -1
- package/dist/assets/ja-JP.819a38cf.js +0 -1
- package/dist/assets/layouts.3c14b583.js +0 -54
- package/dist/assets/layouts.ca8afd39.js +0 -1
- package/dist/assets/localization.374b7427.js +0 -1
- package/dist/assets/manual.ab601c95.js +0 -10
- package/dist/assets/migrations.8989fedc.js +0 -19
- package/dist/assets/modules.17c944d1.js +0 -69
- package/dist/assets/notifications.33c688c9.js +0 -153
- package/dist/assets/operations.22151874.js +0 -169
- package/dist/assets/operations.50a08aae.js +0 -1
- package/dist/assets/overview.3436365c.js +0 -1
- package/dist/assets/overview.623fafba.js +0 -1
- package/dist/assets/overview.dbebe94a.js +0 -1
- package/dist/assets/panels.385b173a.js +0 -65
- package/dist/assets/permissions.f84f8d42.js +0 -178
- package/dist/assets/pl-PL.7e448fa9.js +0 -1
- package/dist/assets/plesk.f7e3d5ef.js +0 -27
- package/dist/assets/presets-bookmarks.1b8ec70c.js +0 -1
- package/dist/assets/presets.b1e8b6c1.js +0 -164
- package/dist/assets/project-settings.d32669a9.js +0 -1
- package/dist/assets/projects.bb50c3df.js +0 -1
- package/dist/assets/pt-BR.2d6fa7cc.js +0 -1
- package/dist/assets/pt-PT.c28534a0.js +0 -1
- package/dist/assets/query.dbe0b56d.js +0 -152
- package/dist/assets/quickstart.01824cc9.js +0 -9
- package/dist/assets/quickstart.4d7c7736.js +0 -20
- package/dist/assets/relations.d29aa86d.js +0 -115
- package/dist/assets/relationships.c9c5db8a.js +0 -55
- package/dist/assets/resources.00028bf0.js +0 -1
- package/dist/assets/revisions.2898106e.js +0 -40
- package/dist/assets/roles.9fec37da.js +0 -171
- package/dist/assets/running-locally.811d0dcc.js +0 -26
- package/dist/assets/sdk.12cd7974.js +0 -393
- package/dist/assets/security.8e2a8a41.js +0 -1
- package/dist/assets/server.9f12ae3e.js +0 -114
- package/dist/assets/settings.149d1dff.js +0 -1
- package/dist/assets/settings.28abc1f0.js +0 -51
- package/dist/assets/sso.64b2717b.js +0 -22
- package/dist/assets/support.94e3734b.js +0 -1
- package/dist/assets/teams.9ff14f8f.js +0 -1
- package/dist/assets/themes.df7ec485.js +0 -5
- package/dist/assets/tr-TR.d7a7361f.js +0 -1
- package/dist/assets/translations.5191ab7c.js +0 -1
- package/dist/assets/triggers.1f1ace5f.js +0 -1
- package/dist/assets/ubuntu.f4c21886.js +0 -11
- package/dist/assets/uk-UA.473dd1c9.js +0 -1
- package/dist/assets/upgrades-migrations.15498a47.js +0 -1
- package/dist/assets/user-directory.47c8beb2.js +0 -1
- package/dist/assets/users-roles-permissions.005388fa.js +0 -1
- package/dist/assets/users.84251ab9.js +0 -252
- package/dist/assets/utilities.26e6a9e8.js +0 -74
- package/dist/assets/webhooks.4eeecb7d.js +0 -147
- package/dist/assets/webhooks.61b11e7d.js +0 -1
- package/dist/assets/zh-CN.c51e7308.js +0 -1
- package/dist/assets/zh-TW.8ef6cec8.js +0 -1
|
@@ -0,0 +1,393 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i,o as n,b as c,w as d,g as e,B as a}from"./runtime-core.esm-bundler.b1f35d24.js";const o=e("div",{class:"markdown-body"},[e("blockquote",null,[e("p",null,"TK")]),e("h2",{id:"https",tabindex:"-1"},[a("HTTPS "),e("a",{class:"header-anchor",href:"#https"},"#")]),e("h2",{id:"password-salting%2Fhashing%2Falgorithm-%26-password-policy",tabindex:"-1"},[a("Password Salting/Hashing/Algorithm & Password Policy "),e("a",{class:"header-anchor",href:"#password-salting%2Fhashing%2Falgorithm-%26-password-policy"},"#")]),e("h2",{id:"static-tokens",tabindex:"-1"},[a("Static Tokens "),e("a",{class:"header-anchor",href:"#static-tokens"},"#")]),e("h2",{id:"encrypted-fields-%26-encrypted-database",tabindex:"-1"},[a("Encrypted Fields & Encrypted Database "),e("a",{class:"header-anchor",href:"#encrypted-fields-%26-encrypted-database"},"#")]),e("h2",{id:"private-file-links",tabindex:"-1"},[a("Private File Links "),e("a",{class:"header-anchor",href:"#private-file-links"},"#")]),e("h2",{id:"mfa-(required)-%26-sso",tabindex:"-1"},[a("MFA (Required) & SSO "),e("a",{class:"header-anchor",href:"#mfa-(required)-%26-sso"},"#")]),e("h2",{id:"granular-access-control-%26-ip-white-listing-%26-app-access",tabindex:"-1"},[a("Granular Access Control & IP WHite-Listing & App Access "),e("a",{class:"header-anchor",href:"#granular-access-control-%26-ip-white-listing-%26-app-access"},"#")]),e("h2",{id:"rate-limiting",tabindex:"-1"},[a("Rate Limiting "),e("a",{class:"header-anchor",href:"#rate-limiting"},"#")]),e("h2",{id:"encrypted",tabindex:"-1"},[a("Encrypted "),e("a",{class:"header-anchor",href:"#encrypted"},"#")]),e("h2",{id:"parameterized-database-queries",tabindex:"-1"},[a("Parameterized Database Queries "),e("a",{class:"header-anchor",href:"#parameterized-database-queries"},"#")])],-1),m="Security",u=!1,b={name:"security",setup(h,{expose:t}){const s={title:"Security",modularExtension:!1};return t({frontmatter:s}),(l,p)=>{const r=i("docs-wrapper");return n(),c(r,{frontmatter:s},{default:d(()=>[o]),_:1})}}};export{b as default,u as modularExtension,m as title};
|