@directus/app 9.12.1 → 9.14.0
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.9a1812c6.entry.js → @directus_extensions-sdk.016f1070.entry.js} +1 -1
- package/dist/assets/accounts.40ab36c1.js +1 -0
- package/dist/assets/{active-line.b42e95d2.js → active-line.71775521.js} +1 -1
- package/dist/assets/activity-log.9449feec.js +1 -0
- package/dist/assets/activity.fbd319d5.js +80 -0
- package/dist/assets/{apl.a10fee96.js → apl.fabbb08e.js} +1 -1
- package/dist/assets/ar-SA.215069dc.js +1 -0
- package/dist/assets/architecture.9e90b6f3.js +1 -0
- package/dist/assets/{asciiarmor.3440160d.js → asciiarmor.f87dc63a.js} +1 -1
- package/dist/assets/{asn.1.bdf78f70.js → asn.1.5dd57608.js} +1 -1
- package/dist/assets/{asterisk.88ae33f0.js → asterisk.395cf0ad.js} +1 -1
- package/dist/assets/authentication.bc20bce5.js +73 -0
- package/dist/assets/{autorefresh.fa8b7b34.js → autorefresh.2c9c0320.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.af40cbfc.js → brainfuck.60536f63.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.75f55953.js → clike.74e0448b.js} +1 -1
- package/dist/assets/{clojure.f44f8182.js → clojure.8f96f0f7.js} +1 -1
- package/dist/assets/cloudron.a348537b.js +1 -0
- package/dist/assets/{cmake.dc51a5f4.js → cmake.723ea5dd.js} +1 -1
- package/dist/assets/{cobol.bd572fbc.js → cobol.a990507c.js} +1 -1
- package/dist/assets/codebase-overview.b46635f9.js +1 -0
- package/dist/assets/{coffeescript.903da3d2.js → coffeescript.c826a1f4.js} +1 -1
- package/dist/assets/collections.60e4b448.js +2 -0
- package/dist/assets/collections.80e4a52c.js +106 -0
- package/dist/assets/{commonlisp.0c024da5.js → commonlisp.0f5d3fae.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.80f7e1ba.js → crystal.8517c407.js} +1 -1
- package/dist/assets/cs-CZ.a3c83b73.js +1 -0
- package/dist/assets/{css.eb89b9da.js → css.f2b45d65.js} +1 -1
- package/dist/assets/{cypher.f649c40f.js → cypher.0f67a8c4.js} +1 -1
- package/dist/assets/{d.3e286089.js → d.d8c5a86d.js} +1 -1
- package/dist/assets/{da-DK.88f53a7d.js → da-DK.3c379038.js} +1 -1
- package/dist/assets/{dart.5b9bb9bb.js → dart.ff540412.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.c63eafa7.js → diff.1b6cf85e.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.3a6905fc.js → django.b05a00dd.js} +1 -1
- package/dist/assets/{docker.e1bb4205.js → docker.6f265c46.js} +7 -7
- package/dist/assets/{dockerfile.a9f614c8.js → dockerfile.50e7896f.js} +1 -1
- package/dist/assets/documentation.ad1fdaf2.js +1 -0
- package/dist/assets/{dtd.5b2d40ab.js → dtd.4f30128b.js} +1 -1
- package/dist/assets/{dylan.744cd79f.js → dylan.295f582b.js} +1 -1
- package/dist/assets/{ebnf.6637a8f6.js → ebnf.48a4d2a4.js} +1 -1
- package/dist/assets/{ecl.cdabfae6.js → ecl.686a8714.js} +1 -1
- package/dist/assets/{eiffel.60b61e7f.js → eiffel.ee4a91b5.js} +1 -1
- package/dist/assets/{el-GR.98199dde.js → el-GR.103ebf8d.js} +1 -1
- package/dist/assets/{elm.74b68fc8.js → elm.3575efea.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.d6cd5265.js → erlang.2f06eab4.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.965cfdad.js → factor.59c6a149.js} +1 -1
- package/dist/assets/faq.63c79c18.js +2 -0
- package/dist/assets/{fcl.e515f605.js → fcl.a6a387b9.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.c62ab807.js → forth.eec0a81d.js} +1 -1
- package/dist/assets/{fortran.c0e428c5.js → fortran.b9df31da.js} +1 -1
- package/dist/assets/fr-CA.0e824ae4.js +1 -0
- package/dist/assets/fr-FR.77a5277c.js +1 -0
- package/dist/assets/{gas.fd59e425.js → gas.1bf79f8f.js} +1 -1
- package/dist/assets/gcp.6c61b39e.js +60 -0
- package/dist/assets/{gfm.8125a8e6.js → gfm.04d0828d.js} +1 -1
- package/dist/assets/{gherkin.c9a9f9d2.js → gherkin.f334d646.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.31390264.js → go.81bbba54.js} +1 -1
- package/dist/assets/{groovy.c940d48b.js → groovy.3fb79de5.js} +1 -1
- package/dist/assets/{haml.1a456af6.js → haml.9645befc.js} +1 -1
- package/dist/assets/{handlebars.d3c0e9e6.js → handlebars.c78fa1ca.js} +1 -1
- package/dist/assets/{haskell-literate.06d0d330.js → haskell-literate.ee77a8c9.js} +1 -1
- package/dist/assets/{haskell.f83a5b48.js → haskell.0f131af0.js} +1 -1
- package/dist/assets/{haxe.cf38bc86.js → haxe.5ecd20ea.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.4765ab1f.js → htmlembedded.b9d52c93.js} +1 -1
- package/dist/assets/{htmlmixed.a4506ee0.js → htmlmixed.b02b6e2e.js} +1 -1
- package/dist/assets/{http.cf2042b8.js → http.705b0cd9.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.2b562d7a.js → idl.ee86fe0e.js} +1 -1
- package/dist/assets/iis.e068f41a.js +24 -0
- package/dist/assets/import-export.d334c127.js +2 -0
- package/dist/assets/{index.44b36a96.js → index.0295bc4b.js} +1 -1
- package/dist/assets/{index.f6d90b7c.js → index.07257d01.js} +1 -1
- package/dist/assets/{index.515f0cb5.js → index.0e101049.js} +1 -1
- package/dist/assets/{index.bc3296ff.js → index.10f90411.js} +1 -1
- package/dist/assets/{index.17ad666d.js → index.14c720ba.js} +1 -1
- package/dist/assets/{index.6687eb7d.js → index.16acfb90.js} +1 -1
- package/dist/assets/{index.e9099679.js → index.175a81f8.js} +1 -1
- package/dist/assets/index.192147d5.css +1 -0
- package/dist/assets/{index.734cf408.js → index.1a65b37a.js} +1 -1
- package/dist/assets/{index.76212e14.js → index.1b44d300.js} +1 -1
- package/dist/assets/{index.35fb04b2.js → index.20b34242.js} +1 -1
- package/dist/assets/{index.b871b7a5.js → index.2598f40b.js} +1 -1
- package/dist/assets/{index.5490bf54.js → index.28aa754b.js} +1 -1
- package/dist/assets/{index.b955a1be.js → index.2926879f.js} +1 -1
- package/dist/assets/{index.ff5502c6.js → index.2ec06d14.js} +1 -1
- package/dist/assets/{index.05e20b6f.js → index.399c0d62.js} +1 -1
- package/dist/assets/{index.788544c8.js → index.3d4cd218.js} +1 -1
- package/dist/assets/{index.bbf0131f.js → index.3eda79ec.js} +1 -1
- package/dist/assets/{index.f334ad18.js → index.402d83c0.js} +1 -1
- package/dist/assets/{index.48fd0edb.js → index.4100d6f0.js} +1 -1
- package/dist/assets/{index.5312378b.js → index.43fa9898.js} +1 -1
- package/dist/assets/{index.90aad19e.js → index.456ff0bd.js} +1 -1
- package/dist/assets/{index.2ff40292.js → index.4e2109fe.js} +1 -1
- package/dist/assets/{index.4de2df6a.js → index.4ef25ded.js} +1 -1
- package/dist/assets/{index.c91867d3.js → index.4fbaebb7.js} +1 -1
- package/dist/assets/{index.5d10078c.js → index.55a12dfb.js} +1 -1
- package/dist/assets/{index.1d927fd3.js → index.56188e3b.js} +1 -1
- package/dist/assets/{index.ea326829.js → index.5c54c17f.js} +1 -1
- package/dist/assets/{index.f715fb2c.js → index.5f5bf5b9.js} +1 -1
- package/dist/assets/{index.064c96df.js → index.60d33aa1.js} +1 -1
- package/dist/assets/{index.491a4003.js → index.627523d7.js} +1 -1
- package/dist/assets/{index.921bf39b.js → index.63d1f569.js} +1 -1
- package/dist/assets/{index.27da0362.js → index.663b73a9.js} +1 -1
- package/dist/assets/{index.8c9bb9d2.js → index.6bebaca7.js} +1 -1
- package/dist/assets/{index.c219c9fd.js → index.6f0b7179.js} +1 -1
- package/dist/assets/{index.895a297f.css → index.6f497914.css} +1 -1
- package/dist/assets/{index.f5a62bca.js → index.7249f524.js} +1 -1
- package/dist/assets/{index.6752521e.js → index.77260d1d.js} +1 -1
- package/dist/assets/{index.5e2cb31c.js → index.7f906cfe.js} +1 -1
- package/dist/assets/{index.1a186179.js → index.7fd5e2a0.js} +1 -1
- package/dist/assets/{index.e9faa1b7.js → index.7fe984e4.js} +1 -1
- package/dist/assets/{index.0a4e8fad.js → index.8493b2e7.js} +1 -1
- package/dist/assets/{index.db01bb54.js → index.85b9f847.js} +1 -1
- package/dist/assets/{index.629b6c38.js → index.8a9f2874.js} +1 -1
- package/dist/assets/{index.859a78cb.js → index.93059741.js} +1 -1
- package/dist/assets/{index.f6a5906f.js → index.94cf6fb4.js} +1 -1
- package/dist/assets/{index.55f6227c.js → index.98713a56.js} +1 -1
- package/dist/assets/{index.009353d9.js → index.98ee194a.js} +1 -1
- package/dist/assets/{index.9fbcba2f.js → index.9b60cfa4.js} +1 -1
- package/dist/assets/{index.bc32829f.js → index.a3e085ea.js} +1 -1
- package/dist/assets/{index.1e0212f9.js → index.a40592f5.js} +1 -1
- package/dist/assets/{index.fc7b1181.js → index.a5d15d7f.js} +1 -1
- package/dist/assets/{index.71e28483.js → index.a71fa74c.js} +1 -1
- package/dist/assets/{index.e39c7e76.js → index.a8aa4628.js} +1 -1
- package/dist/assets/{index.9b23cd7f.js → index.a9b73f2c.js} +1 -1
- package/dist/assets/{index.fd2a5a74.js → index.a9faa4e8.js} +1 -1
- package/dist/assets/{index.ddbad0a0.js → index.af021d8a.js} +1 -1
- package/dist/assets/{index.8f901e72.js → index.b43832c6.js} +1 -1
- package/dist/assets/{index.44c7ed90.js → index.b5ed5076.js} +1 -1
- package/dist/assets/{index.540a1c0d.js → index.b67f8116.js} +1 -1
- package/dist/assets/{index.b635a926.js → index.b702042e.js} +1 -1
- package/dist/assets/{index.3c7e729b.js → index.bce5f50d.js} +1 -1
- package/dist/assets/{index.691d9c7a.js → index.bfd23a9c.js} +1 -1
- package/dist/assets/{index.70f6f88a.entry.js → index.c2e31551.entry.js} +226 -230
- package/dist/assets/{index.a40a776b.js → index.c2e6211e.js} +1 -1
- package/dist/assets/{index.f80921e7.js → index.c35b11e6.js} +1 -1
- package/dist/assets/{index.131b4ee8.js → index.c5266851.js} +1 -1
- package/dist/assets/{index.b09321f5.js → index.c6e501ec.js} +1 -1
- package/dist/assets/{index.ae9b035a.js → index.c9fb33ab.js} +1 -1
- package/dist/assets/{index.4ff10039.js → index.cc6496a8.js} +1 -1
- package/dist/assets/{index.d911a640.js → index.cda6c2d6.js} +1 -1
- package/dist/assets/{index.54a49224.js → index.cef58c9b.js} +1 -1
- package/dist/assets/{index.a9473e05.js → index.d060d5f6.js} +1 -1
- package/dist/assets/{index.b8baec6c.js → index.d0fe3776.js} +1 -1
- package/dist/assets/{index.e7e17448.js → index.d653bbf2.js} +1 -1
- package/dist/assets/{index.4533ce42.js → index.d8fe2ade.js} +1 -1
- package/dist/assets/{index.ff5a189a.js → index.d9285c22.js} +1 -1
- package/dist/assets/{index.bb82940a.js → index.e3dcc63c.js} +1 -1
- package/dist/assets/{index.c6ea1824.js → index.e6715953.js} +1 -1
- package/dist/assets/{index.08e6475d.js → index.ebb444cf.js} +1 -1
- package/dist/assets/{index.a0bc3d71.js → index.ee22568a.js} +1 -1
- package/dist/assets/{index.c54243ff.js → index.ef3faba8.js} +1 -1
- package/dist/assets/index.f0d32a46.js +26 -0
- package/dist/assets/{index.3acd783e.js → index.fa57ca3f.js} +1 -1
- package/dist/assets/{input-rich-text-html.2d85a8a3.css → input-rich-text-html.172a38cb.css} +1 -1
- package/dist/assets/input-rich-text-html.c72d474e.js +239 -0
- 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.29e9b67f.js → javascript-hint.af96cc6a.js} +1 -1
- package/dist/assets/{javascript.d2db845f.js → javascript.ed7a2c00.js} +1 -1
- package/dist/assets/{jinja2.f97723a0.js → jinja2.541c30d3.js} +1 -1
- package/dist/assets/{jsx.3f2b01c1.js → jsx.211ba53b.js} +1 -1
- package/dist/assets/{julia.fa920089.js → julia.66e518ec.js} +1 -1
- package/dist/assets/ko-KR.9056bd31.js +1 -0
- 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.2ec2e5ab.js → livescript.06428372.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.5e0c8497.js → lua.4f86b0e3.js} +1 -1
- package/dist/assets/manual.20d730b3.js +12 -0
- package/dist/assets/{mark-selection.54726b3f.js → mark-selection.c376d4be.js} +1 -1
- package/dist/assets/{match-highlighter.218123e7.js → match-highlighter.75cb1404.js} +1 -1
- package/dist/assets/{mathematica.df44764c.js → mathematica.1e1f53c5.js} +1 -1
- package/dist/assets/{mbox.491dfb6c.js → mbox.4a5729c3.js} +1 -1
- package/dist/assets/migrations.f13ec64d.js +19 -0
- package/dist/assets/{mirc.a9dca563.js → mirc.9b793041.js} +1 -1
- package/dist/assets/{mllike.0a469a43.js → mllike.4e43f07d.js} +1 -1
- package/dist/assets/{mn-MN.ae109212.js → mn-MN.c504a096.js} +1 -1
- package/dist/assets/{modelica.306697a8.js → modelica.deb73769.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.a45d586b.js → mscgen.48ffdfc0.js} +1 -1
- package/dist/assets/{multiplex.26e09ed5.js → multiplex.a2d83d7f.js} +1 -1
- package/dist/assets/{mumps.ae29c70e.js → mumps.210b8bdf.js} +1 -1
- package/dist/assets/{nginx.52e6bfcd.js → nginx.dbe68b8c.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.5869c4bd.js → nsis.5576ebf1.js} +1 -1
- package/dist/assets/{ntriples.c7dd54df.js → ntriples.07c64718.js} +1 -1
- package/dist/assets/{octave.ef49cef7.js → octave.9cb94caa.js} +1 -1
- package/dist/assets/operations.46679bea.js +1 -0
- package/dist/assets/operations.9995851b.js +169 -0
- package/dist/assets/{overlay.9a3d0cba.js → overlay.b1fd0f5a.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.6a13c27c.js → oz.4bedbc84.js} +1 -1
- package/dist/assets/panels.570ee526.js +65 -0
- package/dist/assets/{pascal.77947c82.js → pascal.9f3e47db.js} +1 -1
- package/dist/assets/{pegjs.fb3674fc.js → pegjs.38dabda4.js} +1 -1
- package/dist/assets/{perl.bd20c5e2.js → perl.d07c357e.js} +1 -1
- package/dist/assets/permissions.768d1878.js +178 -0
- package/dist/assets/{php.f7000a8d.js → php.a2fb29e5.js} +1 -1
- package/dist/assets/{pig.7044156f.js → pig.cc357f9e.js} +1 -1
- package/dist/assets/pl-PL.80cfbed6.js +1 -0
- package/dist/assets/plesk.b0ee9a9a.js +27 -0
- package/dist/assets/{powershell.d6251d29.js → powershell.283f357b.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.21d46a91.js → properties.57480d0c.js} +1 -1
- package/dist/assets/{protobuf.0595884b.js → protobuf.c1758733.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.02047604.js → pug.bdcaf1c5.js} +1 -1
- package/dist/assets/{puppet.7c07ba75.js → puppet.8b6ff9f4.js} +1 -1
- package/dist/assets/{python.fe6c7a24.js → python.987c2ae7.js} +1 -1
- package/dist/assets/{q.bfdf1988.js → q.85f4c589.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.d6b5ac21.js → r.25d10fd4.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.92483469.js → rpm.8909ead0.js} +1 -1
- package/dist/assets/{rst.b2603799.js → rst.4d43ef54.js} +1 -1
- package/dist/assets/ru-RU.35703ea4.js +1 -0
- package/dist/assets/{ruby.0246dbd5.js → ruby.b7e26986.js} +1 -1
- package/dist/assets/running-locally.ce0a8200.js +26 -0
- package/dist/assets/{rust.dd8abd8d.js → rust.6984b11a.js} +1 -1
- package/dist/assets/{sas.d26b2302.js → sas.91990a72.js} +1 -1
- package/dist/assets/{sass.a791aa27.js → sass.898f89c7.js} +1 -1
- package/dist/assets/{scheme.ef2b1440.js → scheme.f661c5b8.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.2f3bc735.js → shell.af2902da.js} +1 -1
- package/dist/assets/{show-hint.6fa4d537.js → show-hint.2d43524d.js} +1 -1
- package/dist/assets/{sieve.99fca314.js → sieve.327a81f8.js} +1 -1
- package/dist/assets/{simple.0e90a38e.js → simple.4fb4f28d.js} +1 -1
- package/dist/assets/{sl-SI.719d987e.js → sl-SI.632899f8.js} +1 -1
- package/dist/assets/{slim.92d997b6.js → slim.e97ce531.js} +1 -1
- package/dist/assets/{smalltalk.a9b3ffec.js → smalltalk.b9556415.js} +1 -1
- package/dist/assets/{smarty.c54a652c.js → smarty.d91926e3.js} +1 -1
- package/dist/assets/{solr.1356a877.js → solr.20381d3e.js} +1 -1
- package/dist/assets/{soy.e1b19eef.js → soy.a0154260.js} +1 -1
- package/dist/assets/{sparql.1335f7a5.js → sparql.36de4d3f.js} +1 -1
- package/dist/assets/{spreadsheet.e9096343.js → spreadsheet.00a4877b.js} +1 -1
- package/dist/assets/{sql.ac45a460.js → sql.1f7dd82a.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.fb7fd990.js → stex.2b7cb363.js} +1 -1
- package/dist/assets/{stylus.d0281b2a.js → stylus.123ca166.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.a9fd2d64.js → swift.9ca91d28.js} +1 -1
- package/dist/assets/{tcl.8f7bdfb5.js → tcl.1b7f83bd.js} +1 -1
- package/dist/assets/teams.44eb670e.js +1 -0
- package/dist/assets/{textile.ae199003.js → textile.ee402504.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.52caa0ed.js → tiddlywiki.67540872.js} +1 -1
- package/dist/assets/{tiki.831b9315.js → tiki.fb6dd4a0.js} +1 -1
- package/dist/assets/{toml.6f660b6b.js → toml.9c5fe3d8.js} +1 -1
- package/dist/assets/{tornado.01563722.js → tornado.c681a8fd.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.f5f797f2.js → troff.a6f4e798.js} +1 -1
- package/dist/assets/{ttcn-cfg.a6927435.js → ttcn-cfg.a0214838.js} +1 -1
- package/dist/assets/{ttcn.24c6b925.js → ttcn.4c22a431.js} +1 -1
- package/dist/assets/{turtle.d0e831a8.js → turtle.d40e9c31.js} +1 -1
- package/dist/assets/{twig.d5e90842.js → twig.d78613df.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 +28 -0
- 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.bb33c7a5.js → vb.5adeb8ea.js} +1 -1
- package/dist/assets/{vbscript.d8f8d95e.js → vbscript.27937162.js} +1 -1
- package/dist/assets/{velocity.26721ec5.js → velocity.581c25aa.js} +1 -1
- package/dist/assets/{verilog.24512a86.js → verilog.9f72c282.js} +1 -1
- package/dist/assets/{vhdl.6e64552d.js → vhdl.4d290e0b.js} +1 -1
- package/dist/assets/{vi-VN.7478a743.js → vi-VN.3e9c985f.js} +1 -1
- package/dist/assets/{vue.4450af40.js → vue.cf5a232a.js} +1 -1
- package/dist/assets/{wast.79f64b4c.js → wast.16f886c5.js} +1 -1
- package/dist/assets/webhooks.00ee297b.js +147 -0
- package/dist/assets/webhooks.01ddb390.js +1 -0
- package/dist/assets/{webidl.860cea4e.js → webidl.1185b166.js} +1 -1
- package/dist/assets/{xquery.23f4fa34.js → xquery.34864271.js} +1 -1
- package/dist/assets/{yacas.0d60e6b0.js → yacas.880a270b.js} +1 -1
- package/dist/assets/{yaml-frontmatter.70ea956b.js → yaml-frontmatter.4cec6c13.js} +1 -1
- package/dist/assets/{yaml.9d5c3ac9.js → yaml.15292258.js} +1 -1
- package/dist/assets/{z80.527b7cb8.js → z80.727a7271.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 +3 -3
- package/package.json +10 -7
- package/dist/assets/accounts.08433099.js +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/authentication.a6f04750.js +0 -73
- package/dist/assets/aws.3b1c64af.js +0 -1
- package/dist/assets/backing-directus.1ed89e33.js +0 -1
- package/dist/assets/bg-BG.0eca7613.js +0 -2
- 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.1c745e99.css +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.d1197f4c.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.956444f4.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.3e651030.js +0 -1
- package/dist/assets/files.064d5a35.js +0 -187
- package/dist/assets/filter-rules.e442e006.js +0 -76
- package/dist/assets/filters.3db1b044.js +0 -1
- package/dist/assets/folders.0024d3d3.js +0 -132
- package/dist/assets/fr-CA.6d6d8d1f.js +0 -1
- package/dist/assets/fr-FR.7fa01b32.js +0 -1
- package/dist/assets/gcp.627205b5.js +0 -60
- package/dist/assets/github-ci.abd39dcc.js +0 -2
- package/dist/assets/glossary.75ca2027.js +0 -1
- package/dist/assets/glossary.bf083fb1.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.40c42250.css +0 -1
- package/dist/assets/index.9b42e31d.js +0 -26
- package/dist/assets/input-rich-text-html.1550fe06.js +0 -240
- 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.7c5efc8a.js +0 -1
- package/dist/assets/introduction.d5621d79.js +0 -1
- package/dist/assets/it-IT.34d52fbd.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/ko-KR.30f60079.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/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.22d5965f.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.b0451bed.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/revisions.2898106e.js +0 -40
- package/dist/assets/roles.9fec37da.js +0 -171
- package/dist/assets/ru-RU.39540ee0.js +0 -1
- 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/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/use-sync.ded22f96.js +0 -28
- 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
- package/dist/robots.txt +0 -2
|
@@ -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};
|