directus-cms-extensions
v1.2.0
Published
* Open folder with extension in terminal * For plain extension run ```directus-extension build``` + ```directus-extension-builder.js``` \ for bundles run ```directus-extension build``` + ```directus-extension-bundles-builder.js```
Downloads
2
Readme
Building
- Open folder with extension in terminal
- For plain extension run
directus-extension build
+directus-extension-builder.js
for bundles rundirectus-extension build
+directus-extension-bundles-builder.js
Extensions:
You can find docs for operations in corresponding folders
Testing:
There is explained an approach how to create and maintain tests with Directus entities
like Flows and Operations.
Each test labeled with prefix [TEST | **]
.
We have 3 types ones: [TEST | START]
, [TEST | TESTS FLOWS]
, [TEST | FLOW]
.
[TEST | START] - Main launcher for all test cases.
Schema: [Webhook: flow] -> [Trigger flow: operation] -> [Run script: operation] -> [Output: operation]- [Webhook: flow] - launcher for testing, for example webhook flow.
- [Trigger flow: operation] - type:
Trigger flow
operation. Triggers [TEST | TEST FLOWS] and gets common result from there. Key: main_output. - [Run script: operation] - type:
Run script
operation. Gets common result and prepare a report.
Prepare tests output code:
module.exports = async function(data) { const defaultFields = { $trigger: '$trigger', $last: '$last', $accountability: '$accountability', $env: '$env' }; const testsResult = { status: '', passed: {tests: []}, failed: {tests: []} }; const checkedTests = Object.keys(data.main_output) .filter((key) => !defaultFields[key]) .map((key) => data.main_output[key]) .forEach((t) => { if (t.status === 'success') { testsResult.passed.tests.push(t); } else { testsResult.failed.tests.push(t); } delete t.status; }); testsResult.passed.count = testsResult.passed.tests.length; testsResult.failed.count = testsResult.failed.tests.length; testsResult.status = testsResult.failed.count ? 'failed' : 'success'; return testsResult; }
* [TEST | TEST FLOWS] - Collects data from chain of [TEST | FLOW] and returns to it's trigger in [TEST | START] \
Schema: [Another flow: flow] -> [Trigger flow: operation] -> [Trigger flow: operation] ...
* [Another flow: flow] - triggers chain of triggers flow operation, collects and returns data.
data to own trigger. <ins>Response body - All data</ins>.
* [Trigger flow: operation] - trigger for `[TEST | FLOW]`(test).
* [TEST | FLOW] - Triggers testing operation, testing and return response.
Schema: [Another flow: flow] -> [Testing operations: operation] -> [Run script: operation]
* [Another flow: flow] - triggers chain of tested operations, collects and returns data. <ins>Response body - Data of last operation</ins>
* [Testing operations: operation] - tested operations.
* [Run script: operation] - gets operations output, prepare and return response with next interface.
Success: `{test: '<operation name>', status: 'success'}` \
Failure: ` {test: '<operation name>', step: '<operation step>', status: 'error'}`
---
Tested operations:
* [TEST | FLOW] CRUD user flow - create_users/read_users/update_users/delete_users
* [TEST | FLOW] Create proxy - serp
* [TEST | FLOW] Generate pin code - generate_pin_code
* [TEST | FLOW] JWT flow - create_jwt/verify_jwt
* [TEST | FLOW] OpenAI - openai/openai_embeddings
* [TEST | FLOW] Translations - deepL
* [TEST | FLOW] Web-scraping - scrape_webpage/get_website_urls/get_website_dead_urls
* [TEST | FLOW] Communication - send_sms_by_gateway/send_emails_by_mailgun/send_fb_push_notifications
Test cases you can find in /directus-tests file