@pipedream/pandadoc 0.2.5 → 0.2.6

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.
@@ -9,7 +9,7 @@ export default {
9
9
  name: "Create Document Attachment",
10
10
  description: "Adds an attachment to a document. [See the docs here](https://developers.pandadoc.com/reference/create-document-attachment)",
11
11
  type: "action",
12
- version: "0.0.5",
12
+ version: "0.0.6",
13
13
  props: {
14
14
  app,
15
15
  documentId: {
@@ -7,7 +7,7 @@ export default {
7
7
  name: "Create Document From File",
8
8
  description: "Create a document from a file or public file URL. [See the docs here](https://developers.pandadoc.com/reference/create-document-from-pdf)",
9
9
  type: "action",
10
- version: "0.0.6",
10
+ version: "0.0.7",
11
11
  props: {
12
12
  app,
13
13
  name: {
@@ -41,6 +41,13 @@ export default {
41
41
  "documentFolderId",
42
42
  ],
43
43
  },
44
+ fields: {
45
+ type: "string",
46
+ label: "Fields",
47
+ description: `A \`fields\` object containing fields to add to the document. [See the documentation](https://developers.pandadoc.com/reference/create-document-from-pdf) for more information about fields.
48
+ \nE.g. \`{ "name": { "value": "Jane", "role": "user" }, "like": { "value": true, "role": "user" } }\``,
49
+ optional: true,
50
+ },
44
51
  },
45
52
  methods: createDocumentAttachment.methods,
46
53
  async run({ $ }) {
@@ -64,6 +71,12 @@ export default {
64
71
  recipients: parsedRecipients,
65
72
  folder_uuid: documentFolderId,
66
73
  };
74
+ if (this.fields) {
75
+ json.parse_form_fields = true;
76
+ json.fields = typeof this.fields === "string"
77
+ ? JSON.parse(this.fields)
78
+ : this.fields;
79
+ }
67
80
 
68
81
  if (fileUrl) {
69
82
  data = json;
@@ -83,7 +96,7 @@ export default {
83
96
  },
84
97
  });
85
98
 
86
- $.export("$summary", `Successfully created document attachment with ID: ${response.uuid}`);
99
+ $.export("$summary", `Successfully created document with ID: ${response.uuid}`);
87
100
  return response;
88
101
  },
89
102
  };
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Create Document From Template",
6
6
  description: "Create Document from PandaDoc Template. [See the docs here](https://developers.pandadoc.com/reference/create-document-from-pandadoc-template)",
7
7
  type: "action",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  props: {
10
10
  app,
11
11
  name: {
@@ -19,6 +19,8 @@ export default {
19
19
  app,
20
20
  "templateId",
21
21
  ],
22
+ reloadProps: true,
23
+ description: "The ID of a template you want to use. Note: if you want to **prefill fields in your template**, you need to map your template fields to the API fields following [the instruction here](https://developers.pandadoc.com/reference/create-document-from-pandadoc-template#prefilled-fields)",
22
24
  },
23
25
  documentFolderId: {
24
26
  propDefinition: [
@@ -48,6 +50,23 @@ export default {
48
50
  optional: true,
49
51
  },
50
52
  },
53
+ async additionalProps() {
54
+ const props = {};
55
+ const { fields } = await this.app.getTemplate({
56
+ templateId: this.templateId,
57
+ });
58
+ for (const field of fields) {
59
+ if (!field.merge_field) {
60
+ continue;
61
+ }
62
+ props[field.merge_field] = {
63
+ type: "string",
64
+ label: `Field ${field.merge_field}`,
65
+ optional: true,
66
+ };
67
+ }
68
+ return props;
69
+ },
51
70
  methods: {
52
71
  parseToAnyArray(arr) {
53
72
  if (!arr) {
@@ -71,6 +90,19 @@ export default {
71
90
  tokens,
72
91
  } = this;
73
92
 
93
+ const fields = {};
94
+ const { fields: items } = await this.app.getTemplate({
95
+ templateId: this.templateId,
96
+ });
97
+ for (const field of items) {
98
+ if (!field.merge_field) {
99
+ continue;
100
+ }
101
+ fields[field.merge_field] = {
102
+ value: this[field.merge_field],
103
+ };
104
+ }
105
+
74
106
  const response = await this.app.createDocument({
75
107
  $,
76
108
  data: {
@@ -80,6 +112,7 @@ export default {
80
112
  tags,
81
113
  recipients: this.parseToAnyArray(recipients),
82
114
  tokens: this.parseToAnyArray(tokens),
115
+ fields,
83
116
  },
84
117
  });
85
118
 
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Create Folder",
6
6
  description: "Create a new folder to store your documents. [See the docs here](https://developers.pandadoc.com/reference/create-documents-folder)",
7
7
  type: "action",
8
- version: "0.0.4",
8
+ version: "0.0.5",
9
9
  props: {
10
10
  app,
11
11
  name: {
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Create or Update Contact",
6
6
  description: "This method adds or updates a contact using the email as index. [See the docs here](https://developers.pandadoc.com/reference/create-contact)",
7
7
  type: "action",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  props: {
10
10
  app,
11
11
  email: {
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Document Details",
6
6
  description: "Return detailed data about a document. [See the docs here](https://developers.pandadoc.com/reference/document-details)",
7
7
  type: "action",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  props: {
10
10
  app,
11
11
  id: {
@@ -6,16 +6,19 @@ export default {
6
6
  description:
7
7
  "Get basic status info about a document. [See documentation here](https://developers.pandadoc.com/reference/document-status)",
8
8
  type: "action",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  props: {
11
11
  app,
12
12
  id: {
13
- propDefinition: [app, "documentId"],
13
+ propDefinition: [
14
+ app,
15
+ "documentId",
16
+ ],
14
17
  },
15
18
  },
16
19
  async run({ $ }) {
17
20
  const response = await this.app.getDocument({
18
- id: this.id
21
+ id: this.id,
19
22
  });
20
23
 
21
24
  $.export("$summary", `Successfully fetched document status with ID ${this.id}`);
@@ -5,7 +5,7 @@ export default {
5
5
  name: "List Contacts",
6
6
  description: "This method lists all contacts within an account. [See the docs here](https://developers.pandadoc.com/reference/list-contacts)",
7
7
  type: "action",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  props: {
10
10
  app,
11
11
  },
@@ -5,7 +5,7 @@ export default {
5
5
  name: "List Document Attachment",
6
6
  description: "Returns a list of attachments associated with a specified document. [See the docs here](https://developers.pandadoc.com/reference/list-attachment)",
7
7
  type: "action",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  props: {
10
10
  app,
11
11
  documentId: {
@@ -6,7 +6,7 @@ export default {
6
6
  name: "List Documents",
7
7
  description: "List documents optionally filter by a search query or tags. [See the docs here](https://developers.pandadoc.com/reference/list-documents)",
8
8
  type: "action",
9
- version: "0.0.5",
9
+ version: "0.0.6",
10
10
  props: {
11
11
  app,
12
12
  query: {
@@ -5,7 +5,7 @@ export default {
5
5
  name: "List Folders",
6
6
  description: "List folders which contain Documents [See the docs here](https://developers.pandadoc.com/reference/list-documents-folders)",
7
7
  type: "action",
8
- version: "0.0.4",
8
+ version: "0.0.5",
9
9
  props: {
10
10
  app,
11
11
  parentFolderId: {
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Send Document",
6
6
  description: "Move a document to sent status and send an optional email. [See the documentation](https://developers.pandadoc.com/reference/send-document)",
7
7
  type: "action",
8
- version: "0.0.5",
8
+ version: "0.0.6",
9
9
  props: {
10
10
  app,
11
11
  documentId: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/pandadoc",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Pipedream PandaDoc Components",
5
5
  "main": "pandadoc.app.mjs",
6
6
  "keywords": [
@@ -14,7 +14,7 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@pipedream/platform": "^1.4.1",
17
+ "@pipedream/platform": "^1.6.0",
18
18
  "form-data": "^4.0.0"
19
19
  }
20
20
  }
package/pandadoc.app.mjs CHANGED
@@ -61,7 +61,7 @@ export default {
61
61
  file: {
62
62
  type: "string",
63
63
  label: "File",
64
- description: "The file to upload from the `/tmp` folder. [See the docs here] on how to upload a file to `/tmp`.(https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)",
64
+ description: "The file to upload from the `/tmp` folder. [See the docs here](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp) on how to upload a file to `/tmp`.",
65
65
  },
66
66
  name: {
67
67
  type: "string",
@@ -76,7 +76,7 @@ export default {
76
76
  If not passed, a person will receive a read-only link to view the document.
77
77
  If the first_name and last_name not passed the system: 1. creates a new contact,
78
78
  if none exists with the given email; or 2. gets the existing contact with the given email that already exists.
79
- \n\nE.g. \`{ "email": "john.doe@pipedream.com", "first_name": "John", "last_name": "Doe" }\``,
79
+ \n\nE.g. \`{ "email": "john.doe@pipedream.com", "first_name": "John", "last_name": "Doe", "role": "user" }\``,
80
80
  },
81
81
  },
82
82
  methods: {
@@ -104,6 +104,14 @@ export default {
104
104
  };
105
105
  return axios($, config);
106
106
  },
107
+ getTemplate({
108
+ templateId, ...args
109
+ }) {
110
+ return this.makeRequest({
111
+ path: `/templates/${templateId}/details`,
112
+ ...args,
113
+ });
114
+ },
107
115
  listTemplates(args = {}) {
108
116
  return this.makeRequest({
109
117
  path: "/templates",
@@ -188,7 +196,9 @@ export default {
188
196
  ...args,
189
197
  });
190
198
  },
191
- getDocument({ id, ...args }) {
199
+ getDocument({
200
+ id, ...args
201
+ }) {
192
202
  return this.makeRequest({
193
203
  path: `/documents/${id}`,
194
204
  ...args,
@@ -8,7 +8,7 @@ export default {
8
8
  description:
9
9
  `Emit new event when a document failed to be created [See docs here](${DOCS_LINK})`,
10
10
  key: "pandadoc-document-creation-failed",
11
- version: "0.0.3",
11
+ version: "0.0.4",
12
12
  type: "source",
13
13
  methods: {
14
14
  ...common.methods,
@@ -8,7 +8,7 @@ export default {
8
8
  description:
9
9
  `Emit new event when a document is deleted [See docs here](${DOCS_LINK})`,
10
10
  key: "pandadoc-document-deleted",
11
- version: "0.0.3",
11
+ version: "0.0.4",
12
12
  type: "source",
13
13
  methods: {
14
14
  ...common.methods,
@@ -8,7 +8,7 @@ export default {
8
8
  description:
9
9
  `Emit new event when a document's state is changed [See docs here](${DOCS_LINK})`,
10
10
  key: "pandadoc-document-state-changed",
11
- version: "0.0.3",
11
+ version: "0.0.4",
12
12
  type: "source",
13
13
  methods: {
14
14
  ...common.methods,
@@ -8,7 +8,7 @@ export default {
8
8
  description:
9
9
  `Emit new event when a document is updated [See docs here](${DOCS_LINK})`,
10
10
  key: "pandadoc-document-updated",
11
- version: "0.0.3",
11
+ version: "0.0.4",
12
12
  type: "source",
13
13
  methods: {
14
14
  ...common.methods,
@@ -8,7 +8,7 @@ export default {
8
8
  description:
9
9
  `Emit new event when a recipient completes a document [See docs here](${DOCS_LINK})`,
10
10
  key: "pandadoc-recipient-completed",
11
- version: "0.0.3",
11
+ version: "0.0.4",
12
12
  type: "source",
13
13
  methods: {
14
14
  ...common.methods,