{"version":3,"sources":["jsdelivr-header.js","/npm/@pipedream/pipedrive@0.11.0/pipedrive.app.mjs"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCNO,OAAQ,mBACR,cAAe,uCAEP,CACb,KAAM,MACN,IAAK,YACL,gBAAiB,CACf,OAAQ,CACN,KAAM,UACN,MAAO,UACP,YAAa,gHACb,UAAU,EACV,aAAM,GACJ,MAAQ,KAAM,SAAgB,KAAK,WACnC,OAAO,EAAM,KAAI,EACf,KAAI,WACA,CACJ,MAAO,EACP,MAAO,KAEX,GAEF,SAAU,CACR,KAAM,UACN,MAAO,YACP,YAAa,qDACb,UAAU,EACV,aAAM,EAAQ,YAAE,IACd,IAA4B,IAAxB,GAAa,OACf,MAAO,GAET,MACE,KAAM,EACN,gBAAiB,SACT,KAAK,WAAW,CACxB,OAAQ,EAAY,OACpB,MAAO,UAAU,qBAGnB,MAAO,CACL,QAAS,EAAQ,KAAI,EACnB,KAAI,WACA,CACJ,MAAO,EACP,MAAO,MAET,QAAS,CACP,OAAQ,EAAe,cAAe,GAG5C,GAEF,eAAgB,CACd,KAAM,UACN,MAAO,kBACP,YAAa,2DACb,UAAU,EACV,aAAM,EAAQ,YAAE,IACd,IAA4B,IAAxB,GAAa,OACf,MAAO,GAET,MACE,KAAM,EACN,gBAAiB,SACT,KAAK,iBAAiB,CAC9B,OAAQ,EAAY,OACpB,MAAO,UAAU,qBAEnB,MAAO,CACL,QAAS,EAAc,KAAI,EACzB,KAAI,WACA,CACJ,MAAO,EACP,MAAO,MAET,QAAS,CACP,OAAQ,EAAe,cAAe,GAG5C,GAEF,YAAa,CACX,KAAM,UACN,MAAO,cACP,YAAa,wHACb,UAAU,GAEZ,WAAY,CACV,KAAM,SACN,MAAO,cACP,YAAa,6EACb,UAAU,GAEZ,UAAW,CACT,KAAM,UACN,MAAO,aACP,YAAa,0IACb,UAAU,EACV,QAAS,UAAU,oBAErB,QAAS,CACP,KAAM,SACN,MAAO,WACP,YAAa,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CAAW,GAET,OADiB,KAAK,IAAI,YACV,WAAW,CACzB,GAAI,GAER,EACA,SAAA,CAAU,GAER,OADmB,KAAK,IAAI,aAAc,MACxB,UAAU,CAC1B,GAAI,GAER,EACA,OAAA,CAAQ,GAEN,OADgB,KAAK,IAAI,YACV,QAAQ,CACrB,GAAI,GAER,EACA,WAAA,CAAY,EAAO,CAAC,GAElB,OADgB,KAAK,IAAI,WAAY,MACtB,YAAY,EAC7B,EACA,cAAO,EAAS,GACd,EAAE,OAAE,EAAM,IAAE,IAEZ,EAAS,IACJ,EACH,MAAO,EACP,MAAO,KAET,IAAI,EAAS,EAAQ,EACrB,EAAG,CACD,MAAM,KACJ,EAAM,gBAAiB,SACf,EAAG,GACb,IAAK,GAAM,OACT,OAEF,IAAK,MAAM,KAAQ,EAEjB,SADM,EACF,KAAS,GAAS,EACpB,OAGJ,EAAO,OAAS,EAAO,MACvB,EAAU,EAAe,WAAW,wBACtC,OAAS,EACX,EACA,2BAAM,CAAsB,GAC1B,MAAM,EAAU,GACV,EAAY,KAAK,SAAS,GAChC,UAAW,MAAM,KAAY,EAC3B,EAAQ,KAAK,GAEf,OAAO,CACT","file":"/npm/@pipedream/pipedrive@0.11.0/pipedrive.app.mjs","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@pipedream/pipedrive@0.11.0/pipedrive.app.mjs\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import pd from \"pipedrive\";\nimport constants from \"./common/constants.mjs\";\n\nexport default {\n  type: \"app\",\n  app: \"pipedrive\",\n  propDefinitions: {\n    userId: {\n      type: \"integer\",\n      label: \"User ID\",\n      description: \"ID of the user who will be marked as the owner of this deal. If omitted, the authorized user ID will be used.\",\n      optional: true,\n      async options() {\n        const { data: users } = await this.getUsers();\n        return users.map(({\n          id, name,\n        }) => ({\n          label: name,\n          value: id,\n        }));\n      },\n    },\n    personId: {\n      type: \"integer\",\n      label: \"Person ID\",\n      description: \"ID of the person this deal will be associated with\",\n      optional: true,\n      async options({ prevContext }) {\n        if (prevContext?.cursor === false) {\n          return [];\n        }\n        const {\n          data: persons,\n          additional_data: additionalData,\n        } = await this.getPersons({\n          cursor: prevContext.cursor,\n          limit: constants.DEFAULT_PAGE_LIMIT,\n        });\n\n        return {\n          options: persons.map(({\n            id, name,\n          }) => ({\n            label: name,\n            value: id,\n          })),\n          context: {\n            cursor: additionalData.next_cursor || false,\n          },\n        };\n      },\n    },\n    organizationId: {\n      type: \"integer\",\n      label: \"Organization ID\",\n      description: \"ID of the organization this deal will be associated with\",\n      optional: true,\n      async options({ prevContext }) {\n        if (prevContext?.cursor === false) {\n          return [];\n        }\n        const {\n          data: organizations,\n          additional_data: additionalData,\n        } = await this.getOrganizations({\n          cursor: prevContext.cursor,\n          limit: constants.DEFAULT_PAGE_LIMIT,\n        });\n        return {\n          options: organizations.map(({\n            id, name,\n          }) => ({\n            label: name,\n            value: id,\n          })),\n          context: {\n            cursor: additionalData.next_cursor || false,\n          },\n        };\n      },\n    },\n    probability: {\n      type: \"integer\",\n      label: \"Probability\",\n      description: \"Deal success probability percentage. Used/shown only when `deal_probability` for the pipeline of the deal is enabled.\",\n      optional: true,\n    },\n    lostReason: {\n      type: \"string\",\n      label: \"Lost Reason\",\n      description: \"Optional message about why the deal was lost (to be used when status=lost)\",\n      optional: true,\n    },\n    visibleTo: {\n      type: \"integer\",\n      label: \"Visible To\",\n      description: \"Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.\",\n      optional: true,\n      options: constants.VISIBLE_TO_OPTIONS,\n    },\n    addTime: {\n      type: \"string\",\n      label: \"Add Time\",\n      description: \"The creation date and time of the deal. Requires admin user API token. Format: `YYYY-MM-DDTHH:MM:SSZ`\",\n      optional: true,\n    },\n    dealTitle: {\n      type: \"string\",\n      label: \"Title\",\n      description: \"Deal title\",\n    },\n    dealValue: {\n      type: \"string\",\n      label: \"Value\",\n      description: \"Value of the deal. If omitted, value will be set to 0.\",\n      optional: true,\n    },\n    dealCurrency: {\n      type: \"string\",\n      label: \"Currency\",\n      description: \"Currency of the deal. Accepts a 3-character currency code. If omitted, currency will be set to the default currency of the authorized user.\",\n      optional: true,\n    },\n    stageId: {\n      type: \"integer\",\n      label: \"Stage ID\",\n      description: \"ID of the stage this deal will be placed in a pipeline (note that you can't supply the ID of the pipeline as this will be assigned automatically based on `stage_id`). If omitted, the deal will be placed in the first stage of the default pipeline. Get the `stage_id` from [here](https://developers.pipedrive.com/docs/api/v1/#!/Stages/get_stages).\",\n      optional: true,\n      async options({ prevContext }) {\n        if (prevContext.cursor === false) {\n          return [];\n        }\n        const {\n          data: stages,\n          additional_data: additionalData,\n        } = await this.getStages({\n          cursor: prevContext.cursor,\n          limit: constants.DEFAULT_PAGE_LIMIT,\n        });\n\n        return {\n          options: stages?.map(({\n            id, name,\n          }) => ({\n            label: name,\n            value: id,\n          })),\n          context: {\n            cursor: additionalData.next_cursor || false,\n          },\n        };\n      },\n    },\n    status: {\n      type: \"string\",\n      label: \"Status\",\n      description: \"open = Open, won = Won, lost = Lost, deleted = Deleted. If omitted, status will be set to open.\",\n      optional: true,\n      options: constants.STATUS_OPTIONS,\n    },\n    dealId: {\n      type: \"string\",\n      label: \"Deal ID\",\n      description: \"ID of the deal this activity will be associated with\",\n      optional: true,\n      async options({ prevContext }) {\n        if (prevContext?.cursor === false) {\n          return [];\n        }\n        const {\n          data: deals,\n          additional_data: additionalData,\n        } = await this.getDeals({\n          cursor: prevContext.cursor,\n          limit: constants.DEFAULT_PAGE_LIMIT,\n        });\n\n        return {\n          options: deals?.map(({\n            id, title,\n          }) => ({\n            label: title,\n            value: id,\n          })),\n          context: {\n            cursor: additionalData.next_cursor,\n          },\n        };\n      },\n    },\n    pipelineId: {\n      type: \"integer\",\n      label: \"Pipeline ID\",\n      description: \"ID of the pipeline this activity will be associated with\",\n      optional: true,\n      async options({ prevContext }) {\n        if (prevContext?.cursor === false) {\n          return [];\n        }\n        const {\n          data: pipelines,\n          additional_data: additionalData,\n        } = await this.getPipelines({\n          cursor: prevContext.cursor,\n          limit: constants.DEFAULT_PAGE_LIMIT,\n        });\n\n        return {\n          options: pipelines?.map(({\n            id, title,\n          }) => ({\n            label: title,\n            value: id,\n          })),\n          context: {\n            cursor: additionalData.next_cursor || false,\n          },\n        };\n      },\n    },\n    leadId: {\n      type: \"string\",\n      label: \"Lead ID\",\n      description: \"ID of the lead this activity will be associated with\",\n      optional: true,\n      async options({ prevContext }) {\n        if (prevContext?.nextStart === false) {\n          return [];\n        }\n        const {\n          data: leads,\n          additional_data: additionalData,\n        } = await this.getLeads({\n          start: prevContext.nextStart,\n          limit: constants.DEFAULT_PAGE_LIMIT,\n        });\n\n        return {\n          options: leads?.map(({\n            id, title,\n          }) => ({\n            label: title,\n            value: id,\n          })),\n          context: {\n            nextStart: additionalData.next_start || false,\n          },\n        };\n      },\n    },\n    projectId: {\n      type: \"string\",\n      label: \"Project ID\",\n      description: \"ID of the project this activity will be associated with\",\n      optional: true,\n      async options({ prevContext }) {\n        if (prevContext?.nextStart === false) {\n          return [];\n        }\n        const {\n          data: projects,\n          additional_data: additionalData,\n        } = await this.getProjects({\n          start: prevContext.nextStart,\n          limit: constants.DEFAULT_PAGE_LIMIT,\n        });\n\n        return {\n          options: projects?.map(({\n            id, title,\n          }) => ({\n            label: title,\n            value: id,\n          })),\n          context: {\n            nextStart: additionalData.next_start || false,\n          },\n        };\n      },\n    },\n    leadLabelIds: {\n      type: \"string[]\",\n      label: \"Lead Label IDs\",\n      description: \"The IDs of the lead labels to associate with the lead\",\n      optional: true,\n      async options() {\n        const { data: leadLabels } = await this.getLeadLabels();\n\n        return leadLabels?.map(({\n          id, name,\n        }) => ({\n          label: name,\n          value: id,\n        }));\n      },\n    },\n    filterId: {\n      type: \"integer\",\n      label: \"Lead Filter ID\",\n      description: \"The ID of a filter to apply to leads\",\n      optional: true,\n      async options({ filterType = \"leads\" }) {\n        const { data: filters } = await this.getFilters({\n          type: filterType,\n        });\n\n        return filters?.map(({\n          id, name,\n        }) => ({\n          label: name,\n          value: id,\n        }));\n      },\n    },\n    emails: {\n      type: \"string[]\",\n      label: \"Emails\",\n      description: \"Email addresses (one or more) associated with the person, presented in the same manner as received by GET request of a person. **Example: {\\\"value\\\":\\\"email1@email.com\\\", \\\"primary\\\":true, \\\"label\\\":\\\"work\\\"}**\",\n      optional: true,\n    },\n    phones: {\n      type: \"string[]\",\n      label: \"Phones\",\n      description: \"Phone numbers (one or more) associated with the person, presented in the same manner as received by GET request of a person. **Example: {\\\"value\\\":\\\"12345\\\", \\\"primary\\\":true, \\\"label\\\":\\\"work\\\"}**\",\n      optional: true,\n    },\n    isDeleted: {\n      type: \"boolean\",\n      label: \"Is Deleted\",\n      description: \"Whether the deal is deleted or not\",\n      optional: true,\n    },\n    isArchived: {\n      type: \"boolean\",\n      label: \"Is Archived\",\n      description: \"Whether the deal is archived or not\",\n      optional: true,\n    },\n    archiveTime: {\n      type: \"string\",\n      label: \"Archive Time\",\n      description: \"The optional date and time of archiving the deal in UTC. Format: `YYYY-MM-DD HH:MM:SS`. If omitted and **Is Archived** is `true`, it will be set to the current date and time.\",\n      optional: true,\n    },\n    closeTime: {\n      type: \"string\",\n      label: \"Close Time\",\n      description: \"The date and time of closing the deal. Can only be set if deal status is won or lost. Format: `YYYY-MM-DD HH:MM:SS`\",\n      optional: true,\n    },\n    wonTime: {\n      type: \"string\",\n      label: \"Won Time\",\n      description: \"The date and time of changing the deal status as won. Can only be set if deal status is won. Format: `YYYY-MM-DD HH:MM:SS`\",\n      optional: true,\n    },\n    lostTime: {\n      type: \"string\",\n      label: \"Lost Time\",\n      description: \"The date and time of changing the deal status as lost. Can only be set if deal status is lost. Format: `YYYY-MM-DD HH:MM:SS`\",\n      optional: true,\n    },\n    expectedCloseDate: {\n      type: \"string\",\n      label: \"Expected Close Date\",\n      description: \"The expected close date of the deal. Format: `YYYY-MM-DD`\",\n      optional: true,\n    },\n    customFields: {\n      type: \"object\",\n      label: \"Custom Fields\",\n      description: \"An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes\",\n      optional: true,\n    },\n    labelIds: {\n      type: \"integer[]\",\n      label: \"Label IDs\",\n      description: \"The IDs of labels assigned to the deal\",\n      optional: true,\n      async options() {\n        const { data } = await this.getDealCustomFields();\n        const labelField = data.find(({ key }) => key === \"label\");\n        return labelField?.options?.map(({\n          id: value, label,\n        }) => ({\n          label,\n          value,\n        })) || [];\n      },\n    },\n    personLabelIds: {\n      type: \"integer[]\",\n      label: \"Person Label IDs\",\n      description: \"The IDs of the person labels to associate with the person\",\n      async options() {\n        const { data } = await this.getPersonCustomFields();\n        const labelField = data.find(({ key }) => key === \"label\");\n        return labelField?.options?.map(({\n          id: value, label,\n        }) => ({\n          label,\n          value,\n        })) || [];\n      },\n    },\n    organizationLabelIds: {\n      type: \"integer[]\",\n      label: \"Organization Label IDs\",\n      description: \"The IDs of the organization labels to associate with the organization\",\n      async options() {\n        const { data } = await this.getOrganizationCustomFields();\n        const labelField = data.find(({ field_code: fieldCode }) => fieldCode === \"label_ids\");\n        return labelField?.options?.map(({\n          id: value, label,\n        }) => ({\n          label,\n          value,\n        })) || [];\n      },\n    },\n    includeAllCustomFields: {\n      type: \"boolean\",\n      label: \"Include All Custom Fields\",\n      description: \"When enabled, all custom fields will be included in the results\",\n      optional: true,\n    },\n  },\n  methods: {\n    api(model, version = \"v1\") {\n      const config = new pd[version].Configuration({\n        accessToken: this.$auth.oauth_access_token,\n        basePath: `${this.$auth.api_domain}/api/${version}`,\n      });\n      return new pd[version][model](config);\n    },\n    getActivityTypes(opts) {\n      const activityTypesApi = this.api(\"ActivityTypesApi\");\n      return activityTypesApi.getActivityTypes(opts);\n    },\n    getDeals(opts = {}) {\n      const dealApi = this.api(\"DealsApi\", \"v2\");\n      return dealApi.getDeals(opts);\n    },\n    getPipelines(opts = {}) {\n      const pipelineApi = this.api(\"PipelinesApi\", \"v2\");\n      return pipelineApi.getPipelines(opts);\n    },\n    getLeads(opts = {}) {\n      const leadApi = this.api(\"LeadsApi\");\n      return leadApi.getLeads(opts);\n    },\n    getProjects(opts = {}) {\n      const projectApi = this.api(\"ProjectsApi\");\n      return projectApi.getProjects(opts);\n    },\n    getOrganizations(opts = {}) {\n      const organizationApi = this.api(\"OrganizationsApi\", \"v2\");\n      return organizationApi.getOrganizations(opts);\n    },\n    getPersons(opts = {}) {\n      const personApi = this.api(\"PersonsApi\", \"v2\");\n      return personApi.getPersons(opts);\n    },\n    getUsers(opts) {\n      const UsersApi = this.api(\"UsersApi\");\n      return UsersApi.getUsers(opts);\n    },\n    getStages(opts) {\n      const stagesApi = this.api(\"StagesApi\", \"v2\");\n      return stagesApi.getStages(opts);\n    },\n    getLeadLabels(opts) {\n      const leadLabelsApi = this.api(\"LeadLabelsApi\");\n      return leadLabelsApi.getLeadLabels(opts);\n    },\n    getFilters(opts = {}) {\n      const filtersApi = this.api(\"FiltersApi\");\n      return filtersApi.getFilters(opts);\n    },\n    getNotes(opts = {}) {\n      const notesApi = this.api(\"NotesApi\");\n      return notesApi.getNotes(opts);\n    },\n    getDealCustomFields(opts) {\n      const dealCustomFieldsApi = this.api(\"DealFieldsApi\");\n      return dealCustomFieldsApi.getDealFields(opts);\n    },\n    getPersonCustomFields(opts) {\n      const personCustomFieldsApi = this.api(\"PersonFieldsApi\");\n      return personCustomFieldsApi.getPersonFields(opts);\n    },\n    getOrganizationCustomFields(opts) {\n      const organizationCustomFieldsApi = this.api(\"OrganizationFieldsApi\", \"v2\");\n      return organizationCustomFieldsApi.getOrganizationFields(opts);\n    },\n    addActivity(opts = {}) {\n      const activityApi = this.api(\"ActivitiesApi\", \"v2\");\n      return activityApi.addActivity({\n        AddActivityRequest: opts,\n      });\n    },\n    addNote(opts = {}) {\n      const noteApi = this.api(\"NotesApi\");\n      return noteApi.addNote({\n        AddNoteRequest: opts,\n      });\n    },\n    addDeal(opts = {}) {\n      const dealsApi = this.api(\"DealsApi\", \"v2\");\n      return dealsApi.addDeal({\n        AddDealRequest: opts,\n      });\n    },\n    addOrganization(opts = {}) {\n      const organizationApi = this.api(\"OrganizationsApi\", \"v2\");\n      return organizationApi.addOrganization({\n        AddOrganizationRequest: opts,\n      });\n    },\n    addPerson(opts = {}) {\n      const personsApi = this.api(\"PersonsApi\", \"v2\");\n      return personsApi.addPerson({\n        AddPersonRequest: opts,\n      });\n    },\n    addLead(opts = {}) {\n      const leadApi = this.api(\"LeadsApi\");\n      return leadApi.addLead({\n        AddLeadRequest: opts,\n      });\n    },\n    addWebhook(opts = {}) {\n      const webhooksApi = this.api(\"WebhooksApi\");\n      return webhooksApi.addWebhook({\n        AddWebhookRequest: opts,\n      });\n    },\n    deleteWebhook(webhookId) {\n      const webhooksApi = this.api(\"WebhooksApi\");\n      return webhooksApi.deleteWebhook({\n        id: webhookId,\n      });\n    },\n    searchPersons(opts = {}) {\n      const personsApi = this.api(\"PersonsApi\", \"v2\");\n      return personsApi.searchPersons(opts);\n    },\n    updateDeal({\n      dealId, ...opts\n    }) {\n      const dealsApi = this.api(\"DealsApi\", \"v2\");\n      return dealsApi.updateDeal({\n        id: dealId,\n        UpdateDealRequest: opts,\n      });\n    },\n    updatePerson({\n      personId, ...opts\n    }) {\n      const personsApi = this.api(\"PersonsApi\", \"v2\");\n      return personsApi.updatePerson({\n        id: personId,\n        UpdatePersonRequest: opts,\n      });\n    },\n    updateLead({\n      leadId, ...opts\n    }) {\n      const leadsApi = this.api(\"LeadsApi\");\n      return leadsApi.updateLead({\n        id: leadId,\n        UpdateLeadRequest: opts,\n      });\n    },\n    updateOrganization({\n      organizationId, ...opts\n    }) {\n      const organizationsApi = this.api(\"OrganizationsApi\", \"v2\");\n      return organizationsApi.updateOrganization({\n        id: organizationId,\n        UpdateOrganizationRequest: opts,\n      });\n    },\n    getDeal(dealId) {\n      const dealsApi = this.api(\"DealsApi\", \"v2\");\n      return dealsApi.getDeal({\n        id: dealId,\n      });\n    },\n    getOrganization(organizationId) {\n      const organizationsApi = this.api(\"OrganizationsApi\", \"v2\");\n      return organizationsApi.getOrganization({\n        id: organizationId,\n      });\n    },\n    deleteNote(noteId) {\n      const notesApi = this.api(\"NotesApi\");\n      return notesApi.deleteNote({\n        id: noteId,\n      });\n    },\n    getPerson(personId) {\n      const personsApi = this.api(\"PersonsApi\", \"v2\");\n      return personsApi.getPerson({\n        id: personId,\n      });\n    },\n    getLead(leadId) {\n      const leadApi = this.api(\"LeadsApi\");\n      return leadApi.getLead({\n        id: leadId,\n      });\n    },\n    searchLeads(opts = {}) {\n      const leadApi = this.api(\"LeadsApi\", \"v2\");\n      return leadApi.searchLeads(opts);\n    },\n    async *paginate({\n      fn, params, max,\n    }) {\n      params = {\n        ...params,\n        start: 0,\n        limit: 100,\n      };\n      let hasMore, count = 0;\n      do {\n        const {\n          data, additional_data: additionalData,\n        } = await fn(params);\n        if (!data?.length) {\n          return;\n        }\n        for (const item of data) {\n          yield item;\n          if (max && ++count >= max) {\n            return;\n          }\n        }\n        params.start += params.limit;\n        hasMore = additionalData.pagination.more_items_in_collection;\n      } while (hasMore);\n    },\n    async getPaginatedResources(opts) {\n      const results = [];\n      const resources = this.paginate(opts);\n      for await (const resource of resources) {\n        results.push(resource);\n      }\n      return results;\n    },\n  },\n};\n"]}