diff --git a/components/dolibarr/actions/create-order/create-order.mjs b/components/dolibarr/actions/create-order/create-order.mjs new file mode 100644 index 0000000000000..473540db8d296 --- /dev/null +++ b/components/dolibarr/actions/create-order/create-order.mjs @@ -0,0 +1,79 @@ +import dolibarr from "../../dolibarr.app.mjs"; +import { parseObject } from "../../common/utils.mjs"; + +export default { + key: "dolibarr-create-order", + name: "Create Order", + description: "Create a new order in Dolibarr.", + version: "0.0.1", + type: "action", + props: { + dolibarr, + thirdPartyId: { + propDefinition: [ + dolibarr, + "thirdPartyId", + ], + }, + date: { + type: "string", + label: "Date", + description: "The date of the order in YYYY-MM-DD format", + }, + deliveryDate: { + type: "string", + label: "Delivery Date", + description: "The expecteddelivery date of the order in YYYY-MM-DD format", + optional: true, + }, + paymentMethodCode: { + propDefinition: [ + dolibarr, + "paymentMethodCode", + ], + }, + paymentTermCode: { + propDefinition: [ + dolibarr, + "paymentTermCode", + ], + }, + notePublic: { + type: "string", + label: "Note Public", + description: "A public note to add to the order", + optional: true, + }, + notePrivate: { + type: "string", + label: "Note Private", + description: "A private note to add to the order", + optional: true, + }, + additionalProperties: { + propDefinition: [ + dolibarr, + "additionalProperties", + ], + }, + }, + async run({ $ }) { + const response = await this.dolibarr.createOrder({ + $, + data: { + socid: this.thirdPartyId, + date: Date.parse(this.date) / 1000, + deliverydate: this.deliveryDate + ? Date.parse(this.deliveryDate) / 1000 + : undefined, + mode_reglement_code: this.paymentMethodCode, + cond_reglement_code: this.paymentTermCode, + note_public: this.notePublic, + note_private: this.notePrivate, + ...parseObject(this.additionalProperties), + }, + }); + $.export("$summary", `Successfully created order ${response}`); + return response; + }, +}; diff --git a/components/dolibarr/actions/create-thirdparty/create-thirdparty.mjs b/components/dolibarr/actions/create-thirdparty/create-thirdparty.mjs new file mode 100644 index 0000000000000..1b6cf85b63977 --- /dev/null +++ b/components/dolibarr/actions/create-thirdparty/create-thirdparty.mjs @@ -0,0 +1,70 @@ +import dolibarr from "../../dolibarr.app.mjs"; +import { parseObject } from "../../common/utils.mjs"; + +export default { + key: "dolibarr-create-thirdparty", + name: "Create Third Party", + description: "Create a new third party in Dolibarr.", + version: "0.0.1", + type: "action", + props: { + dolibarr, + name: { + type: "string", + label: "Name", + description: "The name of the third party", + }, + email: { + type: "string", + label: "Email", + description: "The email address of the third party", + optional: true, + }, + phone: { + type: "string", + label: "Phone", + description: "The phone number of the third party", + optional: true, + }, + streetAddress: { + type: "string", + label: "Street Address", + description: "The street address of the third party", + optional: true, + }, + zip: { + type: "string", + label: "Zip", + description: "The zip code of the third party", + optional: true, + }, + town: { + type: "string", + label: "Town", + description: "The city or town of the third party", + optional: true, + }, + additionalProperties: { + propDefinition: [ + dolibarr, + "additionalProperties", + ], + }, + }, + async run({ $ }) { + const response = await this.dolibarr.createThirdParty({ + $, + data: { + name: this.name, + email: this.email, + phone: this.phone, + address: this.streetAddress, + zip: this.zip, + town: this.town, + ...parseObject(this.additionalProperties), + }, + }); + $.export("$summary", `Successfully created third party with ID${response}`); + return response; + }, +}; diff --git a/components/dolibarr/actions/create-user/create-user.mjs b/components/dolibarr/actions/create-user/create-user.mjs new file mode 100644 index 0000000000000..2802de55d62d4 --- /dev/null +++ b/components/dolibarr/actions/create-user/create-user.mjs @@ -0,0 +1,105 @@ +import dolibarr from "../../dolibarr.app.mjs"; +import { parseObject } from "../../common/utils.mjs"; + +export default { + key: "dolibarr-create-user", + name: "Create User", + description: "Create a new user in Dolibarr.", + version: "0.0.1", + type: "action", + props: { + dolibarr, + firstName: { + type: "string", + label: "First Name", + description: "The first name of the user", + optional: true, + }, + lastName: { + type: "string", + label: "Last Name", + description: "The last name of the user", + }, + login: { + type: "string", + label: "Login", + description: "The login name of the user. Must be unique.", + }, + password: { + type: "string", + label: "Password", + description: "The password of the user", + }, + email: { + type: "string", + label: "Email", + description: "The email address of the user", + optional: true, + }, + officePhone: { + type: "string", + label: "Office Phone", + description: "The office phone number of the user", + optional: true, + }, + jobPosition: { + type: "string", + label: "Job Position", + description: "The job position of the user", + optional: true, + }, + isAdmin: { + type: "boolean", + label: "Is Admin", + description: "Whether the user is an administrator", + optional: true, + }, + streetAddress: { + type: "string", + label: "Street Address", + description: "The street address of the user", + optional: true, + }, + zip: { + type: "string", + label: "Zip", + description: "The zip code of the user", + optional: true, + }, + town: { + type: "string", + label: "Town", + description: "The city or town of the user", + optional: true, + }, + additionalProperties: { + propDefinition: [ + dolibarr, + "additionalProperties", + ], + }, + }, + async run({ $ }) { + const response = await this.dolibarr.createUser({ + $, + data: { + firstname: this.firstName, + lastname: this.lastName, + login: this.login, + password: this.password, + email: this.email, + office_phone: this.officePhone, + job: this.jobPosition, + admin: this.isAdmin + ? 1 + : 0, + address: this.streetAddress, + zip: this.zip, + town: this.town, + ...parseObject(this.additionalProperties), + }, + }); + $.export("$summary", `Successfully created user ${response}`); + return response; + }, +}; diff --git a/components/dolibarr/common/utils.mjs b/components/dolibarr/common/utils.mjs new file mode 100644 index 0000000000000..1854a9f805f41 --- /dev/null +++ b/components/dolibarr/common/utils.mjs @@ -0,0 +1,27 @@ +export function parseObject(obj) { + if (!obj) { + return {}; + } + if (typeof obj === "string") { + try { + return JSON.parse(obj); + } catch (e) { + return obj; + } + } + if (Array.isArray(obj)) { + return obj.map(parseObject); + } + if (typeof obj === "object") { + return Object.fromEntries( + Object.entries(obj).map(([ + key, + value, + ]) => [ + key, + parseObject(value), + ]), + ); + } + return obj; +} diff --git a/components/dolibarr/dolibarr.app.mjs b/components/dolibarr/dolibarr.app.mjs index 324971615c26d..74b39f9942cc4 100644 --- a/components/dolibarr/dolibarr.app.mjs +++ b/components/dolibarr/dolibarr.app.mjs @@ -1,11 +1,167 @@ +import { axios } from "@pipedream/platform"; +const DEFAULT_LIMIT = 20; + export default { type: "app", app: "dolibarr", - propDefinitions: {}, + propDefinitions: { + thirdPartyId: { + type: "string", + label: "Third Party ID", + description: "The ID of the third party or customer", + async options({ page }) { + const response = await this.listThirdParties({ + params: { + limit: DEFAULT_LIMIT, + page, + }, + }); + return response?.map((item) => ({ + label: item.name, + value: item.id, + })) || []; + }, + }, + paymentTermCode: { + type: "string", + label: "Payment Term ID", + description: "The ID of the payment term", + optional: true, + async options({ page }) { + const response = await this.listPaymentTerms({ + params: { + limit: DEFAULT_LIMIT, + page, + }, + }); + return response?.map((item) => ({ + label: item.label, + value: item.code, + })) || []; + }, + }, + paymentMethodCode: { + type: "string", + label: "Payment Method Code", + description: "The code of the payment method", + optional: true, + async options({ page }) { + const response = await this.listPaymentMethods({ + params: { + limit: DEFAULT_LIMIT, + page, + }, + }); + return response?.map((item) => ({ + label: item.label, + value: item.code, + })) || []; + }, + }, + additionalProperties: { + type: "object", + label: "Additional Properties", + description: "Additional properties to add", + optional: true, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return `https://${this.$auth.domain}/api/index.php`; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + return axios ($, { + url: `${this._baseUrl()}${path}`, + headers: { + dolapikey: this.$auth.api_key, + }, + ...opts, + }); + }, + listUsers(opts = {}) { + return this._makeRequest({ + path: "/users", + ...opts, + }); + }, + listInvoices(opts = {}) { + return this._makeRequest({ + path: "/invoices", + ...opts, + }); + }, + listOrders(opts = {}) { + return this._makeRequest({ + path: "/orders", + ...opts, + }); + }, + listThirdParties(opts = {}) { + return this._makeRequest({ + path: "/thirdparties", + ...opts, + }); + }, + listPaymentTerms(opts = {}) { + return this._makeRequest({ + path: "/setup/dictionary/payment_terms", + ...opts, + }); + }, + listPaymentMethods(opts = {}) { + return this._makeRequest({ + path: "/setup/dictionary/payment_types", + ...opts, + }); + }, + createUser(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/users", + ...opts, + }); + }, + createOrder(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/orders", + ...opts, + }); + }, + createThirdParty(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/thirdparties", + ...opts, + }); + }, + async *paginate({ + fn, params = {}, max, + }) { + params = { + ...params, + limit: 100, + page: 0, + }; + let total, count = 0; + do { + const results = await fn({ + params, + }); + if (!results?.length) { + return; + } + for (const item of results) { + yield item; + if (max && ++count >= max) { + return; + } + } + params.page++; + total = results?.length; + } while (total === params.limit); }, }, -}; \ No newline at end of file +}; diff --git a/components/dolibarr/package.json b/components/dolibarr/package.json index 3a47239e9402d..9272adf3b2479 100644 --- a/components/dolibarr/package.json +++ b/components/dolibarr/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/dolibarr", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Dolibarr Components", "main": "dolibarr.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.0" } -} \ No newline at end of file +} diff --git a/components/dolibarr/sources/common/base.mjs b/components/dolibarr/sources/common/base.mjs new file mode 100644 index 0000000000000..8450e0686df5d --- /dev/null +++ b/components/dolibarr/sources/common/base.mjs @@ -0,0 +1,83 @@ +import dolibarr from "../../dolibarr.app.mjs"; +import { + DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, ConfigurationError, +} from "@pipedream/platform"; + +export default { + props: { + dolibarr, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + }, + }, + }, + methods: { + _getLastTs() { + return this.db.get("lastTs") || 0; + }, + _setLastTs(ts) { + this.db.set("lastTs", ts); + }, + getArgs() { + return { + params: { + sortfield: "date_creation", + sortorder: "DESC", + }, + }; + }, + generateMeta(item) { + return { + id: item.id, + summary: this.getSummary(item), + ts: item.date_creation, + }; + }, + emitEvent(item) { + const meta = this.generateMeta(item); + this.$emit(item, meta); + }, + async processEvent(max) { + const resourceFn = this.getResourceFn(); + const args = this.getArgs(); + const lastTs = this._getLastTs(); + let maxTs = lastTs; + const results = this.dolibarr.paginate({ + fn: resourceFn, + params: args, + max, + }); + const items = []; + for await (const item of results) { + if (item.date_creation > lastTs) { + items.push(item); + maxTs = Math.max(maxTs, item.date_creation); + } + } + + if (!items.length) { + return; + } + + this._setLastTs(maxTs); + items.reverse().forEach(this.emitEvent); + }, + getResourceFn() { + throw new ConfigurationError("getResourceFn is not implemented"); + }, + getSummary() { + throw new ConfigurationError("getSummary is not implemented"); + }, + }, + hooks: { + async deploy() { + await this.processEvent(25); + }, + }, + async run() { + await this.processEvent(); + }, +}; diff --git a/components/dolibarr/sources/new-invoice-created/new-invoice-created.mjs b/components/dolibarr/sources/new-invoice-created/new-invoice-created.mjs new file mode 100644 index 0000000000000..cf3459ced899c --- /dev/null +++ b/components/dolibarr/sources/new-invoice-created/new-invoice-created.mjs @@ -0,0 +1,22 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "dolibarr-new-invoice-created", + name: "New Invoice Created", + description: "Emit new event when a new invoice is created", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getResourceFn() { + return this.dolibarr.listInvoices; + }, + getSummary(item) { + return `Invoice ID ${item.id} created`; + }, + }, + sampleEmit, +}; diff --git a/components/dolibarr/sources/new-invoice-created/test-event.mjs b/components/dolibarr/sources/new-invoice-created/test-event.mjs new file mode 100644 index 0000000000000..f930188afbe8c --- /dev/null +++ b/components/dolibarr/sources/new-invoice-created/test-event.mjs @@ -0,0 +1,134 @@ +export default { + "module": null, + "id": "1", + "entity": "1", + "import_key": null, + "array_options": [], + "array_languages": null, + "contacts_ids": [], + "linkedObjectsIds": null, + "fk_project": null, + "contact_id": null, + "user": null, + "origin_type": null, + "origin_id": null, + "ref": "(PROV1)", + "ref_ext": null, + "statut": "0", + "status": "0", + "country_id": null, + "country_code": null, + "state_id": null, + "region_id": null, + "mode_reglement_id": "4", + "cond_reglement_id": "2", + "demand_reason_id": null, + "transport_mode_id": null, + "shipping_method_id": null, + "shipping_method": null, + "fk_multicurrency": "0", + "multicurrency_code": "EUR", + "multicurrency_tx": "1.00000000", + "multicurrency_total_ht": "0.00000000", + "multicurrency_total_tva": "0.00000000", + "multicurrency_total_ttc": "0.00000000", + "multicurrency_total_localtax1": null, + "multicurrency_total_localtax2": null, + "last_main_doc": null, + "fk_account": null, + "note_public": null, + "note_private": null, + "total_ht": "0.00000000", + "total_tva": "0.00000000", + "total_localtax1": "0.00000000", + "total_localtax2": "0.00000000", + "total_ttc": "0.00000000", + "lines": [], + "actiontypecode": null, + "name": null, + "lastname": null, + "firstname": null, + "civility_id": null, + "date_creation": 1749232376, + "date_validation": "", + "date_modification": 1749232376, + "tms": null, + "date_cloture": null, + "user_author": null, + "user_creation": null, + "user_creation_id": "1", + "user_valid": null, + "user_validation": null, + "user_validation_id": null, + "user_closing_id": null, + "user_modification": null, + "user_modification_id": null, + "fk_user_creat": null, + "fk_user_modif": null, + "specimen": 0, + "totalpaid": 0, + "extraparams": [], + "product": null, + "cond_reglement_supplier_id": null, + "deposit_percent": null, + "retained_warranty_fk_cond_reglement": "0", + "warehouse_id": null, + "title": null, + "type": "0", + "subtype": null, + "fk_soc": null, + "socid": "4", + "paye": "0", + "date": 1749168000, + "date_lim_reglement": 1751760000, + "cond_reglement_code": "30D", + "cond_reglement_label": null, + "cond_reglement_doc": "Réglement à 30 jours", + "mode_reglement_code": "LIQ", + "revenuestamp": "0.00000000", + "totaldeposits": null, + "totalcreditnotes": null, + "sumpayed": null, + "sumpayed_multicurrency": null, + "sumdeposit": null, + "sumdeposit_multicurrency": null, + "sumcreditnote": null, + "sumcreditnote_multicurrency": null, + "remaintopay": "0", + "nbofopendirectdebitorcredittransfer": null, + "stripechargedone": null, + "stripechargeerror": null, + "description": null, + "ref_client": null, + "situation_cycle_ref": null, + "close_code": null, + "close_note": null, + "postactionmessages": null, + "fk_incoterms": "0", + "label_incoterms": null, + "location_incoterms": "", + "fk_user_author": "1", + "fk_user_valid": null, + "datem": 1749232376, + "delivery_date": null, + "ref_customer": null, + "resteapayer": null, + "module_source": null, + "pos_source": null, + "fk_fac_rec_source": null, + "fk_facture_source": null, + "line": null, + "fac_rec": null, + "date_pointoftax": "", + "situation_counter": null, + "situation_final": "0", + "tab_previous_situation_invoice": [], + "tab_next_situation_invoice": [], + "retained_warranty": "0", + "retained_warranty_date_limit": 1751760000, + "availability_id": null, + "date_closing": null, + "source": null, + "remise_percent": null, + "online_payment_url": "" + } \ No newline at end of file diff --git a/components/dolibarr/sources/new-order-created/new-order-created.mjs b/components/dolibarr/sources/new-order-created/new-order-created.mjs new file mode 100644 index 0000000000000..4dc93ba991f4b --- /dev/null +++ b/components/dolibarr/sources/new-order-created/new-order-created.mjs @@ -0,0 +1,22 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "dolibarr-new-order-created", + name: "New Order Created", + description: "Emit new event when a new order is created", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getResourceFn() { + return this.dolibarr.listOrders; + }, + getSummary(item) { + return `Order ID ${item.id} created`; + }, + }, + sampleEmit, +}; diff --git a/components/dolibarr/sources/new-order-created/test-event.mjs b/components/dolibarr/sources/new-order-created/test-event.mjs new file mode 100644 index 0000000000000..616263d412d84 --- /dev/null +++ b/components/dolibarr/sources/new-order-created/test-event.mjs @@ -0,0 +1,231 @@ +export default { + "module": null, + "id": "1", + "entity": "1", + "import_key": null, + "array_options": [], + "array_languages": null, + "contacts_ids": [], + "linkedObjectsIds": null, + "canvas": null, + "fk_project": null, + "contact_id": null, + "user": null, + "origin_type": null, + "origin_id": null, + "ref": "(PROV1)", + "ref_ext": null, + "statut": "0", + "status": "0", + "country_id": null, + "country_code": null, + "state_id": null, + "region_id": null, + "mode_reglement_id": "6", + "cond_reglement_id": "1", + "demand_reason_id": "1", + "transport_mode_id": null, + "shipping_method_id": null, + "shipping_method": null, + "fk_multicurrency": "0", + "multicurrency_code": "EUR", + "multicurrency_tx": "1.00000000", + "multicurrency_total_ht": "1.00000000", + "multicurrency_total_tva": "0.00000000", + "multicurrency_total_ttc": "1.00000000", + "multicurrency_total_localtax1": null, + "multicurrency_total_localtax2": null, + "last_main_doc": "commande/(PROV1)/(PROV1).pdf", + "fk_account": null, + "note_public": "note (public)", + "note_private": "note (private)", + "total_ht": "1.00000000", + "total_tva": "0.00000000", + "total_localtax1": "0.00000000", + "total_localtax2": "0.00000000", + "total_ttc": "1.00000000", + "lines": [ + { + "module": null, + "id": "1", + "entity": null, + "import_key": null, + "array_options": [], + "array_languages": null, + "contacts_ids": null, + "linkedObjectsIds": null, + "canvas": null, + "origin_type": null, + "origin_id": null, + "ref": null, + "ref_ext": "", + "statut": null, + "status": null, + "state_id": null, + "region_id": null, + "demand_reason_id": null, + "transport_mode_id": null, + "shipping_method": null, + "multicurrency_tx": null, + "multicurrency_total_ht": "1.00000000", + "multicurrency_total_tva": "0.00000000", + "multicurrency_total_ttc": "1.00000000", + "multicurrency_total_localtax1": null, + "multicurrency_total_localtax2": null, + "last_main_doc": null, + "fk_account": null, + "total_ht": "1.00000000", + "total_tva": "0.00000000", + "total_localtax1": "0.00000000", + "total_localtax2": "0.00000000", + "total_ttc": "1.00000000", + "lines": null, + "actiontypecode": null, + "date_creation": null, + "date_validation": null, + "date_modification": null, + "tms": null, + "date_cloture": null, + "user_author": null, + "user_creation": null, + "user_creation_id": null, + "user_valid": null, + "user_validation": null, + "user_validation_id": null, + "user_closing_id": null, + "user_modification": null, + "user_modification_id": null, + "fk_user_creat": null, + "fk_user_modif": null, + "specimen": 0, + "totalpaid": null, + "extraparams": [], + "product": null, + "cond_reglement_supplier_id": null, + "deposit_percent": null, + "retained_warranty_fk_cond_reglement": null, + "warehouse_id": null, + "parent_element": "", + "fk_parent_attribute": "", + "rowid": "1", + "fk_unit": null, + "date_debut_prevue": null, + "date_debut_reel": null, + "date_fin_prevue": null, + "date_fin_reel": null, + "weight": null, + "weight_units": null, + "length": null, + "length_units": null, + "width": null, + "width_units": null, + "height": null, + "height_units": null, + "surface": null, + "surface_units": null, + "volume": null, + "volume_units": null, + "multilangs": null, + "product_type": "0", + "fk_product": null, + "desc": "product", + "description": "product", + "product_ref": null, + "product_label": null, + "product_barcode": null, + "product_desc": null, + "fk_product_type": null, + "qty": "1", + "duree": null, + "remise_percent": "0", + "info_bits": "0", + "special_code": "0", + "subprice": "1.00000000", + "tva_tx": "0.000", + "multicurrency_subprice": "1.00000000", + "label": null, + "libelle": null, + "product_tosell": null, + "product_tobuy": null, + "product_tobatch": null, + "price": "1", + "vat_src_code": "", + "localtax1_tx": "0.000", + "localtax2_tx": "0.000", + "localtax1_type": "0", + "localtax2_type": "0", + "fk_commande": "1", + "commande_id": "1", + "fk_parent_line": null, + "fk_facture": null, + "fk_remise_except": null, + "rang": "1", + "fk_fournprice": null, + "pa_ht": "0.00000000", + "marge_tx": "", + "marque_tx": 100, + "remise": null, + "date_start": "", + "date_end": "" + } + ], + "actiontypecode": null, + "name": null, + "lastname": null, + "firstname": null, + "civility_id": null, + "date_creation": 1749233296, + "date_validation": "", + "date_modification": 1749234847, + "tms": null, + "date_cloture": null, + "user_author": null, + "user_creation": null, + "user_creation_id": "1", + "user_valid": null, + "user_validation": null, + "user_validation_id": null, + "user_closing_id": null, + "user_modification": null, + "user_modification_id": null, + "fk_user_creat": null, + "fk_user_modif": null, + "specimen": 0, + "totalpaid": null, + "extraparams": [], + "product": null, + "cond_reglement_supplier_id": null, + "deposit_percent": null, + "retained_warranty_fk_cond_reglement": null, + "warehouse_id": null, + "code": "", + "fk_incoterms": "0", + "label_incoterms": null, + "location_incoterms": "", + "socid": "5", + "ref_client": null, + "ref_customer": null, + "contactid": null, + "billed": "0", + "date_lim_reglement": null, + "cond_reglement_code": "RECEP", + "cond_reglement_doc": "Due Upon Receipt", + "mode_reglement_code": "CB", + "availability_id": "2", + "availability_code": "AV_1W", + "availability": "1 week", + "demand_reason_code": "SRC_INTE", + "date": 1749168000, + "date_commande": 1749168000, + "delivery_date": 1749254400, + "fk_remise_except": null, + "remise_percent": null, + "source": "0", + "signed_status": 0, + "user_author_id": "1", + "line": null, + "module_source": null, + "pos_source": null, + "expeditions": null, + "online_payment_url": "" + } \ No newline at end of file diff --git a/components/dolibarr/sources/new-thirdparty-created/new-thirdparty-created.mjs b/components/dolibarr/sources/new-thirdparty-created/new-thirdparty-created.mjs new file mode 100644 index 0000000000000..e76fac038400d --- /dev/null +++ b/components/dolibarr/sources/new-thirdparty-created/new-thirdparty-created.mjs @@ -0,0 +1,22 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "dolibarr-new-thirdparty-created", + name: "New Third Party Created", + description: "Emit new event when a new third party is created", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getResourceFn() { + return this.dolibarr.listThirdParties; + }, + getSummary(item) { + return `Third Party ID ${item.id} created`; + }, + }, + sampleEmit, +}; diff --git a/components/dolibarr/sources/new-thirdparty-created/test-event.mjs b/components/dolibarr/sources/new-thirdparty-created/test-event.mjs new file mode 100644 index 0000000000000..caf99cb5fb3ec --- /dev/null +++ b/components/dolibarr/sources/new-thirdparty-created/test-event.mjs @@ -0,0 +1,161 @@ +export default { + "module": "societe", + "id": "1", + "entity": "1", + "import_key": null, + "array_options": [], + "array_languages": null, + "contacts_ids": null, + "linkedObjectsIds": null, + "canvas": null, + "fk_project": null, + "contact_id": null, + "user": null, + "origin_type": null, + "origin_id": null, + "ref": "1", + "ref_ext": null, + "statut": null, + "status": "1", + "country_id": null, + "country_code": "", + "state_id": null, + "region_id": null, + "barcode_type": null, + "barcode_type_coder": null, + "mode_reglement_id": null, + "cond_reglement_id": null, + "demand_reason_id": null, + "transport_mode_id": null, + "shipping_method_id": null, + "shipping_method": null, + "fk_multicurrency": "0", + "multicurrency_code": "", + "multicurrency_tx": null, + "multicurrency_total_ht": null, + "multicurrency_total_tva": null, + "multicurrency_total_ttc": null, + "multicurrency_total_localtax1": null, + "multicurrency_total_localtax2": null, + "last_main_doc": null, + "fk_account": "0", + "note_public": null, + "note_private": null, + "actiontypecode": null, + "name": "new third party", + "lastname": null, + "firstname": null, + "civility_id": null, + "date_creation": 1749230630, + "date_validation": null, + "date_modification": 1749230630, + "tms": null, + "date_cloture": null, + "user_author": null, + "user_creation": null, + "user_creation_id": "1", + "user_valid": null, + "user_validation": null, + "user_validation_id": null, + "user_closing_id": null, + "user_modification": null, + "user_modification_id": "1", + "fk_user_creat": null, + "fk_user_modif": null, + "specimen": 0, + "totalpaid": null, + "extraparams": [], + "product": null, + "cond_reglement_supplier_id": null, + "deposit_percent": null, + "retained_warranty_fk_cond_reglement": null, + "warehouse_id": null, + "SupplierCategories": [], + "prefixCustomerIsRequired": null, + "name_alias": "", + "phone": null, + "phone_mobile": null, + "fax": null, + "email": null, + "no_email": null, + "skype": null, + "twitter": null, + "facebook": null, + "linkedin": null, + "url": null, + "barcode": null, + "idprof1": "", + "idprof2": "", + "idprof3": "", + "idprof4": "", + "idprof5": "", + "idprof6": "", + "idprof7": null, + "idprof8": null, + "idprof9": null, + "idprof10": null, + "socialobject": null, + "tva_assuj": "1", + "tva_intra": "", + "vat_reverse_charge": 0, + "localtax1_assuj": "0", + "localtax1_value": "0.000", + "localtax2_assuj": "0", + "localtax2_value": "0.000", + "managers": null, + "capital": "0.00000000", + "typent_id": "0", + "typent_code": null, + "effectif": "", + "effectif_id": null, + "forme_juridique_code": null, + "forme_juridique": "", + "remise_percent": 0, + "remise_supplier_percent": "0", + "mode_reglement_supplier_id": null, + "transport_mode_supplier_id": null, + "fk_prospectlevel": "", + "client": "0", + "prospect": 0, + "fournisseur": "0", + "code_client": null, + "code_fournisseur": null, + "code_compta_client": null, + "accountancy_code_customer_general": null, + "accountancy_code_customer": null, + "code_compta_fournisseur": null, + "accountancy_code_supplier_general": null, + "accountancy_code_supplier": null, + "code_compta_product": null, + "stcomm_id": "0", + "stcomm_picto": null, + "status_prospect_label": "Never contacted", + "price_level": null, + "outstanding_limit": null, + "order_min_amount": null, + "supplier_order_min_amount": null, + "parent": null, + "default_lang": null, + "ip": null, + "webservices_url": null, + "webservices_key": null, + "logo": null, + "logo_small": null, + "logo_mini": null, + "logo_squarred": null, + "logo_squarred_small": null, + "logo_squarred_mini": null, + "accountancy_code_sell": "", + "accountancy_code_buy": "", + "fk_warehouse": null, + "termsofsale": null, + "partnerships": [], + "bank_account": null, + "fk_incoterms": "0", + "label_incoterms": null, + "location_incoterms": null, + "socialnetworks": [], + "address": "", + "zip": null, + "town": null + } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 866b3a7f82bb0..85f139abcaff4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2742,8 +2742,7 @@ importers: components/codeq_natural_language_processing_api: {} - components/codeqr: - specifiers: {} + components/codeqr: {} components/codereadr: dependencies: @@ -3757,7 +3756,11 @@ importers: components/dokan: {} - components/dolibarr: {} + components/dolibarr: + dependencies: + '@pipedream/platform': + specifier: ^3.1.0 + version: 3.1.0 components/domain_group: dependencies: @@ -4595,8 +4598,7 @@ importers: components/finage: {} - components/finalscout: - specifiers: {} + components/finalscout: {} components/findymail: dependencies: @@ -10335,8 +10337,7 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/predictleads: - specifiers: {} + components/predictleads: {} components/prepr_graphql: {} @@ -29185,22 +29186,22 @@ packages: superagent@3.8.1: resolution: {integrity: sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==} engines: {node: '>= 4.0'} - deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@4.1.0: resolution: {integrity: sha512-FT3QLMasz0YyCd4uIi5HNe+3t/onxMyEho7C3PSqmti3Twgy2rXT4fmkTz6wRL6bTF4uzPcfkUCa8u4JWHw8Ag==} engines: {node: '>= 6.0'} - deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@5.3.1: resolution: {integrity: sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==} engines: {node: '>= 7.0.0'} - deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net superagent@7.1.6: resolution: {integrity: sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==} engines: {node: '>=6.4.0 <13 || >=14'} - deprecated: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731) + deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net supports-color@2.0.0: resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==}