@epilot/erp-integration-client 0.2.0 → 0.3.1

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={187:function(e,t,r){var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=o(r(466));t.default=n.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":{"content":{"application/json":{}}},"responses":{}}}},"components":{},"servers":[{"url":"https://erp-integration-api.sls.epilot.io"}]}')}},t={},r=function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,r),s.exports}(187),o=exports;for(var n in r)o[n]=r[n];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={187:function(e,t,o){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=n(o(466));t.default=r.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":{}}}},"components":{"responses":{"BadRequest":{"content":{"application/json":{}}},"Unauthorized":{"content":{"application/json":{}}},"NotFound":{"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={},o=function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,o),s.exports}(187),n=exports;for(var r in o)n[r]=o[r];o.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
@@ -20,15 +20,60 @@
20
20
  "post": {
21
21
  "operationId": "triggerErp",
22
22
  "requestBody": {
23
+ "required": true,
23
24
  "content": {
24
25
  "application/json": {}
25
26
  }
26
27
  },
27
28
  "responses": {}
28
29
  }
30
+ },
31
+ "/v1/erp/updates/events": {
32
+ "post": {
33
+ "operationId": "processErpUpdatesEvents",
34
+ "requestBody": {
35
+ "content": {
36
+ "application/json": {}
37
+ }
38
+ },
39
+ "responses": {}
40
+ }
41
+ }
42
+ },
43
+ "components": {
44
+ "responses": {
45
+ "BadRequest": {
46
+ "content": {
47
+ "application/json": {}
48
+ }
49
+ },
50
+ "Unauthorized": {
51
+ "content": {
52
+ "application/json": {}
53
+ }
54
+ },
55
+ "NotFound": {
56
+ "content": {
57
+ "application/json": {}
58
+ }
59
+ },
60
+ "InternalServerError": {
61
+ "content": {
62
+ "application/json": {}
63
+ }
64
+ },
65
+ "ERPUpdatesResponse": {
66
+ "content": {
67
+ "application/json": {}
68
+ }
69
+ },
70
+ "TriggerWebhookResponse": {
71
+ "content": {
72
+ "application/json": {}
73
+ }
74
+ }
29
75
  }
30
76
  },
31
- "components": {},
32
77
  "servers": [
33
78
  {
34
79
  "url": "https://erp-integration-api.sls.epilot.io"
package/dist/openapi.d.ts CHANGED
@@ -8,6 +8,94 @@ import type {
8
8
  AxiosRequestConfig,
9
9
  } from 'openapi-client-axios';
10
10
 
11
+ declare namespace Components {
12
+ namespace Responses {
13
+ export type BadRequest = Schemas.ErrorResponseBase;
14
+ export interface ERPUpdatesResponse {
15
+ results?: {
16
+ /**
17
+ * ID of the processed event
18
+ */
19
+ event_id: string;
20
+ /**
21
+ * Processing status for the event
22
+ */
23
+ status: "success" | "error";
24
+ message?: string;
25
+ }[];
26
+ }
27
+ export type InternalServerError = Schemas.ErrorResponseBase;
28
+ export type NotFound = Schemas.ErrorResponseBase;
29
+ export type TriggerWebhookResponse = Schemas.TriggerWebhookResp;
30
+ export type Unauthorized = Schemas.ErrorResponseBase;
31
+ }
32
+ namespace Schemas {
33
+ export interface ErrorResponseBase {
34
+ /**
35
+ * Computer-readable error code
36
+ */
37
+ code?: string;
38
+ /**
39
+ * Error message
40
+ */
41
+ message?: string;
42
+ }
43
+ export interface TriggerErpActionRequest {
44
+ /**
45
+ * Unique identifier of the current automation execution
46
+ */
47
+ execution_id: string;
48
+ /**
49
+ * Identifier of the organization where the automation is executed
50
+ */
51
+ org_id: string;
52
+ /**
53
+ * Identifier of the self-service webhook configuration
54
+ */
55
+ webhook_id: string;
56
+ /**
57
+ * Identifier of the automation flow that triggered the action
58
+ */
59
+ flow_id: string;
60
+ /**
61
+ * ISO-8601 timestamp when the webhook event was created
62
+ */
63
+ created_at: string; // date-time
64
+ /**
65
+ * Identifier of the automation action being executed
66
+ */
67
+ action_id: string;
68
+ /**
69
+ * Identifier of the specific automation flow action instance
70
+ */
71
+ flow_action_id: string;
72
+ /**
73
+ * Human readable name of the automation flow
74
+ */
75
+ flow_name: string;
76
+ /**
77
+ * Identifier of the entity activity related to this trigger
78
+ */
79
+ activity_id: string;
80
+ /**
81
+ * Identifier of the entity referenced by the activity
82
+ */
83
+ entity_id: string;
84
+ }
85
+ export interface TriggerWebhookResp {
86
+ status_code?: string;
87
+ message?: string;
88
+ body?: {
89
+ [key: string]: any;
90
+ };
91
+ code?: string;
92
+ status?: "succeeded" | "failed";
93
+ start_date?: string;
94
+ end_date?: string;
95
+ event_id?: string;
96
+ }
97
+ }
98
+ }
11
99
  declare namespace Paths {
12
100
  namespace AcknowledgeTracking {
13
101
  export interface RequestBody {
@@ -30,17 +118,64 @@ declare namespace Paths {
30
118
  }
31
119
  }
32
120
  }
33
- namespace TriggerErp {
121
+ namespace ProcessErpUpdatesEvents {
34
122
  export interface RequestBody {
35
123
  /**
36
- * The Webhook that relates to this service action.
124
+ * UUID that identifies the specific integration app instance
125
+ */
126
+ app_id: string; // uuid
127
+ /**
128
+ * UUID that identifies the specific integration app component instance
129
+ */
130
+ component_id: string; // uuid
131
+ /**
132
+ * Metadata to be passed along with the events
37
133
  */
38
- webhookId: string;
134
+ meta: {
135
+ [name: string]: any;
136
+ /**
137
+ * ID that identifies the specific request for debugging purposes
138
+ */
139
+ correlation_id?: string;
140
+ };
141
+ /**
142
+ * List of ERP events to process
143
+ */
144
+ events: {
145
+ /**
146
+ * Type of event (create, update, delete)
147
+ */
148
+ event_type: "CREATE" | "UPDATE" | "DELETE";
149
+ /**
150
+ * Type of the object being updated (business_partner, contract_account, etc.)
151
+ */
152
+ object_type: string;
153
+ /**
154
+ * Timestamp when the event occurred
155
+ */
156
+ timestamp: string; // date-time
157
+ /**
158
+ * Format of the payload data
159
+ */
160
+ format: "json" | "xml";
161
+ /**
162
+ * The serialized object data payload (JSON, XML, etc.) as a string
163
+ */
164
+ payload: string;
165
+ }[];
39
166
  }
40
167
  namespace Responses {
41
- export interface $200 {
42
- message?: string;
43
- }
168
+ export type $200 = Components.Responses.ERPUpdatesResponse;
169
+ export type $400 = Components.Responses.BadRequest;
170
+ export type $401 = Components.Responses.Unauthorized;
171
+ export type $422 = Components.Responses.ERPUpdatesResponse;
172
+ export type $500 = Components.Responses.InternalServerError;
173
+ }
174
+ }
175
+ namespace TriggerErp {
176
+ export type RequestBody = Components.Schemas.TriggerErpActionRequest;
177
+ namespace Responses {
178
+ export type $200 = Components.Responses.TriggerWebhookResponse;
44
179
  export interface $400 {
45
180
  }
46
181
  export interface $401 {
@@ -73,6 +208,16 @@ export interface OperationMethods {
73
208
  data?: Paths.TriggerErp.RequestBody,
74
209
  config?: AxiosRequestConfig
75
210
  ): OperationResponse<Paths.TriggerErp.Responses.$200>
211
+ /**
212
+ * processErpUpdatesEvents - Process ERP system updates
213
+ *
214
+ * Handles updates from ERP systems and tracks them appropriately
215
+ */
216
+ 'processErpUpdatesEvents'(
217
+ parameters?: Parameters<UnknownParamsObject> | null,
218
+ data?: Paths.ProcessErpUpdatesEvents.RequestBody,
219
+ config?: AxiosRequestConfig
220
+ ): OperationResponse<Paths.ProcessErpUpdatesEvents.Responses.$200>
76
221
  }
77
222
 
78
223
  export interface PathsDictionary {
@@ -100,9 +245,23 @@ export interface PathsDictionary {
100
245
  config?: AxiosRequestConfig
101
246
  ): OperationResponse<Paths.TriggerErp.Responses.$200>
102
247
  }
248
+ ['/v1/erp/updates/events']: {
249
+ /**
250
+ * processErpUpdatesEvents - Process ERP system updates
251
+ *
252
+ * Handles updates from ERP systems and tracks them appropriately
253
+ */
254
+ 'post'(
255
+ parameters?: Parameters<UnknownParamsObject> | null,
256
+ data?: Paths.ProcessErpUpdatesEvents.RequestBody,
257
+ config?: AxiosRequestConfig
258
+ ): OperationResponse<Paths.ProcessErpUpdatesEvents.Responses.$200>
259
+ }
103
260
  }
104
261
 
105
262
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
106
263
 
107
264
 
108
-
265
+ export type ErrorResponseBase = Components.Schemas.ErrorResponseBase;
266
+ export type TriggerErpActionRequest = Components.Schemas.TriggerErpActionRequest;
267
+ export type TriggerWebhookResp = Components.Schemas.TriggerWebhookResp;
package/dist/openapi.json CHANGED
@@ -82,48 +82,160 @@
82
82
  "erp",
83
83
  "trigger"
84
84
  ],
85
+ "requestBody": {
86
+ "required": true,
87
+ "content": {
88
+ "application/json": {
89
+ "schema": {
90
+ "$ref": "#/components/schemas/TriggerErpActionRequest"
91
+ }
92
+ }
93
+ }
94
+ },
95
+ "responses": {
96
+ "200": {
97
+ "$ref": "#/components/responses/TriggerWebhookResponse"
98
+ },
99
+ "400": {
100
+ "description": "Bad request - invalid or missing parameters"
101
+ },
102
+ "401": {
103
+ "description": "Unauthorized - invalid or missing token"
104
+ },
105
+ "500": {
106
+ "description": "Server error processing the request"
107
+ }
108
+ }
109
+ }
110
+ },
111
+ "/v1/erp/updates/events": {
112
+ "post": {
113
+ "operationId": "processErpUpdatesEvents",
114
+ "summary": "Process ERP system updates",
115
+ "description": "Handles updates from ERP systems and tracks them appropriately",
116
+ "tags": [
117
+ "erp"
118
+ ],
85
119
  "requestBody": {
86
120
  "content": {
87
121
  "application/json": {
88
122
  "schema": {
89
123
  "type": "object",
90
124
  "required": [
91
- "webhookId"
125
+ "app_id",
126
+ "component_id",
127
+ "meta",
128
+ "events"
92
129
  ],
93
130
  "properties": {
94
- "webhookId": {
131
+ "app_id": {
132
+ "type": "string",
133
+ "format": "uuid",
134
+ "description": "UUID that identifies the specific integration app instance"
135
+ },
136
+ "component_id": {
95
137
  "type": "string",
96
- "description": "The Webhook that relates to this service action."
138
+ "format": "uuid",
139
+ "description": "UUID that identifies the specific integration app component instance"
140
+ },
141
+ "meta": {
142
+ "type": "object",
143
+ "description": "Metadata to be passed along with the events",
144
+ "additionalProperties": true,
145
+ "properties": {
146
+ "correlation_id": {
147
+ "type": "string",
148
+ "description": "ID that identifies the specific request for debugging purposes"
149
+ }
150
+ }
151
+ },
152
+ "events": {
153
+ "type": "array",
154
+ "description": "List of ERP events to process",
155
+ "items": {
156
+ "type": "object",
157
+ "required": [
158
+ "event_type",
159
+ "object_type",
160
+ "timestamp",
161
+ "format",
162
+ "payload"
163
+ ],
164
+ "properties": {
165
+ "event_type": {
166
+ "type": "string",
167
+ "enum": [
168
+ "CREATE",
169
+ "UPDATE",
170
+ "DELETE"
171
+ ],
172
+ "description": "Type of event (create, update, delete)"
173
+ },
174
+ "object_type": {
175
+ "type": "string",
176
+ "description": "Type of the object being updated (business_partner, contract_account, etc.)"
177
+ },
178
+ "timestamp": {
179
+ "type": "string",
180
+ "format": "date-time",
181
+ "description": "Timestamp when the event occurred"
182
+ },
183
+ "format": {
184
+ "type": "string",
185
+ "enum": [
186
+ "json",
187
+ "xml"
188
+ ],
189
+ "default": "json",
190
+ "description": "Format of the payload data"
191
+ },
192
+ "payload": {
193
+ "type": "string",
194
+ "description": "The serialized object data payload (JSON, XML, etc.) as a string"
195
+ }
196
+ }
197
+ }
97
198
  }
98
199
  }
200
+ },
201
+ "example": {
202
+ "app_id": "123e4567-e89b-12d3-a456-426614174000",
203
+ "component_id": "123e4567-e89b-12d3-a456-426614174000",
204
+ "events": [
205
+ {
206
+ "event_type": "CREATE",
207
+ "object_type": "business_partner",
208
+ "timestamp": "2025-05-01T08:30:00Z",
209
+ "format": "json",
210
+ "payload": "{\"id\":\"BP10001\",\"name\":\"Acme Corporation\",\"type\":\"organization\",\"tax_id\":\"DE123456789\",\"status\":\"active\"}"
211
+ },
212
+ {
213
+ "event_type": "UPDATE",
214
+ "object_type": "contract_account",
215
+ "timestamp": "2025-05-01T08:35:00Z",
216
+ "format": "json",
217
+ "payload": "{\"id\":\"CA20001\",\"business_partner_id\":\"BP10001\",\"status\":\"active\",\"payment_method\":\"direct_debit\"}"
218
+ }
219
+ ]
99
220
  }
100
221
  }
101
222
  }
102
223
  },
103
224
  "responses": {
104
225
  "200": {
105
- "description": "Success - if the ERP Toolkit was triggered successfully",
106
- "content": {
107
- "application/json": {
108
- "schema": {
109
- "type": "object",
110
- "properties": {
111
- "message": {
112
- "type": "string"
113
- }
114
- }
115
- }
116
- }
117
- }
226
+ "$ref": "#/components/responses/ERPUpdatesResponse"
118
227
  },
119
228
  "400": {
120
- "description": "Bad request - missing webhookId"
229
+ "$ref": "#/components/responses/BadRequest"
121
230
  },
122
231
  "401": {
123
- "description": "Unauthorized - invalid or missing token"
232
+ "$ref": "#/components/responses/Unauthorized"
233
+ },
234
+ "422": {
235
+ "$ref": "#/components/responses/ERPUpdatesResponse"
124
236
  },
125
237
  "500": {
126
- "description": "Server error processing the request"
238
+ "$ref": "#/components/responses/InternalServerError"
127
239
  }
128
240
  }
129
241
  }
@@ -143,9 +255,209 @@
143
255
  "description": "Authorization header with epilot public access token",
144
256
  "bearerFormat": "JWT"
145
257
  }
258
+ },
259
+ "schemas": {
260
+ "ErrorResponseBase": {
261
+ "type": "object",
262
+ "properties": {
263
+ "code": {
264
+ "type": "string",
265
+ "description": "Computer-readable error code"
266
+ },
267
+ "message": {
268
+ "type": "string",
269
+ "description": "Error message"
270
+ }
271
+ }
272
+ },
273
+ "TriggerErpActionRequest": {
274
+ "type": "object",
275
+ "required": [
276
+ "execution_id",
277
+ "org_id",
278
+ "webhook_id",
279
+ "flow_id",
280
+ "created_at",
281
+ "action_id",
282
+ "flow_action_id",
283
+ "flow_name",
284
+ "activity_id",
285
+ "entity_id"
286
+ ],
287
+ "properties": {
288
+ "execution_id": {
289
+ "type": "string",
290
+ "description": "Unique identifier of the current automation execution"
291
+ },
292
+ "org_id": {
293
+ "type": "string",
294
+ "description": "Identifier of the organization where the automation is executed"
295
+ },
296
+ "webhook_id": {
297
+ "type": "string",
298
+ "description": "Identifier of the self-service webhook configuration"
299
+ },
300
+ "flow_id": {
301
+ "type": "string",
302
+ "description": "Identifier of the automation flow that triggered the action"
303
+ },
304
+ "created_at": {
305
+ "type": "string",
306
+ "format": "date-time",
307
+ "description": "ISO-8601 timestamp when the webhook event was created"
308
+ },
309
+ "action_id": {
310
+ "type": "string",
311
+ "description": "Identifier of the automation action being executed"
312
+ },
313
+ "flow_action_id": {
314
+ "type": "string",
315
+ "description": "Identifier of the specific automation flow action instance"
316
+ },
317
+ "flow_name": {
318
+ "type": "string",
319
+ "description": "Human readable name of the automation flow"
320
+ },
321
+ "activity_id": {
322
+ "type": "string",
323
+ "description": "Identifier of the entity activity related to this trigger"
324
+ },
325
+ "entity_id": {
326
+ "type": "string",
327
+ "description": "Identifier of the entity referenced by the activity"
328
+ }
329
+ }
330
+ },
331
+ "TriggerWebhookResp": {
332
+ "type": "object",
333
+ "properties": {
334
+ "status_code": {
335
+ "type": "string"
336
+ },
337
+ "message": {
338
+ "type": "string"
339
+ },
340
+ "body": {
341
+ "type": "object"
342
+ },
343
+ "code": {
344
+ "type": "string"
345
+ },
346
+ "status": {
347
+ "type": "string",
348
+ "enum": [
349
+ "succeeded",
350
+ "failed"
351
+ ]
352
+ },
353
+ "start_date": {
354
+ "type": "string"
355
+ },
356
+ "end_date": {
357
+ "type": "string"
358
+ },
359
+ "event_id": {
360
+ "type": "string"
361
+ }
362
+ }
363
+ }
364
+ },
365
+ "responses": {
366
+ "BadRequest": {
367
+ "description": "Bad request",
368
+ "content": {
369
+ "application/json": {
370
+ "schema": {
371
+ "$ref": "#/components/schemas/ErrorResponseBase"
372
+ }
373
+ }
374
+ }
375
+ },
376
+ "Unauthorized": {
377
+ "description": "Unauthorized request",
378
+ "content": {
379
+ "application/json": {
380
+ "schema": {
381
+ "$ref": "#/components/schemas/ErrorResponseBase"
382
+ }
383
+ }
384
+ }
385
+ },
386
+ "NotFound": {
387
+ "description": "The specified resource was not found",
388
+ "content": {
389
+ "application/json": {
390
+ "schema": {
391
+ "$ref": "#/components/schemas/ErrorResponseBase"
392
+ }
393
+ }
394
+ }
395
+ },
396
+ "InternalServerError": {
397
+ "description": "Internal Server Error",
398
+ "content": {
399
+ "application/json": {
400
+ "schema": {
401
+ "$ref": "#/components/schemas/ErrorResponseBase"
402
+ }
403
+ }
404
+ }
405
+ },
406
+ "ERPUpdatesResponse": {
407
+ "description": "Some events failed to process",
408
+ "content": {
409
+ "application/json": {
410
+ "schema": {
411
+ "type": "object",
412
+ "properties": {
413
+ "results": {
414
+ "type": "array",
415
+ "items": {
416
+ "type": "object",
417
+ "required": [
418
+ "event_id",
419
+ "status"
420
+ ],
421
+ "properties": {
422
+ "event_id": {
423
+ "type": "string",
424
+ "description": "ID of the processed event"
425
+ },
426
+ "status": {
427
+ "type": "string",
428
+ "enum": [
429
+ "success",
430
+ "error"
431
+ ],
432
+ "description": "Processing status for the event"
433
+ },
434
+ "message": {
435
+ "type": "string"
436
+ }
437
+ }
438
+ }
439
+ }
440
+ }
441
+ }
442
+ }
443
+ }
444
+ },
445
+ "TriggerWebhookResponse": {
446
+ "description": "Result of triggering an ERP synchronization event",
447
+ "content": {
448
+ "application/json": {
449
+ "schema": {
450
+ "$ref": "#/components/schemas/TriggerWebhookResp"
451
+ }
452
+ }
453
+ }
454
+ }
146
455
  }
147
456
  },
148
457
  "servers": [
458
+ {
459
+ "url": "https://erp-integration-api.sls.epilot.io"
460
+ },
149
461
  {
150
462
  "url": "https://erp-integration-api.sls.epilot.io"
151
463
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/erp-integration-client",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Client library for ePilot ERP Integration API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "build:patch": "sed -i'' -e '/^__exportStar.*openapi.*$/d' dist/index.js",
33
33
  "build:watch": "npm run build && tsc -w",
34
34
  "prepublishOnly": "npm run typegen && npm run build",
35
- "lint": "../../node_modules/eslint/bin/eslint.js src"
35
+ "lint": "pnpm exec eslint src"
36
36
  },
37
37
  "files": [
38
38
  "*.js",
@@ -54,7 +54,7 @@
54
54
  "@dazn/lambda-powertools-correlation-ids": "^1.28.1",
55
55
  "buffer": "^6.0.3",
56
56
  "https-browserify": "^1.0.0",
57
- "openapi-client-axios": "^7.5.1",
57
+ "openapi-client-axios": "^7.6.0",
58
58
  "stream-http": "^3.1.1",
59
59
  "url": "^0.11.0",
60
60
  "util": "^0.12.3"
@@ -65,7 +65,7 @@
65
65
  "copy-webpack-plugin": "^7.0.0",
66
66
  "jest": "^26.6.3",
67
67
  "json-loader": "^0.5.7",
68
- "openapicmd": "^2.6.0",
68
+ "openapicmd": "^2.7.0",
69
69
  "ts-jest": "^26.5.0",
70
70
  "ts-loader": "^8.0.14",
71
71
  "ts-node": "^10.9.1",