n8n-nodes-vtiger-oss 0.0.1

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 (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +262 -0
  3. package/THIRD_PARTY_NOTICES.md +29 -0
  4. package/dist/credentials/VtigerOssApi.credentials.d.ts +8 -0
  5. package/dist/credentials/VtigerOssApi.credentials.js +50 -0
  6. package/dist/credentials/VtigerOssApi.credentials.js.map +1 -0
  7. package/dist/nodes/VtigerOss/VtigerOss.node.d.ts +11 -0
  8. package/dist/nodes/VtigerOss/VtigerOss.node.js +82 -0
  9. package/dist/nodes/VtigerOss/VtigerOss.node.js.map +1 -0
  10. package/dist/nodes/VtigerOss/VtigerOss.node.json +18 -0
  11. package/dist/nodes/VtigerOss/actions/advanced/customGet.action.d.ts +2 -0
  12. package/dist/nodes/VtigerOss/actions/advanced/customGet.action.js +11 -0
  13. package/dist/nodes/VtigerOss/actions/advanced/customGet.action.js.map +1 -0
  14. package/dist/nodes/VtigerOss/actions/advanced/customPost.action.d.ts +2 -0
  15. package/dist/nodes/VtigerOss/actions/advanced/customPost.action.js +11 -0
  16. package/dist/nodes/VtigerOss/actions/advanced/customPost.action.js.map +1 -0
  17. package/dist/nodes/VtigerOss/actions/document/download.action.d.ts +2 -0
  18. package/dist/nodes/VtigerOss/actions/document/download.action.js +31 -0
  19. package/dist/nodes/VtigerOss/actions/document/download.action.js.map +1 -0
  20. package/dist/nodes/VtigerOss/actions/document/upload.action.d.ts +4 -0
  21. package/dist/nodes/VtigerOss/actions/document/upload.action.js +41 -0
  22. package/dist/nodes/VtigerOss/actions/document/upload.action.js.map +1 -0
  23. package/dist/nodes/VtigerOss/actions/document/uploadAndLink.action.d.ts +2 -0
  24. package/dist/nodes/VtigerOss/actions/document/uploadAndLink.action.js +16 -0
  25. package/dist/nodes/VtigerOss/actions/document/uploadAndLink.action.js.map +1 -0
  26. package/dist/nodes/VtigerOss/actions/lead/convert.action.d.ts +2 -0
  27. package/dist/nodes/VtigerOss/actions/lead/convert.action.js +37 -0
  28. package/dist/nodes/VtigerOss/actions/lead/convert.action.js.map +1 -0
  29. package/dist/nodes/VtigerOss/actions/metadata/describe.action.d.ts +2 -0
  30. package/dist/nodes/VtigerOss/actions/metadata/describe.action.js +13 -0
  31. package/dist/nodes/VtigerOss/actions/metadata/describe.action.js.map +1 -0
  32. package/dist/nodes/VtigerOss/actions/metadata/listTypes.action.d.ts +2 -0
  33. package/dist/nodes/VtigerOss/actions/metadata/listTypes.action.js +6 -0
  34. package/dist/nodes/VtigerOss/actions/metadata/listTypes.action.js.map +1 -0
  35. package/dist/nodes/VtigerOss/actions/properties.d.ts +2 -0
  36. package/dist/nodes/VtigerOss/actions/properties.js +679 -0
  37. package/dist/nodes/VtigerOss/actions/properties.js.map +1 -0
  38. package/dist/nodes/VtigerOss/actions/query/getMany.action.d.ts +2 -0
  39. package/dist/nodes/VtigerOss/actions/query/getMany.action.js +16 -0
  40. package/dist/nodes/VtigerOss/actions/query/getMany.action.js.map +1 -0
  41. package/dist/nodes/VtigerOss/actions/query/rawQuery.action.d.ts +2 -0
  42. package/dist/nodes/VtigerOss/actions/query/rawQuery.action.js +13 -0
  43. package/dist/nodes/VtigerOss/actions/query/rawQuery.action.js.map +1 -0
  44. package/dist/nodes/VtigerOss/actions/record/create.action.d.ts +2 -0
  45. package/dist/nodes/VtigerOss/actions/record/create.action.js +15 -0
  46. package/dist/nodes/VtigerOss/actions/record/create.action.js.map +1 -0
  47. package/dist/nodes/VtigerOss/actions/record/delete.action.d.ts +2 -0
  48. package/dist/nodes/VtigerOss/actions/record/delete.action.js +11 -0
  49. package/dist/nodes/VtigerOss/actions/record/delete.action.js.map +1 -0
  50. package/dist/nodes/VtigerOss/actions/record/retrieve.action.d.ts +2 -0
  51. package/dist/nodes/VtigerOss/actions/record/retrieve.action.js +10 -0
  52. package/dist/nodes/VtigerOss/actions/record/retrieve.action.js.map +1 -0
  53. package/dist/nodes/VtigerOss/actions/record/revise.action.d.ts +2 -0
  54. package/dist/nodes/VtigerOss/actions/record/revise.action.js +16 -0
  55. package/dist/nodes/VtigerOss/actions/record/revise.action.js.map +1 -0
  56. package/dist/nodes/VtigerOss/actions/record/update.action.d.ts +2 -0
  57. package/dist/nodes/VtigerOss/actions/record/update.action.js +16 -0
  58. package/dist/nodes/VtigerOss/actions/record/update.action.js.map +1 -0
  59. package/dist/nodes/VtigerOss/actions/relation/addRelated.action.d.ts +2 -0
  60. package/dist/nodes/VtigerOss/actions/relation/addRelated.action.js +16 -0
  61. package/dist/nodes/VtigerOss/actions/relation/addRelated.action.js.map +1 -0
  62. package/dist/nodes/VtigerOss/actions/relation/listTypes.action.d.ts +2 -0
  63. package/dist/nodes/VtigerOss/actions/relation/listTypes.action.js +13 -0
  64. package/dist/nodes/VtigerOss/actions/relation/listTypes.action.js.map +1 -0
  65. package/dist/nodes/VtigerOss/actions/relation/queryRelated.action.d.ts +2 -0
  66. package/dist/nodes/VtigerOss/actions/relation/queryRelated.action.js +17 -0
  67. package/dist/nodes/VtigerOss/actions/relation/queryRelated.action.js.map +1 -0
  68. package/dist/nodes/VtigerOss/actions/relation/retrieveRelated.action.d.ts +2 -0
  69. package/dist/nodes/VtigerOss/actions/relation/retrieveRelated.action.js +16 -0
  70. package/dist/nodes/VtigerOss/actions/relation/retrieveRelated.action.js.map +1 -0
  71. package/dist/nodes/VtigerOss/actions/router.d.ts +2 -0
  72. package/dist/nodes/VtigerOss/actions/router.js +55 -0
  73. package/dist/nodes/VtigerOss/actions/router.js.map +1 -0
  74. package/dist/nodes/VtigerOss/actions/types.d.ts +17 -0
  75. package/dist/nodes/VtigerOss/actions/types.js +23 -0
  76. package/dist/nodes/VtigerOss/actions/types.js.map +1 -0
  77. package/dist/nodes/VtigerOss/helpers/advanced.d.ts +3 -0
  78. package/dist/nodes/VtigerOss/helpers/advanced.js +31 -0
  79. package/dist/nodes/VtigerOss/helpers/advanced.js.map +1 -0
  80. package/dist/nodes/VtigerOss/helpers/document.d.ts +21 -0
  81. package/dist/nodes/VtigerOss/helpers/document.js +91 -0
  82. package/dist/nodes/VtigerOss/helpers/document.js.map +1 -0
  83. package/dist/nodes/VtigerOss/helpers/file.d.ts +10 -0
  84. package/dist/nodes/VtigerOss/helpers/file.js +74 -0
  85. package/dist/nodes/VtigerOss/helpers/file.js.map +1 -0
  86. package/dist/nodes/VtigerOss/helpers/lead.d.ts +17 -0
  87. package/dist/nodes/VtigerOss/helpers/lead.js +77 -0
  88. package/dist/nodes/VtigerOss/helpers/lead.js.map +1 -0
  89. package/dist/nodes/VtigerOss/helpers/output.d.ts +5 -0
  90. package/dist/nodes/VtigerOss/helpers/output.js +65 -0
  91. package/dist/nodes/VtigerOss/helpers/output.js.map +1 -0
  92. package/dist/nodes/VtigerOss/helpers/pagination.d.ts +9 -0
  93. package/dist/nodes/VtigerOss/helpers/pagination.js +93 -0
  94. package/dist/nodes/VtigerOss/helpers/pagination.js.map +1 -0
  95. package/dist/nodes/VtigerOss/helpers/serialization.d.ts +3 -0
  96. package/dist/nodes/VtigerOss/helpers/serialization.js +24 -0
  97. package/dist/nodes/VtigerOss/helpers/serialization.js.map +1 -0
  98. package/dist/nodes/VtigerOss/helpers/webserviceId.d.ts +1 -0
  99. package/dist/nodes/VtigerOss/helpers/webserviceId.js +12 -0
  100. package/dist/nodes/VtigerOss/helpers/webserviceId.js.map +1 -0
  101. package/dist/nodes/VtigerOss/transport/authentication.d.ts +5 -0
  102. package/dist/nodes/VtigerOss/transport/authentication.js +92 -0
  103. package/dist/nodes/VtigerOss/transport/authentication.js.map +1 -0
  104. package/dist/nodes/VtigerOss/transport/client.d.ts +13 -0
  105. package/dist/nodes/VtigerOss/transport/client.js +81 -0
  106. package/dist/nodes/VtigerOss/transport/client.js.map +1 -0
  107. package/dist/nodes/VtigerOss/transport/compatibility.d.ts +1 -0
  108. package/dist/nodes/VtigerOss/transport/compatibility.js +24 -0
  109. package/dist/nodes/VtigerOss/transport/compatibility.js.map +1 -0
  110. package/dist/nodes/VtigerOss/transport/credentialTest.d.ts +2 -0
  111. package/dist/nodes/VtigerOss/transport/credentialTest.js +40 -0
  112. package/dist/nodes/VtigerOss/transport/credentialTest.js.map +1 -0
  113. package/dist/nodes/VtigerOss/transport/errors.d.ts +8 -0
  114. package/dist/nodes/VtigerOss/transport/errors.js +55 -0
  115. package/dist/nodes/VtigerOss/transport/errors.js.map +1 -0
  116. package/dist/nodes/VtigerOss/transport/types.d.ts +38 -0
  117. package/dist/nodes/VtigerOss/transport/types.js +3 -0
  118. package/dist/nodes/VtigerOss/transport/types.js.map +1 -0
  119. package/dist/nodes/VtigerOss/vtigerOss.dark.svg +15 -0
  120. package/dist/nodes/VtigerOss/vtigerOss.svg +15 -0
  121. package/dist/package.json +67 -0
  122. package/examples/list-accessible-modules.workflow.json +47 -0
  123. package/package.json +67 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 n8n-nodes-vtiger-oss contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,262 @@
1
+ # n8n-nodes-vtiger-oss
2
+
3
+ An n8n community node for Vtiger CRM Open Source 8.x. It gives workflows authenticated access to
4
+ Vtiger's webservice API with dedicated actions for records, documents, relations, VTQL queries,
5
+ module metadata, and lead conversion.
6
+
7
+ The package targets n8n 2.x and Node.js 22.22 or 24. Loading of the packaged node is tested against
8
+ n8n 2.34.5. Core read operations have been verified on fresh Vtiger 8.0 through 8.4 installations;
9
+ known limitations are listed under [Compatibility](#compatibility).
10
+
11
+ ## Resources and Operations
12
+
13
+ The names below match what you see in n8n.
14
+
15
+ | Resource | Operations |
16
+ | ------------------ | --------------------------------------------------------------------------------------- |
17
+ | **Advanced** | Custom GET, Custom POST |
18
+ | **Document** | Download Attachment, Upload, Upload and Link to Record |
19
+ | **Lead** | Convert |
20
+ | **Module** | Describe Module, List Accessible Modules |
21
+ | **Query** | Guided VTQL Query, Raw VTQL Query |
22
+ | **Record** | Create, Delete, Full Update, Retrieve, Update Fields |
23
+ | **Related Record** | Add Related Record, List Related Types, Query Related Records, Retrieve Related Records |
24
+
25
+ Records are referenced by their full Vtiger webservice ID in the form
26
+ `<entity-type-prefix>x<record-number>`, for example `11x123`. The prefix depends on the
27
+ installation, and the plain numeric ID from a CRM URL is not enough. A few inventory fields are
28
+ exceptions – `currency_id`, for instance, usually takes the internal numeric currency ID. When in
29
+ doubt, check the module metadata or an existing record in your installation.
30
+
31
+ ### Record Operations
32
+
33
+ **Record** covers generic CRUD for any module the API user can access, including inventory modules
34
+ as long as you supply the full payload the installation expects.
35
+
36
+ - **Update Fields** uses Vtiger's `revise` operation. Only the fields you send are changed;
37
+ everything else stays as it is.
38
+ - **Full Update** uses Vtiger's `update` operation. You must send every mandatory field and every
39
+ value you want to keep.
40
+
41
+ Use **Update Fields** unless you specifically need the full-update behavior.
42
+ After a successful **Delete**, the node returns `{ "deleted": true }`.
43
+
44
+ ### Output
45
+
46
+ Actions that return records or metadata provide three output modes:
47
+
48
+ - **Simplified** is the default. It returns up to ten top-level fields and prioritizes common
49
+ identity fields such as `id`, names, labels, and email addresses.
50
+ - **Raw** returns every top-level field provided by Vtiger.
51
+ - **Selected Fields** returns only the comma-separated top-level fields you request.
52
+
53
+ Each record in a list remains a separate n8n item. File downloads and action confirmations are not
54
+ filtered by these modes.
55
+
56
+ ### Quotes, Invoices, Sales Orders, and Purchase Orders
57
+
58
+ These modules work with the normal **Record** operations. **Retrieve** returns the `LineItems`
59
+ collection. **Update Fields** keeps existing line items when `LineItems` is omitted and replaces
60
+ them when a non-empty collection is supplied.
61
+
62
+ Vtiger also registers a `retrieve_inventory` operation, but it returns nothing beyond the regular
63
+ `retrieve`. When updating a record in a foreign currency, include its current `conversion_rate` –
64
+ otherwise Vtiger's inventory handler may fall back to `1`.
65
+
66
+ A Quote create payload typically looks like this:
67
+
68
+ ```json
69
+ {
70
+ "subject": "Example Quote",
71
+ "quotestage": "Created",
72
+ "account_id": "11x123",
73
+ "assigned_user_id": "19x1",
74
+ "currency_id": "1",
75
+ "conversion_rate": "1",
76
+ "hdnTaxType": "group",
77
+ "productid": "14x456",
78
+ "quantity": "1",
79
+ "listprice": "100.00",
80
+ "LineItems": [
81
+ {
82
+ "productid": "14x456",
83
+ "quantity": "1",
84
+ "listprice": "100.00",
85
+ "discount_percent": "0",
86
+ "discount_amount": "0",
87
+ "comment": "Example line item"
88
+ }
89
+ ]
90
+ }
91
+ ```
92
+
93
+ Treat this as a structural example rather than a ready-to-run payload. Use **Describe Module** to
94
+ get the actual field list, and take IDs, picklist values, currencies, taxes, custom fields, and any
95
+ further mandatory fields from your installation. The parent-level `productid`, `quantity`, and
96
+ `listprice` are the minimum; some installations also expect the first line item's comment,
97
+ discounts, taxes, purchase cost, margin, or other values at parent level.
98
+
99
+ ### Lead Conversion
100
+
101
+ Vtiger creates the selected Account, Contact, and Potential one after another. If a later step
102
+ fails, the records created before it remain while the Lead stays unconverted. A missing required
103
+ Potential field, for example, can leave behind a Contact that was already created.
104
+
105
+ ### VTQL Queries
106
+
107
+ Both query operations run VTQL `SELECT` statements with offset-based pagination.
108
+
109
+ - **Guided VTQL Query** builds `SELECT *`, `FROM`, `WHERE`, and `ORDER BY` from separate fields.
110
+ Enter the condition only, without the `WHERE` keyword.
111
+ - **Raw VTQL Query** takes the complete `SELECT` statement.
112
+
113
+ Control the result size with **Limit** or **Return All**. The node turns these settings into the
114
+ `LIMIT` clause, so leave `LIMIT` out of the raw query text. Queries that need more than one API
115
+ request must have a stable `ORDER BY`, and records changing mid-query can still affect offset-based
116
+ results.
117
+
118
+ ### Documents and Attachments
119
+
120
+ **Upload** creates a `Documents` record with an internally stored file. **Upload and Link to
121
+ Record** creates the document first and then relates it to an existing record. If linking fails,
122
+ the document is kept and its ID is included in the error message so you can clean up.
123
+
124
+ Vtiger uses two different identifiers here:
125
+
126
+ - The Document ID (`result.id`) is used for retrieval, deletion, and relations.
127
+ - The Attachment Download ID (`imageattachmentids`) is used by **Download Attachment** via
128
+ `files_retrieve`.
129
+
130
+ Downloads are returned as n8n binary data. The aggregate download limit is configurable, defaults
131
+ to 25 MB, and is capped at 100 MB.
132
+
133
+ ### Related Records
134
+
135
+ Start with **List Related Types** to get the exact related module and related-list label the
136
+ installation expects, then use that label with the other operations:
137
+
138
+ - **Retrieve Related Records** returns a related list for a parent record.
139
+ - **Query Related Records** runs a VTQL query within a related list. An optional `LIMIT` clause is
140
+ passed through to Vtiger as-is; there is no automatic pagination.
141
+ - **Add Related Record** links two existing records.
142
+
143
+ Vtiger has no standard webservice operation for removing a relation, so the node does not offer
144
+ one.
145
+
146
+ ### Advanced Operations
147
+
148
+ **Custom GET** and **Custom POST** call any operation registered in the Vtiger installation. The
149
+ node protects the internally managed operation and session parameters, but the operations
150
+ themselves are not allowlisted and can change or delete data.
151
+
152
+ ## Installation
153
+
154
+ Install `n8n-nodes-vtiger-oss` from **Settings > Community Nodes** in n8n. For a manual
155
+ self-hosted installation, run this inside `~/.n8n/nodes`:
156
+
157
+ ```sh
158
+ npm install n8n-nodes-vtiger-oss
159
+ ```
160
+
161
+ Restart n8n, add the **Vtiger Open Source API** credential, and select **Vtiger Open Source** in a
162
+ workflow.
163
+
164
+ ## Credentials
165
+
166
+ Create a dedicated Vtiger API user with only the permissions your workflows need. Enter the
167
+ installation base URL, the username, and the access key from the user's Vtiger preferences – not
168
+ the account password.
169
+
170
+ HTTPS is required by default. **Allow Insecure HTTP** exists only for isolated local test systems
171
+ and should never be enabled on production credentials. n8n stores the access key in its encrypted
172
+ credential store.
173
+
174
+ When the node is used as an AI tool, the generic Record actions can create, update, and delete data
175
+ within the API user's permissions. Keep that user least-privilege and only expose mutating tools
176
+ where the workflow actually needs them.
177
+
178
+ ## Compatibility
179
+
180
+ Compatibility is operation-specific. Fresh-install probes confirmed login, module metadata,
181
+ relation metadata, and ordered VTQL queries on Vtiger 8.0 through 8.4; targeted integration tests
182
+ cover further read behavior. Newer Vtiger 8.x releases are not assumed to work without testing.
183
+ The lab setup, probe generator, and retained matrix results are available in
184
+ [hwjf/vtiger-oss-lab](https://github.com/hwjf/vtiger-oss-lab).
185
+
186
+ ### Fresh Installations
187
+
188
+ | Vtiger version | Status |
189
+ | -------------- | ----------------------------------------------------------------------- |
190
+ | 8.0 – 8.3 | Core read probes pass; `files_retrieve` is broken under PHP 8 |
191
+ | 8.4 | Core read probes pass; `files_retrieve` handler signature is compatible |
192
+
193
+ - Fresh 8.0 through 8.3 installations register `files_retrieve` with an `id` parameter while the
194
+ PHP handler expects `$file_id`. Vtiger 8.4 fixes this.
195
+ - Lead conversion requires the current registration with a single encoded `element` parameter.
196
+
197
+ ### Upgraded Installations
198
+
199
+ An upgraded installation can behave differently from a fresh one reporting the same version.
200
+ Database registrations and old customizations may survive several upgrades even after the PHP
201
+ handlers have changed. One example seen in practice is an obsolete five-parameter `convertlead`
202
+ registration.
203
+
204
+ ## Example
205
+
206
+ A read-only workflow you can import is available at
207
+ [`examples/list-accessible-modules.workflow.json`](https://github.com/hwjf/n8n-nodes-vtiger-oss/blob/main/examples/list-accessible-modules.workflow.json).
208
+ Import it, assign your **Vtiger Open Source API** credential, and run it manually.
209
+
210
+ ## Development
211
+
212
+ Clone the repository, then:
213
+
214
+ ```sh
215
+ npm ci
216
+ npm run format:check
217
+ npm run lint
218
+ npm test
219
+ npm run test:coverage
220
+ npm run build
221
+ ```
222
+
223
+ `npm run dev` loads the package into a local n8n development instance.
224
+
225
+ For integration tests, copy
226
+ [`.env.example`](https://github.com/hwjf/n8n-nodes-vtiger-oss/blob/main/.env.example) to `.env`,
227
+ enter the credentials of a dedicated Vtiger test user, and run `npm run test:integration`.
228
+ Optional record and attachment IDs enable additional read tests. Mutating tests require separate
229
+ explicit flags and an isolated test instance – never point them at production.
230
+
231
+ There is also a
232
+ [packaged-node smoke test](https://github.com/hwjf/n8n-nodes-vtiger-oss/tree/main/test/n8n) that
233
+ builds the package, installs it into n8n 2.34.5, and verifies that the node loads against n8n's
234
+ own `n8n-workflow` installation.
235
+
236
+ ## Troubleshooting
237
+
238
+ - **Credential test fails:** Enter the base URL without `/webservice.php`, double-check the access
239
+ key, and use HTTPS.
240
+ - **Invalid record ID:** Use the full webservice ID returned by Vtiger or this node, not the
241
+ numeric ID from a CRM URL.
242
+ - **Permission to perform the operation is denied:** Make sure the module is active and the API
243
+ user can access the module, the record, any referenced users, and all related modules involved.
244
+ Vtiger also returns this message when a module such as Leads is disabled.
245
+ - **HTTP 500 on attachments or lead conversion:** See the compatibility notes and check the
246
+ `vtiger_ws_operation` table. Upgraded installations can carry incompatible registrations.
247
+ - **A query stops at 100 records:** Enable **Return All** or raise **Limit**. The node converts
248
+ this into the `LIMIT` clause; multi-page queries also need an `ORDER BY`.
249
+ - **Execution continues after an item error:** Disable n8n's **Continue On Fail** if the workflow
250
+ should stop at the first failed item.
251
+ - **Local development fails on Node 23:** Use Node.js 22.22 LTS or 24. Odd-numbered Node.js
252
+ releases are not supported by the toolchain.
253
+
254
+ ## Trademarks
255
+
256
+ Vtiger and the Vtiger logo are trademarks of their respective owner and are used here only to
257
+ indicate compatibility with Vtiger CRM. This is an independent community project and is not
258
+ affiliated with or endorsed by Vtiger.
259
+
260
+ ## License
261
+
262
+ [MIT](https://github.com/hwjf/n8n-nodes-vtiger-oss/blob/main/LICENSE)
@@ -0,0 +1,29 @@
1
+ # Third-Party Notices
2
+
3
+ ## Vtiger Logo Mark
4
+
5
+ The Vtiger logo mark in `nodes/VtigerOss/vtigerOss.svg` is adapted from:
6
+
7
+ https://github.com/sogjugz/n8n-nodes-vtiger-crm/blob/master/nodes/Vtiger/vtiger.svg
8
+
9
+ That repository distributes its software under the MIT License:
10
+
11
+ Copyright 2022 n8n
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
14
+ associated documentation files (the "Software"), to deal in the Software without restriction,
15
+ including without limitation the rights to use, copy, modify, merge, publish, distribute,
16
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all copies or
20
+ substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
23
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
26
+ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
+
28
+ Vtiger and the Vtiger logo are trademarks of their respective owner. Their use does not imply
29
+ affiliation with or endorsement of this community project.
@@ -0,0 +1,8 @@
1
+ import type { Icon, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class VtigerOssApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: Icon;
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VtigerOssApi = void 0;
4
+ class VtigerOssApi {
5
+ constructor() {
6
+ this.name = 'vtigerOssApi';
7
+ this.displayName = 'Vtiger Open Source API';
8
+ this.icon = {
9
+ light: 'file:../nodes/VtigerOss/vtigerOss.svg',
10
+ dark: 'file:../nodes/VtigerOss/vtigerOss.dark.svg',
11
+ };
12
+ this.documentationUrl = 'https://github.com/hwjf/n8n-nodes-vtiger-oss#credentials';
13
+ this.properties = [
14
+ {
15
+ displayName: 'Base URL',
16
+ name: 'baseUrl',
17
+ type: 'string',
18
+ default: '',
19
+ placeholder: 'e.g. https://vtiger.example.com/vtigercrm',
20
+ description: 'Root URL of the Vtiger installation, including any installation subdirectory and excluding /webservice.php',
21
+ required: true,
22
+ },
23
+ {
24
+ displayName: 'Username',
25
+ name: 'username',
26
+ type: 'string',
27
+ default: '',
28
+ required: true,
29
+ },
30
+ {
31
+ displayName: 'Access Key',
32
+ name: 'apiKey',
33
+ type: 'string',
34
+ typeOptions: { password: true },
35
+ default: '',
36
+ description: 'Access key from the Vtiger user preferences, not the account password',
37
+ required: true,
38
+ },
39
+ {
40
+ displayName: 'Allow Insecure HTTP',
41
+ name: 'allowInsecureHttp',
42
+ type: 'boolean',
43
+ default: false,
44
+ description: 'Whether to allow unencrypted HTTP connections. Enable only for isolated development systems.',
45
+ },
46
+ ];
47
+ }
48
+ }
49
+ exports.VtigerOssApi = VtigerOssApi;
50
+ //# sourceMappingURL=VtigerOssApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VtigerOssApi.credentials.js","sourceRoot":"","sources":["../../credentials/VtigerOssApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAY;IAAzB;QACC,SAAI,GAAG,cAAc,CAAC;QAEtB,gBAAW,GAAG,wBAAwB,CAAC;QAEvC,SAAI,GAAS;YACZ,KAAK,EAAE,uCAAuC;YAC9C,IAAI,EAAE,4CAA4C;SAClD,CAAC;QAEF,qBAAgB,GAAG,0DAA0D,CAAC;QAE9E,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,2CAA2C;gBACxD,WAAW,EACV,4GAA4G;gBAC7G,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,uEAAuE;gBACpF,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,KAAK;gBACd,WAAW,EACV,8FAA8F;aAC/F;SACD,CAAC;IACH,CAAC;CAAA;AAhDD,oCAgDC"}
@@ -0,0 +1,11 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ import { testVtigerCredentials } from './transport/credentialTest';
3
+ export declare class VtigerOss implements INodeType {
4
+ description: INodeTypeDescription;
5
+ methods: {
6
+ credentialTest: {
7
+ testVtigerCredentials: typeof testVtigerCredentials;
8
+ };
9
+ };
10
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
11
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VtigerOss = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const properties_1 = require("./actions/properties");
6
+ const router_1 = require("./actions/router");
7
+ const types_1 = require("./actions/types");
8
+ const output_1 = require("./helpers/output");
9
+ const client_1 = require("./transport/client");
10
+ const credentialTest_1 = require("./transport/credentialTest");
11
+ class VtigerOss {
12
+ constructor() {
13
+ this.description = {
14
+ displayName: 'Vtiger Open Source',
15
+ name: 'vtigerOss',
16
+ icon: { light: 'file:vtigerOss.svg', dark: 'file:vtigerOss.dark.svg' },
17
+ group: ['transform'],
18
+ version: 1,
19
+ description: 'Interact with Vtiger CRM Open Source',
20
+ subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
21
+ defaults: {
22
+ name: 'Vtiger Open Source',
23
+ },
24
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
25
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
26
+ usableAsTool: true,
27
+ credentials: [
28
+ {
29
+ name: 'vtigerOssApi',
30
+ required: true,
31
+ testedBy: 'testVtigerCredentials',
32
+ },
33
+ ],
34
+ properties: properties_1.actionProperties,
35
+ };
36
+ this.methods = {
37
+ credentialTest: {
38
+ testVtigerCredentials: credentialTest_1.testVtigerCredentials,
39
+ },
40
+ };
41
+ }
42
+ async execute() {
43
+ const inputItems = this.getInputData();
44
+ if (inputItems.length === 0)
45
+ return [[]];
46
+ const client = await client_1.VtigerClient.create(this);
47
+ const outputItems = [];
48
+ for (let itemIndex = 0; itemIndex < inputItems.length; itemIndex++) {
49
+ try {
50
+ const resource = this.getNodeParameter('resource', itemIndex);
51
+ const operation = this.getNodeParameter('operation', itemIndex);
52
+ const result = await (0, router_1.routeAction)({ context: this, client, itemIndex });
53
+ const outputMode = (0, output_1.actionSupportsOutput)(resource, operation)
54
+ ? this.getNodeParameter('output', itemIndex, 'simplified')
55
+ : 'raw';
56
+ const selectedFields = outputMode === 'selected'
57
+ ? (0, output_1.parseSelectedFields)(this.getNodeParameter('fieldsToInclude', itemIndex, ''))
58
+ : [];
59
+ for (const output of (0, types_1.asOutputItems)(result)) {
60
+ outputItems.push({
61
+ ...output,
62
+ json: (0, output_1.formatOutput)(output.json, outputMode, selectedFields),
63
+ pairedItem: itemIndex,
64
+ });
65
+ }
66
+ }
67
+ catch (error) {
68
+ const nodeError = new n8n_workflow_1.NodeOperationError(this.getNode(), error instanceof Error ? error : new Error('Unknown Vtiger error'), { itemIndex });
69
+ if (!this.continueOnFail())
70
+ throw nodeError;
71
+ outputItems.push({
72
+ json: inputItems[itemIndex].json,
73
+ error: nodeError,
74
+ pairedItem: itemIndex,
75
+ });
76
+ }
77
+ }
78
+ return [outputItems];
79
+ }
80
+ }
81
+ exports.VtigerOss = VtigerOss;
82
+ //# sourceMappingURL=VtigerOss.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VtigerOss.node.js","sourceRoot":"","sources":["../../../nodes/VtigerOss/VtigerOss.node.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,18 @@
1
+ {
2
+ "node": "n8n-nodes-vtiger-oss.vtigerOss",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Sales", "Productivity"],
6
+ "resources": {
7
+ "credentialDocumentation": [
8
+ {
9
+ "url": "https://github.com/hwjf/n8n-nodes-vtiger-oss#credentials"
10
+ }
11
+ ],
12
+ "primaryDocumentation": [
13
+ {
14
+ "url": "https://github.com/hwjf/n8n-nodes-vtiger-oss#readme"
15
+ }
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,2 @@
1
+ import type { ActionHandler } from '../types';
2
+ export declare const customGet: ActionHandler;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.customGet = void 0;
4
+ const advanced_1 = require("../../helpers/advanced");
5
+ const customGet = async ({ context, client, itemIndex }) => {
6
+ const operation = (0, advanced_1.validateCustomOperation)(context.getNodeParameter('customOperation', itemIndex));
7
+ const parameters = (0, advanced_1.serializeCustomParameters)(context.getNodeParameter('customParameters', itemIndex));
8
+ return await client.request({ method: 'GET', operation, parameters });
9
+ };
10
+ exports.customGet = customGet;
11
+ //# sourceMappingURL=customGet.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customGet.action.js","sourceRoot":"","sources":["../../../../../nodes/VtigerOss/actions/advanced/customGet.action.ts"],"names":[],"mappings":";;;AACA,qDAA4F;AAErF,MAAM,SAAS,GAAkB,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE;IAChF,MAAM,SAAS,GAAG,IAAA,kCAAuB,EACxC,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,SAAS,CAAW,CAChE,CAAC;IACF,MAAM,UAAU,GAAG,IAAA,oCAAyB,EAC3C,OAAO,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,SAAS,CAAC,CACvD,CAAC;IACF,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;AACvE,CAAC,CAAC;AARW,QAAA,SAAS,aAQpB"}
@@ -0,0 +1,2 @@
1
+ import type { ActionHandler } from '../types';
2
+ export declare const customPost: ActionHandler;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.customPost = void 0;
4
+ const advanced_1 = require("../../helpers/advanced");
5
+ const customPost = async ({ context, client, itemIndex }) => {
6
+ const operation = (0, advanced_1.validateCustomOperation)(context.getNodeParameter('customOperation', itemIndex));
7
+ const parameters = (0, advanced_1.serializeCustomParameters)(context.getNodeParameter('customParameters', itemIndex));
8
+ return await client.request({ method: 'POST', operation, parameters });
9
+ };
10
+ exports.customPost = customPost;
11
+ //# sourceMappingURL=customPost.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customPost.action.js","sourceRoot":"","sources":["../../../../../nodes/VtigerOss/actions/advanced/customPost.action.ts"],"names":[],"mappings":";;;AACA,qDAA4F;AAErF,MAAM,UAAU,GAAkB,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE;IACjF,MAAM,SAAS,GAAG,IAAA,kCAAuB,EACxC,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,SAAS,CAAW,CAChE,CAAC;IACF,MAAM,UAAU,GAAG,IAAA,oCAAyB,EAC3C,OAAO,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,SAAS,CAAC,CACvD,CAAC;IACF,OAAO,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;AACxE,CAAC,CAAC;AARW,QAAA,UAAU,cAQrB"}
@@ -0,0 +1,2 @@
1
+ import type { ActionHandler } from '../types';
2
+ export declare const downloadAttachment: ActionHandler;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.downloadAttachment = void 0;
4
+ const types_1 = require("../types");
5
+ const file_1 = require("../../helpers/file");
6
+ const webserviceId_1 = require("../../helpers/webserviceId");
7
+ const downloadAttachment = async ({ context, client, itemIndex }) => {
8
+ const id = (0, webserviceId_1.validateWebserviceId)(context.getNodeParameter('attachmentId', itemIndex));
9
+ const binaryPropertyName = context.getNodeParameter('binaryPropertyName', itemIndex);
10
+ const maximumMegabytes = context.getNodeParameter('maximumFileSize', itemIndex);
11
+ const maximumBytes = (0, file_1.maximumFileSizeInBytes)(maximumMegabytes);
12
+ const result = await client.request({
13
+ method: 'GET',
14
+ operation: 'files_retrieve',
15
+ parameters: { id },
16
+ });
17
+ const files = (0, file_1.parseRetrievedFiles)(result, maximumBytes);
18
+ const outputs = [];
19
+ for (const file of files) {
20
+ const binaryData = await context.helpers.prepareBinaryData(file.data, file.fileName, file.mimeType);
21
+ outputs.push((0, types_1.createActionOutput)({
22
+ fileId: file.fileId,
23
+ fileName: file.fileName,
24
+ mimeType: file.mimeType,
25
+ fileSize: file.fileSize,
26
+ }, { [binaryPropertyName]: binaryData }));
27
+ }
28
+ return outputs;
29
+ };
30
+ exports.downloadAttachment = downloadAttachment;
31
+ //# sourceMappingURL=download.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.action.js","sourceRoot":"","sources":["../../../../../nodes/VtigerOss/actions/document/download.action.ts"],"names":[],"mappings":";;;AACA,oCAA8C;AAC9C,6CAAiF;AACjF,6DAAkE;AAE3D,MAAM,kBAAkB,GAAkB,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE;IACzF,MAAM,EAAE,GAAG,IAAA,mCAAoB,EAAC,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,SAAS,CAAW,CAAC,CAAC;IAC/F,MAAM,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,SAAS,CAAW,CAAC;IAC/F,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,SAAS,CAAW,CAAC;IAC1F,MAAM,YAAY,GAAG,IAAA,6BAAsB,EAAC,gBAAgB,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QACnC,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,gBAAgB;QAC3B,UAAU,EAAE,EAAE,EAAE,EAAE;KAClB,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,IAAA,0BAAmB,EAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,EAAE,CAAC;IAEnB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,iBAAiB,CACzD,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,QAAQ,CACb,CAAC;QACF,OAAO,CAAC,IAAI,CACX,IAAA,0BAAkB,EACjB;YACC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACvB,EACD,EAAE,CAAC,kBAAkB,CAAC,EAAE,UAAU,EAAE,CACpC,CACD,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAjCW,QAAA,kBAAkB,sBAiC7B"}
@@ -0,0 +1,4 @@
1
+ import type { ActionContext, ActionHandler } from '../types';
2
+ import type { UploadedDocument } from '../../helpers/document';
3
+ export declare function uploadDocument({ context, client, itemIndex, }: ActionContext): Promise<UploadedDocument>;
4
+ export declare const upload: ActionHandler;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.upload = void 0;
4
+ exports.uploadDocument = uploadDocument;
5
+ const document_1 = require("../../helpers/document");
6
+ const file_1 = require("../../helpers/file");
7
+ const serialization_1 = require("../../helpers/serialization");
8
+ async function uploadDocument({ context, client, itemIndex, }) {
9
+ const binaryPropertyName = context.getNodeParameter('binaryPropertyName', itemIndex);
10
+ const binaryData = context.helpers.assertBinaryData(itemIndex, binaryPropertyName);
11
+ const fileName = (0, document_1.validateUploadFileName)(binaryData.fileName);
12
+ const file = await context.helpers.getBinaryDataBuffer(itemIndex, binaryPropertyName);
13
+ const maximumBytes = (0, file_1.maximumFileSizeInBytes)(context.getNodeParameter('maximumFileSize', itemIndex), 'Maximum Upload Size', 'create');
14
+ (0, document_1.assertUploadSize)(file.length, maximumBytes);
15
+ const element = (0, document_1.buildDocumentElement)({
16
+ title: context.getNodeParameter('documentTitle', itemIndex, ''),
17
+ fileName,
18
+ assignedToId: context.getNodeParameter('assignedToId', itemIndex),
19
+ folderId: context.getNodeParameter('folderId', itemIndex),
20
+ fileStatus: context.getNodeParameter('fileStatus', itemIndex),
21
+ additionalFields: context.getNodeParameter('documentFields', itemIndex, '{}'),
22
+ });
23
+ const result = await client.requestMultipart({
24
+ operation: 'create',
25
+ parameters: {
26
+ elementType: 'Documents',
27
+ element: (0, serialization_1.encodeElement)(element),
28
+ filename_hidden: fileName,
29
+ },
30
+ file: {
31
+ fieldName: 'filename',
32
+ data: file,
33
+ fileName,
34
+ mimeType: binaryData.mimeType,
35
+ },
36
+ });
37
+ return (0, document_1.normalizeUploadedDocument)(result);
38
+ }
39
+ const upload = async (actionContext) => await uploadDocument(actionContext);
40
+ exports.upload = upload;
41
+ //# sourceMappingURL=upload.action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.action.js","sourceRoot":"","sources":["../../../../../nodes/VtigerOss/actions/document/upload.action.ts"],"names":[],"mappings":";;;AAWA,wCAuCC;AAhDD,qDAKgC;AAChC,6CAA4D;AAC5D,+DAA4D;AAErD,KAAK,UAAU,cAAc,CAAC,EACpC,OAAO,EACP,MAAM,EACN,SAAS,GACM;IACf,MAAM,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,SAAS,CAAW,CAAC;IAC/F,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IACnF,MAAM,QAAQ,GAAG,IAAA,iCAAsB,EAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IACtF,MAAM,YAAY,GAAG,IAAA,6BAAsB,EAC1C,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,SAAS,CAAW,EAChE,qBAAqB,EACrB,QAAQ,CACR,CAAC;IACF,IAAA,2BAAgB,EAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,IAAA,+BAAoB,EAAC;QACpC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,EAAE,SAAS,EAAE,EAAE,CAAW;QACzE,QAAQ;QACR,YAAY,EAAE,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,SAAS,CAAW;QAC3E,QAAQ,EAAE,OAAO,CAAC,gBAAgB,CAAC,UAAU,EAAE,SAAS,CAAW;QACnE,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,YAAY,EAAE,SAAS,CAAY;QACxE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,SAAS,EAAE,IAAI,CAAC;KAC7E,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC;QAC5C,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE;YACX,WAAW,EAAE,WAAW;YACxB,OAAO,EAAE,IAAA,6BAAa,EAAC,OAAO,CAAC;YAC/B,eAAe,EAAE,QAAQ;SACzB;QACD,IAAI,EAAE;YACL,SAAS,EAAE,UAAU;YACrB,IAAI,EAAE,IAAI;YACV,QAAQ;YACR,QAAQ,EAAE,UAAU,CAAC,QAAQ;SAC7B;KACD,CAAC,CAAC;IAEH,OAAO,IAAA,oCAAyB,EAAC,MAAM,CAAC,CAAC;AAC1C,CAAC;AAEM,MAAM,MAAM,GAAkB,KAAK,EAAE,aAAa,EAAE,EAAE,CAAC,MAAM,cAAc,CAAC,aAAa,CAAC,CAAC;AAArF,QAAA,MAAM,UAA+E"}
@@ -0,0 +1,2 @@
1
+ import type { ActionHandler } from '../types';
2
+ export declare const uploadAndLink: ActionHandler;