directus-template-cli 0.3.3 → 0.3.5

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 (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -3
  3. package/oclif.manifest.json +1 -1
  4. package/package.json +1 -1
  5. package/templates/agencyos/package.json +2 -2
  6. package/templates/agencyos/src/collections.json +346 -232
  7. package/templates/agencyos/src/content/block_button.json +6 -6
  8. package/templates/agencyos/src/content/block_button_group.json +11 -11
  9. package/templates/agencyos/src/content/block_columns_rows.json +6 -6
  10. package/templates/agencyos/src/content/block_cta.json +3 -3
  11. package/templates/agencyos/src/content/block_gallery_files.json +10 -10
  12. package/templates/agencyos/src/content/block_richtext.json +1 -1
  13. package/templates/agencyos/src/content/block_step_items.json +5 -5
  14. package/templates/agencyos/src/content/block_team.json +4 -4
  15. package/templates/agencyos/src/content/help_collections.json +2 -2
  16. package/templates/agencyos/src/content/inbox.json +15 -1
  17. package/templates/agencyos/src/content/navigation_items.json +76 -76
  18. package/templates/agencyos/src/content/organizations.json +2 -2
  19. package/templates/agencyos/src/content/os_activities.json +3 -3
  20. package/templates/agencyos/src/content/os_invoice_items.json +6 -6
  21. package/templates/agencyos/src/content/os_invoices.json +5 -5
  22. package/templates/agencyos/src/content/os_payment_terms.json +2 -2
  23. package/templates/agencyos/src/content/os_payments.json +1 -1
  24. package/templates/agencyos/src/content/os_projects.json +3 -3
  25. package/templates/agencyos/src/content/os_proposal_blocks.json +4 -4
  26. package/templates/agencyos/src/content/os_proposals.json +3 -3
  27. package/templates/agencyos/src/content/os_tasks.json +65 -87
  28. package/templates/agencyos/src/content/os_tax_rates.json +2 -2
  29. package/templates/agencyos/src/content/page_blocks.json +23 -23
  30. package/templates/agencyos/src/content/pages.json +7 -7
  31. package/templates/agencyos/src/content/posts.json +9 -9
  32. package/templates/agencyos/src/content/seo.json +10 -10
  33. package/templates/agencyos/src/content/testimonials.json +4 -4
  34. package/templates/agencyos/src/dashboards.json +3 -3
  35. package/templates/agencyos/src/files.json +49 -49
  36. package/templates/agencyos/src/flows.json +39 -39
  37. package/templates/agencyos/src/operations.json +74 -74
  38. package/templates/agencyos/src/panels.json +136 -132
  39. package/templates/agencyos/src/permissions.json +349 -871
  40. package/templates/agencyos/src/roles.json +4 -4
  41. package/templates/agencyos/src/schema/snapshot.json +246 -97
  42. package/templates/agencyos/src/settings.json +32 -10
  43. package/templates/agencyos/src/users.json +54 -9
@@ -4,12 +4,12 @@
4
4
  "operation": "e2189b0d-54b6-46d7-b979-25021c1f7840",
5
5
  "id": "0f8ea882-219d-4823-bb80-bc725d280c3a",
6
6
  "date_created": "2023-09-09T02:13:28.159Z",
7
+ "color": "#18222F",
8
+ "name": "[Website] Deploy Site",
9
+ "icon": "build",
7
10
  "accountability": "all",
8
11
  "trigger": "manual",
9
12
  "status": "active",
10
- "color": "#18222F",
11
- "icon": "build",
12
- "name": "[Website] Deploy Site",
13
13
  "options": {
14
14
  "collections": [
15
15
  "globals"
@@ -28,12 +28,12 @@
28
28
  "operation": null,
29
29
  "id": "12513e3d-9ecb-4d3b-9a1f-9137eb7e4376",
30
30
  "date_created": "2023-10-05T21:09:19.365Z",
31
+ "color": "#D064AC",
32
+ "name": "[Payments] New Payment Notification",
33
+ "icon": "payments",
31
34
  "accountability": "all",
32
35
  "trigger": "event",
33
36
  "status": "active",
34
- "color": "#D064AC",
35
- "icon": "payments",
36
- "name": "[Payments] New Payment Notification",
37
37
  "options": {
38
38
  "type": "action",
39
39
  "scope": [
@@ -53,12 +53,12 @@
53
53
  "operation": "ac6ebd69-ec0e-4e11-8e94-0c22b635fe11",
54
54
  "id": "201e023d-6b67-4068-bc21-d60ef5b7668d",
55
55
  "date_created": "2023-09-14T04:47:33.988Z",
56
+ "color": "#D064AC",
57
+ "name": "[Invoices] Calculate Invoice",
58
+ "icon": "calculate",
56
59
  "accountability": "all",
57
60
  "trigger": "event",
58
61
  "status": "active",
59
- "color": "#D064AC",
60
- "icon": "calculate",
61
- "name": "[Invoices] Calculate Invoice",
62
62
  "options": {
63
63
  "type": "action",
64
64
  "scope": [
@@ -83,12 +83,12 @@
83
83
  "operation": "bb1b1e3f-032e-48b7-b260-1cf3af4a116c",
84
84
  "id": "69e87d0b-df14-4779-bdc8-abc05f2f1e97",
85
85
  "date_created": "2023-10-22T06:25:00.093Z",
86
+ "color": "#A2B5CD",
87
+ "name": "[Util] Get Globals",
88
+ "icon": "globe_uk",
86
89
  "accountability": "all",
87
90
  "trigger": "operation",
88
91
  "status": "active",
89
- "color": "#A2B5CD",
90
- "icon": "globe_uk",
91
- "name": "[Util] Get Globals",
92
92
  "options": {
93
93
  "return": "$last"
94
94
  },
@@ -103,12 +103,12 @@
103
103
  "operation": "86e25afa-0940-4970-a331-979b6efb2112",
104
104
  "id": "6f4dcc83-5b25-4477-a898-3c1314cfe36f",
105
105
  "date_created": "2023-09-14T04:20:18.619Z",
106
+ "color": "#D064AC",
107
+ "name": "[Invoices] Calculate Line Items",
108
+ "icon": "calculate",
106
109
  "accountability": "all",
107
110
  "trigger": "event",
108
111
  "status": "active",
109
- "color": "#D064AC",
110
- "icon": "calculate",
111
- "name": "[Invoices] Calculate Line Items",
112
112
  "options": {
113
113
  "type": "filter",
114
114
  "scope": [
@@ -130,12 +130,12 @@
130
130
  "operation": "cd56fd51-c0f4-4744-8622-855dca695df9",
131
131
  "id": "7de538a5-bc7b-4563-8be3-dc8d3879df6a",
132
132
  "date_created": "2023-09-09T13:19:53.407Z",
133
+ "color": "#D064AC",
134
+ "name": "[Invoices] Generate Number",
135
+ "icon": "receipt_long",
133
136
  "accountability": "all",
134
137
  "trigger": "event",
135
138
  "status": "active",
136
- "color": "#D064AC",
137
- "icon": "receipt_long",
138
- "name": "[Invoices] Generate Number",
139
139
  "options": {
140
140
  "type": "action",
141
141
  "scope": [
@@ -158,12 +158,12 @@
158
158
  "operation": "0a95cdb6-8492-43e8-a2c9-0dfdc0ea2a9d",
159
159
  "id": "8106be67-aa96-4260-aac7-8ab129bb944b",
160
160
  "date_created": "2023-09-10T20:42:06.136Z",
161
+ "color": "#6644FF",
162
+ "name": "[Organizations] Fetch Logo for Organizations",
163
+ "icon": "business_center",
161
164
  "accountability": "all",
162
165
  "trigger": "event",
163
166
  "status": "active",
164
- "color": "#6644FF",
165
- "icon": "business_center",
166
- "name": "[Organizations] Fetch Logo for Organizations",
167
167
  "options": {
168
168
  "type": "action",
169
169
  "scope": [
@@ -189,12 +189,12 @@
189
189
  "operation": "a7a66ae8-47ad-4d7a-97d3-e27f8c52241b",
190
190
  "id": "ac372072-30ff-4806-91cc-a6ade72e6636",
191
191
  "date_created": "2023-09-09T02:13:28.359Z",
192
+ "color": "#18222F",
193
+ "name": "[Website] Create SEO Item",
194
+ "icon": "saved_search",
192
195
  "accountability": "all",
193
196
  "trigger": "event",
194
197
  "status": "active",
195
- "color": "#18222F",
196
- "icon": "saved_search",
197
- "name": "[Website] Create SEO Item",
198
198
  "options": {
199
199
  "type": "action",
200
200
  "scope": [
@@ -216,12 +216,12 @@
216
216
  "operation": "1d167b20-13af-4f0b-afe1-a4c4d8971654",
217
217
  "id": "b94189fe-0d20-4611-88a1-dd7b5d419b35",
218
218
  "date_created": "2023-09-09T02:13:28.458Z",
219
+ "color": "#18222F",
220
+ "name": "[Website] Slugify",
221
+ "icon": "link",
219
222
  "accountability": "all",
220
223
  "trigger": "event",
221
224
  "status": "active",
222
- "color": "#18222F",
223
- "icon": "link",
224
- "name": "[Website] Slugify",
225
225
  "options": {
226
226
  "type": "action",
227
227
  "scope": [
@@ -244,12 +244,12 @@
244
244
  "operation": "aa70c7bb-cb61-417f-9110-468d79b4849b",
245
245
  "id": "c29208b0-4187-4af0-83a3-1bea7e30e12c",
246
246
  "date_created": "2023-09-09T02:13:28.559Z",
247
+ "color": "#18222F",
248
+ "name": "[Website] Post Approval",
249
+ "icon": "mark_email_read",
247
250
  "accountability": "all",
248
251
  "trigger": "event",
249
252
  "status": "active",
250
- "color": "#18222F",
251
- "icon": "mark_email_read",
252
- "name": "[Website] Post Approval",
253
253
  "options": {
254
254
  "type": "action",
255
255
  "scope": [
@@ -270,12 +270,12 @@
270
270
  "operation": "43e30267-a0bd-43e9-8f3c-56be4dcf565a",
271
271
  "id": "e9a31eab-99aa-453e-8889-b7339ed31034",
272
272
  "date_created": "2023-09-10T19:51:29.565Z",
273
+ "color": "#D064AC",
274
+ "name": "[Projects] Create Project",
275
+ "icon": "playlist_add_check_circle",
273
276
  "accountability": "all",
274
277
  "trigger": "manual",
275
278
  "status": "active",
276
- "color": "#D064AC",
277
- "icon": "playlist_add_check_circle",
278
- "name": "[Projects] Create Project",
279
279
  "options": {
280
280
  "collections": [
281
281
  "os_projects",
@@ -380,12 +380,12 @@
380
380
  "operation": "58124944-d33c-4d7e-8fd3-dfe76309ff7b",
381
381
  "id": "f302764e-84d7-4208-8c6d-d4da76400544",
382
382
  "date_created": "2023-10-04T17:37:50.215Z",
383
+ "color": "#6644FF",
384
+ "name": "[Organizations] Manage Folders",
385
+ "icon": "folder_copy",
383
386
  "accountability": "all",
384
387
  "trigger": "event",
385
388
  "status": "active",
386
- "color": "#6644FF",
387
- "icon": "folder_copy",
388
- "name": "[Organizations] Manage Folders",
389
389
  "options": {
390
390
  "type": "action",
391
391
  "scope": [
@@ -410,12 +410,12 @@
410
410
  "operation": "870017e8-bc7d-459b-a087-04cc00f05a5c",
411
411
  "id": "f78d4723-8d74-4ffc-8a82-06a31c857584",
412
412
  "date_created": "2023-09-12T19:54:11.279Z",
413
+ "color": "#D064AC",
414
+ "name": "[Proposals] Send Proposal",
415
+ "icon": "send",
413
416
  "accountability": "all",
414
417
  "trigger": "manual",
415
418
  "status": "active",
416
- "color": "#D064AC",
417
- "icon": "send",
418
- "name": "[Proposals] Send Proposal",
419
419
  "options": {
420
420
  "collections": [
421
421
  "os_proposals"
@@ -20,8 +20,8 @@
20
20
  }
21
21
  }
22
22
  },
23
- "position_y": 1,
24
- "position_x": 19
23
+ "position_x": 19,
24
+ "position_y": 1
25
25
  },
26
26
  {
27
27
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -36,8 +36,8 @@
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_y": 1,
40
- "position_x": 39
39
+ "position_x": 39,
40
+ "position_y": 1
41
41
  },
42
42
  {
43
43
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -57,8 +57,8 @@
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_y": 1,
61
- "position_x": 37
60
+ "position_x": 37,
61
+ "position_y": 1
62
62
  },
63
63
  {
64
64
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -73,8 +73,8 @@
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_y": 1,
77
- "position_x": 19
76
+ "position_x": 19,
77
+ "position_y": 1
78
78
  },
79
79
  {
80
80
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -89,8 +89,8 @@
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_y": 1,
93
- "position_x": 37
92
+ "position_x": 37,
93
+ "position_y": 1
94
94
  },
95
95
  {
96
96
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -105,8 +105,8 @@
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_y": 19,
109
- "position_x": 19
108
+ "position_x": 19,
109
+ "position_y": 19
110
110
  },
111
111
  {
112
112
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -121,8 +121,8 @@
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_y": 1,
125
- "position_x": 37
124
+ "position_x": 37,
125
+ "position_y": 1
126
126
  },
127
127
  {
128
128
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -140,8 +140,8 @@
140
140
  "{{$trigger.body.os_project_template.key}}"
141
141
  ]
142
142
  },
143
- "position_y": 1,
144
- "position_x": 20
143
+ "position_x": 20,
144
+ "position_y": 1
145
145
  },
146
146
  {
147
147
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -157,8 +157,8 @@
157
157
  "collection": "os_settings",
158
158
  "permissions": "$full"
159
159
  },
160
- "position_y": 1,
161
- "position_x": 19
160
+ "position_x": 19,
161
+ "position_y": 1
162
162
  },
163
163
  {
164
164
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -173,8 +173,8 @@
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_y": 1,
177
- "position_x": 55
176
+ "position_x": 55,
177
+ "position_y": 1
178
178
  },
179
179
  {
180
180
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -189,8 +189,8 @@
189
189
  "options": {
190
190
  "message": "Missing build hook URL"
191
191
  },
192
- "position_y": 17,
193
- "position_x": 55
192
+ "position_x": 55,
193
+ "position_y": 17
194
194
  },
195
195
  {
196
196
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -214,8 +214,8 @@
214
214
  ]
215
215
  }
216
216
  },
217
- "position_y": 1,
218
- "position_x": 19
217
+ "position_x": 19,
218
+ "position_y": 1
219
219
  },
220
220
  {
221
221
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -240,8 +240,8 @@
240
240
  ],
241
241
  "collection": "os_proposals"
242
242
  },
243
- "position_y": 1,
244
- "position_x": 19
243
+ "position_x": 19,
244
+ "position_y": 1
245
245
  },
246
246
  {
247
247
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -260,8 +260,8 @@
260
260
  "next_invoice_number": "{{increment_invoice_number}}"
261
261
  }
262
262
  },
263
- "position_y": 19,
264
- "position_x": 37
263
+ "position_x": 37,
264
+ "position_y": 19
265
265
  },
266
266
  {
267
267
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -282,8 +282,8 @@
282
282
  "logo": "{{import_logo.data.data.id}}"
283
283
  }
284
284
  },
285
- "position_y": 19,
286
- "position_x": 59
285
+ "position_x": 59,
286
+ "position_y": 19
287
287
  },
288
288
  {
289
289
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -299,8 +299,8 @@
299
299
  "method": "POST",
300
300
  "url": "{{check_build_hook}}"
301
301
  },
302
- "position_y": 1,
303
- "position_x": 55
302
+ "position_x": 55,
303
+ "position_y": 1
304
304
  },
305
305
  {
306
306
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -315,8 +315,8 @@
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_y": 1,
319
- "position_x": 37
318
+ "position_x": 37,
319
+ "position_y": 1
320
320
  },
321
321
  {
322
322
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -340,8 +340,8 @@
340
340
  }
341
341
  }
342
342
  },
343
- "position_y": 1,
344
- "position_x": 20
343
+ "position_x": 20,
344
+ "position_y": 1
345
345
  },
346
346
  {
347
347
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -360,8 +360,8 @@
360
360
  "{{$trigger.payload.invoice}}"
361
361
  ]
362
362
  },
363
- "position_y": 1,
364
- "position_x": 57
363
+ "position_x": 57,
364
+ "position_y": 1
365
365
  },
366
366
  {
367
367
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -384,8 +384,8 @@
384
384
  }
385
385
  }
386
386
  },
387
- "position_y": 1,
388
- "position_x": 19
387
+ "position_x": 19,
388
+ "position_y": 1
389
389
  },
390
390
  {
391
391
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -401,8 +401,8 @@
401
401
  "collection": "os_projects",
402
402
  "payload": "{{format_project_from_template}}"
403
403
  },
404
- "position_y": 1,
405
- "position_x": 56
404
+ "position_x": 56,
405
+ "position_y": 1
406
406
  },
407
407
  {
408
408
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -427,8 +427,8 @@
427
427
  ]
428
428
  }
429
429
  },
430
- "position_y": 1,
431
- "position_x": 21
430
+ "position_x": 21,
431
+ "position_y": 1
432
432
  },
433
433
  {
434
434
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -447,8 +447,8 @@
447
447
  "slug": "{{ slug_me }}"
448
448
  }
449
449
  },
450
- "position_y": 1,
451
- "position_x": 37
450
+ "position_x": 37,
451
+ "position_y": 1
452
452
  },
453
453
  {
454
454
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -469,8 +469,8 @@
469
469
  "collection": "os_projects",
470
470
  "item": "{{create_project}}"
471
471
  },
472
- "position_y": 1,
473
- "position_x": 74
472
+ "position_x": 74,
473
+ "position_y": 1
474
474
  },
475
475
  {
476
476
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -485,8 +485,8 @@
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_y": 1,
489
- "position_x": 38
488
+ "position_x": 38,
489
+ "position_y": 1
490
490
  },
491
491
  {
492
492
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -502,8 +502,8 @@
502
502
  "permissions": "$full",
503
503
  "collection": "globals"
504
504
  },
505
- "position_y": 1,
506
- "position_x": 19
505
+ "position_x": 19,
506
+ "position_y": 1
507
507
  },
508
508
  {
509
509
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -518,8 +518,8 @@
518
518
  "options": {
519
519
  "message": "The payload did not include a `website`."
520
520
  },
521
- "position_y": 19,
522
- "position_x": 19
521
+ "position_x": 19,
522
+ "position_y": 19
523
523
  },
524
524
  {
525
525
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -535,8 +535,8 @@
535
535
  "permissions": "$full",
536
536
  "collection": "os_invoice_config"
537
537
  },
538
- "position_y": 1,
539
- "position_x": 19
538
+ "position_x": 19,
539
+ "position_y": 1
540
540
  },
541
541
  {
542
542
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -555,8 +555,8 @@
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_y": 1,
559
- "position_x": 37
558
+ "position_x": 37,
559
+ "position_y": 1
560
560
  },
561
561
  {
562
562
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -571,8 +571,8 @@
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_y": 19,
575
- "position_x": 37
574
+ "position_x": 37,
575
+ "position_y": 19
576
576
  },
577
577
  {
578
578
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -599,8 +599,8 @@
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_y": 19,
603
- "position_x": 41
602
+ "position_x": 41,
603
+ "position_y": 19
604
604
  },
605
605
  {
606
606
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -619,8 +619,8 @@
619
619
  "collection": "organizations",
620
620
  "permissions": "$full"
621
621
  },
622
- "position_y": 19,
623
- "position_x": 19
622
+ "position_x": 19,
623
+ "position_y": 19
624
624
  },
625
625
  {
626
626
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -635,8 +635,8 @@
635
635
  "options": {
636
636
  "flow": "69e87d0b-df14-4779-bdc8-abc05f2f1e97"
637
637
  },
638
- "position_y": 1,
639
- "position_x": 19
638
+ "position_x": 19,
639
+ "position_y": 1
640
640
  },
641
641
  {
642
642
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -658,8 +658,8 @@
658
658
  "invoice_number": "{{invoice_settings[0].next_invoice_number}}"
659
659
  }
660
660
  },
661
- "position_y": 1,
662
- "position_x": 37
661
+ "position_x": 37,
662
+ "position_y": 1
663
663
  },
664
664
  {
665
665
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -674,8 +674,8 @@
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_y": 1,
678
- "position_x": 37
677
+ "position_x": 37,
678
+ "position_y": 1
679
679
  },
680
680
  {
681
681
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -695,8 +695,8 @@
695
695
  "collection": "organizations",
696
696
  "permissions": "$full"
697
697
  },
698
- "position_y": 19,
699
- "position_x": 55
698
+ "position_x": 55,
699
+ "position_y": 19
700
700
  },
701
701
  {
702
702
  "user_created": "95e535d2-f45b-4d94-891b-a89ee6ed1475",
@@ -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_y": 1,
715
- "position_x": 37
714
+ "position_x": 37,
715
+ "position_y": 1
716
716
  }
717
717
  ]