@epilot/erp-integration-client 0.6.0 → 0.7.0

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.
@@ -1 +1 @@
1
- (()=>{"use strict";var e={330:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(466));t.default=o.default},466:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"paths":{"/v1/erp/tracking/acknowledgement":{"post":{"operationId":"acknowledgeTracking","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/erp/trigger":{"post":{"operationId":"triggerErp","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/erp/updates/events":{"post":{"operationId":"processErpUpdatesEvents","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/erp/updates/mapping_simulation":{"post":{"operationId":"simulateMapping","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations":{"get":{"operationId":"listIntegrations","responses":{}},"post":{"operationId":"createIntegration","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}":{"get":{"operationId":"getIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}},"put":{"operationId":"updateIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}}},"/v1/integrations/{integrationId}/use-cases":{"get":{"operationId":"listUseCases","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}},"post":{"operationId":"createUseCase","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}/use-cases/{useCaseId}":{"get":{"operationId":"getUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"responses":{}},"put":{"operationId":"updateUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"responses":{}}}},"components":{"responses":{"BadRequest":{"content":{"application/json":{}}},"Unauthorized":{"content":{"application/json":{}}},"InternalServerError":{"content":{"application/json":{}}},"ERPUpdatesResponse":{"content":{"application/json":{}}},"TriggerWebhookResponse":{"content":{"application/json":{}}}}},"servers":[{"url":"https://erp-integration-api.sls.epilot.io"}]}')}},t={},r=function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(330),n=exports;for(var o in r)n[o]=r[o];r.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={330:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(466));t.default=o.default},466:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"paths":{"/v1/erp/tracking/acknowledgement":{"post":{"operationId":"acknowledgeTracking","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/erp/trigger":{"post":{"operationId":"triggerErp","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/erp/updates/events":{"post":{"operationId":"processErpUpdatesEvents","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v2/erp/updates/events":{"post":{"operationId":"processErpUpdatesEventsV2","requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/erp/updates/mapping_simulation":{"post":{"operationId":"simulateMapping","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations":{"get":{"operationId":"listIntegrations","responses":{}},"post":{"operationId":"createIntegration","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}":{"get":{"operationId":"getIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}},"put":{"operationId":"updateIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteIntegration","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}}},"/v1/integrations/{integrationId}/use-cases":{"get":{"operationId":"listUseCases","parameters":[{"name":"integrationId","in":"path","required":true}],"responses":{}},"post":{"operationId":"createUseCase","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/integrations/{integrationId}/use-cases/{useCaseId}":{"get":{"operationId":"getUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"responses":{}},"put":{"operationId":"updateUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteUseCase","parameters":[{"name":"integrationId","in":"path","required":true},{"name":"useCaseId","in":"path","required":true}],"responses":{}}},"/v1/integrations/{integrationId}/app-mapping":{"put":{"operationId":"setIntegrationAppMapping","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}},"delete":{"operationId":"deleteIntegrationAppMapping","parameters":[{"name":"integrationId","in":"path","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}}},"components":{"responses":{"BadRequest":{"content":{"application/json":{}}},"Unauthorized":{"content":{"application/json":{}}},"InternalServerError":{"content":{"application/json":{}}},"ERPUpdatesResponse":{"content":{"application/json":{}}},"TriggerWebhookResponse":{"content":{"application/json":{}}}}},"servers":[{"url":"https://erp-integration-api.sls.epilot.io"}]}')}},t={},n=function n(r){var o=t[r];if(void 0!==o)return o.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.exports}(330),r=exports;for(var o in n)r[o]=n[o];n.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
@@ -39,6 +39,17 @@
39
39
  "responses": {}
40
40
  }
41
41
  },
42
+ "/v2/erp/updates/events": {
43
+ "post": {
44
+ "operationId": "processErpUpdatesEventsV2",
45
+ "requestBody": {
46
+ "content": {
47
+ "application/json": {}
48
+ }
49
+ },
50
+ "responses": {}
51
+ }
52
+ },
42
53
  "/v1/erp/updates/mapping_simulation": {
43
54
  "post": {
44
55
  "operationId": "simulateMapping",
@@ -193,6 +204,42 @@
193
204
  ],
194
205
  "responses": {}
195
206
  }
207
+ },
208
+ "/v1/integrations/{integrationId}/app-mapping": {
209
+ "put": {
210
+ "operationId": "setIntegrationAppMapping",
211
+ "parameters": [
212
+ {
213
+ "name": "integrationId",
214
+ "in": "path",
215
+ "required": true
216
+ }
217
+ ],
218
+ "requestBody": {
219
+ "required": true,
220
+ "content": {
221
+ "application/json": {}
222
+ }
223
+ },
224
+ "responses": {}
225
+ },
226
+ "delete": {
227
+ "operationId": "deleteIntegrationAppMapping",
228
+ "parameters": [
229
+ {
230
+ "name": "integrationId",
231
+ "in": "path",
232
+ "required": true
233
+ }
234
+ ],
235
+ "requestBody": {
236
+ "required": true,
237
+ "content": {
238
+ "application/json": {}
239
+ }
240
+ },
241
+ "responses": {}
242
+ }
196
243
  }
197
244
  },
198
245
  "components": {
package/dist/openapi.d.ts CHANGED
@@ -59,6 +59,16 @@ declare namespace Components {
59
59
  [name: string]: any;
60
60
  };
61
61
  }
62
+ export interface DeleteIntegrationAppMappingRequest {
63
+ /**
64
+ * UUID of the integration app instance
65
+ */
66
+ app_id: string; // uuid
67
+ /**
68
+ * UUID of the integration app component instance
69
+ */
70
+ component_id: string; // uuid
71
+ }
62
72
  export interface EntityUpdate {
63
73
  /**
64
74
  * The entity type slug
@@ -77,6 +87,51 @@ declare namespace Components {
77
87
  [name: string]: any;
78
88
  };
79
89
  }
90
+ export interface ErpEvent {
91
+ /**
92
+ * Type of event (create, update, delete)
93
+ */
94
+ event_type: "CREATE" | "UPDATE" | "DELETE";
95
+ /**
96
+ * Type of the object being updated (business_partner, contract_account, etc.)
97
+ */
98
+ object_type: string;
99
+ /**
100
+ * Timestamp when the event occurred
101
+ */
102
+ timestamp: string; // date-time
103
+ /**
104
+ * Format of the payload data
105
+ */
106
+ format: "json" | "xml";
107
+ /**
108
+ * The object data payload - can be either a serialized string or a direct JSON object
109
+ */
110
+ payload: /* The object data payload - can be either a serialized string or a direct JSON object */ string | {
111
+ [name: string]: any;
112
+ };
113
+ /**
114
+ * Optional unique identifier for idempotency - prevents duplicate processing of the same event within 24 hours in context of the same integration. Must contain only alphanumeric characters, hyphens, and underscores.
115
+ *
116
+ * example:
117
+ * evt-2025-05-01-12345-create-bp
118
+ */
119
+ deduplication_id?: string; // ^[a-zA-Z0-9_-]+$
120
+ }
121
+ export interface ErpUpdatesEventsV2Request {
122
+ /**
123
+ * UUID that identifies the integration configuration to use
124
+ */
125
+ integration_id: string; // uuid
126
+ /**
127
+ * Optional ID that identifies the specific request for debugging purposes
128
+ */
129
+ correlation_id?: string;
130
+ /**
131
+ * List of ERP events to process
132
+ */
133
+ events: ErpEvent[];
134
+ }
80
135
  export interface ErrorResponseBase {
81
136
  /**
82
137
  * Computer-readable error code
@@ -87,6 +142,37 @@ declare namespace Components {
87
142
  */
88
143
  message?: string;
89
144
  }
145
+ export interface InboundUseCase {
146
+ /**
147
+ * Unique identifier for the use case
148
+ */
149
+ id: string; // uuid
150
+ /**
151
+ * Parent integration ID
152
+ */
153
+ integrationId: string; // uuid
154
+ /**
155
+ * Use case name
156
+ */
157
+ name: string;
158
+ /**
159
+ * Use case type
160
+ */
161
+ type: "inbound";
162
+ /**
163
+ * Whether the use case is enabled
164
+ */
165
+ enabled: boolean;
166
+ configuration?: IntegrationEvent;
167
+ /**
168
+ * ISO-8601 timestamp when the use case was created
169
+ */
170
+ created_at: string; // date-time
171
+ /**
172
+ * ISO-8601 timestamp when the use case was last updated
173
+ */
174
+ updated_at: string; // date-time
175
+ }
90
176
  export interface Integration {
91
177
  /**
92
178
  * Unique identifier for the integration
@@ -113,6 +199,12 @@ declare namespace Components {
113
199
  */
114
200
  updated_at: string; // date-time
115
201
  }
202
+ export interface IntegrationAppMapping {
203
+ /**
204
+ * The integration ID this app/component is mapped to
205
+ */
206
+ integration_id: string; // uuid
207
+ }
116
208
  export interface IntegrationConfigurationV1 {
117
209
  /**
118
210
  * Mapping specification version
@@ -180,6 +272,10 @@ declare namespace Components {
180
272
  * Constant value to assign (any type)
181
273
  */
182
274
  constant?: any;
275
+ /**
276
+ * Controls whether this field mapping should be processed. Can be a boolean or a JSONata expression (string) that evaluates to a boolean. Defaults to true if omitted.
277
+ */
278
+ enabled?: /* Controls whether this field mapping should be processed. Can be a boolean or a JSONata expression (string) that evaluates to a boolean. Defaults to true if omitted. */ boolean | string;
183
279
  relations?: RelationConfig;
184
280
  }
185
281
  export interface IntegrationEvent {
@@ -293,6 +389,42 @@ declare namespace Components {
293
389
  ...RelationUniqueIdField[]
294
390
  ];
295
391
  }
392
+ export interface OutboundUseCase {
393
+ /**
394
+ * Unique identifier for the use case
395
+ */
396
+ id: string; // uuid
397
+ /**
398
+ * Parent integration ID
399
+ */
400
+ integrationId: string; // uuid
401
+ /**
402
+ * Use case name
403
+ */
404
+ name: string;
405
+ /**
406
+ * Use case type
407
+ */
408
+ type: "outbound";
409
+ /**
410
+ * Whether the use case is enabled
411
+ */
412
+ enabled: boolean;
413
+ /**
414
+ * Use case specific configuration
415
+ */
416
+ configuration?: {
417
+ [name: string]: any;
418
+ };
419
+ /**
420
+ * ISO-8601 timestamp when the use case was created
421
+ */
422
+ created_at: string; // date-time
423
+ /**
424
+ * ISO-8601 timestamp when the use case was last updated
425
+ */
426
+ updated_at: string; // date-time
427
+ }
296
428
  export interface RelationConfig {
297
429
  /**
298
430
  * Relation operation:
@@ -342,6 +474,20 @@ declare namespace Components {
342
474
  */
343
475
  constant?: any;
344
476
  }
477
+ export interface SetIntegrationAppMappingRequest {
478
+ /**
479
+ * UUID of the integration app instance
480
+ */
481
+ app_id: string; // uuid
482
+ /**
483
+ * UUID of the integration app component instance
484
+ */
485
+ component_id: string; // uuid
486
+ /**
487
+ * If true, overwrites existing mapping. If false and mapping exists, returns 409 Conflict.
488
+ */
489
+ overwrite?: boolean;
490
+ }
345
491
  export interface TriggerErpActionRequest {
346
492
  /**
347
493
  * Unique identifier of the current automation execution
@@ -426,42 +572,7 @@ declare namespace Components {
426
572
  [name: string]: any;
427
573
  };
428
574
  }
429
- export interface UseCase {
430
- /**
431
- * Unique identifier for the use case
432
- */
433
- id: string; // uuid
434
- /**
435
- * Parent integration ID
436
- */
437
- integrationId: string; // uuid
438
- /**
439
- * Use case name
440
- */
441
- name: string;
442
- /**
443
- * Use case type
444
- */
445
- type: "inbound" | "outbound";
446
- /**
447
- * Whether the use case is enabled
448
- */
449
- enabled: boolean;
450
- /**
451
- * Use case specific configuration
452
- */
453
- configuration?: {
454
- [name: string]: any;
455
- };
456
- /**
457
- * ISO-8601 timestamp when the use case was created
458
- */
459
- created_at: string; // date-time
460
- /**
461
- * ISO-8601 timestamp when the use case was last updated
462
- */
463
- updated_at: string; // date-time
464
- }
575
+ export type UseCase = InboundUseCase | OutboundUseCase;
465
576
  }
466
577
  }
467
578
  declare namespace Paths {
@@ -529,6 +640,25 @@ declare namespace Paths {
529
640
  export type $500 = Components.Responses.InternalServerError;
530
641
  }
531
642
  }
643
+ namespace DeleteIntegrationAppMapping {
644
+ namespace Parameters {
645
+ export type IntegrationId = string; // uuid
646
+ }
647
+ export interface PathParameters {
648
+ integrationId: Parameters.IntegrationId /* uuid */;
649
+ }
650
+ export type RequestBody = Components.Schemas.DeleteIntegrationAppMappingRequest;
651
+ namespace Responses {
652
+ export interface $200 {
653
+ message?: string;
654
+ }
655
+ export type $400 = Components.Responses.BadRequest;
656
+ export type $401 = Components.Responses.Unauthorized;
657
+ export interface $404 {
658
+ }
659
+ export type $500 = Components.Responses.InternalServerError;
660
+ }
661
+ }
532
662
  namespace DeleteUseCase {
533
663
  namespace Parameters {
534
664
  export type IntegrationId = string; // uuid
@@ -627,37 +757,7 @@ declare namespace Paths {
627
757
  /**
628
758
  * List of ERP events to process
629
759
  */
630
- events: {
631
- /**
632
- * Type of event (create, update, delete)
633
- */
634
- event_type: "CREATE" | "UPDATE" | "DELETE";
635
- /**
636
- * Type of the object being updated (business_partner, contract_account, etc.)
637
- */
638
- object_type: string;
639
- /**
640
- * Timestamp when the event occurred
641
- */
642
- timestamp: string; // date-time
643
- /**
644
- * Format of the payload data
645
- */
646
- format: "json" | "xml";
647
- /**
648
- * The object data payload - can be either a serialized string or a direct JSON object
649
- */
650
- payload: /* The object data payload - can be either a serialized string or a direct JSON object */ string | {
651
- [name: string]: any;
652
- };
653
- /**
654
- * Optional unique identifier for idempotency - prevents duplicate processing of the same event within 24 hours in context of the same app and component. Must contain only alphanumeric characters, hyphens, and underscores.
655
- *
656
- * example:
657
- * evt-2025-05-01-12345-create-bp
658
- */
659
- deduplication_id?: string; // ^[a-zA-Z0-9_-]+$
660
- }[];
760
+ events: Components.Schemas.ErpEvent[];
661
761
  }
662
762
  namespace Responses {
663
763
  export type $200 = Components.Responses.ERPUpdatesResponse;
@@ -667,6 +767,34 @@ declare namespace Paths {
667
767
  export type $500 = Components.Responses.InternalServerError;
668
768
  }
669
769
  }
770
+ namespace ProcessErpUpdatesEventsV2 {
771
+ export type RequestBody = Components.Schemas.ErpUpdatesEventsV2Request;
772
+ namespace Responses {
773
+ export type $200 = Components.Responses.ERPUpdatesResponse;
774
+ export type $400 = Components.Responses.BadRequest;
775
+ export type $401 = Components.Responses.Unauthorized;
776
+ export type $422 = Components.Responses.ERPUpdatesResponse;
777
+ export type $500 = Components.Responses.InternalServerError;
778
+ }
779
+ }
780
+ namespace SetIntegrationAppMapping {
781
+ namespace Parameters {
782
+ export type IntegrationId = string; // uuid
783
+ }
784
+ export interface PathParameters {
785
+ integrationId: Parameters.IntegrationId /* uuid */;
786
+ }
787
+ export type RequestBody = Components.Schemas.SetIntegrationAppMappingRequest;
788
+ namespace Responses {
789
+ export type $200 = Components.Schemas.IntegrationAppMapping;
790
+ export type $400 = Components.Responses.BadRequest;
791
+ export type $401 = Components.Responses.Unauthorized;
792
+ export interface $404 {
793
+ }
794
+ export type $409 = Components.Schemas.ErrorResponseBase;
795
+ export type $500 = Components.Responses.InternalServerError;
796
+ }
797
+ }
670
798
  namespace SimulateMapping {
671
799
  export type RequestBody = Components.Schemas.MappingSimulationRequest;
672
800
  namespace Responses {
@@ -759,6 +887,19 @@ export interface OperationMethods {
759
887
  data?: Paths.ProcessErpUpdatesEvents.RequestBody,
760
888
  config?: AxiosRequestConfig
761
889
  ): OperationResponse<Paths.ProcessErpUpdatesEvents.Responses.$200>
890
+ /**
891
+ * processErpUpdatesEventsV2 - processErpUpdatesEventsV2
892
+ *
893
+ * Handles updates from ERP systems using integration_id directly.
894
+ * This is the v2 version that simplifies the API by accepting integration_id
895
+ * instead of app_id and component_id.
896
+ *
897
+ */
898
+ 'processErpUpdatesEventsV2'(
899
+ parameters?: Parameters<UnknownParamsObject> | null,
900
+ data?: Paths.ProcessErpUpdatesEventsV2.RequestBody,
901
+ config?: AxiosRequestConfig
902
+ ): OperationResponse<Paths.ProcessErpUpdatesEventsV2.Responses.$200>
762
903
  /**
763
904
  * simulateMapping - simulateMapping
764
905
  *
@@ -873,6 +1014,30 @@ export interface OperationMethods {
873
1014
  data?: any,
874
1015
  config?: AxiosRequestConfig
875
1016
  ): OperationResponse<Paths.DeleteUseCase.Responses.$200>
1017
+ /**
1018
+ * setIntegrationAppMapping - Set integration app mapping
1019
+ *
1020
+ * Creates or updates a mapping from an app/component to an integration.
1021
+ * This allows ERP updates sent via app_id and component_id to be associated
1022
+ * with a specific integration configuration.
1023
+ *
1024
+ */
1025
+ 'setIntegrationAppMapping'(
1026
+ parameters?: Parameters<Paths.SetIntegrationAppMapping.PathParameters> | null,
1027
+ data?: Paths.SetIntegrationAppMapping.RequestBody,
1028
+ config?: AxiosRequestConfig
1029
+ ): OperationResponse<Paths.SetIntegrationAppMapping.Responses.$200>
1030
+ /**
1031
+ * deleteIntegrationAppMapping - Delete integration app mapping
1032
+ *
1033
+ * Removes a mapping from an app/component to an integration.
1034
+ *
1035
+ */
1036
+ 'deleteIntegrationAppMapping'(
1037
+ parameters?: Parameters<Paths.DeleteIntegrationAppMapping.PathParameters> | null,
1038
+ data?: Paths.DeleteIntegrationAppMapping.RequestBody,
1039
+ config?: AxiosRequestConfig
1040
+ ): OperationResponse<Paths.DeleteIntegrationAppMapping.Responses.$200>
876
1041
  }
877
1042
 
878
1043
  export interface PathsDictionary {
@@ -912,6 +1077,21 @@ export interface PathsDictionary {
912
1077
  config?: AxiosRequestConfig
913
1078
  ): OperationResponse<Paths.ProcessErpUpdatesEvents.Responses.$200>
914
1079
  }
1080
+ ['/v2/erp/updates/events']: {
1081
+ /**
1082
+ * processErpUpdatesEventsV2 - processErpUpdatesEventsV2
1083
+ *
1084
+ * Handles updates from ERP systems using integration_id directly.
1085
+ * This is the v2 version that simplifies the API by accepting integration_id
1086
+ * instead of app_id and component_id.
1087
+ *
1088
+ */
1089
+ 'post'(
1090
+ parameters?: Parameters<UnknownParamsObject> | null,
1091
+ data?: Paths.ProcessErpUpdatesEventsV2.RequestBody,
1092
+ config?: AxiosRequestConfig
1093
+ ): OperationResponse<Paths.ProcessErpUpdatesEventsV2.Responses.$200>
1094
+ }
915
1095
  ['/v1/erp/updates/mapping_simulation']: {
916
1096
  /**
917
1097
  * simulateMapping - simulateMapping
@@ -1036,6 +1216,32 @@ export interface PathsDictionary {
1036
1216
  config?: AxiosRequestConfig
1037
1217
  ): OperationResponse<Paths.DeleteUseCase.Responses.$200>
1038
1218
  }
1219
+ ['/v1/integrations/{integrationId}/app-mapping']: {
1220
+ /**
1221
+ * setIntegrationAppMapping - Set integration app mapping
1222
+ *
1223
+ * Creates or updates a mapping from an app/component to an integration.
1224
+ * This allows ERP updates sent via app_id and component_id to be associated
1225
+ * with a specific integration configuration.
1226
+ *
1227
+ */
1228
+ 'put'(
1229
+ parameters?: Parameters<Paths.SetIntegrationAppMapping.PathParameters> | null,
1230
+ data?: Paths.SetIntegrationAppMapping.RequestBody,
1231
+ config?: AxiosRequestConfig
1232
+ ): OperationResponse<Paths.SetIntegrationAppMapping.Responses.$200>
1233
+ /**
1234
+ * deleteIntegrationAppMapping - Delete integration app mapping
1235
+ *
1236
+ * Removes a mapping from an app/component to an integration.
1237
+ *
1238
+ */
1239
+ 'delete'(
1240
+ parameters?: Parameters<Paths.DeleteIntegrationAppMapping.PathParameters> | null,
1241
+ data?: Paths.DeleteIntegrationAppMapping.RequestBody,
1242
+ config?: AxiosRequestConfig
1243
+ ): OperationResponse<Paths.DeleteIntegrationAppMapping.Responses.$200>
1244
+ }
1039
1245
  }
1040
1246
 
1041
1247
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
@@ -1043,9 +1249,14 @@ export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
1043
1249
 
1044
1250
  export type CreateIntegrationRequest = Components.Schemas.CreateIntegrationRequest;
1045
1251
  export type CreateUseCaseRequest = Components.Schemas.CreateUseCaseRequest;
1252
+ export type DeleteIntegrationAppMappingRequest = Components.Schemas.DeleteIntegrationAppMappingRequest;
1046
1253
  export type EntityUpdate = Components.Schemas.EntityUpdate;
1254
+ export type ErpEvent = Components.Schemas.ErpEvent;
1255
+ export type ErpUpdatesEventsV2Request = Components.Schemas.ErpUpdatesEventsV2Request;
1047
1256
  export type ErrorResponseBase = Components.Schemas.ErrorResponseBase;
1257
+ export type InboundUseCase = Components.Schemas.InboundUseCase;
1048
1258
  export type Integration = Components.Schemas.Integration;
1259
+ export type IntegrationAppMapping = Components.Schemas.IntegrationAppMapping;
1049
1260
  export type IntegrationConfigurationV1 = Components.Schemas.IntegrationConfigurationV1;
1050
1261
  export type IntegrationConfigurationV2 = Components.Schemas.IntegrationConfigurationV2;
1051
1262
  export type IntegrationEntity = Components.Schemas.IntegrationEntity;
@@ -1058,9 +1269,11 @@ export type MappingSimulationRequest = Components.Schemas.MappingSimulationReque
1058
1269
  export type MappingSimulationResponse = Components.Schemas.MappingSimulationResponse;
1059
1270
  export type MeterReadingUpdate = Components.Schemas.MeterReadingUpdate;
1060
1271
  export type MeterUniqueIdsConfig = Components.Schemas.MeterUniqueIdsConfig;
1272
+ export type OutboundUseCase = Components.Schemas.OutboundUseCase;
1061
1273
  export type RelationConfig = Components.Schemas.RelationConfig;
1062
1274
  export type RelationItemConfig = Components.Schemas.RelationItemConfig;
1063
1275
  export type RelationUniqueIdField = Components.Schemas.RelationUniqueIdField;
1276
+ export type SetIntegrationAppMappingRequest = Components.Schemas.SetIntegrationAppMappingRequest;
1064
1277
  export type TriggerErpActionRequest = Components.Schemas.TriggerErpActionRequest;
1065
1278
  export type TriggerWebhookResp = Components.Schemas.TriggerWebhookResp;
1066
1279
  export type UpdateIntegrationRequest = Components.Schemas.UpdateIntegrationRequest;
package/dist/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.0.3",
3
3
  "info": {
4
4
  "title": "ERP Integration API",
5
- "version": "0.8.2",
5
+ "version": "0.12.0",
6
6
  "description": "API for integrating with ERP systems, handling tracking acknowledgments, triggering ERP processes, and processing ERP updates."
7
7
  },
8
8
  "tags": [
@@ -162,65 +162,7 @@
162
162
  "type": "array",
163
163
  "description": "List of ERP events to process",
164
164
  "items": {
165
- "type": "object",
166
- "required": [
167
- "event_type",
168
- "object_type",
169
- "timestamp",
170
- "format",
171
- "payload"
172
- ],
173
- "properties": {
174
- "event_type": {
175
- "type": "string",
176
- "enum": [
177
- "CREATE",
178
- "UPDATE",
179
- "DELETE"
180
- ],
181
- "description": "Type of event (create, update, delete)"
182
- },
183
- "object_type": {
184
- "type": "string",
185
- "description": "Type of the object being updated (business_partner, contract_account, etc.)"
186
- },
187
- "timestamp": {
188
- "type": "string",
189
- "format": "date-time",
190
- "description": "Timestamp when the event occurred"
191
- },
192
- "format": {
193
- "type": "string",
194
- "enum": [
195
- "json",
196
- "xml"
197
- ],
198
- "default": "json",
199
- "description": "Format of the payload data"
200
- },
201
- "payload": {
202
- "oneOf": [
203
- {
204
- "type": "string",
205
- "description": "The serialized object data payload (JSON, XML, etc.) as a string"
206
- },
207
- {
208
- "type": "object",
209
- "description": "Direct JSON object (will be automatically serialized)",
210
- "additionalProperties": true
211
- }
212
- ],
213
- "description": "The object data payload - can be either a serialized string or a direct JSON object"
214
- },
215
- "deduplication_id": {
216
- "type": "string",
217
- "pattern": "^[a-zA-Z0-9_-]+$",
218
- "minLength": 1,
219
- "maxLength": 255,
220
- "description": "Optional unique identifier for idempotency - prevents duplicate processing of the same event within 24 hours in context of the same app and component. Must contain only alphanumeric characters, hyphens, and underscores.\n",
221
- "example": "evt-2025-05-01-12345-create-bp"
222
- }
223
- }
165
+ "$ref": "#/components/schemas/ErpEvent"
224
166
  }
225
167
  }
226
168
  }
@@ -272,6 +214,64 @@
272
214
  }
273
215
  }
274
216
  },
217
+ "/v2/erp/updates/events": {
218
+ "post": {
219
+ "operationId": "processErpUpdatesEventsV2",
220
+ "summary": "processErpUpdatesEventsV2",
221
+ "description": "Handles updates from ERP systems using integration_id directly.\nThis is the v2 version that simplifies the API by accepting integration_id\ninstead of app_id and component_id.\n",
222
+ "tags": [
223
+ "erp"
224
+ ],
225
+ "requestBody": {
226
+ "content": {
227
+ "application/json": {
228
+ "schema": {
229
+ "$ref": "#/components/schemas/ErpUpdatesEventsV2Request"
230
+ },
231
+ "example": {
232
+ "integration_id": "123e4567-e89b-12d3-a456-426614174000",
233
+ "correlation_id": "req-789e4567-e89b-12d3-a456-426614174000",
234
+ "events": [
235
+ {
236
+ "event_type": "CREATE",
237
+ "object_type": "business_partner",
238
+ "timestamp": "2025-05-01T08:30:00Z",
239
+ "format": "json",
240
+ "payload": "{\"id\":\"BP10001\",\"name\":\"Acme Corporation\",\"type\":\"organization\",\"tax_id\":\"DE123456789\",\"status\":\"active\"}",
241
+ "deduplication_id": "bp-create-20250501-083000-001"
242
+ },
243
+ {
244
+ "event_type": "UPDATE",
245
+ "object_type": "contract_account",
246
+ "timestamp": "2025-05-01T08:35:00Z",
247
+ "format": "json",
248
+ "payload": "{\"id\":\"CA20001\",\"business_partner_id\":\"BP10001\",\"status\":\"active\",\"payment_method\":\"direct_debit\"}",
249
+ "deduplication_id": "ca-update-20250501-083500-001"
250
+ }
251
+ ]
252
+ }
253
+ }
254
+ }
255
+ },
256
+ "responses": {
257
+ "200": {
258
+ "$ref": "#/components/responses/ERPUpdatesResponse"
259
+ },
260
+ "400": {
261
+ "$ref": "#/components/responses/BadRequest"
262
+ },
263
+ "401": {
264
+ "$ref": "#/components/responses/Unauthorized"
265
+ },
266
+ "422": {
267
+ "$ref": "#/components/responses/ERPUpdatesResponse"
268
+ },
269
+ "500": {
270
+ "$ref": "#/components/responses/InternalServerError"
271
+ }
272
+ }
273
+ }
274
+ },
275
275
  "/v1/erp/updates/mapping_simulation": {
276
276
  "post": {
277
277
  "operationId": "simulateMapping",
@@ -492,6 +492,81 @@
492
492
  "format": "json",
493
493
  "payload": "{\"contractNumber\":\"CTR-001\",\"contactEmail\":\"new.contact@example.com\"}"
494
494
  }
495
+ },
496
+ "v2_field_enabled": {
497
+ "summary": "Version 2.0 - Field-Level Conditional Processing",
498
+ "description": "Example showing how to conditionally enable/disable individual field mappings using the enabled property",
499
+ "value": {
500
+ "mapping_configuration": {
501
+ "version": "2.0",
502
+ "mapping": {
503
+ "events": {
504
+ "CustomerChanged": {
505
+ "entities": [
506
+ {
507
+ "entity_schema": "contact",
508
+ "unique_ids": [
509
+ "customer_number"
510
+ ],
511
+ "fields": [
512
+ {
513
+ "attribute": "customer_number",
514
+ "field": "customerId"
515
+ },
516
+ {
517
+ "attribute": "email",
518
+ "field": "email",
519
+ "enabled": true
520
+ },
521
+ {
522
+ "attribute": "phone",
523
+ "field": "phone",
524
+ "enabled": "$exists(phone) and phone != ''"
525
+ },
526
+ {
527
+ "attribute": "mobile",
528
+ "field": "mobile",
529
+ "enabled": "$exists(mobile)"
530
+ },
531
+ {
532
+ "attribute": "vip_status",
533
+ "constant": "VIP",
534
+ "enabled": "vipFlag = true"
535
+ },
536
+ {
537
+ "attribute": "internal_notes",
538
+ "field": "notes",
539
+ "enabled": false
540
+ },
541
+ {
542
+ "attribute": "billing_account",
543
+ "enabled": "$exists(billingAccountId)",
544
+ "relations": {
545
+ "operation": "_set",
546
+ "items": [
547
+ {
548
+ "entity_schema": "billing_account",
549
+ "unique_ids": [
550
+ {
551
+ "attribute": "external_id",
552
+ "field": "billingAccountId"
553
+ }
554
+ ]
555
+ }
556
+ ]
557
+ }
558
+ }
559
+ ]
560
+ }
561
+ ]
562
+ }
563
+ }
564
+ }
565
+ },
566
+ "object_type": "CustomerChanged",
567
+ "format": "json",
568
+ "payload": "{\"customerId\":\"12345\",\"email\":\"user@example.com\",\"phone\":\"\",\"mobile\":\"555-1234\",\"vipFlag\":true,\"notes\":\"Internal only\",\"billingAccountId\":\"ACC-999\"}"
569
+ }
495
570
  }
496
571
  }
497
572
  }
@@ -1028,6 +1103,131 @@
1028
1103
  }
1029
1104
  }
1030
1105
  }
1106
+ },
1107
+ "/v1/integrations/{integrationId}/app-mapping": {
1108
+ "put": {
1109
+ "operationId": "setIntegrationAppMapping",
1110
+ "summary": "Set integration app mapping",
1111
+ "description": "Creates or updates a mapping from an app/component to an integration.\nThis allows ERP updates sent via app_id and component_id to be associated\nwith a specific integration configuration.\n",
1112
+ "tags": [
1113
+ "integrations"
1114
+ ],
1115
+ "parameters": [
1116
+ {
1117
+ "name": "integrationId",
1118
+ "in": "path",
1119
+ "required": true,
1120
+ "description": "The integration ID to map to",
1121
+ "schema": {
1122
+ "type": "string",
1123
+ "format": "uuid"
1124
+ }
1125
+ }
1126
+ ],
1127
+ "requestBody": {
1128
+ "required": true,
1129
+ "content": {
1130
+ "application/json": {
1131
+ "schema": {
1132
+ "$ref": "#/components/schemas/SetIntegrationAppMappingRequest"
1133
+ }
1134
+ }
1135
+ }
1136
+ },
1137
+ "responses": {
1138
+ "200": {
1139
+ "description": "App mapping set successfully",
1140
+ "content": {
1141
+ "application/json": {
1142
+ "schema": {
1143
+ "$ref": "#/components/schemas/IntegrationAppMapping"
1144
+ }
1145
+ }
1146
+ }
1147
+ },
1148
+ "400": {
1149
+ "$ref": "#/components/responses/BadRequest"
1150
+ },
1151
+ "401": {
1152
+ "$ref": "#/components/responses/Unauthorized"
1153
+ },
1154
+ "404": {
1155
+ "description": "Integration not found"
1156
+ },
1157
+ "409": {
1158
+ "description": "Mapping already exists (use overwrite=true to replace)",
1159
+ "content": {
1160
+ "application/json": {
1161
+ "schema": {
1162
+ "$ref": "#/components/schemas/ErrorResponseBase"
1163
+ }
1164
+ }
1165
+ }
1166
+ },
1167
+ "500": {
1168
+ "$ref": "#/components/responses/InternalServerError"
1169
+ }
1170
+ }
1171
+ },
1172
+ "delete": {
1173
+ "operationId": "deleteIntegrationAppMapping",
1174
+ "summary": "Delete integration app mapping",
1175
+ "description": "Removes a mapping from an app/component to an integration.\n",
1176
+ "tags": [
1177
+ "integrations"
1178
+ ],
1179
+ "parameters": [
1180
+ {
1181
+ "name": "integrationId",
1182
+ "in": "path",
1183
+ "required": true,
1184
+ "description": "The integration ID (used for authorization, must match the mapping)",
1185
+ "schema": {
1186
+ "type": "string",
1187
+ "format": "uuid"
1188
+ }
1189
+ }
1190
+ ],
1191
+ "requestBody": {
1192
+ "required": true,
1193
+ "content": {
1194
+ "application/json": {
1195
+ "schema": {
1196
+ "$ref": "#/components/schemas/DeleteIntegrationAppMappingRequest"
1197
+ }
1198
+ }
1199
+ }
1200
+ },
1201
+ "responses": {
1202
+ "200": {
1203
+ "description": "App mapping deleted successfully",
1204
+ "content": {
1205
+ "application/json": {
1206
+ "schema": {
1207
+ "type": "object",
1208
+ "properties": {
1209
+ "message": {
1210
+ "type": "string"
1211
+ }
1212
+ }
1213
+ }
1214
+ }
1215
+ }
1216
+ },
1217
+ "400": {
1218
+ "$ref": "#/components/responses/BadRequest"
1219
+ },
1220
+ "401": {
1221
+ "$ref": "#/components/responses/Unauthorized"
1222
+ },
1223
+ "404": {
1224
+ "description": "App mapping not found"
1225
+ },
1226
+ "500": {
1227
+ "$ref": "#/components/responses/InternalServerError"
1228
+ }
1229
+ }
1230
+ }
1031
1231
  }
1032
1232
  },
1033
1233
  "components": {
@@ -1053,6 +1253,92 @@
1053
1253
  }
1054
1254
  }
1055
1255
  },
1256
+ "ErpEvent": {
1257
+ "type": "object",
1258
+ "required": [
1259
+ "event_type",
1260
+ "object_type",
1261
+ "timestamp",
1262
+ "format",
1263
+ "payload"
1264
+ ],
1265
+ "properties": {
1266
+ "event_type": {
1267
+ "type": "string",
1268
+ "enum": [
1269
+ "CREATE",
1270
+ "UPDATE",
1271
+ "DELETE"
1272
+ ],
1273
+ "description": "Type of event (create, update, delete)"
1274
+ },
1275
+ "object_type": {
1276
+ "type": "string",
1277
+ "description": "Type of the object being updated (business_partner, contract_account, etc.)"
1278
+ },
1279
+ "timestamp": {
1280
+ "type": "string",
1281
+ "format": "date-time",
1282
+ "description": "Timestamp when the event occurred"
1283
+ },
1284
+ "format": {
1285
+ "type": "string",
1286
+ "enum": [
1287
+ "json",
1288
+ "xml"
1289
+ ],
1290
+ "default": "json",
1291
+ "description": "Format of the payload data"
1292
+ },
1293
+ "payload": {
1294
+ "oneOf": [
1295
+ {
1296
+ "type": "string",
1297
+ "description": "The serialized object data payload (JSON, XML, etc.) as a string"
1298
+ },
1299
+ {
1300
+ "type": "object",
1301
+ "description": "Direct JSON object (will be automatically serialized)",
1302
+ "additionalProperties": true
1303
+ }
1304
+ ],
1305
+ "description": "The object data payload - can be either a serialized string or a direct JSON object"
1306
+ },
1307
+ "deduplication_id": {
1308
+ "type": "string",
1309
+ "pattern": "^[a-zA-Z0-9_-]+$",
1310
+ "minLength": 1,
1311
+ "maxLength": 255,
1312
+ "description": "Optional unique identifier for idempotency - prevents duplicate processing of the same event within 24 hours in context of the same integration. Must contain only alphanumeric characters, hyphens, and underscores.\n",
1313
+ "example": "evt-2025-05-01-12345-create-bp"
1314
+ }
1315
+ }
1316
+ },
1317
+ "ErpUpdatesEventsV2Request": {
1318
+ "type": "object",
1319
+ "required": [
1320
+ "integration_id",
1321
+ "events"
1322
+ ],
1323
+ "properties": {
1324
+ "integration_id": {
1325
+ "type": "string",
1326
+ "format": "uuid",
1327
+ "description": "UUID that identifies the integration configuration to use"
1328
+ },
1329
+ "correlation_id": {
1330
+ "type": "string",
1331
+ "description": "Optional ID that identifies the specific request for debugging purposes"
1332
+ },
1333
+ "events": {
1334
+ "type": "array",
1335
+ "description": "List of ERP events to process",
1336
+ "items": {
1337
+ "$ref": "#/components/schemas/ErpEvent"
1338
+ }
1339
+ }
1340
+ }
1341
+ },
1056
1342
  "TriggerErpActionRequest": {
1057
1343
  "type": "object",
1058
1344
  "required": [
@@ -1218,7 +1504,132 @@
1218
1504
  }
1219
1505
  }
1220
1506
  },
1507
+ "SetIntegrationAppMappingRequest": {
1508
+ "type": "object",
1509
+ "required": [
1510
+ "app_id",
1511
+ "component_id"
1512
+ ],
1513
+ "properties": {
1514
+ "app_id": {
1515
+ "type": "string",
1516
+ "format": "uuid",
1517
+ "description": "UUID of the integration app instance"
1518
+ },
1519
+ "component_id": {
1520
+ "type": "string",
1521
+ "format": "uuid",
1522
+ "description": "UUID of the integration app component instance"
1523
+ },
1524
+ "overwrite": {
1525
+ "type": "boolean",
1526
+ "default": false,
1527
+ "description": "If true, overwrites existing mapping. If false and mapping exists, returns 409 Conflict."
1528
+ }
1529
+ }
1530
+ },
1531
+ "DeleteIntegrationAppMappingRequest": {
1532
+ "type": "object",
1533
+ "required": [
1534
+ "app_id",
1535
+ "component_id"
1536
+ ],
1537
+ "properties": {
1538
+ "app_id": {
1539
+ "type": "string",
1540
+ "format": "uuid",
1541
+ "description": "UUID of the integration app instance"
1542
+ },
1543
+ "component_id": {
1544
+ "type": "string",
1545
+ "format": "uuid",
1546
+ "description": "UUID of the integration app component instance"
1547
+ }
1548
+ }
1549
+ },
1550
+ "IntegrationAppMapping": {
1551
+ "type": "object",
1552
+ "required": [
1553
+ "integration_id"
1554
+ ],
1555
+ "properties": {
1556
+ "integration_id": {
1557
+ "type": "string",
1558
+ "format": "uuid",
1559
+ "description": "The integration ID this app/component is mapped to"
1560
+ }
1561
+ }
1562
+ },
1221
1563
  "UseCase": {
1564
+ "oneOf": [
1565
+ {
1566
+ "$ref": "#/components/schemas/InboundUseCase"
1567
+ },
1568
+ {
1569
+ "$ref": "#/components/schemas/OutboundUseCase"
1570
+ }
1571
+ ],
1572
+ "discriminator": {
1573
+ "propertyName": "type",
1574
+ "mapping": {
1575
+ "inbound": "#/components/schemas/InboundUseCase",
1576
+ "outbound": "#/components/schemas/OutboundUseCase"
1577
+ }
1578
+ }
1579
+ },
1580
+ "InboundUseCase": {
1581
+ "type": "object",
1582
+ "required": [
1583
+ "id",
1584
+ "integrationId",
1585
+ "name",
1586
+ "type",
1587
+ "enabled",
1588
+ "created_at",
1589
+ "updated_at"
1590
+ ],
1591
+ "properties": {
1592
+ "id": {
1593
+ "type": "string",
1594
+ "format": "uuid",
1595
+ "description": "Unique identifier for the use case"
1596
+ },
1597
+ "integrationId": {
1598
+ "type": "string",
1599
+ "format": "uuid",
1600
+ "description": "Parent integration ID"
1601
+ },
1602
+ "name": {
1603
+ "type": "string",
1604
+ "description": "Use case name"
1605
+ },
1606
+ "type": {
1607
+ "type": "string",
1608
+ "enum": [
1609
+ "inbound"
1610
+ ],
1611
+ "description": "Use case type"
1612
+ },
1613
+ "enabled": {
1614
+ "type": "boolean",
1615
+ "description": "Whether the use case is enabled"
1616
+ },
1617
+ "configuration": {
1618
+ "$ref": "#/components/schemas/IntegrationEvent"
1619
+ },
1620
+ "created_at": {
1621
+ "type": "string",
1622
+ "format": "date-time",
1623
+ "description": "ISO-8601 timestamp when the use case was created"
1624
+ },
1625
+ "updated_at": {
1626
+ "type": "string",
1627
+ "format": "date-time",
1628
+ "description": "ISO-8601 timestamp when the use case was last updated"
1629
+ }
1630
+ }
1631
+ },
1632
+ "OutboundUseCase": {
1222
1633
  "type": "object",
1223
1634
  "required": [
1224
1635
  "id",
@@ -1247,7 +1658,6 @@
1247
1658
  "type": {
1248
1659
  "type": "string",
1249
1660
  "enum": [
1250
- "inbound",
1251
1661
  "outbound"
1252
1662
  ],
1253
1663
  "description": "Use case type"
@@ -1714,6 +2124,17 @@
1714
2124
  "constant": {
1715
2125
  "description": "Constant value to assign (any type)"
1716
2126
  },
2127
+ "enabled": {
2128
+ "oneOf": [
2129
+ {
2130
+ "type": "boolean"
2131
+ },
2132
+ {
2133
+ "type": "string"
2134
+ }
2135
+ ],
2136
+ "description": "Controls whether this field mapping should be processed. Can be a boolean or a JSONata expression (string) that evaluates to a boolean. Defaults to true if omitted."
2137
+ },
1717
2138
  "relations": {
1718
2139
  "$ref": "#/components/schemas/RelationConfig"
1719
2140
  }
@@ -1881,9 +2302,6 @@
1881
2302
  }
1882
2303
  },
1883
2304
  "servers": [
1884
- {
1885
- "url": "https://erp-integration-api.sls.epilot.io"
1886
- },
1887
2305
  {
1888
2306
  "url": "https://erp-integration-api.sls.epilot.io"
1889
2307
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/erp-integration-client",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Client library for ePilot ERP Integration API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",