Compare commits
	
		
			2 Commits
		
	
	
		
			dependabot
			...
			AUT-755
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 71a404063c | ||
|   | 8bb7b16c0e | 
							
								
								
									
										1487
									
								
								packages/backend/src/apps/pdf-monkey/assets/favicon.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1487
									
								
								packages/backend/src/apps/pdf-monkey/assets/favicon.svg
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| After Width: | Height: | Size: 112 KiB | 
							
								
								
									
										21
									
								
								packages/backend/src/apps/pdf-monkey/auth/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								packages/backend/src/apps/pdf-monkey/auth/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | import verifyCredentials from './verify-credentials.js'; | ||||||
|  | import isStillVerified from './is-still-verified.js'; | ||||||
|  |  | ||||||
|  | export default { | ||||||
|  |   fields: [ | ||||||
|  |     { | ||||||
|  |       key: 'apiKey', | ||||||
|  |       label: 'API Key', | ||||||
|  |       type: 'string', | ||||||
|  |       required: true, | ||||||
|  |       readOnly: false, | ||||||
|  |       value: null, | ||||||
|  |       placeholder: null, | ||||||
|  |       description: 'PDFMonkey API secret key of your account.', | ||||||
|  |       clickToCopy: false, | ||||||
|  |     }, | ||||||
|  |   ], | ||||||
|  |  | ||||||
|  |   verifyCredentials, | ||||||
|  |   isStillVerified, | ||||||
|  | }; | ||||||
| @@ -0,0 +1,8 @@ | |||||||
|  | import getCurrentUser from '../common/get-current-user.js'; | ||||||
|  |  | ||||||
|  | const isStillVerified = async ($) => { | ||||||
|  |   const currentUser = await getCurrentUser($); | ||||||
|  |   return !!currentUser.id; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | export default isStillVerified; | ||||||
| @@ -0,0 +1,15 @@ | |||||||
|  | import getCurrentUser from '../common/get-current-user.js'; | ||||||
|  |  | ||||||
|  | const verifyCredentials = async ($) => { | ||||||
|  |   const currentUser = await getCurrentUser($); | ||||||
|  |   const screenName = [currentUser.desired_name, currentUser.email] | ||||||
|  |     .filter(Boolean) | ||||||
|  |     .join(' @ '); | ||||||
|  |  | ||||||
|  |   await $.auth.set({ | ||||||
|  |     screenName, | ||||||
|  |     apiKey: $.auth.data.apiKey, | ||||||
|  |   }); | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | export default verifyCredentials; | ||||||
| @@ -0,0 +1,9 @@ | |||||||
|  | const addAuthHeader = ($, requestConfig) => { | ||||||
|  |   if ($.auth.data?.apiKey) { | ||||||
|  |     requestConfig.headers.Authorization = `Bearer ${$.auth.data.apiKey}`; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   return requestConfig; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | export default addAuthHeader; | ||||||
| @@ -0,0 +1,8 @@ | |||||||
|  | const getCurrentUser = async ($) => { | ||||||
|  |   const response = await $.http.get('/v1/current_user'); | ||||||
|  |   const currentUser = response.data.current_user; | ||||||
|  |  | ||||||
|  |   return currentUser; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | export default getCurrentUser; | ||||||
| @@ -0,0 +1,4 @@ | |||||||
|  | import listTemplates from './list-templates/index.js'; | ||||||
|  | import listWorkspaces from './list-workspaces/index.js'; | ||||||
|  |  | ||||||
|  | export default [listTemplates, listWorkspaces]; | ||||||
| @@ -0,0 +1,39 @@ | |||||||
|  | export default { | ||||||
|  |   name: 'List templates', | ||||||
|  |   key: 'listTemplates', | ||||||
|  |  | ||||||
|  |   async run($) { | ||||||
|  |     const templates = { | ||||||
|  |       data: [], | ||||||
|  |     }; | ||||||
|  |     const workspaceId = $.step.parameters.workspaceId; | ||||||
|  |     let next = false; | ||||||
|  |  | ||||||
|  |     const params = { | ||||||
|  |       page: 'all', | ||||||
|  |       'q[workspace_id]': workspaceId, | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     if (!workspaceId) { | ||||||
|  |       return templates; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     do { | ||||||
|  |       const { data } = await $.http.get('/v1/document_template_cards', params); | ||||||
|  |       next = data.meta.next_page; | ||||||
|  |  | ||||||
|  |       if (!data?.document_template_cards?.length) { | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       for (const template of data.document_template_cards) { | ||||||
|  |         templates.data.push({ | ||||||
|  |           value: template.id, | ||||||
|  |           name: template.identifier, | ||||||
|  |         }); | ||||||
|  |       } | ||||||
|  |     } while (next); | ||||||
|  |  | ||||||
|  |     return templates; | ||||||
|  |   }, | ||||||
|  | }; | ||||||
| @@ -0,0 +1,29 @@ | |||||||
|  | export default { | ||||||
|  |   name: 'List workspaces', | ||||||
|  |   key: 'listWorkspaces', | ||||||
|  |  | ||||||
|  |   async run($) { | ||||||
|  |     const workspaces = { | ||||||
|  |       data: [], | ||||||
|  |     }; | ||||||
|  |     let next = false; | ||||||
|  |  | ||||||
|  |     do { | ||||||
|  |       const { data } = await $.http.get('/v1/workspace_cards'); | ||||||
|  |       next = data.meta.next_page; | ||||||
|  |  | ||||||
|  |       if (!data?.workspace_cards?.length) { | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       for (const workspace of data.workspace_cards) { | ||||||
|  |         workspaces.data.push({ | ||||||
|  |           value: workspace.id, | ||||||
|  |           name: workspace.identifier, | ||||||
|  |         }); | ||||||
|  |       } | ||||||
|  |     } while (next); | ||||||
|  |  | ||||||
|  |     return workspaces; | ||||||
|  |   }, | ||||||
|  | }; | ||||||
							
								
								
									
										20
									
								
								packages/backend/src/apps/pdf-monkey/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								packages/backend/src/apps/pdf-monkey/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | |||||||
|  | import defineApp from '../../helpers/define-app.js'; | ||||||
|  | import addAuthHeader from './common/add-auth-header.js'; | ||||||
|  | import auth from './auth/index.js'; | ||||||
|  | import triggers from './triggers/index.js'; | ||||||
|  | import dynamicData from './dynamic-data/index.js'; | ||||||
|  |  | ||||||
|  | export default defineApp({ | ||||||
|  |   name: 'PDFMonkey', | ||||||
|  |   key: 'pdf-monkey', | ||||||
|  |   iconUrl: '{BASE_URL}/apps/pdf-monkey/assets/favicon.svg', | ||||||
|  |   authDocUrl: 'https://automatisch.io/docs/apps/pdf-monkey/connection', | ||||||
|  |   supportsConnections: true, | ||||||
|  |   baseUrl: 'https://pdfmonkey.io', | ||||||
|  |   apiBaseUrl: 'https://api.pdfmonkey.io/api', | ||||||
|  |   primaryColor: '376794', | ||||||
|  |   beforeRequest: [addAuthHeader], | ||||||
|  |   auth, | ||||||
|  |   triggers, | ||||||
|  |   dynamicData, | ||||||
|  | }); | ||||||
| @@ -0,0 +1,99 @@ | |||||||
|  | import defineTrigger from '../../../../helpers/define-trigger.js'; | ||||||
|  |  | ||||||
|  | export default defineTrigger({ | ||||||
|  |   name: 'Documents Generated', | ||||||
|  |   key: 'documentsGenerated', | ||||||
|  |   pollInterval: 15, | ||||||
|  |   description: | ||||||
|  |     'Triggers upon the successful completion of document generation.', | ||||||
|  |   arguments: [ | ||||||
|  |     { | ||||||
|  |       label: 'Workspace', | ||||||
|  |       key: 'workspaceId', | ||||||
|  |       type: 'dropdown', | ||||||
|  |       required: true, | ||||||
|  |       description: '', | ||||||
|  |       variables: true, | ||||||
|  |       source: { | ||||||
|  |         type: 'query', | ||||||
|  |         name: 'getDynamicData', | ||||||
|  |         arguments: [ | ||||||
|  |           { | ||||||
|  |             name: 'key', | ||||||
|  |             value: 'listWorkspaces', | ||||||
|  |           }, | ||||||
|  |         ], | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       label: 'Templates', | ||||||
|  |       key: 'templateIds', | ||||||
|  |       type: 'dynamic', | ||||||
|  |       required: false, | ||||||
|  |       description: 'Apply this trigger exclusively for particular templates.', | ||||||
|  |       fields: [ | ||||||
|  |         { | ||||||
|  |           label: 'Template', | ||||||
|  |           key: 'templateId', | ||||||
|  |           type: 'dropdown', | ||||||
|  |           required: false, | ||||||
|  |           depensOn: ['parameters.workspaceId'], | ||||||
|  |           description: '', | ||||||
|  |           variables: true, | ||||||
|  |           source: { | ||||||
|  |             type: 'query', | ||||||
|  |             name: 'getDynamicData', | ||||||
|  |             arguments: [ | ||||||
|  |               { | ||||||
|  |                 name: 'key', | ||||||
|  |                 value: 'listTemplates', | ||||||
|  |               }, | ||||||
|  |               { | ||||||
|  |                 name: 'parameters.workspaceId', | ||||||
|  |                 value: '{parameters.workspaceId}', | ||||||
|  |               }, | ||||||
|  |             ], | ||||||
|  |           }, | ||||||
|  |         }, | ||||||
|  |       ], | ||||||
|  |     }, | ||||||
|  |   ], | ||||||
|  |  | ||||||
|  |   async run($) { | ||||||
|  |     const workspaceId = $.step.parameters.workspaceId; | ||||||
|  |     const templateIds = $.step.parameters.templateIds; | ||||||
|  |     const allTemplates = templateIds | ||||||
|  |       .map((templateId) => templateId.templateId) | ||||||
|  |       .join(','); | ||||||
|  |  | ||||||
|  |     const params = { | ||||||
|  |       'page[size]': 100, | ||||||
|  |       'q[workspace_id]': workspaceId, | ||||||
|  |       'q[status]': 'success', | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     if (!templateIds.length) { | ||||||
|  |       params['q[document_template_id]'] = allTemplates; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     let next = false; | ||||||
|  |     do { | ||||||
|  |       const { data } = await $.http.get('/v1/document_cards', { params }); | ||||||
|  |  | ||||||
|  |       if (!data?.document_cards?.length) { | ||||||
|  |         return; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       next = data.meta.next_page; | ||||||
|  |  | ||||||
|  |       for (const document of data.document_cards) { | ||||||
|  |         $.pushTriggerItem({ | ||||||
|  |           raw: document, | ||||||
|  |           meta: { | ||||||
|  |             internalId: document.id, | ||||||
|  |           }, | ||||||
|  |         }); | ||||||
|  |       } | ||||||
|  |     } while (next); | ||||||
|  |   }, | ||||||
|  | }); | ||||||
							
								
								
									
										3
									
								
								packages/backend/src/apps/pdf-monkey/triggers/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								packages/backend/src/apps/pdf-monkey/triggers/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | import documentsGenerated from './documents-generated/index.js'; | ||||||
|  |  | ||||||
|  | export default [documentsGenerated]; | ||||||
| @@ -252,6 +252,15 @@ export default defineConfig({ | |||||||
|             { text: 'Connection', link: '/apps/openai/connection' }, |             { text: 'Connection', link: '/apps/openai/connection' }, | ||||||
|           ], |           ], | ||||||
|         }, |         }, | ||||||
|  |         { | ||||||
|  |           text: 'PDFMonkey', | ||||||
|  |           collapsible: true, | ||||||
|  |           collapsed: true, | ||||||
|  |           items: [ | ||||||
|  |             { text: 'Triggers', link: '/apps/pdf-monkey/triggers' }, | ||||||
|  |             { text: 'Connection', link: '/apps/pdf-monkey/connection' }, | ||||||
|  |           ], | ||||||
|  |         }, | ||||||
|         { |         { | ||||||
|           text: 'Pipedrive', |           text: 'Pipedrive', | ||||||
|           collapsible: true, |           collapsible: true, | ||||||
| @@ -305,7 +314,7 @@ export default defineConfig({ | |||||||
|           collapsed: true, |           collapsed: true, | ||||||
|           items: [ |           items: [ | ||||||
|             { text: 'Actions', link: '/apps/removebg/actions' }, |             { text: 'Actions', link: '/apps/removebg/actions' }, | ||||||
|             { text: 'Connection', link: '/apps/removebg/connection' } |             { text: 'Connection', link: '/apps/removebg/connection' }, | ||||||
|           ], |           ], | ||||||
|         }, |         }, | ||||||
|         { |         { | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								packages/docs/pages/apps/pdf-monkey/connection.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								packages/docs/pages/apps/pdf-monkey/connection.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  | # PDFMonkey | ||||||
|  |  | ||||||
|  | :::info | ||||||
|  | This page explains the steps you need to follow to set up the PDFMonkey | ||||||
|  | connection in Automatisch. If any of the steps are outdated, please let us know! | ||||||
|  | ::: | ||||||
|  |  | ||||||
|  | 1. Login to your PDFMonkey account: [https://dashboard.pdfmonkey.io/login](https://dashboard.pdfmonkey.io/login). | ||||||
|  | 2. Go to **My Account** section from your profile. | ||||||
|  | 3. Copy `API SECRET KEY` from the page to the `API Key` field on Automatisch. | ||||||
|  | 4. Now, you can start using the PDFMonkey connection with Automatisch. | ||||||
							
								
								
									
										12
									
								
								packages/docs/pages/apps/pdf-monkey/triggers.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								packages/docs/pages/apps/pdf-monkey/triggers.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | --- | ||||||
|  | favicon: /favicons/pdf-monkey.svg | ||||||
|  | items: | ||||||
|  |   - name: Documents Generated | ||||||
|  |     desc: Triggers upon the successful completion of document generation. | ||||||
|  | --- | ||||||
|  |  | ||||||
|  | <script setup> | ||||||
|  |   import CustomListing from '../../components/CustomListing.vue' | ||||||
|  | </script> | ||||||
|  |  | ||||||
|  | <CustomListing /> | ||||||
							
								
								
									
										1487
									
								
								packages/docs/pages/public/favicons/pdf-monkey.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1487
									
								
								packages/docs/pages/public/favicons/pdf-monkey.svg
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| After Width: | Height: | Size: 112 KiB | 
		Reference in New Issue
	
	Block a user