directus-template-cli 0.3.0-beta.7 → 0.3.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.
Files changed (46) hide show
  1. package/oclif.manifest.json +1 -1
  2. package/package.json +1 -1
  3. package/templates/agencyos/src/collections.json +152 -181
  4. package/templates/agencyos/src/content/block_button.json +9 -9
  5. package/templates/agencyos/src/content/block_button_group.json +4 -4
  6. package/templates/agencyos/src/content/block_columns_rows.json +6 -6
  7. package/templates/agencyos/src/content/block_gallery_files.json +10 -70
  8. package/templates/agencyos/src/content/block_hero.json +4 -4
  9. package/templates/agencyos/src/content/block_step_items.json +5 -5
  10. package/templates/agencyos/src/content/block_team.json +4 -4
  11. package/templates/agencyos/src/content/block_testimonial_slider_items.json +8 -8
  12. package/templates/agencyos/src/content/categories.json +2 -2
  13. package/templates/agencyos/src/content/globals.json +12 -12
  14. package/templates/agencyos/src/content/help_collections.json +2 -2
  15. package/templates/agencyos/src/content/navigation.json +1 -1
  16. package/templates/agencyos/src/content/navigation_items.json +40 -71
  17. package/templates/agencyos/src/content/os_deal_stages.json +6 -6
  18. package/templates/agencyos/src/content/os_email_templates.json +1 -1
  19. package/templates/agencyos/src/content/os_expenses.json +2 -2
  20. package/templates/agencyos/src/content/os_invoice_items.json +6 -6
  21. package/templates/agencyos/src/content/os_invoices.json +3 -3
  22. package/templates/agencyos/src/content/os_items.json +1 -1
  23. package/templates/agencyos/src/content/os_payments.json +1 -1
  24. package/templates/agencyos/src/content/os_project_templates.json +4 -4
  25. package/templates/agencyos/src/content/os_proposal_approvals.json +1 -44
  26. package/templates/agencyos/src/content/os_proposal_blocks.json +0 -22
  27. package/templates/agencyos/src/content/os_proposals.json +3 -6
  28. package/templates/agencyos/src/content/os_tasks.json +44 -44
  29. package/templates/agencyos/src/content/page_blocks.json +5 -29
  30. package/templates/agencyos/src/content/pages.json +11 -11
  31. package/templates/agencyos/src/content/pages_blog.json +1 -1
  32. package/templates/agencyos/src/content/pages_projects.json +1 -1
  33. package/templates/agencyos/src/content/post_gallery_items.json +5 -5
  34. package/templates/agencyos/src/content/posts.json +49 -49
  35. package/templates/agencyos/src/content/redirects.json +1 -1
  36. package/templates/agencyos/src/content/seo.json +0 -710
  37. package/templates/agencyos/src/content/team.json +5 -5
  38. package/templates/agencyos/src/dashboards.json +6 -6
  39. package/templates/agencyos/src/files.json +147 -147
  40. package/templates/agencyos/src/flows.json +26 -26
  41. package/templates/agencyos/src/operations.json +111 -111
  42. package/templates/agencyos/src/panels.json +174 -174
  43. package/templates/agencyos/src/permissions.json +0 -99
  44. package/templates/agencyos/src/schema/snapshot.json +0 -71
  45. package/templates/agencyos/src/settings.json +33 -33
  46. package/templates/agencyos/src/users.json +3 -3
@@ -1,10 +1,10 @@
1
1
  [
2
2
  {
3
- "id": "0a95cdb6-8492-43e8-a2c9-0dfdc0ea2a9d",
4
3
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
5
4
  "flow": "8106be67-aa96-4260-aac7-8ab129bb944b",
6
5
  "reject": "cae72421-7737-4dd7-af91-ef0ce795bb36",
7
6
  "resolve": "e77e2f02-ba09-4cf1-85ff-acd0f85f02e2",
7
+ "id": "0a95cdb6-8492-43e8-a2c9-0dfdc0ea2a9d",
8
8
  "date_created": "2023-09-10T20:46:26.467Z",
9
9
  "type": "condition",
10
10
  "key": "if_website",
@@ -20,15 +20,15 @@
20
20
  }
21
21
  }
22
22
  },
23
- "position_x": 19,
24
- "position_y": 1
23
+ "position_y": 1,
24
+ "position_x": 19
25
25
  },
26
26
  {
27
- "id": "0cb36f9e-c84d-4e85-b23c-7eaf2b3e2f6b",
28
27
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
29
28
  "flow": "201e023d-6b67-4068-bc21-d60ef5b7668d",
30
29
  "reject": null,
31
30
  "resolve": "aa0755b9-1bef-422c-b03d-07af0e42ab2a",
31
+ "id": "0cb36f9e-c84d-4e85-b23c-7eaf2b3e2f6b",
32
32
  "date_created": "2023-09-14T05:09:37.510Z",
33
33
  "type": "exec",
34
34
  "key": "calculations",
@@ -36,15 +36,15 @@
36
36
  "options": {
37
37
  "code": "function sumValues(items, propName) {\n return items.reduce((total, item) => total + (parseFloat(item[propName] || 0)), 0);\n}\n\nfunction calculateInvoiceTotals(invoice) {\n const lineItems = invoice.line_items || [];\n const subtotal = sumValues(lineItems, 'line_amount').toFixed(2);\n const totalTax = sumValues(lineItems, 'tax_amount').toFixed(2);\n const total = (parseFloat(subtotal) + parseFloat(totalTax)).toFixed(2);\n\n let changes = {};\n if (invoice.subtotal !== subtotal) changes.subtotal = subtotal;\n if (invoice.total_tax !== totalTax) changes.total_tax = totalTax;\n if (invoice.total !== total) changes.total = total;\n\n return {\n changes: Object.keys(changes).length > 0 ? changes : null,\n total: total\n };\n}\n\nfunction calculateInvoicePayments(invoice, calculatedTotal) {\n const payments = invoice.payments || [];\n const totalPayments = sumValues(payments, 'amount').toFixed(2);\n const amountDue = (parseFloat(calculatedTotal) - parseFloat(totalPayments)).toFixed(2);\n\n let changes = {};\n if (invoice.amount_due !== amountDue) changes.amount_due = amountDue;\n if (invoice.amount_paid !== totalPayments) changes.amount_paid = totalPayments;\n\t\n if (invoice.status === 'paid' && parseFloat(totalPayments) < parseFloat(calculatedTotal)) {\n changes.status = 'unpaid';\n } else if (invoice.status !== 'paid' && parseFloat(totalPayments) >= parseFloat(calculatedTotal)) {\n changes.status = 'paid';\n }\n\n return Object.keys(changes).length > 0 ? changes : null;\n}\n\nmodule.exports = async function processInvoiceChanges(data) {\n const invoice = data.invoice;\n if (!invoice) throw new Error(\"Invalid invoice data\");\n\n const { changes: totalsChanges, total: calculatedTotal } = calculateInvoiceTotals(invoice);\n const paymentChanges = calculateInvoicePayments(invoice, calculatedTotal);\n\n if (!totalsChanges && !paymentChanges) throw new Error('No changes necessary');\n\n return { ...totalsChanges, ...paymentChanges };\n};\n"
38
38
  },
39
- "position_x": 39,
40
- "position_y": 1
39
+ "position_y": 1,
40
+ "position_x": 39
41
41
  },
42
42
  {
43
- "id": "18e48c59-e5af-4988-9b85-55e499549149",
44
43
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
45
44
  "flow": "f78d4723-8d74-4ffc-8a82-06a31c857584",
46
45
  "reject": null,
47
46
  "resolve": null,
47
+ "id": "18e48c59-e5af-4988-9b85-55e499549149",
48
48
  "date_created": "2023-09-12T20:04:56.897Z",
49
49
  "type": "mail",
50
50
  "key": "send_email",
@@ -57,15 +57,15 @@
57
57
  "type": "wysiwyg",
58
58
  "body": "<div>{{$trigger.body.message}}</div>\n<div>&nbsp;</div>\n<div><strong><a href=\"http://localhost:3000/proposals/{{get_proposal.id}}?approver={{get_proposal.contacts[0].contacts_id.id}}\" target=\"_blank\" rel=\"noopener\">Review Proposal</a></strong></div>"
59
59
  },
60
- "position_x": 37,
61
- "position_y": 1
60
+ "position_y": 1,
61
+ "position_x": 37
62
62
  },
63
63
  {
64
- "id": "1d167b20-13af-4f0b-afe1-a4c4d8971654",
65
64
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
66
65
  "flow": "b94189fe-0d20-4611-88a1-dd7b5d419b35",
67
66
  "reject": null,
68
67
  "resolve": "adcc6c22-a63a-46dc-8f1c-cb0b997a3106",
68
+ "id": "1d167b20-13af-4f0b-afe1-a4c4d8971654",
69
69
  "date_created": "2023-09-09T02:13:28.859Z",
70
70
  "type": "exec",
71
71
  "key": "slug_me",
@@ -73,15 +73,15 @@
73
73
  "options": {
74
74
  "code": "module.exports = async function (data) {\n\t// Index data to get the string you want to slugify\n\t// Assign it to the \"text\" var below.\n\tconst text = data.$trigger.payload.title;\n\n\tconst slug = text\n\t\t.toLowerCase()\n\t\t.trim()\n\t\t.replace(/[^\\w\\s-]/g, '')\n\t\t.replace(/[\\s_-]+/g, '-')\n\t\t.replace(/^-+|-+$/g, '');\n\n\treturn slug;\n};\n"
75
75
  },
76
- "position_x": 19,
77
- "position_y": 1
76
+ "position_y": 1,
77
+ "position_x": 19
78
78
  },
79
79
  {
80
- "id": "40fd454c-a438-47bb-9bc5-399d1fffd562",
81
80
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
82
81
  "flow": "0f8ea882-219d-4823-bb80-bc725d280c3a",
83
82
  "reject": "70242292-da15-47fc-8ec8-edc40d192410",
84
83
  "resolve": "a207e95a-65b9-488e-ac1f-3fbabb01446c",
84
+ "id": "40fd454c-a438-47bb-9bc5-399d1fffd562",
85
85
  "date_created": "2023-09-09T02:13:28.886Z",
86
86
  "type": "exec",
87
87
  "key": "check_build_hook",
@@ -89,15 +89,15 @@
89
89
  "options": {
90
90
  "code": "module.exports = async function(data) {\n\tconst build_hook_url = data.globals.build_hook_url\n if (!build_hook_url) throw new Error('Missing build hook url')\n return build_hook_url\n}"
91
91
  },
92
- "position_x": 37,
93
- "position_y": 1
92
+ "position_y": 1,
93
+ "position_x": 37
94
94
  },
95
95
  {
96
- "id": "427ee1d9-4bac-4113-96ea-c3911bc8ed21",
97
96
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
98
97
  "flow": "7de538a5-bc7b-4563-8be3-dc8d3879df6a",
99
98
  "reject": null,
100
99
  "resolve": "8d1406b1-bc45-4564-8d0c-c9db1101ece3",
100
+ "id": "427ee1d9-4bac-4113-96ea-c3911bc8ed21",
101
101
  "date_created": "2023-09-09T13:49:42.597Z",
102
102
  "type": "exec",
103
103
  "key": "increment_invoice_number",
@@ -105,15 +105,15 @@
105
105
  "options": {
106
106
  "code": "module.exports = async function(data) {\n\tlet nextInvoiceNumber = data.invoice_settings[0].next_invoice_number\n nextInvoiceNumber++\n\treturn nextInvoiceNumber;\n}"
107
107
  },
108
- "position_x": 19,
109
- "position_y": 19
108
+ "position_y": 19,
109
+ "position_x": 19
110
110
  },
111
111
  {
112
- "id": "43c19fc5-0b7e-410a-bda6-a88273f983d0",
113
112
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
114
113
  "flow": "f302764e-84d7-4208-8c6d-d4da76400544",
115
114
  "reject": null,
116
115
  "resolve": "e0745757-aada-4167-9faf-d119b2b37c99",
116
+ "id": "43c19fc5-0b7e-410a-bda6-a88273f983d0",
117
117
  "date_created": "2023-10-04T17:43:17.051Z",
118
118
  "type": "exec",
119
119
  "key": "handle_trigger",
@@ -121,15 +121,15 @@
121
121
  "options": {
122
122
  "code": "function extractKey(obj) {\n if (obj.key) {\n // If \"key\" property exists, return its value\n return obj.key;\n } else if (obj.keys && Array.isArray(obj.keys) && obj.keys.length > 0) {\n // If \"keys\" property exists, is an array, and has at least one element, return the first element\n return obj.keys[0];\n } else {\n // If neither condition is met, return null or throw an error\n throw new Error('Key not found');\n \n }\n}\n\n\nmodule.exports = async function(data) {\n\tconst key = extractKey(data.$trigger)\n \n return key\n}"
123
123
  },
124
- "position_x": 37,
125
- "position_y": 1
124
+ "position_y": 1,
125
+ "position_x": 37
126
126
  },
127
127
  {
128
- "id": "43e30267-a0bd-43e9-8f3c-56be4dcf565a",
129
128
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
130
129
  "flow": "e9a31eab-99aa-453e-8889-b7339ed31034",
131
130
  "reject": null,
132
131
  "resolve": "bae0bd5b-bdc7-4b75-9b33-7b63eca22a23",
132
+ "id": "43e30267-a0bd-43e9-8f3c-56be4dcf565a",
133
133
  "date_created": "2023-09-10T19:56:14.533Z",
134
134
  "type": "item-read",
135
135
  "key": "get_project_template",
@@ -140,15 +140,15 @@
140
140
  "{{$trigger.body.os_project_template.key}}"
141
141
  ]
142
142
  },
143
- "position_x": 20,
144
- "position_y": 1
143
+ "position_y": 1,
144
+ "position_x": 20
145
145
  },
146
146
  {
147
- "id": "58124944-d33c-4d7e-8fd3-dfe76309ff7b",
148
147
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
149
148
  "flow": "f302764e-84d7-4208-8c6d-d4da76400544",
150
149
  "reject": null,
151
150
  "resolve": "43c19fc5-0b7e-410a-bda6-a88273f983d0",
151
+ "id": "58124944-d33c-4d7e-8fd3-dfe76309ff7b",
152
152
  "date_created": "2023-10-05T11:46:33.871Z",
153
153
  "type": "item-read",
154
154
  "key": "settings",
@@ -157,15 +157,15 @@
157
157
  "collection": "os_settings",
158
158
  "permissions": "$full"
159
159
  },
160
- "position_x": 19,
161
- "position_y": 1
160
+ "position_y": 1,
161
+ "position_x": 19
162
162
  },
163
163
  {
164
- "id": "5cee46e9-e59e-4bee-8958-6e21e46f1da1",
165
164
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
166
165
  "flow": "8106be67-aa96-4260-aac7-8ab129bb944b",
167
166
  "reject": null,
168
167
  "resolve": "daaac907-97f2-4cac-9687-132d6bf7f392",
168
+ "id": "5cee46e9-e59e-4bee-8958-6e21e46f1da1",
169
169
  "date_created": "2023-09-11T00:51:24.102Z",
170
170
  "type": "exec",
171
171
  "key": "extract_domain",
@@ -173,15 +173,15 @@
173
173
  "options": {
174
174
  "code": "function extractDomain(inputUrl) {\n\t// Regular expression to extract domain from URL\n\tconst regex = /^(?:https?:\\/\\/)?(?:www\\.)?([^\\/?#]+)(?:[\\/?#]|$)/i;\n\tconst matches = inputUrl.match(regex);\n\n\t// Return the matched domain or undefined if not found\n\treturn matches && matches[1];\n}\n\nmodule.exports = function (data) {\n\tconst website = data.$trigger.payload.website;\n\n\tconst domain = extractDomain(website);\n\n\tif (!domain) {\n\t\tthrow new Error('Unable to properly determine the domain for this website');\n\t}\n\treturn domain;\n};\n"
175
175
  },
176
- "position_x": 55,
177
- "position_y": 1
176
+ "position_y": 1,
177
+ "position_x": 55
178
178
  },
179
179
  {
180
- "id": "70242292-da15-47fc-8ec8-edc40d192410",
181
180
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
182
181
  "flow": "0f8ea882-219d-4823-bb80-bc725d280c3a",
183
182
  "reject": null,
184
183
  "resolve": null,
184
+ "id": "70242292-da15-47fc-8ec8-edc40d192410",
185
185
  "date_created": "2023-09-09T02:13:28.898Z",
186
186
  "type": "log",
187
187
  "key": "log_error",
@@ -189,15 +189,15 @@
189
189
  "options": {
190
190
  "message": "Missing build hook URL"
191
191
  },
192
- "position_x": 55,
193
- "position_y": 17
192
+ "position_y": 17,
193
+ "position_x": 55
194
194
  },
195
195
  {
196
- "id": "86e25afa-0940-4970-a331-979b6efb2112",
197
196
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
198
197
  "flow": "6f4dcc83-5b25-4477-a898-3c1314cfe36f",
199
198
  "reject": null,
200
199
  "resolve": "a395ac61-f429-481e-b957-19e9ce0ef2eb",
200
+ "id": "86e25afa-0940-4970-a331-979b6efb2112",
201
201
  "date_created": "2023-09-14T04:23:11.886Z",
202
202
  "type": "item-read",
203
203
  "key": "invoice_items",
@@ -214,15 +214,15 @@
214
214
  ]
215
215
  }
216
216
  },
217
- "position_x": 19,
218
- "position_y": 1
217
+ "position_y": 1,
218
+ "position_x": 19
219
219
  },
220
220
  {
221
- "id": "870017e8-bc7d-459b-a087-04cc00f05a5c",
222
221
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
223
222
  "flow": "f78d4723-8d74-4ffc-8a82-06a31c857584",
224
223
  "reject": null,
225
224
  "resolve": "18e48c59-e5af-4988-9b85-55e499549149",
225
+ "id": "870017e8-bc7d-459b-a087-04cc00f05a5c",
226
226
  "date_created": "2023-09-12T19:56:06.495Z",
227
227
  "type": "item-read",
228
228
  "key": "get_proposal",
@@ -240,15 +240,15 @@
240
240
  ],
241
241
  "collection": "os_proposals"
242
242
  },
243
- "position_x": 19,
244
- "position_y": 1
243
+ "position_y": 1,
244
+ "position_x": 19
245
245
  },
246
246
  {
247
- "id": "8d1406b1-bc45-4564-8d0c-c9db1101ece3",
248
247
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
249
248
  "flow": "7de538a5-bc7b-4563-8be3-dc8d3879df6a",
250
249
  "reject": null,
251
250
  "resolve": null,
251
+ "id": "8d1406b1-bc45-4564-8d0c-c9db1101ece3",
252
252
  "date_created": "2023-09-09T13:54:42.707Z",
253
253
  "type": "item-update",
254
254
  "key": "update_next_invoice_number",
@@ -260,15 +260,15 @@
260
260
  "next_invoice_number": "{{increment_invoice_number}}"
261
261
  }
262
262
  },
263
- "position_x": 37,
264
- "position_y": 19
263
+ "position_y": 19,
264
+ "position_x": 37
265
265
  },
266
266
  {
267
- "id": "968684f7-e04d-4bb2-af05-f4c7cb5225b5",
268
267
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
269
268
  "flow": "8106be67-aa96-4260-aac7-8ab129bb944b",
270
269
  "reject": null,
271
270
  "resolve": null,
271
+ "id": "968684f7-e04d-4bb2-af05-f4c7cb5225b5",
272
272
  "date_created": "2023-09-10T20:46:26.491Z",
273
273
  "type": "item-update",
274
274
  "key": "update_organization",
@@ -282,15 +282,15 @@
282
282
  "logo": "{{import_logo.data.data.id}}"
283
283
  }
284
284
  },
285
- "position_x": 59,
286
- "position_y": 19
285
+ "position_y": 19,
286
+ "position_x": 59
287
287
  },
288
288
  {
289
- "id": "a207e95a-65b9-488e-ac1f-3fbabb01446c",
290
289
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
291
290
  "flow": "0f8ea882-219d-4823-bb80-bc725d280c3a",
292
291
  "reject": null,
293
292
  "resolve": null,
293
+ "id": "a207e95a-65b9-488e-ac1f-3fbabb01446c",
294
294
  "date_created": "2023-09-09T02:13:28.911Z",
295
295
  "type": "request",
296
296
  "key": "call_build_hook",
@@ -299,15 +299,15 @@
299
299
  "method": "POST",
300
300
  "url": "{{check_build_hook}}"
301
301
  },
302
- "position_x": 55,
303
- "position_y": 1
302
+ "position_y": 1,
303
+ "position_x": 55
304
304
  },
305
305
  {
306
- "id": "a395ac61-f429-481e-b957-19e9ce0ef2eb",
307
306
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
308
307
  "flow": "6f4dcc83-5b25-4477-a898-3c1314cfe36f",
309
308
  "reject": null,
310
309
  "resolve": null,
310
+ "id": "a395ac61-f429-481e-b957-19e9ce0ef2eb",
311
311
  "date_created": "2023-09-14T04:31:59.286Z",
312
312
  "type": "exec",
313
313
  "key": "calculations",
@@ -315,15 +315,15 @@
315
315
  "options": {
316
316
  "code": "module.exports = async function (data) {\n\tconst item = { ...data.invoice_items, ...data.$trigger.payload };\n\n\t// Basic validation for unit_price and quantity\n\tif (!item.unit_price || !item.quantity) {\n\t\tthrow new Error('Missing or invalid unit_price or quantity.');\n\t}\n\n\t// Calculate line_amount\n\tconst lineAmount = parseFloat(item.unit_price) * parseFloat(item.quantity);\n\tif (isNaN(lineAmount)) {\n\t\tthrow new Error('Error calculating line_amount.');\n\t}\n\titem.line_amount = lineAmount;\n\n\t// Validate and calculate tax_amount if tax_rate is provided\n\tif (item.tax_rate && item.tax_rate.rate) {\n\t\tconst taxRateId = item.tax_rate.id;\n\t\tconst taxAmount = (lineAmount * parseFloat(item.tax_rate.rate)) / 100;\n\t\tif (isNaN(taxAmount)) {\n\t\t\tthrow new Error('Error calculating tax_amount.');\n\t\t}\n\t\titem.tax_amount = taxAmount;\n\n\t\tdelete item.tax_rate;\n\t\titem.tax_rate = taxRateId;\n\t}\n\n\treturn item;\n};\n"
317
317
  },
318
- "position_x": 37,
319
- "position_y": 1
318
+ "position_y": 1,
319
+ "position_x": 37
320
320
  },
321
321
  {
322
- "id": "a7a66ae8-47ad-4d7a-97d3-e27f8c52241b",
323
322
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
324
323
  "flow": "ac372072-30ff-4806-91cc-a6ade72e6636",
325
324
  "reject": null,
326
325
  "resolve": null,
326
+ "id": "a7a66ae8-47ad-4d7a-97d3-e27f8c52241b",
327
327
  "date_created": "2023-09-09T02:13:28.918Z",
328
328
  "type": "item-update",
329
329
  "key": "update_trigger_item",
@@ -340,15 +340,15 @@
340
340
  }
341
341
  }
342
342
  },
343
- "position_x": 20,
344
- "position_y": 1
343
+ "position_y": 1,
344
+ "position_x": 20
345
345
  },
346
346
  {
347
- "id": "aa0755b9-1bef-422c-b03d-07af0e42ab2a",
348
347
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
349
348
  "flow": "201e023d-6b67-4068-bc21-d60ef5b7668d",
350
349
  "reject": null,
351
350
  "resolve": null,
351
+ "id": "aa0755b9-1bef-422c-b03d-07af0e42ab2a",
352
352
  "date_created": "2023-09-14T05:09:37.492Z",
353
353
  "type": "item-update",
354
354
  "key": "update_invoice",
@@ -360,15 +360,15 @@
360
360
  "{{$trigger.payload.invoice}}"
361
361
  ]
362
362
  },
363
- "position_x": 57,
364
- "position_y": 1
363
+ "position_y": 1,
364
+ "position_x": 57
365
365
  },
366
366
  {
367
- "id": "aa70c7bb-cb61-417f-9110-468d79b4849b",
368
367
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
369
368
  "flow": "c29208b0-4187-4af0-83a3-1bea7e30e12c",
370
369
  "reject": null,
371
370
  "resolve": "d1bfebad-1335-4a63-b9cb-f2e705244738",
371
+ "id": "aa70c7bb-cb61-417f-9110-468d79b4849b",
372
372
  "date_created": "2023-09-09T02:13:28.923Z",
373
373
  "type": "condition",
374
374
  "key": "check_status",
@@ -384,15 +384,15 @@
384
384
  }
385
385
  }
386
386
  },
387
- "position_x": 19,
388
- "position_y": 1
387
+ "position_y": 1,
388
+ "position_x": 19
389
389
  },
390
390
  {
391
- "id": "ab0750d0-7dc0-4927-a0df-47ef5643afd9",
392
391
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
393
392
  "flow": "e9a31eab-99aa-453e-8889-b7339ed31034",
394
393
  "reject": null,
395
394
  "resolve": "afd3e10b-ec05-48ba-9fdd-98a91e7b8bb7",
395
+ "id": "ab0750d0-7dc0-4927-a0df-47ef5643afd9",
396
396
  "date_created": "2023-09-10T19:58:18.682Z",
397
397
  "type": "item-create",
398
398
  "key": "create_new_project",
@@ -401,15 +401,15 @@
401
401
  "collection": "os_projects",
402
402
  "payload": "{{format_project_from_template}}"
403
403
  },
404
- "position_x": 56,
405
- "position_y": 1
404
+ "position_y": 1,
405
+ "position_x": 56
406
406
  },
407
407
  {
408
- "id": "ac6ebd69-ec0e-4e11-8e94-0c22b635fe11",
409
408
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
410
409
  "flow": "201e023d-6b67-4068-bc21-d60ef5b7668d",
411
410
  "reject": null,
412
411
  "resolve": "0cb36f9e-c84d-4e85-b23c-7eaf2b3e2f6b",
412
+ "id": "ac6ebd69-ec0e-4e11-8e94-0c22b635fe11",
413
413
  "date_created": "2023-09-14T04:48:19.910Z",
414
414
  "type": "item-read",
415
415
  "key": "invoice",
@@ -427,15 +427,15 @@
427
427
  ]
428
428
  }
429
429
  },
430
- "position_x": 21,
431
- "position_y": 1
430
+ "position_y": 1,
431
+ "position_x": 21
432
432
  },
433
433
  {
434
- "id": "adcc6c22-a63a-46dc-8f1c-cb0b997a3106",
435
434
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
436
435
  "flow": "b94189fe-0d20-4611-88a1-dd7b5d419b35",
437
436
  "reject": null,
438
437
  "resolve": null,
438
+ "id": "adcc6c22-a63a-46dc-8f1c-cb0b997a3106",
439
439
  "date_created": "2023-09-09T02:13:28.929Z",
440
440
  "type": "item-update",
441
441
  "key": "update_slug",
@@ -447,15 +447,15 @@
447
447
  "slug": "{{ slug_me }}"
448
448
  }
449
449
  },
450
- "position_x": 37,
451
- "position_y": 1
450
+ "position_y": 1,
451
+ "position_x": 37
452
452
  },
453
453
  {
454
- "id": "afd3e10b-ec05-48ba-9fdd-98a91e7b8bb7",
455
454
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
456
455
  "flow": "e9a31eab-99aa-453e-8889-b7339ed31034",
457
456
  "reject": null,
458
457
  "resolve": null,
458
+ "id": "afd3e10b-ec05-48ba-9fdd-98a91e7b8bb7",
459
459
  "date_created": "2023-10-22T06:14:13.842Z",
460
460
  "type": "notification",
461
461
  "key": "send_success_notification",
@@ -469,15 +469,15 @@
469
469
  "collection": "os_projects",
470
470
  "item": "{{create_project}}"
471
471
  },
472
- "position_x": 74,
473
- "position_y": 1
472
+ "position_y": 1,
473
+ "position_x": 74
474
474
  },
475
475
  {
476
- "id": "bae0bd5b-bdc7-4b75-9b33-7b63eca22a23",
477
476
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
478
477
  "flow": "e9a31eab-99aa-453e-8889-b7339ed31034",
479
478
  "reject": null,
480
479
  "resolve": "ab0750d0-7dc0-4927-a0df-47ef5643afd9",
480
+ "id": "bae0bd5b-bdc7-4b75-9b33-7b63eca22a23",
481
481
  "date_created": "2023-09-10T20:04:25.381Z",
482
482
  "type": "exec",
483
483
  "key": "format_project_from_template",
@@ -485,15 +485,15 @@
485
485
  "options": {
486
486
  "code": "module.exports = async function(data) {\n // Validate necessary fields in the trigger data\n if (!data || !data.$trigger || !data.$trigger.body || !data.get_project_template || !data.get_project_template.tasks) {\n throw new Error('Invalid or missing data in trigger payload');\n }\n\n const { project_start_date, project_due_date } = data.$trigger.body;\n const projectStartDate = project_start_date ? new Date(project_start_date) : new Date();\n const projectDueDate = project_due_date ? new Date(project_due_date) : new Date();\n\n const templateTasks = data.get_project_template.tasks;\n const projectTasks = [];\n\n for (const task of templateTasks) {\n let taskStartDate;\n let taskDueDate;\n\n if (task.set_dates_relative_to === 'project_start_date' && project_start_date) {\n taskStartDate = new Date(projectStartDate);\n taskStartDate.setDate(taskStartDate.getDate() + (task.start_days || 0));\n\n taskDueDate = new Date(projectStartDate);\n taskDueDate.setDate(taskDueDate.getDate() + (task.due_days || 0));\n } else if (task.set_dates_relative_to === 'project_due_date' && project_due_date) {\n taskStartDate = new Date(projectDueDate);\n taskStartDate.setDate(taskStartDate.getDate() - (task.start_days || 0));\n\n taskDueDate = new Date(projectDueDate);\n taskDueDate.setDate(taskDueDate.getDate() - (task.due_days || 0));\n }\n\n // If dates are not calculated due to missing project dates, default to null\n const newTask = {\n name: task.name,\n description: task.description,\n type: task.type,\n start_date: taskStartDate ? taskStartDate.toISOString() : null,\n due_date: taskDueDate ? taskDueDate.toISOString() : null,\n is_visible_to_client: task.is_visible_to_client ?? false,\n assigned_to: task.default_team_assigned_to?.key ?? null,\n form: task.form ?? null,\n embed_url: task.embed_url ?? null\n };\n\n projectTasks.push(newTask);\n }\n\n const project = {\n name: data.$trigger.body.name,\n tasks: projectTasks,\n organization: data.$trigger.body.organization.key,\n contacts: [\n { contacts_id: data.$trigger.body.contact.key }\n ],\n owner: data.$accountability.user,\n start_date: project_start_date ? projectStartDate.toISOString() : null,\n due_date: project_due_date ? projectDueDate.toISOString() : null,\n };\n \n return project;\n};\n"
487
487
  },
488
- "position_x": 38,
489
- "position_y": 1
488
+ "position_y": 1,
489
+ "position_x": 38
490
490
  },
491
491
  {
492
- "id": "bb1b1e3f-032e-48b7-b260-1cf3af4a116c",
493
492
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
494
493
  "flow": "69e87d0b-df14-4779-bdc8-abc05f2f1e97",
495
494
  "reject": null,
496
495
  "resolve": "fd271542-fac2-42d8-aa10-a02520c3753f",
496
+ "id": "bb1b1e3f-032e-48b7-b260-1cf3af4a116c",
497
497
  "date_created": "2023-10-22T06:25:43.441Z",
498
498
  "type": "item-read",
499
499
  "key": "read_globals",
@@ -502,15 +502,15 @@
502
502
  "permissions": "$full",
503
503
  "collection": "globals"
504
504
  },
505
- "position_x": 19,
506
- "position_y": 1
505
+ "position_y": 1,
506
+ "position_x": 19
507
507
  },
508
508
  {
509
- "id": "cae72421-7737-4dd7-af91-ef0ce795bb36",
510
509
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
511
510
  "flow": "8106be67-aa96-4260-aac7-8ab129bb944b",
512
511
  "reject": null,
513
512
  "resolve": null,
513
+ "id": "cae72421-7737-4dd7-af91-ef0ce795bb36",
514
514
  "date_created": "2023-10-20T01:22:15.065Z",
515
515
  "type": "log",
516
516
  "key": "no_website",
@@ -518,15 +518,15 @@
518
518
  "options": {
519
519
  "message": "The payload did not include a `website`."
520
520
  },
521
- "position_x": 19,
522
- "position_y": 19
521
+ "position_y": 19,
522
+ "position_x": 19
523
523
  },
524
524
  {
525
- "id": "cd56fd51-c0f4-4744-8622-855dca695df9",
526
525
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
527
526
  "flow": "7de538a5-bc7b-4563-8be3-dc8d3879df6a",
528
527
  "reject": null,
529
528
  "resolve": "e333ec0c-49a9-41c1-acd4-593619cec456",
529
+ "id": "cd56fd51-c0f4-4744-8622-855dca695df9",
530
530
  "date_created": "2023-09-09T13:21:17.744Z",
531
531
  "type": "item-read",
532
532
  "key": "invoice_settings",
@@ -535,15 +535,15 @@
535
535
  "permissions": "$full",
536
536
  "collection": "os_invoice_config"
537
537
  },
538
- "position_x": 19,
539
- "position_y": 1
538
+ "position_y": 1,
539
+ "position_x": 19
540
540
  },
541
541
  {
542
- "id": "d1bfebad-1335-4a63-b9cb-f2e705244738",
543
542
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
544
543
  "flow": "c29208b0-4187-4af0-83a3-1bea7e30e12c",
545
544
  "reject": null,
546
545
  "resolve": null,
546
+ "id": "d1bfebad-1335-4a63-b9cb-f2e705244738",
547
547
  "date_created": "2023-09-09T02:13:28.944Z",
548
548
  "type": "mail",
549
549
  "key": "send_email",
@@ -555,15 +555,15 @@
555
555
  "subject": "New post is ready to review",
556
556
  "body": "Hello Team,\n\nThe following article has been submitted for your review. Please log in, and either approve this content or provide feedback for necessary improvements.\n\nhttps://nuxt-starter.directus.app/admin/posts/{{$trigger.keys[0]}}\n\nBest,\n\n//"
557
557
  },
558
- "position_x": 37,
559
- "position_y": 1
558
+ "position_y": 1,
559
+ "position_x": 37
560
560
  },
561
561
  {
562
- "id": "d41e3629-f303-4c8b-a0e5-6d04f228d67a",
563
562
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
564
563
  "flow": "f302764e-84d7-4208-8c6d-d4da76400544",
565
564
  "reject": null,
566
565
  "resolve": "e7909463-c740-4b32-9c12-90f50f2f0d29",
566
+ "id": "d41e3629-f303-4c8b-a0e5-6d04f228d67a",
567
567
  "date_created": "2023-10-04T17:48:54.919Z",
568
568
  "type": "exec",
569
569
  "key": "has_folder",
@@ -571,15 +571,15 @@
571
571
  "options": {
572
572
  "code": "module.exports = async function(data) {\n const hasFolder = data.get_org.folder\n if (hasFolder) { \n // We can update the folder through the organization\n return {\n folder: {\n id: hasFolder,\n\t name: data.get_org.name,\n }\n }\n \n } else {\n return {\n folder: {\n name: data.get_org.name,\n parent: data.settings[0].organization_folder_root ?? null\n }\n }\n }\n}"
573
573
  },
574
- "position_x": 37,
575
- "position_y": 19
574
+ "position_y": 19,
575
+ "position_x": 37
576
576
  },
577
577
  {
578
- "id": "daaac907-97f2-4cac-9687-132d6bf7f392",
579
578
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
580
579
  "flow": "8106be67-aa96-4260-aac7-8ab129bb944b",
581
580
  "reject": null,
582
581
  "resolve": "968684f7-e04d-4bb2-af05-f4c7cb5225b5",
582
+ "id": "daaac907-97f2-4cac-9687-132d6bf7f392",
583
583
  "date_created": "2023-09-10T20:46:26.437Z",
584
584
  "type": "request",
585
585
  "key": "import_logo",
@@ -599,15 +599,15 @@
599
599
  ],
600
600
  "body": "{\n\t\"url\": \"https://logo.clearbit.com/{{extract_domain}}\",\n\t\"data\": {\n\t\"title\": \"{{extract_domain}} Logo\"\n\t}\n\t}\n"
601
601
  },
602
- "position_x": 41,
603
- "position_y": 19
602
+ "position_y": 19,
603
+ "position_x": 41
604
604
  },
605
605
  {
606
- "id": "e0745757-aada-4167-9faf-d119b2b37c99",
607
606
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
608
607
  "flow": "f302764e-84d7-4208-8c6d-d4da76400544",
609
608
  "reject": null,
610
609
  "resolve": "d41e3629-f303-4c8b-a0e5-6d04f228d67a",
610
+ "id": "e0745757-aada-4167-9faf-d119b2b37c99",
611
611
  "date_created": "2023-10-04T17:43:17.035Z",
612
612
  "type": "item-read",
613
613
  "key": "get_org",
@@ -619,15 +619,15 @@
619
619
  "collection": "organizations",
620
620
  "permissions": "$full"
621
621
  },
622
- "position_x": 19,
623
- "position_y": 19
622
+ "position_y": 19,
623
+ "position_x": 19
624
624
  },
625
625
  {
626
- "id": "e2189b0d-54b6-46d7-b979-25021c1f7840",
627
626
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
628
627
  "flow": "0f8ea882-219d-4823-bb80-bc725d280c3a",
629
628
  "reject": null,
630
629
  "resolve": "40fd454c-a438-47bb-9bc5-399d1fffd562",
630
+ "id": "e2189b0d-54b6-46d7-b979-25021c1f7840",
631
631
  "date_created": "2023-10-22T06:30:42.408Z",
632
632
  "type": "trigger",
633
633
  "key": "globals",
@@ -635,15 +635,15 @@
635
635
  "options": {
636
636
  "flow": "69e87d0b-df14-4779-bdc8-abc05f2f1e97"
637
637
  },
638
- "position_x": 19,
639
- "position_y": 1
638
+ "position_y": 1,
639
+ "position_x": 19
640
640
  },
641
641
  {
642
- "id": "e333ec0c-49a9-41c1-acd4-593619cec456",
643
642
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
644
643
  "flow": "7de538a5-bc7b-4563-8be3-dc8d3879df6a",
645
644
  "reject": null,
646
645
  "resolve": "427ee1d9-4bac-4113-96ea-c3911bc8ed21",
646
+ "id": "e333ec0c-49a9-41c1-acd4-593619cec456",
647
647
  "date_created": "2023-09-09T13:44:57.493Z",
648
648
  "type": "item-update",
649
649
  "key": "update_invoice",
@@ -658,15 +658,15 @@
658
658
  "invoice_number": "{{invoice_settings[0].next_invoice_number}}"
659
659
  }
660
660
  },
661
- "position_x": 37,
662
- "position_y": 1
661
+ "position_y": 1,
662
+ "position_x": 37
663
663
  },
664
664
  {
665
- "id": "e77e2f02-ba09-4cf1-85ff-acd0f85f02e2",
666
665
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
667
666
  "flow": "8106be67-aa96-4260-aac7-8ab129bb944b",
668
667
  "reject": null,
669
668
  "resolve": "5cee46e9-e59e-4bee-8958-6e21e46f1da1",
669
+ "id": "e77e2f02-ba09-4cf1-85ff-acd0f85f02e2",
670
670
  "date_created": "2023-10-20T01:20:30.600Z",
671
671
  "type": "exec",
672
672
  "key": "get_key",
@@ -674,15 +674,15 @@
674
674
  "options": {
675
675
  "code": "// This function is called when used with an Event Hook - Action (Non-Blocking) - Trigger for a flow. It is used to extract the key from the trigger object because the syntax return from Directus can be different depending on the type of trigger. For example, the trigger object for a \"New Item\" trigger is different than the trigger object for a \"New Item in View\" trigger. This function is used to extract the key from the trigger object regardless of the type of trigger.\n\nfunction extractKey(obj) {\n\tif (obj.key) {\n\t\t// If \"key\" property exists, return its value\n\t\treturn obj.key;\n\t} else if (obj.keys && Array.isArray(obj.keys) && obj.keys.length > 0) {\n\t\t// If \"keys\" property exists, is an array, and has at least one element, return the first element\n\t\treturn obj.keys[0];\n\t} else {\n\t\t// If neither condition is met, return null or throw an error\n\t\tthrow new Error('Key not found');\n\t}\n}\n\nmodule.exports = async function (data) {\n\tconst key = extractKey(data.$trigger);\n\n\treturn key;\n};\n"
676
676
  },
677
- "position_x": 37,
678
- "position_y": 1
677
+ "position_y": 1,
678
+ "position_x": 37
679
679
  },
680
680
  {
681
- "id": "e7909463-c740-4b32-9c12-90f50f2f0d29",
682
681
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
683
682
  "flow": "f302764e-84d7-4208-8c6d-d4da76400544",
684
683
  "reject": null,
685
684
  "resolve": null,
685
+ "id": "e7909463-c740-4b32-9c12-90f50f2f0d29",
686
686
  "date_created": "2023-10-04T17:52:46.202Z",
687
687
  "type": "item-update",
688
688
  "key": "update_org_folder",
@@ -695,15 +695,15 @@
695
695
  "collection": "organizations",
696
696
  "permissions": "$full"
697
697
  },
698
- "position_x": 55,
699
- "position_y": 19
698
+ "position_y": 19,
699
+ "position_x": 55
700
700
  },
701
701
  {
702
- "id": "fd271542-fac2-42d8-aa10-a02520c3753f",
703
702
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
704
703
  "flow": "69e87d0b-df14-4779-bdc8-abc05f2f1e97",
705
704
  "reject": null,
706
705
  "resolve": null,
706
+ "id": "fd271542-fac2-42d8-aa10-a02520c3753f",
707
707
  "date_created": "2023-10-22T06:29:28.639Z",
708
708
  "type": "exec",
709
709
  "key": "format",
@@ -711,7 +711,7 @@
711
711
  "options": {
712
712
  "code": "module.exports = async function(data) {\n return data.read_globals[0]\n}"
713
713
  },
714
- "position_x": 37,
715
- "position_y": 1
714
+ "position_y": 1,
715
+ "position_x": 37
716
716
  }
717
717
  ]