Compare commits
3 Commits
changedete
...
AUT-980
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d893a36a47 | ||
![]() |
c62aea3852 | ||
![]() |
58c90da385 |
@@ -0,0 +1,29 @@
|
|||||||
|
import defineAction from '../../../../helpers/define-action.js';
|
||||||
|
|
||||||
|
export default defineAction({
|
||||||
|
name: 'Create a watch',
|
||||||
|
key: 'createWatch',
|
||||||
|
description: 'Creates a new change detection watch for a specific website.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'URL',
|
||||||
|
key: 'url',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
variables: true,
|
||||||
|
description: 'Url you want to monitor',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const url = $.step.parameters.url;
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
url,
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await $.http.post('/v1/watch', body);
|
||||||
|
|
||||||
|
$.setActionItem({ raw: response.data });
|
||||||
|
},
|
||||||
|
});
|
@@ -0,0 +1,29 @@
|
|||||||
|
import defineAction from '../../../../helpers/define-action.js';
|
||||||
|
|
||||||
|
export default defineAction({
|
||||||
|
name: 'Delete a watch',
|
||||||
|
key: 'deleteWatch',
|
||||||
|
description: 'Deletes a change detection watch.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Watch ID',
|
||||||
|
key: 'watchId',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
variables: true,
|
||||||
|
description: 'Watch id you want to delete',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const watchId = $.step.parameters.watchId;
|
||||||
|
|
||||||
|
await $.http.delete(`/v1/watch/${watchId}`);
|
||||||
|
|
||||||
|
$.setActionItem({
|
||||||
|
raw: {
|
||||||
|
result: 'successful',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
@@ -0,0 +1,4 @@
|
|||||||
|
import createWatch from './create-watch/index.js';
|
||||||
|
import deleteWatch from './delete-watch/index.js';
|
||||||
|
|
||||||
|
export default [createWatch, deleteWatch];
|
@@ -0,0 +1,3 @@
|
|||||||
|
import listWatches from './list-watches/index.js';
|
||||||
|
|
||||||
|
export default [listWatches];
|
@@ -0,0 +1,24 @@
|
|||||||
|
export default {
|
||||||
|
name: 'List watches',
|
||||||
|
key: 'listWatches',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const watches = {
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await $.http.get('/v1/watch');
|
||||||
|
const watchIds = Object.keys(data);
|
||||||
|
|
||||||
|
if (watchIds?.length) {
|
||||||
|
for (const watchId of watchIds) {
|
||||||
|
watches.data.push({
|
||||||
|
value: watchId,
|
||||||
|
name: data[watchId].url,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return watches;
|
||||||
|
},
|
||||||
|
};
|
@@ -2,6 +2,9 @@ import defineApp from '../../helpers/define-app.js';
|
|||||||
import addAuthHeader from './common/add-auth-header.js';
|
import addAuthHeader from './common/add-auth-header.js';
|
||||||
import auth from './auth/index.js';
|
import auth from './auth/index.js';
|
||||||
import setBaseUrl from './common/set-base-url.js';
|
import setBaseUrl from './common/set-base-url.js';
|
||||||
|
import actions from './actions/index.js';
|
||||||
|
import dynamicData from './dynamic-data/index.js';
|
||||||
|
import triggers from './triggers/index.js';
|
||||||
|
|
||||||
export default defineApp({
|
export default defineApp({
|
||||||
name: 'Changedetection',
|
name: 'Changedetection',
|
||||||
@@ -14,4 +17,7 @@ export default defineApp({
|
|||||||
primaryColor: '3056d3',
|
primaryColor: '3056d3',
|
||||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
beforeRequest: [setBaseUrl, addAuthHeader],
|
||||||
auth,
|
auth,
|
||||||
|
actions,
|
||||||
|
dynamicData,
|
||||||
|
triggers,
|
||||||
});
|
});
|
||||||
|
@@ -0,0 +1,43 @@
|
|||||||
|
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'Changed watch',
|
||||||
|
key: 'changedWatch',
|
||||||
|
pollInterval: 15,
|
||||||
|
description: 'Triggers when any changes detected.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Watch',
|
||||||
|
key: 'watchId',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listWatches',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const watchId = $.step.parameters.watchId;
|
||||||
|
|
||||||
|
const { data } = await $.http.get(`v1/watch/${watchId}`);
|
||||||
|
|
||||||
|
if (Object.keys(data).length !== 0) {
|
||||||
|
$.pushTriggerItem({
|
||||||
|
raw: data,
|
||||||
|
meta: {
|
||||||
|
internalId: `${watchId}-${data.last_changed}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
@@ -0,0 +1,3 @@
|
|||||||
|
import changedWatch from './changed-watch/index.js';
|
||||||
|
|
||||||
|
export default [changedWatch];
|
@@ -46,6 +46,8 @@ export default defineConfig({
|
|||||||
collapsible: true,
|
collapsible: true,
|
||||||
collapsed: true,
|
collapsed: true,
|
||||||
items: [
|
items: [
|
||||||
|
{ text: 'Triggers', link: '/apps/changedetection/triggers' },
|
||||||
|
{ text: 'Actions', link: '/apps/changedetection/actions' },
|
||||||
{ text: 'Connection', link: '/apps/changedetection/connection' },
|
{ text: 'Connection', link: '/apps/changedetection/connection' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
14
packages/docs/pages/apps/changedetection/actions.md
Normal file
14
packages/docs/pages/apps/changedetection/actions.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
favicon: /favicons/changedetection.svg
|
||||||
|
items:
|
||||||
|
- name: Create a watch
|
||||||
|
desc: Creates a new change detection watch for a specific website.
|
||||||
|
- name: Delete a watch
|
||||||
|
desc: Deletes a change detection watch.
|
||||||
|
---
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import CustomListing from '../../components/CustomListing.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<CustomListing />
|
12
packages/docs/pages/apps/changedetection/triggers.md
Normal file
12
packages/docs/pages/apps/changedetection/triggers.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
favicon: /favicons/changedetection.svg
|
||||||
|
items:
|
||||||
|
- name: Changed watch
|
||||||
|
desc: Triggers when any changes detected.
|
||||||
|
---
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import CustomListing from '../../components/CustomListing.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<CustomListing />
|
@@ -3,6 +3,7 @@
|
|||||||
The following integrations are currently supported by Automatisch.
|
The following integrations are currently supported by Automatisch.
|
||||||
|
|
||||||
- [Carbone](/apps/carbone/actions)
|
- [Carbone](/apps/carbone/actions)
|
||||||
|
- [Changedetection](/apps/changedetection/actions)
|
||||||
- [Datastore](/apps/datastore/actions)
|
- [Datastore](/apps/datastore/actions)
|
||||||
- [DeepL](/apps/deepl/actions)
|
- [DeepL](/apps/deepl/actions)
|
||||||
- [Delay](/apps/delay/actions)
|
- [Delay](/apps/delay/actions)
|
||||||
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 9.9 KiB |
Reference in New Issue
Block a user